Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Started rewriting MPT branch docs
Browse files Browse the repository at this point in the history
  • Loading branch information
miha-stopar committed Aug 28, 2023
1 parent 6821454 commit 91bf48d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
38 changes: 38 additions & 0 deletions specs/mpt/extension_branch.md → specs/mpt/extension-branch.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,43 @@
# Branch

A branch consists of 21 rows. The struct that determines the row type is `ExtensionBranchRowType`:

```
pub(crate) enum ExtensionBranchRowType {
Mod,
Child0,
Child1,
Child2,
Child3,
Child4,
Child5,
Child6,
Child7,
Child8,
Child9,
Child10,
Child11,
Child12,
Child13,
Child14,
Child15,
Key, // Both (S and C) extension nodes have the same key - when it is different, we have a modified extension node case.
ValueS,
Nibbles, // The list of second nibbles (key byte = nibble1 * 16 + nibble2) that correspond to the key.
ValueC,
Count,
}
```

`S` and `C` branches have the same children except for the one at index `modified_node`.
The witness stores the 16 `S` children in `Child1`, ..., `Child15` rows and stores at `Mod` row
the children of the `C` branch where the modification occurs (`C` children at index `modified_node`).

The rows `Key`, `ValueS`, `Nibbles`, and `ValueC` are used only when the branch is an extension node.


# Obsolete

A branch occupies 19 rows:
```
BRANCH.IS_INIT
Expand Down
2 changes: 1 addition & 1 deletion specs/mpt/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ MPT circuit supports the following proofs:
The constraints are grouped according to different trie node types:
* Account leaf: [account-leaf.md](account-leaf.md)
* Storage leaf: [storage-leaf.md](storage-leaf.md)
* Branch and extension node: [branch.md](extension_branch.md)
* Branch and extension node: [branch.md](extension-branch.md)

There is a state machine `StateMachineConfig` that configures constraints for each of the nodes.
```
Expand Down

0 comments on commit 91bf48d

Please sign in to comment.