Skip to content
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

docs: Detailed documentation #16

Closed
wants to merge 34 commits into from
Closed

docs: Detailed documentation #16

wants to merge 34 commits into from

Conversation

hmrtn
Copy link
Member

@hmrtn hmrtn commented Aug 16, 2023

This (WIP) PR adds detailed documentation to Zeth. The updates aim to provide clearer context and more detailed explanations for developers.

TODO:

  • guests

    • eth-block
      • main.rs
  • host

    • main.rs
  • lib

    • block_builder.rs
    • consts.rs
    • execution.rs
    • host
      • mpt.rs
      • provider
        • cached_rpc_provider.rs
        • file_provider.rs
        • rpc_provider.rs
      • provider_db.rs
    • mem_db.rs
    • validation.rs
  • primitives

    • access_list.rs
    • block.rs
    • ethers.rs
    • keccak.rs
    • lib.rs
    • receipt.rs
    • revm.rs
    • signature.rs
    • transaction.rs
    • withdrawl.rs
    • trie
      • account.rs
      • mpt.rs

Draft: looking for early feedback - lmk if it missing anything, typos, or is too pedantic.

@hmrtn hmrtn added the documentation Improvements or additions to documentation label Aug 17, 2023
@@ -662,8 +765,16 @@ pub fn to_nibs(slice: &[u8]) -> Vec<u8> {
result
}

/// Encodes a given slice of nibbles as a vector of bytes, along with additional
/// information about the node itself.
/// Encodes a slice of nibbles into a vector of bytes, with an additional prefix to
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did I understand this correctly?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the first nibble of the first byte in the resulting vector encodes two pieces of information:

  • If the encoded path is for a leaf or extension (2nd least significant bit in nibble)
  • If the number of nibbles encoded in the path is even or odd (least significant bit in nibble)

The second nibble of the first byte is used to represent the first nibble in the slice only if the length of the slice is odd, otherwise that second nibble is set to zero and just considered as padding.

I don't think the description makes that distinction.

hmrtn and others added 14 commits August 17, 2023 16:03
* optimizations

* header prep strategy
* optimizations

* header prep strategy

* block build strategy

* nit
* optimizations

* header prep strategy

* block build strategy

* db init strategy

* nit
* optimizations

* header prep strategy

* block build strategy

* db init strategy

* nit

* remove BlockBuilderDatabase

* nits

* fix
* optimizations

* header prep strategy

* block build strategy

* db init strategy

* nit

* remove BlockBuilderDatabase

* nits

* from over into

* fix

* block header field mismatch error messages

* take tx and withdrawal lists

* NoHashBuilder for faster lookups of prehashed keys

* test mining empty blocks (#23)
@hmrtn
Copy link
Member Author

hmrtn commented Aug 22, 2023

Closing this and opening new PRs to split up into smaller PRs and to avoid conflicts with latest refactor.

@hmrtn hmrtn closed this Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants