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

[fix] transactions trie witness generation after 4844 and OP stack support #34

Merged
merged 2 commits into from
Mar 18, 2024

Commits on Mar 18, 2024

  1. fix: transaction trie needs tx rlp to support 4844 (#291)

    * fix: transaction trie needs tx rlp to support 4844
    
    No ZK circuit code was changed.
    
    To generate witness transaction MPT proofs, we reconstruct the
    transactions trie of a block from the raw transactions returns by a
    JSON-RPC call for a block. To construct the trie, we must compute the
    RLP encoding of each raw transaction. Previously, we used `ethers_core`
    to do this. However `ethers_core` has not been updated after EIP 4844
    (Dencun) for the new Type 3 Blob Transaction.
    
    At first I tried to use `reth`'s transaction RLP encoding logic. However
    `reth` uses an internal type to represent transactions. Since we get
    transactions from RPC calls, we need an adapter from the RPC type. This
    latter type is provided in `alloy_rpc_types`, but in writing the
    converter from RPC type to reth primitive type, I ran into issues that
    many structs were defined in parallel in the two crates, and also there
    was inconsistency in the use of `ruint` primitives. I decided it was
    easier just to keep `ethers_core` types for now and add custom
    implementations of RLP for the new transaction type.
    
    Also added RLP support for OP stack deposit transactions.
    
    Moved some of the trie code from `axiom-query` to `axiom-eth` to remove
    redundancy.
    
    References:
    - https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4844.md
    - https://github.com/paradigmxyz/reth/blob/28f3a2e2d9525bf2f6373e755e2d6dc0c2f97821/crates/primitives/src/transaction/mod.rs#L128
    - https://github.com/alloy-rs/alloy/blob/d5967abdbae58dd84acc4c1ee31345108d42d041/crates/rpc-types/src/eth/transaction/mod.rs
    
    * feat: switch to `ethers` v2.0.14 so `OtherField` and "optimism" are
    compatible
    
    * chore: storageProof key is now U256 instead of H256
    
    * chore: add rpc tests
    jonathanpwang committed Mar 18, 2024
    Configuration menu
    Copy the full SHA
    a715b73 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1ff3bc4 View commit details
    Browse the repository at this point in the history