Skip to content

Grammar and Style Improvements #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/zktrie.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
In essence, zkTrie is a sparse binary Merkle Patricia Trie, depicted in the above figure.
Before diving into the Sparse Binary Merkle Patricia Trie, let's briefly touch on Merkle Trees and Patricia Tries.
* **Merkle Tree**: A Merkle Tree is a tree where each leaf node represents a hash of a data block, and each non-leaf node represents the hash of its child nodes.
* **Patricia Trie**: A Patricia Trie is a type of radix tree or compressed trie used to store key-value pairs efficiently. It encodes the nodes with same prefix of the key to share the common path, where the path is determined by the value of the node key.
* **Patricia Trie**: A Patricia Trie is a type of radix tree or compressed trie used to store key-value pairs efficiently. It encodes the nodes with the same prefix of the key to share the common path, where the path is determined by the value of the node key.

As illustrated in the Figure 1, there are three types of nodes in the zkTrie.
- Parent Node (type: 0): Given the zkTrie is a binary tree, a parent node has two children.
Expand Down Expand Up @@ -138,7 +138,7 @@ valLo = storageKey[16:32]
nodeKey = h(valHi, valLo)
```

The storage value is a `u256` value. The `flag` for the storage value is 1, showed below.
The storage value is a `u256` value. The `flag` for the storage value is 1, shown below.

```
+--------------+
Expand Down
6 changes: 3 additions & 3 deletions types/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Data Format in stateDb

All data node being stored via stateDb are encoded by following syntax:
All data nodes being stored via stateDb are encoded by following syntax:

``` EBNF
node = magic string | node data ;
Expand Down Expand Up @@ -90,7 +90,7 @@ Each account data is saved in one leaf node of account zktrie as 4 `value field`
3. CodeHash as `compressed field` (byte32)
4. Storage root as `field`

The key for an account data is calculated from the 20-bit account address as following:
The key for an account data is calculated from the 20-bit account address as follows:

```

Expand All @@ -106,7 +106,7 @@ key = poseidon(<first 16 byte of 32-byte-zero-end-padding-addr as field>, <last

> 0x017f9d3bbc51d12566ecc6049ca6bf76e32828c22b197405f63a833b566fe7da0a040400000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000029b74e075daad9f17eb39cd893c2dd32f52ecd99084d63964842defd00ebcbe208a2f471d50e56ac5000ab9e82f871e36b5a636b19bd02f70aa666a3bd03142f00

Can be decompose to:
Can be decomposed to:

+ `0x01`: node type prefix for leaf node
+ `7f9d3bbc51d12566ecc6049ca6bf76e32828c22b197405f63a833b566fe7da0a`: node key as field
Expand Down