These are the updates for the week of 2023/08/28.
I did some research on state persistence. Any node needs to save:
These need to be persisted so that if the node crashes or is stopeed the values can be restored and it won't be necessary to get them all again from gossip and request-response protocols.
Key value stores are typically used to store blocks and states, as they are very hierarchical structures that are always queried together and would require many joins if stored in a SQL db. Other consensus clients chose:
All of these solutions use binary keys and binary values. Specially for the values, we'll mostly use SSZ as a serialization mechanism for easiness of use, and as we already have the values encoded.
We chose LevelDB for now, but we'll be building an abstraction so that it's easier to move from one to the other if necessary.
Storage will be a key part of the first milestones, which consists of getting blocks from gossipsub and saving them locally for queries.
When coding an elixir test runner for the spec tests, the team encountered an issue: we're using a rust library (through NIF) for SSZ encoding, NIFs don't support u256 integers. One of the team members was trying to handle the u256 as decimal strings in both languages, and I helped them figure out a way to handle this with integers in elixir and binaries in NIF+rust.
I came up with a description of the required process:
- [elixir] We parse the yaml containing the expected number after deserializing. This contains decimal strings in for U256. We should turn the decimal strings into actual integers here, as elixir can handle big integers out of the box.
- [rust] We parse the yaml containing the encoded ssz and send it to rust for deserialization. This contains some U256 structs/types.
- [rust] we transform the U256 into the little endian (binary) representation.
- [NIF] We send the binary representation to elixir.
- [elixir] We turn the little endian representation to a regular integer
- We compare the two integers in the test.
I also provided elixir tools for easy little endian representation.
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing