Skip to content

Commit

Permalink
feat: zkvm support (#91)
Browse files Browse the repository at this point in the history
* feat: add EIP-7702 tx support (#85)

* upgrade

* upgrade

* Update Cargo.toml

* change branches

* remove poseidon field

* fix scroll types

* trailing lf

* feat: dump utils (#83)

* provide utils lib

* clippy

* unify imports

* fix

* style fix

* add EIP-7702 tx support

* upgrade reth

---------

Co-authored-by: Zhang Zhuo <[email protected]>

* feat: msg queue hash (#84)

* upgrade

* upgrade

* Update Cargo.toml

* change branches

* remove poseidon field

* fix scroll types

* trailing lf

* feat: dump utils (#83)

* provide utils lib

* clippy

* unify imports

* fix

* style fix

* impl msg queue hash

* remove legacy test

* move chunk into primitives and impl EuclidV2

* set prev_msg_queue_hash

* use is_l1_message

* feat: num l1 msgs in scroll block

* fix: usize instead of u64 for num txs

* chore: clippy fix remove unused import

* apply suggestion

---------

Co-authored-by: Zhang Zhuo <[email protected]>
Co-authored-by: Rohit Narurkar <[email protected]>

* fix Eip7702 signature

* chore: update reth dep

* fix bytecode construct

* upgrade to fix

* add euclid v2 test cases

* fix cli

* remove unused

* impl is_euclid_v2 in chunk

* clippy

* fix ChunkInfo

* fix chunk mode

* refactor

* refactor

* fix patches

* remove serde flatten

* export reth chain spec

---------

Co-authored-by: Zhang Zhuo <[email protected]>
Co-authored-by: Rohit Narurkar <[email protected]>
  • Loading branch information
3 people authored Mar 4, 2025
1 parent 34cd296 commit fc4ece0
Show file tree
Hide file tree
Showing 14 changed files with 303 additions and 309 deletions.
366 changes: 168 additions & 198 deletions Cargo.lock

Large diffs are not rendered by default.

46 changes: 23 additions & 23 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,25 @@ alloy-trie = { version = "0.7", default-features = false }
# https://github.com/alloy-rs/core
alloy-primitives = { version = "0.8", default-features = false, features = ["map-hashbrown", "map-fxhash", "rkyv"] }

reth-chainspec = { git = "https://github.com/scroll-tech/reth", branch = "feat/euclid-v2", default-features = false }
reth-evm = { git = "https://github.com/scroll-tech/reth", branch = "feat/euclid-v2", default-features = false }
reth-evm-ethereum = { git = "https://github.com/scroll-tech/reth", branch = "feat/euclid-v2", default-features = false }
reth-ethereum-forks = { git = "https://github.com/scroll-tech/reth", branch = "feat/euclid-v2", default-features = false }
reth-execution-types = { git = "https://github.com/scroll-tech/reth", branch = "feat/euclid-v2", default-features = false }
reth-primitives = { git = "https://github.com/scroll-tech/reth", branch = "feat/euclid-v2", default-features = false }
reth-primitives-traits = { git = "https://github.com/scroll-tech/reth", branch = "feat/euclid-v2", default-features = false }
reth-storage-errors = { git = "https://github.com/scroll-tech/reth", branch = "feat/euclid-v2", default-features = false }
reth-trie = { git = "https://github.com/scroll-tech/reth", branch = "feat/euclid-v2", default-features = false }
reth-trie-sparse = { git = "https://github.com/scroll-tech/reth", branch = "feat/euclid-v2", default-features = false }

reth-scroll-chainspec = { git = "https://github.com/scroll-tech/reth", branch = "feat/euclid-v2", default-features = false }
reth-scroll-evm = { git = "https://github.com/scroll-tech/reth", branch = "feat/euclid-v2", default-features = false }
reth-scroll-forks = { git = "https://github.com/scroll-tech/reth", branch = "feat/euclid-v2", default-features = false }
reth-scroll-primitives = { git = "https://github.com/scroll-tech/reth", branch = "feat/euclid-v2", default-features = false }

scroll-alloy-consensus = { git = "https://github.com/scroll-tech/reth", branch = "feat/euclid-v2", default-features = false }
scroll-alloy-rpc-types = { git = "https://github.com/scroll-tech/reth", branch = "feat/euclid-v2", default-features = false }
scroll-alloy-network = { git = "https://github.com/scroll-tech/reth", branch = "feat/euclid-v2", default-features = false }
reth-chainspec = { git = "https://github.com/scroll-tech/reth", branch = "zkvm/euclid-v2", default-features = false }
reth-evm = { git = "https://github.com/scroll-tech/reth", branch = "zkvm/euclid-v2", default-features = false }
reth-evm-ethereum = { git = "https://github.com/scroll-tech/reth", branch = "zkvm/euclid-v2", default-features = false }
reth-ethereum-forks = { git = "https://github.com/scroll-tech/reth", branch = "zkvm/euclid-v2", default-features = false }
reth-execution-types = { git = "https://github.com/scroll-tech/reth", branch = "zkvm/euclid-v2", default-features = false }
reth-primitives = { git = "https://github.com/scroll-tech/reth", branch = "zkvm/euclid-v2", default-features = false }
reth-primitives-traits = { git = "https://github.com/scroll-tech/reth", branch = "zkvm/euclid-v2", default-features = false }
reth-storage-errors = { git = "https://github.com/scroll-tech/reth", branch = "zkvm/euclid-v2", default-features = false }
reth-trie = { git = "https://github.com/scroll-tech/reth", branch = "zkvm/euclid-v2", default-features = false }
reth-trie-sparse = { git = "https://github.com/scroll-tech/reth", branch = "zkvm/euclid-v2", default-features = false }

reth-scroll-chainspec = { git = "https://github.com/scroll-tech/reth", branch = "zkvm/euclid-v2", default-features = false }
reth-scroll-evm = { git = "https://github.com/scroll-tech/reth", branch = "zkvm/euclid-v2", default-features = false }
reth-scroll-forks = { git = "https://github.com/scroll-tech/reth", branch = "zkvm/euclid-v2", default-features = false }
reth-scroll-primitives = { git = "https://github.com/scroll-tech/reth", branch = "zkvm/euclid-v2", default-features = false }

scroll-alloy-consensus = { git = "https://github.com/scroll-tech/reth", branch = "zkvm/euclid-v2", default-features = false }
scroll-alloy-rpc-types = { git = "https://github.com/scroll-tech/reth", branch = "zkvm/euclid-v2", default-features = false }
scroll-alloy-network = { git = "https://github.com/scroll-tech/reth", branch = "zkvm/euclid-v2", default-features = false }

async-trait = "0.1"
auto_impl = "1.2"
Expand Down Expand Up @@ -121,10 +121,10 @@ ruint = { git = "https://github.com/scroll-tech/uint.git", branch = "v1.12.3" }

alloy-primitives = { git = "https://github.com/scroll-tech/alloy-core", branch = "v0.8.18" }

revm = { git = "https://github.com/scroll-tech/revm", branch = "scroll-evm-executor/feat/v55/euclid-v2" }
revm-interpreter = { git = "https://github.com/scroll-tech/revm", branch = "scroll-evm-executor/feat/v55/euclid-v2" }
revm-precompile = { git = "https://github.com/scroll-tech/revm", branch = "scroll-evm-executor/feat/v55/euclid-v2" }
revm-primitives = { git = "https://github.com/scroll-tech/revm", branch = "scroll-evm-executor/feat/v55/euclid-v2" }
#revm = { git = "https://github.com/scroll-tech/revm", branch = "scroll-evm-executor/feat/v55/euclid-v2" }
#revm-interpreter = { git = "https://github.com/scroll-tech/revm", branch = "scroll-evm-executor/feat/v55/euclid-v2" }
#revm-precompile = { git = "https://github.com/scroll-tech/revm", branch = "scroll-evm-executor/feat/v55/euclid-v2" }
#revm-primitives = { git = "https://github.com/scroll-tech/revm", branch = "scroll-evm-executor/feat/v55/euclid-v2" }

# for local development
# [patch."https://github.com/scroll-tech/revm"]
Expand Down
1 change: 1 addition & 0 deletions crates/primitives/src/chainspec.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::sync::Arc;

pub use reth_chainspec;
pub use reth_chainspec::*;

#[cfg(feature = "scroll")]
Expand Down
1 change: 0 additions & 1 deletion crates/primitives/src/types/auth_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ pub struct Authorization {
#[rkyv(derive(Debug, Hash, PartialEq, Eq))]
pub struct SignedAuthorization {
/// Inner authorization.
#[serde(flatten)]
inner: Authorization,
/// Signature parity value. We allow any [`U8`] here, however, the only valid values are `0`
/// and `1` and anything else will result in error during recovery.
Expand Down
9 changes: 3 additions & 6 deletions crates/primitives/src/types/block_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,23 +125,21 @@ pub struct BlockHeader {
#[serde(
default,
with = "alloy_serde::quantity::opt",
skip_serializing_if = "Option::is_none"
)]
#[rkyv(attr(
doc = "A scalar representing EIP1559 base fee which can move up or down each block according to a formula which is a function of gas used in parent block and gas target (block gas limit divided by elasticity multiplier) of parent block. The algorithm results in the base fee per gas increasing when blocks are above the gas target, and decreasing when blocks are below the gas target. The base fee per gas is burned."
))]
pub base_fee_per_gas: Option<u64>,
/// The Keccak 256-bit hash of the withdrawals list portion of this block.
/// <https://eips.ethereum.org/EIPS/eip-4895>
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(default)]
#[rkyv(attr(doc = "The Keccak 256-bit hash of the withdrawals list portion of this block."))]
pub withdrawals_root: Option<B256>,
/// The total amount of blob gas consumed by the transactions within the block, added in
/// EIP-4844.
#[serde(
default,
with = "alloy_serde::quantity::opt",
skip_serializing_if = "Option::is_none"
)]
#[rkyv(attr(
doc = "The total amount of blob gas consumed by the transactions within the block, added in EIP-4844."
Expand All @@ -153,7 +151,6 @@ pub struct BlockHeader {
#[serde(
default,
with = "alloy_serde::quantity::opt",
skip_serializing_if = "Option::is_none"
)]
#[rkyv(attr(
doc = "A running total of blob gas consumed in excess of the target, prior to the block. Blocks with above-target blob gas consumption increase this value, blocks with below-target blob gas consumption decrease it (bounded at 0). This was added in EIP-4844."
Expand All @@ -166,7 +163,7 @@ pub struct BlockHeader {
/// and more.
///
/// The beacon roots contract handles root storage, enhancing Ethereum's functionalities.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(default)]
#[rkyv(attr(
doc = "The hash of the parent beacon block's root is included in execution blocks, as proposed by EIP-4788. This enables trust-minimized access to consensus state, supporting staking pools, bridges, and more. The beacon roots contract handles root storage, enhancing Ethereum's functionalities."
))]
Expand All @@ -175,7 +172,7 @@ pub struct BlockHeader {
/// [EIP-7685] request in the block body.
///
/// [EIP-7685]: https://eips.ethereum.org/EIPS/eip-7685
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(default)]
#[rkyv(attr(
doc = "The Keccak 256-bit hash of the an RLP encoded list with each [EIP-7685] request in the block body."
))]
Expand Down
9 changes: 0 additions & 9 deletions crates/primitives/src/types/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ pub struct Transaction {
#[serde(
default,
with = "alloy_serde::quantity::opt",
skip_serializing_if = "Option::is_none"
)]
pub gas_price: Option<u128>,
/// Gas amount
Expand All @@ -67,15 +66,13 @@ pub struct Transaction {
#[serde(
default,
with = "alloy_serde::quantity::opt",
skip_serializing_if = "Option::is_none"
)]
pub max_priority_fee_per_gas: Option<u128>,
/// Configured max fee per blob gas for eip-4844 transactions
#[rkyv(attr(doc = "Configured max fee per blob gas for eip-4844 transactions"))]
#[serde(
default,
with = "alloy_serde::quantity::opt",
skip_serializing_if = "Option::is_none"
)]
pub max_fee_per_blob_gas: Option<u128>,
/// Data
Expand All @@ -87,33 +84,28 @@ pub struct Transaction {
#[rkyv(attr(
doc = "All _flattened_ fields of the transaction signature. Note: this is an option so special transaction types without a signature (e.g. <https://github.com/ethereum-optimism/optimism/blob/0bf643c4147b43cd6f25a759d331ef3a2a61a2a3/specs/deposits.md#the-deposited-transaction-type>) can be supported."
))]
#[serde(flatten, skip_serializing_if = "Option::is_none")]
pub signature: Option<Signature>,
/// The chain id of the transaction, if any.
#[rkyv(attr(doc = "The chain id of the transaction, if any."))]
#[serde(
default,
skip_serializing_if = "Option::is_none",
with = "alloy_serde::quantity::opt"
)]
pub chain_id: Option<ChainId>,
/// Contains the blob hashes for eip-4844 transactions.
#[rkyv(attr(doc = "Contains the blob hashes for eip-4844 transactions."))]
#[serde(skip_serializing_if = "Option::is_none")]
pub blob_versioned_hashes: Option<Vec<B256>>,
/// EIP2930
///
/// Pre-pay to warm storage access.
#[rkyv(attr(doc = "EIP2930 Pre-pay to warm storage access."))]
#[serde(skip_serializing_if = "Option::is_none")]
pub access_list: Option<AccessList>,
/// EIP7702
///
/// Authorizations are used to temporarily set the code of its signer to
/// the code referenced by `address`. These also include a `chain_id` (which
/// can be set to zero and not evaluated) as well as an optional `nonce`.
#[rkyv(attr(doc = "EIP7702 Authorizations"))]
#[serde(skip_serializing_if = "Option::is_none")]
pub authorization_list: Option<Vec<SignedAuthorization>>,
/// EIP2718
///
Expand All @@ -131,7 +123,6 @@ pub struct Transaction {
#[serde(
default,
with = "alloy_serde::quantity::opt",
skip_serializing_if = "Option::is_none"
)]
pub queue_index: Option<u64>,
}
Expand Down
10 changes: 6 additions & 4 deletions testdata/scroll_witness/euclid_v2/1.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@
"max_fee_per_gas": "0x3b9aca00",
"max_priority_fee_per_gas": "0x1",
"input": "0x6080604052348015600e575f80fd5b506104a58061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063c566b2091461002d575b5f80fd5b61004760048036038101906100429190610298565b61005e565b604051610055929190610359565b60405180910390f35b5f606061010073ffffffffffffffffffffffffffffffffffffffff168360405161008891906103c1565b5f604051808303815f865af19150503d805f81146100c1576040519150601f19603f3d011682016040523d82523d5f602084013e6100c6565b606091505b5080925081935050508161010f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161010690610431565b60405180910390fd5b7fa82cc8725dfeb485badf0c830fc554a37ed268855e35805056c77c86946342098160405161013e919061044f565b60405180910390a1915091565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6101aa82610164565b810181811067ffffffffffffffff821117156101c9576101c8610174565b5b80604052505050565b5f6101db61014b565b90506101e782826101a1565b919050565b5f67ffffffffffffffff82111561020657610205610174565b5b61020f82610164565b9050602081019050919050565b828183375f83830152505050565b5f61023c610237846101ec565b6101d2565b90508281526020810184848401111561025857610257610160565b5b61026384828561021c565b509392505050565b5f82601f83011261027f5761027e61015c565b5b813561028f84826020860161022a565b91505092915050565b5f602082840312156102ad576102ac610154565b5b5f82013567ffffffffffffffff8111156102ca576102c9610158565b5b6102d68482850161026b565b91505092915050565b5f8115159050919050565b6102f3816102df565b82525050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f61032b826102f9565b6103358185610303565b9350610345818560208601610313565b61034e81610164565b840191505092915050565b5f60408201905061036c5f8301856102ea565b818103602083015261037e8184610321565b90509392505050565b5f81905092915050565b5f61039b826102f9565b6103a58185610387565b93506103b5818560208601610313565b80840191505092915050565b5f6103cc8284610391565b915081905092915050565b5f82825260208201905092915050565b7f507265636f6d70696c652063616c6c206661696c6564000000000000000000005f82015250565b5f61041b6016836103d7565b9150610426826103e7565b602082019050919050565b5f6020820190508181035f8301526104488161040f565b9050919050565b5f6020820190508181035f8301526104678184610321565b90509291505056fea26469706673582212200f74a92387ae88fee4fc7c9238aa9bb6091756accf22046271bf9d976083ed3664736f6c63430008190033",
"r": "0xe6de9d0c2690cb78e410ee6a968110d5a713de6b9f613986ff5a987d32afea31",
"s": "0x4e07c4fe9b184edef8c2c7a58e7b252fc19542c11474cd428d24c9da11bb9fcb",
"y_parity": true,
"chain_id": "0x51615",
"access_list": [],
"transaction_type": 2
"transaction_type": 2,
"signature": {
"r": "0xe6de9d0c2690cb78e410ee6a968110d5a713de6b9f613986ff5a987d32afea31",
"s": "0x4e07c4fe9b184edef8c2c7a58e7b252fc19542c11474cd428d24c9da11bb9fcb",
"y_parity": true
}
}
],
"withdrawals": null,
Expand Down
Loading

0 comments on commit fc4ece0

Please sign in to comment.