From 16d56c8c9aa038cf42faea5ce804e96836ab69d7 Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Thu, 21 Nov 2024 17:49:18 +0100 Subject: [PATCH 01/31] add l1_fee field to `Receipt` Signed-off-by: Gregory Edison --- crates/evm/execution-types/src/chain.rs | 4 +++ .../execution-types/src/execution_outcome.rs | 18 ++++++++++++ crates/optimism/payload/Cargo.toml | 2 +- crates/primitives/src/proofs.rs | 2 ++ crates/primitives/src/receipt.rs | 28 ++++++++++++++++++- crates/storage/db-api/Cargo.toml | 1 + crates/storage/db-api/src/models/mod.rs | 6 ++++ 7 files changed, 59 insertions(+), 2 deletions(-) diff --git a/crates/evm/execution-types/src/chain.rs b/crates/evm/execution-types/src/chain.rs index 200a37423cfa..2d1f815aacad 100644 --- a/crates/evm/execution-types/src/chain.rs +++ b/crates/evm/execution-types/src/chain.rs @@ -817,6 +817,8 @@ mod tests { cumulative_gas_used: 46913, logs: vec![], success: true, + #[cfg(feature = "scroll")] + l1_fee: alloy_primitives::U256::ZERO, }; // Create another random receipt object, receipt2 @@ -825,6 +827,8 @@ mod tests { cumulative_gas_used: 1325345, logs: vec![], success: true, + #[cfg(feature = "scroll")] + l1_fee: alloy_primitives::U256::ZERO, }; // Create a Receipts object with a vector of receipt vectors diff --git a/crates/evm/execution-types/src/execution_outcome.rs b/crates/evm/execution-types/src/execution_outcome.rs index d6a9ddfd8250..2b67b95fcb3a 100644 --- a/crates/evm/execution-types/src/execution_outcome.rs +++ b/crates/evm/execution-types/src/execution_outcome.rs @@ -398,6 +398,8 @@ mod tests { cumulative_gas_used: 46913, logs: vec![], success: true, + #[cfg(feature = "scroll")] + l1_fee: U256::ZERO, })]], }; @@ -460,6 +462,8 @@ mod tests { cumulative_gas_used: 46913, logs: vec![], success: true, + #[cfg(feature = "scroll")] + l1_fee: U256::ZERO, })]], }; @@ -495,6 +499,8 @@ mod tests { cumulative_gas_used: 46913, logs: vec![Log::::default()], success: true, + #[cfg(feature = "scroll")] + l1_fee: U256::ZERO, })]], }; @@ -527,6 +533,8 @@ mod tests { cumulative_gas_used: 46913, logs: vec![Log::::default()], success: true, + #[cfg(feature = "scroll")] + l1_fee: U256::ZERO, })]], }; @@ -553,6 +561,8 @@ mod tests { cumulative_gas_used: 46913, logs: vec![Log::::default()], success: true, + #[cfg(feature = "scroll")] + l1_fee: U256::ZERO, })] ); } @@ -567,6 +577,8 @@ mod tests { cumulative_gas_used: 46913, logs: vec![Log::::default()], success: true, + #[cfg(feature = "scroll")] + l1_fee: U256::ZERO, })]], }; @@ -615,6 +627,8 @@ mod tests { cumulative_gas_used: 46913, logs: vec![], success: true, + #[cfg(feature = "scroll")] + l1_fee: U256::ZERO, }; // Create a Receipts object with a vector of receipt vectors @@ -664,6 +678,8 @@ mod tests { cumulative_gas_used: 46913, logs: vec![], success: true, + #[cfg(feature = "scroll")] + l1_fee: U256::ZERO, }; // Create a Receipts object containing the receipt. @@ -708,6 +724,8 @@ mod tests { cumulative_gas_used: 46913, logs: vec![], success: true, + #[cfg(feature = "scroll")] + l1_fee: U256::ZERO, }; // Create a Receipts object with a vector of receipt vectors diff --git a/crates/optimism/payload/Cargo.toml b/crates/optimism/payload/Cargo.toml index 8873da14605e..b73dcfc5926f 100644 --- a/crates/optimism/payload/Cargo.toml +++ b/crates/optimism/payload/Cargo.toml @@ -60,4 +60,4 @@ optimism = [ "reth-execution-types/optimism", "reth-optimism-consensus/optimism" ] -scroll = [] \ No newline at end of file +scroll = [] diff --git a/crates/primitives/src/proofs.rs b/crates/primitives/src/proofs.rs index 1712112281f4..5cfda9ab1dad 100644 --- a/crates/primitives/src/proofs.rs +++ b/crates/primitives/src/proofs.rs @@ -94,6 +94,8 @@ mod tests { success: true, cumulative_gas_used: 102068, logs, + #[cfg(feature = "scroll")] + l1_fee: U256::from(0xffffff), }, bloom, }; diff --git a/crates/primitives/src/receipt.rs b/crates/primitives/src/receipt.rs index 53adb85eda05..a75e967cc25b 100644 --- a/crates/primitives/src/receipt.rs +++ b/crates/primitives/src/receipt.rs @@ -7,6 +7,8 @@ use alloy_consensus::{ Eip658Value, TxReceipt, }; use alloy_eips::eip2718::Encodable2718; +#[cfg(all(feature = "scroll", not(feature = "optimism")))] +use alloy_primitives::U256; use alloy_primitives::{Bloom, Log, B256}; use alloy_rlp::{length_of_length, Decodable, Encodable, RlpDecodable, RlpEncodable}; use bytes::{Buf, BufMut}; @@ -50,6 +52,12 @@ pub struct Receipt { /// ensures this is only set for post-Canyon deposit transactions. #[cfg(all(feature = "optimism", not(feature = "scroll")))] pub deposit_receipt_version: Option, + /// Additional fee to cover l1 data availability costs. + /// L1 fee is not part of the consensus encoding of a receipt. + /// + #[cfg(all(feature = "scroll", not(feature = "optimism")))] + #[rlp(skip)] + pub l1_fee: U256, } impl Receipt { @@ -247,6 +255,8 @@ impl<'a> arbitrary::Arbitrary<'a> for Receipt { deposit_nonce, #[cfg(all(feature = "optimism", not(feature = "scroll")))] deposit_receipt_version, + #[cfg(all(feature = "scroll", not(feature = "optimism")))] + l1_fee: alloy_primitives::U256::arbitrary(u)?, }) } } @@ -334,6 +344,8 @@ impl ReceiptWithBloom { deposit_nonce: None, #[cfg(all(feature = "optimism", not(feature = "scroll")))] deposit_receipt_version: None, + #[cfg(all(feature = "scroll", not(feature = "optimism")))] + l1_fee: U256::ZERO, }, }; @@ -571,10 +583,14 @@ mod tests { #[test] fn test_decode_receipt() { - #[cfg(not(feature = "optimism"))] + #[cfg(all(not(feature = "optimism"), not(feature = "scroll")))] reth_codecs::test_utils::test_decode::(&hex!( "c428b52ffd23fc42696156b10200f034792b6a94c3850215c2fef7aea361a0c31b79d9a32652eefc0d4e2e730036061cff7344b6fc6132b50cda0ed810a991ae58ef013150c12b2522533cb3b3a8b19b7786a8b5ff1d3cdc84225e22b02def168c8858df" )); + #[cfg(feature = "scroll")] + reth_codecs::test_utils::test_decode::(&hex!( + "c42128b52ffd23fc42696159c90200f034792b6a94c3850215c2fef7aea361a0c31b79d9a32652eefc0d4e2e730036061cff7344b6fc6132b50cda0ed810a991ae58ef013150c12b2522533cb3b3a8b19b7786a8b5ff1d3cdc84225e22b02def168c8858dfffffff" + )); #[cfg(feature = "optimism")] reth_codecs::test_utils::test_decode::(&hex!( "c30328b52ffd23fc426961a00105007eb0042307705a97e503562eacf2b95060cce9de6de68386b6c155b73a9650021a49e2f8baad17f30faff5899d785c4c0873e45bc268bcf07560106424570d11f9a59e8f3db1efa4ceec680123712275f10d92c3411e1caaa11c7c5d591bc11487168e09934a9986848136da1b583babf3a7188e3aed007a1520f1cf4c1ca7d3482c6c28d37c298613c70a76940008816c4c95644579fd08471dc34732fd0f24" @@ -604,6 +620,8 @@ mod tests { deposit_nonce: None, #[cfg(all(feature = "optimism", not(feature = "scroll")))] deposit_receipt_version: None, + #[cfg(all(feature = "scroll", not(feature = "optimism")))] + l1_fee: U256::ZERO, }, bloom: [0; 256].into(), }; @@ -638,6 +656,8 @@ mod tests { deposit_nonce: None, #[cfg(all(feature = "optimism", not(feature = "scroll")))] deposit_receipt_version: None, + #[cfg(all(feature = "scroll", not(feature = "optimism")))] + l1_fee: U256::ZERO, }, bloom: [0; 256].into(), }; @@ -720,6 +740,8 @@ mod tests { deposit_nonce: None, #[cfg(all(feature = "optimism", not(feature = "scroll")))] deposit_receipt_version: None, + #[cfg(all(feature = "scroll", not(feature = "optimism")))] + l1_fee: U256::from(0xffffff), }; let mut data = vec![]; @@ -740,6 +762,8 @@ mod tests { deposit_nonce: None, #[cfg(all(feature = "optimism", not(feature = "scroll")))] deposit_receipt_version: None, + #[cfg(all(feature = "scroll", not(feature = "optimism")))] + l1_fee: U256::from(0xffffff), }, bloom: Bloom::default(), }; @@ -762,6 +786,8 @@ mod tests { deposit_nonce: None, #[cfg(all(feature = "optimism", not(feature = "scroll")))] deposit_receipt_version: None, + #[cfg(all(feature = "scroll", not(feature = "optimism")))] + l1_fee: U256::from(0xffffff), }, bloom: Bloom::default(), }; diff --git a/crates/storage/db-api/Cargo.toml b/crates/storage/db-api/Cargo.toml index 3aa908a60093..1071e0a4432a 100644 --- a/crates/storage/db-api/Cargo.toml +++ b/crates/storage/db-api/Cargo.toml @@ -82,3 +82,4 @@ arbitrary = [ "alloy-consensus/arbitrary", ] optimism = ["reth-primitives/optimism", "reth-codecs/optimism"] +scroll = ["reth-primitives/scroll"] diff --git a/crates/storage/db-api/src/models/mod.rs b/crates/storage/db-api/src/models/mod.rs index 5d18711922ed..83d2913c5bc5 100644 --- a/crates/storage/db-api/src/models/mod.rs +++ b/crates/storage/db-api/src/models/mod.rs @@ -335,7 +335,10 @@ mod tests { assert_eq!(PruneCheckpoint::bitflag_encoded_bytes(), 1); assert_eq!(PruneMode::bitflag_encoded_bytes(), 1); assert_eq!(PruneSegment::bitflag_encoded_bytes(), 1); + #[cfg(not(feature = "scroll"))] assert_eq!(Receipt::bitflag_encoded_bytes(), 1); + #[cfg(feature = "scroll")] + assert_eq!(Receipt::bitflag_encoded_bytes(), 2); assert_eq!(StageCheckpoint::bitflag_encoded_bytes(), 1); assert_eq!(StageUnitCheckpoint::bitflag_encoded_bytes(), 1); assert_eq!(StoredBlockBodyIndices::bitflag_encoded_bytes(), 1); @@ -356,7 +359,10 @@ mod tests { validate_bitflag_backwards_compat!(PruneCheckpoint, UnusedBits::NotZero); validate_bitflag_backwards_compat!(PruneMode, UnusedBits::Zero); validate_bitflag_backwards_compat!(PruneSegment, UnusedBits::Zero); + #[cfg(not(feature = "scroll"))] validate_bitflag_backwards_compat!(Receipt, UnusedBits::Zero); + #[cfg(feature = "scroll")] + validate_bitflag_backwards_compat!(Receipt, UnusedBits::NotZero); validate_bitflag_backwards_compat!(StageCheckpoint, UnusedBits::NotZero); validate_bitflag_backwards_compat!(StageUnitCheckpoint, UnusedBits::Zero); validate_bitflag_backwards_compat!(StoredBlockBodyIndices, UnusedBits::Zero); From 8ac2d238b8d2858eb1ee2243a0d6cbede7aeb4dc Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Thu, 28 Nov 2024 11:31:01 +0100 Subject: [PATCH 02/31] scroll consensus Signed-off-by: Gregory Edison --- Cargo.lock | 22 +++++++++ Cargo.toml | 2 + crates/scroll/consensus/Cargo.toml | 16 ++++++ crates/scroll/consensus/src/curie.rs | 73 ++++++++++++++++++++++++++++ crates/scroll/consensus/src/lib.rs | 4 ++ 5 files changed, 117 insertions(+) create mode 100644 crates/scroll/consensus/Cargo.toml create mode 100644 crates/scroll/consensus/src/curie.rs create mode 100644 crates/scroll/consensus/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index c52f872d2449..d4ffa12b0c6a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9119,12 +9119,34 @@ dependencies = [ "serde_json", ] +[[package]] +name = "reth-scroll-consensus" +version = "1.1.2" +dependencies = [ + "revm", +] + [[package]] name = "reth-scroll-execution" version = "1.1.2" dependencies = [ + "alloy-consensus", + "alloy-eips", + "auto_impl", + "derive_more 1.0.0", + "reth-chainspec", + "reth-consensus", + "reth-ethereum-consensus", + "reth-evm", + "reth-primitives", "reth-revm", + "reth-scroll-consensus", + "reth-scroll-primitives", + "reth-scroll-revm", "reth-scroll-storage", + "revm", + "thiserror 1.0.69", + "tracing", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index a9a188ec2c41..935e465911a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -100,6 +100,7 @@ members = [ "crates/rpc/rpc-testing-util/", "crates/rpc/rpc-types-compat/", "crates/rpc/rpc/", + "crates/scroll/consensus", "crates/scroll/execution", "crates/scroll/primitives", "crates/scroll/revm", @@ -407,6 +408,7 @@ reth-rpc-eth-types = { path = "crates/rpc/rpc-eth-types", default-features = fal reth-rpc-layer = { path = "crates/rpc/rpc-layer" } reth-rpc-server-types = { path = "crates/rpc/rpc-server-types" } reth-rpc-types-compat = { path = "crates/rpc/rpc-types-compat" } +reth-scroll-consensus = { path = "crates/scroll/consensus" } reth-scroll-execution = { path = "crates/scroll/execution" } reth-scroll-primitives = { path = "crates/scroll/primitives" } reth-scroll-revm = { path = "crates/scroll/revm" } diff --git a/crates/scroll/consensus/Cargo.toml b/crates/scroll/consensus/Cargo.toml new file mode 100644 index 000000000000..12f2e3ac5ef4 --- /dev/null +++ b/crates/scroll/consensus/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "reth-scroll-consensus" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true +exclude.workspace = true + +[dependencies] +# revm +revm.workspace = true + +[lints] +workspace = true diff --git a/crates/scroll/consensus/src/curie.rs b/crates/scroll/consensus/src/curie.rs new file mode 100644 index 000000000000..af78368a490c --- /dev/null +++ b/crates/scroll/consensus/src/curie.rs @@ -0,0 +1,73 @@ +use revm::{ + db::{states::StorageSlot, StorageWithOriginalValues}, + primitives::{address, bytes, AccountInfo, Address, Bytecode, Bytes, U256}, + Database, State, +}; + +const L1_GAS_PRICE_ORACLE_ADDRESS: Address = address!("5300000000000000000000000000000000000002"); +const CURIE_L1_GAS_PRICE_ORACLE_BYTECODE: Bytes = bytes!("608060405234801561000f575f80fd5b5060043610610132575f3560e01c8063715018a6116100b4578063a911d77f11610079578063a911d77f1461024c578063bede39b514610254578063de26c4a114610267578063e88a60ad1461027a578063f2fde38b1461028d578063f45e65d8146102a0575f80fd5b8063715018a6146101eb57806384189161146101f35780638da5cb5b146101fc57806393e59dc114610226578063944b247f14610239575f80fd5b80633d0f963e116100fa5780633d0f963e146101a057806349948e0e146101b3578063519b4bd3146101c65780636a5e67e5146101cf57806370465597146101d8575f80fd5b80630c18c1621461013657806313dad5be1461015257806323e524ac1461016f5780633577afc51461017857806339455d3a1461018d575b5f80fd5b61013f60025481565b6040519081526020015b60405180910390f35b60085461015f9060ff1681565b6040519015158152602001610149565b61013f60065481565b61018b6101863660046109b3565b6102a9565b005b61018b61019b3660046109ca565b61033b565b61018b6101ae3660046109ea565b610438565b61013f6101c1366004610a2b565b6104bb565b61013f60015481565b61013f60075481565b61018b6101e63660046109b3565b6104e0565b61018b61056e565b61013f60055481565b5f5461020e906001600160a01b031681565b6040516001600160a01b039091168152602001610149565b60045461020e906001600160a01b031681565b61018b6102473660046109b3565b6105a2565b61018b61062e565b61018b6102623660046109b3565b61068a565b61013f610275366004610a2b565b610747565b61018b6102883660046109b3565b610764565b61018b61029b3660046109ea565b6107f0565b61013f60035481565b5f546001600160a01b031633146102db5760405162461bcd60e51b81526004016102d290610ad6565b60405180910390fd5b621c9c388111156102ff57604051635742c80560e11b815260040160405180910390fd5b60028190556040518181527f32740b35c0ea213650f60d44366b4fb211c9033b50714e4a1d34e65d5beb9bb4906020015b60405180910390a150565b6004805460405163efc7840160e01b815233928101929092526001600160a01b03169063efc7840190602401602060405180830381865afa158015610382573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103a69190610b0d565b6103c3576040516326b3506d60e11b815260040160405180910390fd5b600182905560058190556040518281527f351fb23757bb5ea0546c85b7996ddd7155f96b939ebaa5ff7bc49c75f27f2c449060200160405180910390a16040518181527f9a14bfb5d18c4c3cf14cae19c23d7cf1bcede357ea40ca1f75cd49542c71c214906020015b60405180910390a15050565b5f546001600160a01b031633146104615760405162461bcd60e51b81526004016102d290610ad6565b600480546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f22d1c35fe072d2e42c3c8f9bd4a0d34aa84a0101d020a62517b33fdb3174e5f7910161042c565b6008545f9060ff16156104d7576104d18261087b565b92915050565b6104d1826108c1565b5f546001600160a01b031633146105095760405162461bcd60e51b81526004016102d290610ad6565b610519633b9aca006103e8610b40565b81111561053957604051631e44fdeb60e11b815260040160405180910390fd5b60038190556040518181527f3336cd9708eaf2769a0f0dc0679f30e80f15dcd88d1921b5a16858e8b85c591a90602001610330565b5f546001600160a01b031633146105975760405162461bcd60e51b81526004016102d290610ad6565b6105a05f610904565b565b5f546001600160a01b031633146105cb5760405162461bcd60e51b81526004016102d290610ad6565b6105d9633b9aca0080610b40565b8111156105f95760405163874f603160e01b815260040160405180910390fd5b60068190556040518181527f2ab3f5a4ebbcbf3c24f62f5454f52f10e1a8c9dcc5acac8f19199ce881a6a10890602001610330565b5f546001600160a01b031633146106575760405162461bcd60e51b81526004016102d290610ad6565b60085460ff161561067b576040516379f9c57560e01b815260040160405180910390fd5b6008805460ff19166001179055565b6004805460405163efc7840160e01b815233928101929092526001600160a01b03169063efc7840190602401602060405180830381865afa1580156106d1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106f59190610b0d565b610712576040516326b3506d60e11b815260040160405180910390fd5b60018190556040518181527f351fb23757bb5ea0546c85b7996ddd7155f96b939ebaa5ff7bc49c75f27f2c4490602001610330565b6008545f9060ff161561075b57505f919050565b6104d182610953565b5f546001600160a01b0316331461078d5760405162461bcd60e51b81526004016102d290610ad6565b61079b633b9aca0080610b40565b8111156107bb5760405163f37ec21560e01b815260040160405180910390fd5b60078190556040518181527f6b332a036d8c3ead57dcb06c87243bd7a2aed015ddf2d0528c2501dae56331aa90602001610330565b5f546001600160a01b031633146108195760405162461bcd60e51b81526004016102d290610ad6565b6001600160a01b03811661086f5760405162461bcd60e51b815260206004820152601d60248201527f6e6577206f776e657220697320746865207a65726f206164647265737300000060448201526064016102d2565b61087881610904565b50565b5f633b9aca0060055483516007546108939190610b40565b61089d9190610b40565b6001546006546108ad9190610b40565b6108b79190610b57565b6104d19190610b6a565b5f806108cc83610953565b90505f600154826108dd9190610b40565b9050633b9aca00600354826108f29190610b40565b6108fc9190610b6a565b949350505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80515f908190815b818110156109a45784818151811061097557610975610b89565b01602001516001600160f81b0319165f036109955760048301925061099c565b6010830192505b60010161095b565b50506002540160400192915050565b5f602082840312156109c3575f80fd5b5035919050565b5f80604083850312156109db575f80fd5b50508035926020909101359150565b5f602082840312156109fa575f80fd5b81356001600160a01b0381168114610a10575f80fd5b9392505050565b634e487b7160e01b5f52604160045260245ffd5b5f60208284031215610a3b575f80fd5b813567ffffffffffffffff80821115610a52575f80fd5b818401915084601f830112610a65575f80fd5b813581811115610a7757610a77610a17565b604051601f8201601f19908116603f01168101908382118183101715610a9f57610a9f610a17565b81604052828152876020848701011115610ab7575f80fd5b826020860160208301375f928101602001929092525095945050505050565b60208082526017908201527f63616c6c6572206973206e6f7420746865206f776e6572000000000000000000604082015260600190565b5f60208284031215610b1d575f80fd5b81518015158114610a10575f80fd5b634e487b7160e01b5f52601160045260245ffd5b80820281158282048414176104d1576104d1610b2c565b808201808211156104d1576104d1610b2c565b5f82610b8457634e487b7160e01b5f52601260045260245ffd5b500490565b634e487b7160e01b5f52603260045260245ffdfea26469706673582212200c2ac583f18be4f94ab169ae6f2ea3a708a7c0d4424746b120b177adb39e626064736f6c63430008180033"); +const CURIE_L1_GAS_PRICE_ORACLE_STORAGE: [(U256, U256); 4] = [ + (L1_BLOB_BASE_FEE_SLOT, INITIAL_L1_BLOB_BASE_FEE), + (COMMIT_SCALAR_SLOT, INITIAL_COMMIT_SCALAR), + (BLOB_SCALAR_SLOT, INITIAL_BLOB_SCALAR), + (IS_CURIE_SLOT, IS_CURIE), +]; + +const L1_BLOB_BASE_FEE_SLOT: U256 = U256::from_limbs([5, 0, 0, 0]); +const INITIAL_L1_BLOB_BASE_FEE: U256 = U256::from_limbs([1, 0, 0, 0]); +const COMMIT_SCALAR_SLOT: U256 = U256::from_limbs([6, 0, 0, 0]); +const INITIAL_COMMIT_SCALAR: U256 = U256::from_limbs([230759955285, 0, 0, 0]); +const BLOB_SCALAR_SLOT: U256 = U256::from_limbs([7, 0, 0, 0]); +const INITIAL_BLOB_SCALAR: U256 = U256::from_limbs([417565260, 0, 0, 0]); +const IS_CURIE_SLOT: U256 = U256::from_limbs([8, 0, 0, 0]); +const IS_CURIE: U256 = U256::from_limbs([1, 0, 0, 0]); + +/// Applies the Scroll curie hard fork to the state. +pub fn apply_curie_hard_fork(state: &mut State) -> Result<(), DB::Error> { + let oracle = state.load_cache_account(L1_GAS_PRICE_ORACLE_ADDRESS)?; + + // get old oracle account balance and nonce + let (old_balance, old_nonce) = + oracle.account.as_ref().map(|acc| (acc.info.balance, acc.info.nonce)).unwrap_or_default(); + + // compute the code hash + let bytecode = Bytecode::new_raw(CURIE_L1_GAS_PRICE_ORACLE_BYTECODE); + let code_hash = bytecode.hash_slow(); + + // init new oracle account information + let new_oracle_info = + AccountInfo { balance: old_balance, nonce: old_nonce, code_hash, code: Some(bytecode) }; + + // create `StorageWithOriginalValues` mapping for oracle + let storage = oracle + .account + .as_ref() + .map(|acc| { + let mut storage_with_original_values = StorageWithOriginalValues::default(); + for (slot, new_storage_value) in CURIE_L1_GAS_PRICE_ORACLE_STORAGE { + storage_with_original_values.insert( + slot, + StorageSlot { + previous_or_original_value: acc + .storage + .get(&slot) + .copied() + .unwrap_or_default(), + present_value: new_storage_value, + }, + ); + } + storage_with_original_values + }) + .unwrap_or_default(); + + // create transition for oracle new account info and storage + let transition = oracle.change(new_oracle_info, storage); + + // append transition + if let Some(s) = state.transition_state.as_mut() { + s.add_transitions(vec![(L1_GAS_PRICE_ORACLE_ADDRESS, transition)]) + } + + Ok(()) +} diff --git a/crates/scroll/consensus/src/lib.rs b/crates/scroll/consensus/src/lib.rs new file mode 100644 index 000000000000..86c2e0029221 --- /dev/null +++ b/crates/scroll/consensus/src/lib.rs @@ -0,0 +1,4 @@ +//! Scroll consensus implementation. + +pub use curie::apply_curie_hard_fork; +mod curie; From 54c1fd28d3780c0dcc116276e7a620db413b4cdc Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Thu, 28 Nov 2024 11:32:31 +0100 Subject: [PATCH 03/31] feat: scroll execution strategy Signed-off-by: Gregory Edison --- crates/chainspec/Cargo.toml | 4 + crates/evm/Cargo.toml | 6 + crates/scroll/execution/Cargo.toml | 34 +++- crates/scroll/execution/src/error.rs | 37 +++++ crates/scroll/execution/src/lib.rs | 10 +- crates/scroll/execution/src/strategy.rs | 199 ++++++++++++++++++++++++ 6 files changed, 287 insertions(+), 3 deletions(-) create mode 100644 crates/scroll/execution/src/error.rs create mode 100644 crates/scroll/execution/src/strategy.rs diff --git a/crates/chainspec/Cargo.toml b/crates/chainspec/Cargo.toml index 5bac582cd8b6..93fae173ac6f 100644 --- a/crates/chainspec/Cargo.toml +++ b/crates/chainspec/Cargo.toml @@ -63,3 +63,7 @@ test-utils = [ "reth-primitives-traits/test-utils", "reth-trie-common/test-utils" ] +scroll = [ + "reth-trie-common/scroll", + "reth-primitives-traits/scroll" +] \ No newline at end of file diff --git a/crates/evm/Cargo.toml b/crates/evm/Cargo.toml index 155e54fa90d7..50ea3b405c36 100644 --- a/crates/evm/Cargo.toml +++ b/crates/evm/Cargo.toml @@ -80,3 +80,9 @@ scroll = [ "reth-execution-types/scroll", "reth-scroll-execution/scroll" ] +scroll = [ + "reth-primitives/scroll", + "reth-primitives-traits/scroll", + "reth-execution-types/scroll", + "reth-chainspec/scroll", +] diff --git a/crates/scroll/execution/Cargo.toml b/crates/scroll/execution/Cargo.toml index 7a6af2b39798..0087d773daf6 100644 --- a/crates/scroll/execution/Cargo.toml +++ b/crates/scroll/execution/Cargo.toml @@ -13,12 +13,42 @@ workspace = true [dependencies] # reth +reth-chainspec.workspace = true +reth-consensus.workspace = true +reth-ethereum-consensus.workspace = true +reth-evm.workspace = true +reth-primitives.workspace = true reth-revm.workspace = true + +# revm +revm.workspace = true + +# alloy +alloy-consensus.workspace = true +alloy-eips.workspace = true + +# scroll +reth-scroll-consensus.workspace = true +reth-scroll-primitives = { workspace = true, optional = true } +reth-scroll-revm.workspace = true reth-scroll-storage = { workspace = true, optional = true } +# misc +auto_impl.workspace = true +derive_more.workspace = true +thiserror.workspace = true +tracing.workspace = true + [features] scroll = [ + "reth-scroll-primitives", + "reth-scroll-revm/scroll", "reth-scroll-storage/scroll", - "reth-revm/scroll" + "reth-primitives/scroll", + "reth-chainspec/scroll", + "revm/optional_no_base_fee" ] -test-utils = ["reth-revm/test-utils"] +test-utils = [ + "reth-scroll-revm/test-utils", + "reth-revm/test-utils" +] \ No newline at end of file diff --git a/crates/scroll/execution/src/error.rs b/crates/scroll/execution/src/error.rs new file mode 100644 index 000000000000..615db5fe7813 --- /dev/null +++ b/crates/scroll/execution/src/error.rs @@ -0,0 +1,37 @@ +use reth_consensus::ConsensusError; +use reth_evm::execute::{BlockExecutionError, BlockValidationError, ProviderError}; + +/// Execution error for Scroll. +#[derive(thiserror::Error, derive_more::Display, derive_more::From, Debug)] +pub enum ScrollBlockExecutionError { + /// Error occurred at block execution. + BlockExecution(BlockExecutionError), + /// Error occurred at a hard fork. + #[display("failed to apply hard fork: {_0}")] + HardFork(HardForkError), +} + +/// Scroll hard fork error. +#[derive(Debug, derive_more::Display)] +pub enum HardForkError { + /// Error occurred at the Curie hard fork. + Curie, +} + +impl From for ScrollBlockExecutionError { + fn from(value: ProviderError) -> Self { + Self::BlockExecution(value.into()) + } +} + +impl From for ScrollBlockExecutionError { + fn from(value: BlockValidationError) -> Self { + Self::BlockExecution(value.into()) + } +} + +impl From for ScrollBlockExecutionError { + fn from(value: ConsensusError) -> Self { + Self::BlockExecution(value.into()) + } +} diff --git a/crates/scroll/execution/src/lib.rs b/crates/scroll/execution/src/lib.rs index 150a0e9700da..9abafa3f5a8a 100644 --- a/crates/scroll/execution/src/lib.rs +++ b/crates/scroll/execution/src/lib.rs @@ -1,6 +1,14 @@ //! Scroll execution related implementations. -#![warn(unused_crate_dependencies)] +#![cfg_attr(not(feature = "scroll"), allow(unused_crate_dependencies))] pub use context::FinalizeExecution; mod context; + +#[cfg(feature = "scroll")] +pub use strategy::ScrollExecutionStrategy; +#[cfg(feature = "scroll")] +mod strategy; + +pub use error::{HardForkError, ScrollBlockExecutionError}; +mod error; diff --git a/crates/scroll/execution/src/strategy.rs b/crates/scroll/execution/src/strategy.rs new file mode 100644 index 000000000000..a51b49fecb46 --- /dev/null +++ b/crates/scroll/execution/src/strategy.rs @@ -0,0 +1,199 @@ +//! Implementation of the [`BlockExecutionStrategy`] for Scroll. + +use crate::{HardForkError, ScrollBlockExecutionError}; +use alloy_consensus::{Header, Transaction}; +use alloy_eips::eip7685::Requests; +use reth_chainspec::{ChainSpec, EthereumHardfork, EthereumHardforks}; +use reth_consensus::ConsensusError; +use reth_evm::{ + execute::{BlockExecutionStrategy, BlockValidationError, ExecuteOutput, ProviderError}, + ConfigureEvm, ConfigureEvmEnv, +}; +use reth_primitives::{ + gas_spent_by_transactions, BlockWithSenders, GotExpected, InvalidTransactionError, Receipt, +}; +use reth_revm::primitives::{CfgEnvWithHandlerCfg, U256}; +use reth_scroll_consensus::apply_curie_hard_fork; +use revm::{ + primitives::{BlockEnv, EnvWithHandlerCfg, ResultAndState}, + Database, DatabaseCommit, State, +}; +use std::fmt::{Debug, Display}; + +/// The Scroll block execution strategy. +#[derive(Debug)] +pub struct ScrollExecutionStrategy { + /// Chain specification. + chain_spec: ChainSpec, + /// Evm configuration. + // TODO (scroll): EvmConfig should set the correct coinbase in `fill_block_env`. + // TODO (scroll): Should we have a ScrollConfig? + evm_config: EvmConfig, + /// Current state for the execution. + state: State, +} + +impl ScrollExecutionStrategy +where + EvmConfig: ConfigureEvmEnv
, +{ + /// Configures a new evm configuration and block environment for the given block. + /// + /// # Caution + /// + /// This does not initialize the tx environment. + fn evm_env_for_block(&self, header: &Header, total_difficulty: U256) -> EnvWithHandlerCfg { + let mut cfg = CfgEnvWithHandlerCfg::new(Default::default(), Default::default()); + let mut block_env = BlockEnv::default(); + self.evm_config.fill_cfg_and_block_env(&mut cfg, &mut block_env, header, total_difficulty); + + EnvWithHandlerCfg::new_with_cfg_env(cfg, block_env, Default::default()) + } +} + +impl BlockExecutionStrategy for ScrollExecutionStrategy +where + DB: Database + Display>, + EvmConfig: ConfigureEvm
, +{ + type Error = ScrollBlockExecutionError; + + fn apply_pre_execution_changes( + &mut self, + block: &BlockWithSenders, + _total_difficulty: U256, + ) -> Result<(), Self::Error> { + // TODO (scroll): update to the Scroll chain spec + // TODO (scroll): update to the Curie hardfork + if self.chain_spec.fork(EthereumHardfork::Dao).transitions_at_block(block.number) { + if let Err(err) = apply_curie_hard_fork(&mut self.state) { + tracing::debug!(%err, "failed to apply curie hardfork"); + return Err(HardForkError::Curie.into()); + }; + } + + Ok(()) + } + + fn execute_transactions( + &mut self, + block: &BlockWithSenders, + total_difficulty: U256, + ) -> Result { + let env = self.evm_env_for_block(&block.header, total_difficulty); + let mut evm = self.evm_config.evm_with_env(&mut self.state, env); + + let mut cumulative_gas_used = 0; + let mut receipts = Vec::with_capacity(block.body.transactions.len()); + + for (sender, transaction) in block.transactions_with_sender() { + // The sum of the transaction’s gas limit and the gas utilized in this block prior, + // must be no greater than the block’s gasLimit. + let block_available_gas = block.header.gas_limit - cumulative_gas_used; + if transaction.gas_limit() > block_available_gas { + return Err(BlockValidationError::TransactionGasLimitMoreThanAvailableBlockGas { + transaction_gas_limit: transaction.gas_limit(), + block_available_gas, + } + .into()) + } + + if transaction.is_eip4844() { + return Err(ConsensusError::InvalidTransaction( + InvalidTransactionError::Eip4844Disabled, + ) + .into()) + } + + // TODO (scroll): verify the logic from the stateless block verifier + // https://github.com/scroll-tech/stateless-block-verifier/blob/master/crates/core/src/executor/mod.rs#L71 + self.evm_config.fill_tx_env(evm.tx_mut(), transaction, *sender); + if transaction.is_l1_messaging() { + evm.context.evm.env.cfg.disable_base_fee = true; // disable base fee for l1 msg + } + + let ResultAndState { result, state } = + evm.transact().map_err(|err| BlockValidationError::EVM { + hash: transaction.recalculate_hash(), + error: Box::new(err.map_db_err(|e| e.into())), + })?; + + evm.db_mut().commit(state); + + // TODO (scroll): uncomment once we have the scroll/revm fork integrated + let l1_fee = U256::ZERO; + // if !transaction.is_l1_msg() { + // let mut rlp_bytes = BytesMut::new(); + // transaction.eip2718_encode(&mut rlp_bytes, transaction.signature()); + // let l1_block_info = + // evm.context.evm.inner.l1_block_info.as_ref().expect("l1 block info exists"); + // l1_fee = l1_block_info.calculate_tx_l1_cost(rlp_bytes, evm.handler.cfg.spec_id); + // } + + cumulative_gas_used += result.gas_used(); + + receipts.push(Receipt { + tx_type: transaction.tx_type(), + success: result.is_success(), + cumulative_gas_used, + logs: result.into_logs(), + l1_fee, + }) + } + + Ok(ExecuteOutput { receipts, gas_used: cumulative_gas_used }) + } + + fn apply_post_execution_changes( + &mut self, + _block: &BlockWithSenders, + _total_difficulty: U256, + _receipts: &[Receipt], + ) -> Result { + Ok(Default::default()) + } + + fn state_ref(&self) -> &State { + &self.state + } + + fn state_mut(&mut self) -> &mut State { + &mut self.state + } + + fn validate_block_post_execution( + &self, + block: &BlockWithSenders, + receipts: &[Receipt], + _requests: &Requests, + ) -> Result<(), ConsensusError> { + // verify the block gas used + let cumulative_gas_used = receipts.last().map(|r| r.cumulative_gas_used).unwrap_or(0); + if block.gas_used != cumulative_gas_used { + return Err(ConsensusError::BlockGasUsed { + gas: GotExpected { got: cumulative_gas_used, expected: block.gas_used }, + gas_spent_by_tx: gas_spent_by_transactions(receipts), + }); + } + + // verify the receipts logs bloom and root + if self.chain_spec.is_byzantium_active_at_block(block.header.number) { + if let Err(error) = reth_ethereum_consensus::verify_receipts( + block.header.receipts_root, + block.header.logs_bloom, + receipts, + ) { + tracing::debug!( + %error, + ?receipts, + header_receipt_root = ?block.header.receipts_root, + header_bloom = ?block.header.logs_bloom, + "failed to verify receipts" + ); + return Err(error); + } + } + + Ok(()) + } +} From 5183d5aa5d29d9cd88ee86b5ed5984fcbac6226f Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Thu, 28 Nov 2024 11:33:12 +0100 Subject: [PATCH 04/31] feat: expose `verify_receipts` from reth-ethereum-consensus Signed-off-by: Gregory Edison --- crates/ethereum/consensus/src/lib.rs | 2 +- crates/ethereum/consensus/src/validation.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/ethereum/consensus/src/lib.rs b/crates/ethereum/consensus/src/lib.rs index ffabe5b1952c..87c9af805a07 100644 --- a/crates/ethereum/consensus/src/lib.rs +++ b/crates/ethereum/consensus/src/lib.rs @@ -26,7 +26,7 @@ use std::{fmt::Debug, sync::Arc, time::SystemTime}; pub const GAS_LIMIT_BOUND_DIVISOR: u64 = 1024; mod validation; -pub use validation::validate_block_post_execution; +pub use validation::{validate_block_post_execution, verify_receipts}; /// Ethereum beacon consensus /// diff --git a/crates/ethereum/consensus/src/validation.rs b/crates/ethereum/consensus/src/validation.rs index f990ecc57d82..b07df409d36e 100644 --- a/crates/ethereum/consensus/src/validation.rs +++ b/crates/ethereum/consensus/src/validation.rs @@ -55,7 +55,7 @@ pub fn validate_block_post_execution( /// Calculate the receipts root, and compare it against against the expected receipts root and logs /// bloom. -fn verify_receipts( +pub fn verify_receipts( expected_receipts_root: B256, expected_logs_bloom: Bloom, receipts: &[Receipt], From 36adba418ab6a0a6781167d7721b9d4432a95f62 Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Thu, 28 Nov 2024 17:27:10 +0100 Subject: [PATCH 05/31] feat: add `reth-scroll-evm` crate to avoid cyclic dep Signed-off-by: Gregory Edison --- Cargo.lock | 16 +++++--- Cargo.toml | 2 + crates/evm/Cargo.toml | 6 --- crates/primitives/src/transaction/mod.rs | 2 +- crates/revm/Cargo.toml | 2 +- crates/scroll/consensus/Cargo.toml | 2 +- crates/scroll/consensus/src/curie.rs | 3 +- crates/scroll/evm/Cargo.toml | 41 +++++++++++++++++++ crates/scroll/{execution => evm}/src/error.rs | 5 ++- .../src/strategy.rs => evm/src/execute.rs} | 5 ++- crates/scroll/evm/src/lib.rs | 8 ++++ crates/scroll/execution/Cargo.toml | 32 +-------------- .../execution/src/{context.rs => finalize.rs} | 5 +-- crates/scroll/execution/src/lib.rs | 14 +------ crates/scroll/storage/Cargo.toml | 1 + 15 files changed, 81 insertions(+), 63 deletions(-) create mode 100644 crates/scroll/evm/Cargo.toml rename crates/scroll/{execution => evm}/src/error.rs (89%) rename crates/scroll/{execution/src/strategy.rs => evm/src/execute.rs} (97%) create mode 100644 crates/scroll/evm/src/lib.rs rename crates/scroll/execution/src/{context.rs => finalize.rs} (93%) diff --git a/Cargo.lock b/Cargo.lock index d4ffa12b0c6a..21972ff1f0ec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9123,11 +9123,11 @@ dependencies = [ name = "reth-scroll-consensus" version = "1.1.2" dependencies = [ - "revm", + "reth-scroll-revm", ] [[package]] -name = "reth-scroll-execution" +name = "reth-scroll-evm" version = "1.1.2" dependencies = [ "alloy-consensus", @@ -9141,14 +9141,20 @@ dependencies = [ "reth-primitives", "reth-revm", "reth-scroll-consensus", - "reth-scroll-primitives", + "reth-scroll-execution", "reth-scroll-revm", - "reth-scroll-storage", - "revm", "thiserror 1.0.69", "tracing", ] +[[package]] +name = "reth-scroll-execution" +version = "1.1.2" +dependencies = [ + "reth-revm", + "reth-scroll-storage", +] + [[package]] name = "reth-scroll-primitives" version = "1.1.2" diff --git a/Cargo.toml b/Cargo.toml index 935e465911a7..9359db577a29 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -101,6 +101,7 @@ members = [ "crates/rpc/rpc-types-compat/", "crates/rpc/rpc/", "crates/scroll/consensus", + "crates/scroll/evm", "crates/scroll/execution", "crates/scroll/primitives", "crates/scroll/revm", @@ -409,6 +410,7 @@ reth-rpc-layer = { path = "crates/rpc/rpc-layer" } reth-rpc-server-types = { path = "crates/rpc/rpc-server-types" } reth-rpc-types-compat = { path = "crates/rpc/rpc-types-compat" } reth-scroll-consensus = { path = "crates/scroll/consensus" } +reth-scroll-evm = { path = "crates/scroll/evm" } reth-scroll-execution = { path = "crates/scroll/execution" } reth-scroll-primitives = { path = "crates/scroll/primitives" } reth-scroll-revm = { path = "crates/scroll/revm" } diff --git a/crates/evm/Cargo.toml b/crates/evm/Cargo.toml index 50ea3b405c36..155e54fa90d7 100644 --- a/crates/evm/Cargo.toml +++ b/crates/evm/Cargo.toml @@ -80,9 +80,3 @@ scroll = [ "reth-execution-types/scroll", "reth-scroll-execution/scroll" ] -scroll = [ - "reth-primitives/scroll", - "reth-primitives-traits/scroll", - "reth-execution-types/scroll", - "reth-chainspec/scroll", -] diff --git a/crates/primitives/src/transaction/mod.rs b/crates/primitives/src/transaction/mod.rs index e3868b9c1c98..5937b6280518 100644 --- a/crates/primitives/src/transaction/mod.rs +++ b/crates/primitives/src/transaction/mod.rs @@ -425,7 +425,7 @@ impl Transaction { /// Returns true if the transaction is a Scroll L1 messaging transaction. #[cfg(all(feature = "scroll", not(feature = "optimism")))] #[inline] - pub fn is_l1_message(&self) -> bool { + pub const fn is_l1_message(&self) -> bool { matches!(self, Self::L1Message(_)) } diff --git a/crates/revm/Cargo.toml b/crates/revm/Cargo.toml index ede5c78f45bf..cf04b11bc003 100644 --- a/crates/revm/Cargo.toml +++ b/crates/revm/Cargo.toml @@ -68,5 +68,5 @@ serde = [ scroll = [ "reth-scroll-primitives", "reth-primitives-traits/scroll", - "reth-trie/scroll" + "reth-trie?/scroll" ] diff --git a/crates/scroll/consensus/Cargo.toml b/crates/scroll/consensus/Cargo.toml index 12f2e3ac5ef4..5ce55aa30ab5 100644 --- a/crates/scroll/consensus/Cargo.toml +++ b/crates/scroll/consensus/Cargo.toml @@ -10,7 +10,7 @@ exclude.workspace = true [dependencies] # revm -revm.workspace = true +revm = { workspace = true, features = ["scroll"] } [lints] workspace = true diff --git a/crates/scroll/consensus/src/curie.rs b/crates/scroll/consensus/src/curie.rs index af78368a490c..4ad457274b32 100644 --- a/crates/scroll/consensus/src/curie.rs +++ b/crates/scroll/consensus/src/curie.rs @@ -1,6 +1,7 @@ use revm::{ db::{states::StorageSlot, StorageWithOriginalValues}, - primitives::{address, bytes, AccountInfo, Address, Bytecode, Bytes, U256}, + primitives::{address, bytes, Address, Bytecode, Bytes, U256}, + shared::AccountInfo, Database, State, }; diff --git a/crates/scroll/evm/Cargo.toml b/crates/scroll/evm/Cargo.toml new file mode 100644 index 000000000000..3f20928a8269 --- /dev/null +++ b/crates/scroll/evm/Cargo.toml @@ -0,0 +1,41 @@ +[package] +name = "reth-scroll-evm" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true +exclude.workspace = true + +[lints] +workspace = true + +[dependencies] +# reth +reth-chainspec = { workspace = true, features = ["scroll"] } +reth-consensus.workspace = true +reth-ethereum-consensus.workspace = true +reth-evm = { workspace = true, features = ["scroll"] } +reth-primitives = { workspace = true, features = ["scroll"] } +reth-revm = { workspace = true, features = ["scroll"] } + +# revm +revm = { workspace = true, features = ["scroll", "optional_no_base_fee"] } + +# alloy +alloy-consensus.workspace = true +alloy-eips.workspace = true + +# scroll +reth-scroll-consensus.workspace = true +reth-scroll-execution = { workspace = true, features = ["scroll"] } + +# misc +auto_impl.workspace = true +derive_more.workspace = true +thiserror.workspace = true +tracing.workspace = true + +[features] +optimism = [] diff --git a/crates/scroll/execution/src/error.rs b/crates/scroll/evm/src/error.rs similarity index 89% rename from crates/scroll/execution/src/error.rs rename to crates/scroll/evm/src/error.rs index 615db5fe7813..b0dfa24c49ca 100644 --- a/crates/scroll/execution/src/error.rs +++ b/crates/scroll/evm/src/error.rs @@ -1,8 +1,9 @@ +use derive_more::{Display, From}; use reth_consensus::ConsensusError; use reth_evm::execute::{BlockExecutionError, BlockValidationError, ProviderError}; /// Execution error for Scroll. -#[derive(thiserror::Error, derive_more::Display, derive_more::From, Debug)] +#[derive(thiserror::Error, Display, From, Debug)] pub enum ScrollBlockExecutionError { /// Error occurred at block execution. BlockExecution(BlockExecutionError), @@ -12,7 +13,7 @@ pub enum ScrollBlockExecutionError { } /// Scroll hard fork error. -#[derive(Debug, derive_more::Display)] +#[derive(Debug, Display)] pub enum HardForkError { /// Error occurred at the Curie hard fork. Curie, diff --git a/crates/scroll/execution/src/strategy.rs b/crates/scroll/evm/src/execute.rs similarity index 97% rename from crates/scroll/execution/src/strategy.rs rename to crates/scroll/evm/src/execute.rs index a51b49fecb46..cee6ce384d7d 100644 --- a/crates/scroll/execution/src/strategy.rs +++ b/crates/scroll/evm/src/execute.rs @@ -14,7 +14,9 @@ use reth_primitives::{ }; use reth_revm::primitives::{CfgEnvWithHandlerCfg, U256}; use reth_scroll_consensus::apply_curie_hard_fork; +use reth_scroll_execution::FinalizeExecution; use revm::{ + db::BundleState, primitives::{BlockEnv, EnvWithHandlerCfg, ResultAndState}, Database, DatabaseCommit, State, }; @@ -54,6 +56,7 @@ where impl BlockExecutionStrategy for ScrollExecutionStrategy where DB: Database + Display>, + State: FinalizeExecution, EvmConfig: ConfigureEvm
, { type Error = ScrollBlockExecutionError; @@ -108,7 +111,7 @@ where // TODO (scroll): verify the logic from the stateless block verifier // https://github.com/scroll-tech/stateless-block-verifier/blob/master/crates/core/src/executor/mod.rs#L71 self.evm_config.fill_tx_env(evm.tx_mut(), transaction, *sender); - if transaction.is_l1_messaging() { + if transaction.is_l1_message() { evm.context.evm.env.cfg.disable_base_fee = true; // disable base fee for l1 msg } diff --git a/crates/scroll/evm/src/lib.rs b/crates/scroll/evm/src/lib.rs new file mode 100644 index 000000000000..bceb0c0d3ec7 --- /dev/null +++ b/crates/scroll/evm/src/lib.rs @@ -0,0 +1,8 @@ +//! Scroll evm execution implementation. +#![cfg(not(feature = "optimism"))] + +pub use error::{HardForkError, ScrollBlockExecutionError}; +mod error; + +pub use execute::ScrollExecutionStrategy; +mod execute; diff --git a/crates/scroll/execution/Cargo.toml b/crates/scroll/execution/Cargo.toml index 0087d773daf6..a333d592778c 100644 --- a/crates/scroll/execution/Cargo.toml +++ b/crates/scroll/execution/Cargo.toml @@ -13,42 +13,14 @@ workspace = true [dependencies] # reth -reth-chainspec.workspace = true -reth-consensus.workspace = true -reth-ethereum-consensus.workspace = true -reth-evm.workspace = true -reth-primitives.workspace = true reth-revm.workspace = true -# revm -revm.workspace = true - -# alloy -alloy-consensus.workspace = true -alloy-eips.workspace = true - # scroll -reth-scroll-consensus.workspace = true -reth-scroll-primitives = { workspace = true, optional = true } -reth-scroll-revm.workspace = true reth-scroll-storage = { workspace = true, optional = true } -# misc -auto_impl.workspace = true -derive_more.workspace = true -thiserror.workspace = true -tracing.workspace = true - [features] scroll = [ - "reth-scroll-primitives", - "reth-scroll-revm/scroll", "reth-scroll-storage/scroll", - "reth-primitives/scroll", - "reth-chainspec/scroll", - "revm/optional_no_base_fee" + "reth-revm/scroll" ] -test-utils = [ - "reth-scroll-revm/test-utils", - "reth-revm/test-utils" -] \ No newline at end of file +test-utils = ["reth-revm/test-utils"] \ No newline at end of file diff --git a/crates/scroll/execution/src/context.rs b/crates/scroll/execution/src/finalize.rs similarity index 93% rename from crates/scroll/execution/src/context.rs rename to crates/scroll/execution/src/finalize.rs index 020aa0a7e318..b9f5e49d3679 100644 --- a/crates/scroll/execution/src/context.rs +++ b/crates/scroll/execution/src/finalize.rs @@ -1,11 +1,10 @@ #![allow(clippy::useless_conversion)] #[cfg(any(not(feature = "scroll"), feature = "test-utils"))] -use reth_revm::{cached::CachedReadsDbMut, revm::CacheDB, DatabaseRef}; use reth_revm::{ - database::{EvmStateProvider, StateProviderDatabase}, - revm::State, + cached::CachedReadsDbMut, database::StateProviderDatabase, revm::CacheDB, DatabaseRef, }; +use reth_revm::{database::EvmStateProvider, revm::State}; #[cfg(feature = "scroll")] use reth_scroll_storage::ScrollStateProviderDatabase; diff --git a/crates/scroll/execution/src/lib.rs b/crates/scroll/execution/src/lib.rs index 9abafa3f5a8a..d787a8c2c7dc 100644 --- a/crates/scroll/execution/src/lib.rs +++ b/crates/scroll/execution/src/lib.rs @@ -1,14 +1,4 @@ //! Scroll execution related implementations. -#![cfg_attr(not(feature = "scroll"), allow(unused_crate_dependencies))] - -pub use context::FinalizeExecution; -mod context; - -#[cfg(feature = "scroll")] -pub use strategy::ScrollExecutionStrategy; -#[cfg(feature = "scroll")] -mod strategy; - -pub use error::{HardForkError, ScrollBlockExecutionError}; -mod error; +pub use finalize::FinalizeExecution; +mod finalize; diff --git a/crates/scroll/storage/Cargo.toml b/crates/scroll/storage/Cargo.toml index 9c5cc3744d55..aad2207902bc 100644 --- a/crates/scroll/storage/Cargo.toml +++ b/crates/scroll/storage/Cargo.toml @@ -33,4 +33,5 @@ reth-revm = { workspace = true, features = ["test-utils"] } scroll = [ "reth-primitives-traits/scroll", "reth-scroll-revm/scroll", + "reth-revm/scroll", ] From 38569b3affedc5a9c1ffba36621d672cbc13195e Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Fri, 29 Nov 2024 09:59:30 +0100 Subject: [PATCH 06/31] improve curie fork application + test Signed-off-by: Gregory Edison --- crates/scroll/consensus/Cargo.toml | 7 +- crates/scroll/consensus/src/curie.rs | 148 +++++++++++++++++++++------ 2 files changed, 122 insertions(+), 33 deletions(-) diff --git a/crates/scroll/consensus/Cargo.toml b/crates/scroll/consensus/Cargo.toml index 5ce55aa30ab5..aed40406f1a2 100644 --- a/crates/scroll/consensus/Cargo.toml +++ b/crates/scroll/consensus/Cargo.toml @@ -8,9 +8,12 @@ homepage.workspace = true repository.workspace = true exclude.workspace = true +[lints] +workspace = true + [dependencies] # revm revm = { workspace = true, features = ["scroll"] } -[lints] -workspace = true +[dev-dependencies] +eyre.workspace = true diff --git a/crates/scroll/consensus/src/curie.rs b/crates/scroll/consensus/src/curie.rs index 4ad457274b32..a816b8c94d6e 100644 --- a/crates/scroll/consensus/src/curie.rs +++ b/crates/scroll/consensus/src/curie.rs @@ -1,5 +1,5 @@ use revm::{ - db::{states::StorageSlot, StorageWithOriginalValues}, + db::states::StorageSlot, primitives::{address, bytes, Address, Bytecode, Bytes, U256}, shared::AccountInfo, Database, State, @@ -27,48 +27,134 @@ const IS_CURIE: U256 = U256::from_limbs([1, 0, 0, 0]); pub fn apply_curie_hard_fork(state: &mut State) -> Result<(), DB::Error> { let oracle = state.load_cache_account(L1_GAS_PRICE_ORACLE_ADDRESS)?; - // get old oracle account balance and nonce - let (old_balance, old_nonce) = - oracle.account.as_ref().map(|acc| (acc.info.balance, acc.info.nonce)).unwrap_or_default(); - // compute the code hash let bytecode = Bytecode::new_raw(CURIE_L1_GAS_PRICE_ORACLE_BYTECODE); + let bytecode_len = bytecode.len(); let code_hash = bytecode.hash_slow(); + let poseidon_code_hash = bytecode.poseidon_hash_slow(); + + // get the old oracle account info + let old_oracle_info = oracle.account_info().unwrap_or_default(); // init new oracle account information - let new_oracle_info = - AccountInfo { balance: old_balance, nonce: old_nonce, code_hash, code: Some(bytecode) }; - - // create `StorageWithOriginalValues` mapping for oracle - let storage = oracle - .account - .as_ref() - .map(|acc| { - let mut storage_with_original_values = StorageWithOriginalValues::default(); - for (slot, new_storage_value) in CURIE_L1_GAS_PRICE_ORACLE_STORAGE { - storage_with_original_values.insert( - slot, - StorageSlot { - previous_or_original_value: acc - .storage - .get(&slot) - .copied() - .unwrap_or_default(), - present_value: new_storage_value, - }, - ); - } - storage_with_original_values + let new_oracle_info = AccountInfo { + code_size: bytecode_len, + code_hash, + poseidon_code_hash, + code: Some(bytecode), + ..old_oracle_info + }; + + // init new storage + let new_storage = CURIE_L1_GAS_PRICE_ORACLE_STORAGE + .into_iter() + .map(|(slot, present_value)| { + ( + slot, + StorageSlot { + present_value, + previous_or_original_value: oracle.storage_slot(slot).unwrap_or_default(), + }, + ) }) - .unwrap_or_default(); + .collect(); // create transition for oracle new account info and storage - let transition = oracle.change(new_oracle_info, storage); + let transition = oracle.change(new_oracle_info, new_storage); - // append transition + // add transition if let Some(s) = state.transition_state.as_mut() { s.add_transitions(vec![(L1_GAS_PRICE_ORACLE_ADDRESS, transition)]) } Ok(()) } + +#[cfg(test)] +mod tests { + use crate::{ + apply_curie_hard_fork, + curie::{ + CURIE_L1_GAS_PRICE_ORACLE_BYTECODE, CURIE_L1_GAS_PRICE_ORACLE_STORAGE, + L1_GAS_PRICE_ORACLE_ADDRESS, + }, + }; + use revm::{ + db::states::{bundle_state::BundleRetention, plain_account::PlainStorage, StorageSlot}, + keccak256, + primitives::{bytes, poseidon, U256}, + shared::AccountInfo, + Bytecode, Database, EmptyDB, State, + }; + use std::str::FromStr; + + #[test] + fn test_apply_curie_fork() -> eyre::Result<()> { + // init state + let db = EmptyDB::new(); + let mut state = + State::builder().with_database(db).with_bundle_update().without_state_clear().build(); + + // oracle pre fork state + let bytecode_pre_fork = Bytecode::new_raw( bytes!("608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063715018a61161008c578063bede39b511610066578063bede39b51461018d578063de26c4a1146101a0578063f2fde38b146101b3578063f45e65d8146101c657600080fd5b8063715018a6146101475780638da5cb5b1461014f57806393e59dc11461017a57600080fd5b80630c18c162146100d45780633577afc5146100f05780633d0f963e1461010557806349948e0e14610118578063519b4bd31461012b5780637046559714610134575b600080fd5b6100dd60025481565b6040519081526020015b60405180910390f35b6101036100fe366004610671565b6101cf565b005b61010361011336600461068a565b610291565b6100dd6101263660046106d0565b61031c565b6100dd60015481565b610103610142366004610671565b610361565b610103610416565b600054610162906001600160a01b031681565b6040516001600160a01b0390911681526020016100e7565b600454610162906001600160a01b031681565b61010361019b366004610671565b61044c565b6100dd6101ae3660046106d0565b610533565b6101036101c136600461068a565b610595565b6100dd60035481565b6000546001600160a01b031633146102025760405162461bcd60e51b81526004016101f990610781565b60405180910390fd5b621c9c388111156102555760405162461bcd60e51b815260206004820152601760248201527f657863656564206d6178696d756d206f7665726865616400000000000000000060448201526064016101f9565b60028190556040518181527f32740b35c0ea213650f60d44366b4fb211c9033b50714e4a1d34e65d5beb9bb4906020015b60405180910390a150565b6000546001600160a01b031633146102bb5760405162461bcd60e51b81526004016101f990610781565b600480546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f22d1c35fe072d2e42c3c8f9bd4a0d34aa84a0101d020a62517b33fdb3174e5f7910160405180910390a15050565b60008061032883610533565b905060006001548261033a91906107b8565b9050633b9aca006003548261034f91906107b8565b61035991906107e5565b949350505050565b6000546001600160a01b0316331461038b5760405162461bcd60e51b81526004016101f990610781565b61039b633b9aca006103e86107b8565b8111156103e15760405162461bcd60e51b8152602060048201526014602482015273657863656564206d6178696d756d207363616c6560601b60448201526064016101f9565b60038190556040518181527f3336cd9708eaf2769a0f0dc0679f30e80f15dcd88d1921b5a16858e8b85c591a90602001610286565b6000546001600160a01b031633146104405760405162461bcd60e51b81526004016101f990610781565b61044a6000610621565b565b6004805460405163efc7840160e01b815233928101929092526001600160a01b03169063efc7840190602401602060405180830381865afa158015610495573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b99190610807565b6104fe5760405162461bcd60e51b81526020600482015260166024820152752737ba103bb434ba32b634b9ba32b21039b2b73232b960511b60448201526064016101f9565b60018190556040518181527f351fb23757bb5ea0546c85b7996ddd7155f96b939ebaa5ff7bc49c75f27f2c4490602001610286565b80516000908190815b818110156105865784818151811061055657610556610829565b01602001516001600160f81b0319166000036105775760048301925061057e565b6010830192505b60010161053c565b50506002540160400192915050565b6000546001600160a01b031633146105bf5760405162461bcd60e51b81526004016101f990610781565b6001600160a01b0381166106155760405162461bcd60e51b815260206004820152601d60248201527f6e6577206f776e657220697320746865207a65726f206164647265737300000060448201526064016101f9565b61061e81610621565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561068357600080fd5b5035919050565b60006020828403121561069c57600080fd5b81356001600160a01b03811681146106b357600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156106e257600080fd5b813567ffffffffffffffff808211156106fa57600080fd5b818401915084601f83011261070e57600080fd5b813581811115610720576107206106ba565b604051601f8201601f19908116603f01168101908382118183101715610748576107486106ba565b8160405282815287602084870101111561076157600080fd5b826020860160208301376000928101602001929092525095945050505050565b60208082526017908201527f63616c6c6572206973206e6f7420746865206f776e6572000000000000000000604082015260600190565b60008160001904831182151516156107e057634e487b7160e01b600052601160045260246000fd5b500290565b60008261080257634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561081957600080fd5b815180151581146106b357600080fd5b634e487b7160e01b600052603260045260246000fdfea26469706673582212205ea335809638809cf032c794fd966e2439020737b1dcc2218435cb438286efcf64736f6c63430008100033")); + let oracle_pre_fork = AccountInfo { + code_size: bytecode_pre_fork.len(), + code_hash: bytecode_pre_fork.hash_slow(), + poseidon_code_hash: bytecode_pre_fork.poseidon_hash_slow(), + code: Some(bytecode_pre_fork), + ..Default::default() + }; + let oracle_storage_pre_fork = PlainStorage::from_iter([ + (U256::ZERO, U256::from_str("0x13d24a7ff6f5ec5ff0e9c40fc3b8c9c01c65437b")?), + (U256::from(1), U256::from(0x15f50e5e)), + (U256::from(2), U256::from(0x38)), + (U256::from(3), U256::from(0x3e95ba80)), + (U256::from(4), U256::from_str("0x5300000000000000000000000000000000000003")?), + ]); + state.insert_account_with_storage( + L1_GAS_PRICE_ORACLE_ADDRESS, + oracle_pre_fork.clone(), + oracle_storage_pre_fork.clone(), + ); + + // apply curie fork + apply_curie_hard_fork(&mut state)?; + + // merge transitions + state.merge_transitions(BundleRetention::Reverts); + let bundle = state.take_bundle(); + + // check oracle account info + let oracle = bundle.state.get(&L1_GAS_PRICE_ORACLE_ADDRESS).unwrap().clone(); + let code_hash = keccak256(&CURIE_L1_GAS_PRICE_ORACLE_BYTECODE); + let bytecode = Bytecode::new_raw(CURIE_L1_GAS_PRICE_ORACLE_BYTECODE); + let expected_oracle_info = AccountInfo { + code_size: CURIE_L1_GAS_PRICE_ORACLE_BYTECODE.len(), + code_hash, + poseidon_code_hash: poseidon(&CURIE_L1_GAS_PRICE_ORACLE_BYTECODE), + code: Some(bytecode.clone()), + ..Default::default() + }; + + assert_eq!(oracle.original_info.unwrap(), oracle_pre_fork); + assert_eq!(oracle.info.unwrap(), expected_oracle_info); + + // check oracle storage changeset + let mut storage = oracle.storage.into_iter().collect::>(); + storage.sort_by(|(a, _), (b, _)| a.cmp(b)); + for (got, expected) in storage.into_iter().zip(CURIE_L1_GAS_PRICE_ORACLE_STORAGE) { + assert_eq!(got.0, expected.0); + assert_eq!(got.1, StorageSlot { present_value: expected.1, ..Default::default() }); + } + + // check oracle original storage + for (slot, value) in oracle_storage_pre_fork { + assert_eq!(state.storage(L1_GAS_PRICE_ORACLE_ADDRESS, slot)?, value) + } + + // check deployed contract + assert_eq!(bundle.contracts.get(&code_hash).unwrap().clone(), bytecode); + + Ok(()) + } +} From f431ef15f482627ed95db8333f6be5dc94569930 Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Fri, 29 Nov 2024 10:08:00 +0100 Subject: [PATCH 07/31] integrate l1 fee Signed-off-by: Gregory Edison --- crates/scroll/evm/src/error.rs | 13 +++++++++ crates/scroll/evm/src/execute.rs | 46 ++++++++++++++++++++++---------- 2 files changed, 45 insertions(+), 14 deletions(-) diff --git a/crates/scroll/evm/src/error.rs b/crates/scroll/evm/src/error.rs index b0dfa24c49ca..1a9e8786b024 100644 --- a/crates/scroll/evm/src/error.rs +++ b/crates/scroll/evm/src/error.rs @@ -10,6 +10,19 @@ pub enum ScrollBlockExecutionError { /// Error occurred at a hard fork. #[display("failed to apply hard fork: {_0}")] HardFork(HardForkError), + /// Error occurred at L1 fee computation. + #[display("failed to compute l1 fee: {reason}")] + L1FeeComputation { + /// The reason for the fee computation error. + reason: &'static str, + }, +} + +impl ScrollBlockExecutionError { + /// Returns a [`ScrollBlockExecutionError`] with the `L1FeeComputation` variant. + pub const fn l1_fee(reason: &'static str) -> Self { + Self::L1FeeComputation { reason } + } } /// Scroll hard fork error. diff --git a/crates/scroll/evm/src/execute.rs b/crates/scroll/evm/src/execute.rs index cee6ce384d7d..64f9e54d1e61 100644 --- a/crates/scroll/evm/src/execute.rs +++ b/crates/scroll/evm/src/execute.rs @@ -2,7 +2,7 @@ use crate::{HardForkError, ScrollBlockExecutionError}; use alloy_consensus::{Header, Transaction}; -use alloy_eips::eip7685::Requests; +use alloy_eips::{eip2718::Encodable2718, eip7685::Requests}; use reth_chainspec::{ChainSpec, EthereumHardfork, EthereumHardforks}; use reth_consensus::ConsensusError; use reth_evm::{ @@ -17,7 +17,7 @@ use reth_scroll_consensus::apply_curie_hard_fork; use reth_scroll_execution::FinalizeExecution; use revm::{ db::BundleState, - primitives::{BlockEnv, EnvWithHandlerCfg, ResultAndState}, + primitives::{bytes::BytesMut, BlockEnv, EnvWithHandlerCfg, ResultAndState}, Database, DatabaseCommit, State, }; use std::fmt::{Debug, Display}; @@ -29,12 +29,19 @@ pub struct ScrollExecutionStrategy { chain_spec: ChainSpec, /// Evm configuration. // TODO (scroll): EvmConfig should set the correct coinbase in `fill_block_env`. - // TODO (scroll): Should we have a ScrollConfig? + // TODO (scroll): EvmConfig should use the `Scroll` evm handler from revm. evm_config: EvmConfig, /// Current state for the execution. state: State, } +impl ScrollExecutionStrategy { + /// Returns an instance of [`ScrollExecutionStrategy`]. + pub const fn new(chain_spec: ChainSpec, evm_config: EvmConfig, state: State) -> Self { + Self { chain_spec, evm_config, state } + } +} + impl ScrollExecutionStrategy where EvmConfig: ConfigureEvmEnv
, @@ -108,13 +115,19 @@ where .into()) } - // TODO (scroll): verify the logic from the stateless block verifier - // https://github.com/scroll-tech/stateless-block-verifier/blob/master/crates/core/src/executor/mod.rs#L71 self.evm_config.fill_tx_env(evm.tx_mut(), transaction, *sender); if transaction.is_l1_message() { evm.context.evm.env.cfg.disable_base_fee = true; // disable base fee for l1 msg } + // RLP encode the transaction following eip 2718 + let mut buf = BytesMut::with_capacity(transaction.encode_2718_len()); + transaction.encode_2718(&mut buf); + let transaction_rlp_bytes = buf.freeze(); + evm.context.evm.env.tx.scroll.rlp_bytes = Some(transaction_rlp_bytes.into()); + evm.context.evm.env.tx.scroll.is_l1_msg = transaction.is_l1_message(); + + // execute the transaction and commit the result to the database let ResultAndState { result, state } = evm.transact().map_err(|err| BlockValidationError::EVM { hash: transaction.recalculate_hash(), @@ -123,15 +136,20 @@ where evm.db_mut().commit(state); - // TODO (scroll): uncomment once we have the scroll/revm fork integrated - let l1_fee = U256::ZERO; - // if !transaction.is_l1_msg() { - // let mut rlp_bytes = BytesMut::new(); - // transaction.eip2718_encode(&mut rlp_bytes, transaction.signature()); - // let l1_block_info = - // evm.context.evm.inner.l1_block_info.as_ref().expect("l1 block info exists"); - // l1_fee = l1_block_info.calculate_tx_l1_cost(rlp_bytes, evm.handler.cfg.spec_id); - // } + let l1_fee = if transaction.is_l1_message() { + U256::ZERO + } else { + // compute l1 fee for all non-l1 transaction + let l1_block_info = + evm.context.evm.inner.l1_block_info.as_ref().ok_or_else(|| { + ScrollBlockExecutionError::l1_fee("missing l1 block info") + })?; + let transaction_rlp_bytes = + evm.context.evm.env.tx.scroll.rlp_bytes.as_ref().ok_or_else(|| { + ScrollBlockExecutionError::l1_fee("missing transaction rlp bytes") + })?; + l1_block_info.calculate_tx_l1_cost(transaction_rlp_bytes, evm.handler.cfg.spec_id) + }; cumulative_gas_used += result.gas_used(); From 86945bdf4ebd7834b4c1010ccda2a38289d13251 Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Sat, 30 Nov 2024 10:24:08 +0100 Subject: [PATCH 08/31] add `ScrollEvmConfig` Signed-off-by: Gregory Edison --- crates/scroll/evm/Cargo.toml | 4 + crates/scroll/evm/src/config.rs | 169 +++++++++++++++++++++++++++++++ crates/scroll/evm/src/execute.rs | 2 - crates/scroll/evm/src/lib.rs | 3 + 4 files changed, 176 insertions(+), 2 deletions(-) create mode 100644 crates/scroll/evm/src/config.rs diff --git a/crates/scroll/evm/Cargo.toml b/crates/scroll/evm/Cargo.toml index 3f20928a8269..132808293f1b 100644 --- a/crates/scroll/evm/Cargo.toml +++ b/crates/scroll/evm/Cargo.toml @@ -18,6 +18,7 @@ reth-consensus.workspace = true reth-ethereum-consensus.workspace = true reth-evm = { workspace = true, features = ["scroll"] } reth-primitives = { workspace = true, features = ["scroll"] } +reth-primitives-traits = { workspace = true, features = ["scroll"] } reth-revm = { workspace = true, features = ["scroll"] } # revm @@ -37,5 +38,8 @@ derive_more.workspace = true thiserror.workspace = true tracing.workspace = true +[dev-dependencies] +eyre.workspace = true + [features] optimism = [] diff --git a/crates/scroll/evm/src/config.rs b/crates/scroll/evm/src/config.rs new file mode 100644 index 000000000000..eef182aa52c0 --- /dev/null +++ b/crates/scroll/evm/src/config.rs @@ -0,0 +1,169 @@ +use reth_chainspec::{ChainSpec, Head}; +use reth_evm::{ConfigureEvm, ConfigureEvmEnv, NextBlockEnvAttributes}; +use reth_primitives::TransactionSigned; +use reth_primitives_traits::FillTxEnv; +use reth_revm::{inspector_handle_register, Database, Evm, GetInspector, TxEnv}; +use revm::{ + precompile::{Address, Bytes}, + primitives::{ + AnalysisKind, BlockEnv, CfgEnv, CfgEnvWithHandlerCfg, Env, HandlerCfg, SpecId, U256, + }, + EvmBuilder, +}; +use std::{convert::Infallible, sync::Arc}; + +/// Scroll EVM configuration. +#[derive(Clone, Debug)] +pub struct ScrollEvmConfig { + /// The chain spec for Scroll. + // TODO (scroll): update to ScrollChainSpec. + chain_spec: Arc, +} + +impl ScrollEvmConfig { + /// Returns a new instance of [`ScrollEvmConfig`]. + pub fn new(chain_spec: Arc) -> Self { + Self { chain_spec } + } + + /// Returns the spec id at the given head. + pub fn spec_id_at_head(&self, _head: &Head) -> SpecId { + // TODO (scroll): uncomment once the Scroll chain spec is available + // let chain_spec = &self.chain_spec; + // if chain_spec.fork(ScrollHardfork::Euclid).active_at_head(head) { + // SpecId::EUCLID + // } else if chain_spec.fork(ScrollHardfork::Curie).active_at_head(head) { + // SpecId::CURIE + // } else if chain_spec.fork(ScrollHardfork::Bernouilli).active_at_head(head) { + // SpecId::BERNOULLI + // } else { + // SpecId::PRE_BERNOULLI + // } + SpecId::PRE_BERNOULLI + } +} + +impl ConfigureEvm for ScrollEvmConfig { + type DefaultExternalContext<'a> = (); + + fn evm(&self, db: DB) -> Evm<'_, Self::DefaultExternalContext<'_>, DB> { + EvmBuilder::default().with_db(db).scroll().build() + } + + fn evm_with_inspector(&self, db: DB, inspector: I) -> Evm<'_, I, DB> + where + DB: Database, + I: GetInspector, + { + EvmBuilder::default() + .with_db(db) + .with_external_context(inspector) + .scroll() + .append_handler_register(inspector_handle_register) + .build() + } + + fn default_external_context<'a>(&self) -> Self::DefaultExternalContext<'a> {} +} + +impl ConfigureEvmEnv for ScrollEvmConfig { + type Header = alloy_consensus::Header; + type Error = Infallible; + + fn fill_tx_env(&self, tx_env: &mut TxEnv, transaction: &TransactionSigned, sender: Address) { + transaction.fill_tx_env(tx_env, sender); + } + + fn fill_tx_env_system_contract_call( + &self, + _env: &mut Env, + _caller: Address, + _contract: Address, + _data: Bytes, + ) { + /* noop */ + } + + fn fill_cfg_env( + &self, + cfg_env: &mut CfgEnvWithHandlerCfg, + header: &Self::Header, + total_difficulty: U256, + ) { + let spec_id = self.spec_id_at_head(&Head { + number: header.number, + timestamp: header.timestamp, + difficulty: header.difficulty, + total_difficulty, + ..Default::default() + }); + + cfg_env.handler_cfg.spec_id = spec_id; + cfg_env.handler_cfg.is_scroll = true; + + cfg_env.chain_id = self.chain_spec.chain().id(); + cfg_env.perf_analyse_created_bytecodes = AnalysisKind::Analyse; + } + + fn fill_block_env(&self, block_env: &mut BlockEnv, header: &Self::Header, after_merge: bool) { + block_env.number = U256::from(header.number); + block_env.coinbase = header.beneficiary; + // TODO (scroll): uncomment once the Scroll chain spec is available + // if let Some(vault_address) = self.chain_spec.fee_vault_address { + // block_env.coinbase = vault_address; + // } + block_env.timestamp = U256::from(header.timestamp); + if after_merge { + block_env.prevrandao = Some(header.mix_hash); + block_env.difficulty = U256::ZERO; + } else { + block_env.difficulty = header.difficulty; + block_env.prevrandao = None; + } + block_env.basefee = U256::from(header.base_fee_per_gas.unwrap_or_default()); + block_env.gas_limit = U256::from(header.gas_limit); + } + + fn next_cfg_and_block_env( + &self, + parent: &Self::Header, + attributes: NextBlockEnvAttributes, + ) -> Result<(CfgEnvWithHandlerCfg, BlockEnv), Self::Error> { + // configure evm env based on parent block + let cfg = CfgEnv::default().with_chain_id(self.chain_spec.chain().id()); + + // fetch spec id from next head number and timestamp + let spec_id = self.spec_id_at_head(&Head { + number: parent.number + 1, + timestamp: attributes.timestamp, + ..Default::default() + }); + + let coinbase = attributes.suggested_fee_recipient; + // TODO (scroll): uncomment once the Scroll chain spec is available + // if let Some(vault_address) = self.chain_spec.fee_vault_address { + // block_env.coinbase = vault_address; + // } + + let block_env = BlockEnv { + number: U256::from(parent.number + 1), + coinbase, + timestamp: U256::from(attributes.timestamp), + difficulty: U256::ZERO, + prevrandao: Some(attributes.prev_randao), + gas_limit: U256::from(parent.gas_limit), + // calculate basefee based on parent block's gas usage + basefee: U256::ZERO, + // TODO (scroll): uncomment once the Scroll chain spec is available + // self.chain_spec.next_block_base_fee(parent, attributes.timestamp)?, + blob_excess_gas_and_price: None, + }; + + let cfg_with_handler_cfg = CfgEnvWithHandlerCfg { + cfg_env: cfg, + handler_cfg: HandlerCfg { spec_id, is_scroll: true }, + }; + + Ok((cfg_with_handler_cfg, block_env)) + } +} diff --git a/crates/scroll/evm/src/execute.rs b/crates/scroll/evm/src/execute.rs index 64f9e54d1e61..c4e01b70f75f 100644 --- a/crates/scroll/evm/src/execute.rs +++ b/crates/scroll/evm/src/execute.rs @@ -28,8 +28,6 @@ pub struct ScrollExecutionStrategy { /// Chain specification. chain_spec: ChainSpec, /// Evm configuration. - // TODO (scroll): EvmConfig should set the correct coinbase in `fill_block_env`. - // TODO (scroll): EvmConfig should use the `Scroll` evm handler from revm. evm_config: EvmConfig, /// Current state for the execution. state: State, diff --git a/crates/scroll/evm/src/lib.rs b/crates/scroll/evm/src/lib.rs index bceb0c0d3ec7..5e734d9d7a04 100644 --- a/crates/scroll/evm/src/lib.rs +++ b/crates/scroll/evm/src/lib.rs @@ -1,6 +1,9 @@ //! Scroll evm execution implementation. #![cfg(not(feature = "optimism"))] +pub use config::ScrollEvmConfig; +mod config; + pub use error::{HardForkError, ScrollBlockExecutionError}; mod error; From 63c1986c548067a2cc696fcf1e394af969c28196 Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Sat, 30 Nov 2024 10:24:42 +0100 Subject: [PATCH 09/31] add tests for `ScrollEvmConfig` Signed-off-by: Gregory Edison --- crates/scroll/evm/src/config.rs | 171 ++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) diff --git a/crates/scroll/evm/src/config.rs b/crates/scroll/evm/src/config.rs index eef182aa52c0..24318e88c06b 100644 --- a/crates/scroll/evm/src/config.rs +++ b/crates/scroll/evm/src/config.rs @@ -167,3 +167,174 @@ impl ConfigureEvmEnv for ScrollEvmConfig { Ok((cfg_with_handler_cfg, block_env)) } } + +#[cfg(test)] +mod tests { + use super::*; + use alloy_consensus::Header; + use reth_chainspec::NamedChain::Scroll; + use revm::primitives::{address, SpecId, B256}; + + #[test] + fn test_spec_at_head() { + // TODO (scroll): change this to `ScrollChainSpecBuilder::mainnet()`. + let config = ScrollEvmConfig::new(ChainSpec::default().into()); + + // prepare all fork heads + let euclid_head = &Head { number: u64::MAX, ..Default::default() }; + let curie_head = &Head { number: 7096836, ..Default::default() }; + let bernouilli_head = &Head { number: 5220340, ..Default::default() }; + let pre_bernouilli_head = &Head { number: 0, ..Default::default() }; + + // check correct spec id + assert_eq!(config.spec_id_at_head(euclid_head), SpecId::EUCLID); + assert_eq!(config.spec_id_at_head(curie_head), SpecId::CURIE); + assert_eq!(config.spec_id_at_head(bernouilli_head), SpecId::BERNOULLI); + assert_eq!(config.spec_id_at_head(pre_bernouilli_head), SpecId::PRE_BERNOULLI); + } + + #[test] + fn test_fill_cfg_env() { + // TODO (scroll): change this to `ScrollChainSpecBuilder::mainnet()`. + let config = ScrollEvmConfig::new(ChainSpec::default().into()); + + // euclid header + let mut cfg_env = CfgEnvWithHandlerCfg::new(Default::default(), Default::default()); + let euclid_header = Header { number: u64::MAX, ..Default::default() }; + + // fill cfg env + config.fill_cfg_env(&mut cfg_env, &euclid_header, U256::ZERO); + + // check correct cfg env + assert_eq!(cfg_env.chain_id, Scroll as u64); + assert_eq!(cfg_env.perf_analyse_created_bytecodes, AnalysisKind::Analyse); + assert_eq!(cfg_env.handler_cfg.spec_id, SpecId::EUCLID); + assert!(cfg_env.handler_cfg.is_scroll); + + // curie + let mut cfg_env = CfgEnvWithHandlerCfg::new(Default::default(), Default::default()); + let curie_header = Header { number: 7096836, ..Default::default() }; + + // fill cfg env + config.fill_cfg_env(&mut cfg_env, &curie_header, U256::ZERO); + + // check correct cfg env + assert_eq!(cfg_env.chain_id, Scroll as u64); + assert_eq!(cfg_env.perf_analyse_created_bytecodes, AnalysisKind::Analyse); + assert_eq!(cfg_env.handler_cfg.spec_id, SpecId::CURIE); + assert!(cfg_env.handler_cfg.is_scroll); + + // bernouilli + let mut cfg_env = CfgEnvWithHandlerCfg::new(Default::default(), Default::default()); + let bernouilli_header = Header { number: 5220340, ..Default::default() }; + + // fill cfg env + config.fill_cfg_env(&mut cfg_env, &bernouilli_header, U256::ZERO); + + // check correct cfg env + assert_eq!(cfg_env.chain_id, Scroll as u64); + assert_eq!(cfg_env.perf_analyse_created_bytecodes, AnalysisKind::Analyse); + assert_eq!(cfg_env.handler_cfg.spec_id, SpecId::BERNOULLI); + assert!(cfg_env.handler_cfg.is_scroll); + + // pre-bernouilli + let mut cfg_env = CfgEnvWithHandlerCfg::new(Default::default(), Default::default()); + let pre_bernouilli_header = Header { number: 0, ..Default::default() }; + + // fill cfg env + config.fill_cfg_env(&mut cfg_env, &pre_bernouilli_header, U256::ZERO); + + // check correct cfg env + assert_eq!(cfg_env.chain_id, Scroll as u64); + assert_eq!(cfg_env.perf_analyse_created_bytecodes, AnalysisKind::Analyse); + assert_eq!(cfg_env.handler_cfg.spec_id, SpecId::PRE_BERNOULLI); + assert!(cfg_env.handler_cfg.is_scroll); + } + + #[test] + fn test_fill_block_env() { + // TODO (scroll): change this to `ScrollChainSpecBuilder::mainnet()`. + let config = ScrollEvmConfig::new(ChainSpec::default().into()); + let mut block_env = BlockEnv::default(); + + // curie header + let header = Header { + number: 7096836, + beneficiary: Address::random(), + timestamp: 1719994277, + mix_hash: B256::random(), + base_fee_per_gas: Some(155157341), + gas_limit: 10000000, + ..Default::default() + }; + + // fill block env + config.fill_block_env(&mut block_env, &header, true); + + // verify block env correctly updated + // TODO (scroll): replace with `config.chain_spec.fee_vault_address.unwrap()` + const FEE_VAULT_ADDRESS: Address = address!("5300000000000000000000000000000000000005"); + let expected = BlockEnv { + number: U256::from(header.number), + coinbase: FEE_VAULT_ADDRESS, + timestamp: U256::from(header.timestamp), + prevrandao: Some(header.mix_hash), + difficulty: U256::ZERO, + basefee: U256::from(header.base_fee_per_gas.unwrap_or_default()), + gas_limit: U256::from(header.gas_limit), + ..Default::default() + }; + assert_eq!(block_env, expected) + } + + #[test] + fn test_next_cfg_and_block_env() -> eyre::Result<()> { + // TODO (scroll): change this to `ScrollChainSpecBuilder::mainnet()`. + let config = ScrollEvmConfig::new(ChainSpec::default().into()); + + // pre curie header + let header = Header { + number: 7096835, + beneficiary: Address::random(), + timestamp: 1719994274, + mix_hash: B256::random(), + base_fee_per_gas: None, + gas_limit: 10000000, + ..Default::default() + }; + + // curie block attributes + let attributes = NextBlockEnvAttributes { + timestamp: 1719994277, + suggested_fee_recipient: Address::random(), + prev_randao: B256::random(), + }; + + // get next cfg env and block env + let (cfg_env, block_env) = config.next_cfg_and_block_env(&header, attributes)?; + + // verify cfg env + assert_eq!(cfg_env.chain_id, Scroll as u64); + assert_eq!(cfg_env.handler_cfg.spec_id, SpecId::CURIE); + assert!(cfg_env.handler_cfg.is_scroll); + + // verify block env + // TODO (scroll): replace with `config.chain_spec.fee_vault_address.unwrap()` + const FEE_VAULT_ADDRESS: Address = address!("5300000000000000000000000000000000000005"); + let expected = BlockEnv { + number: U256::from(header.number + 1), + coinbase: FEE_VAULT_ADDRESS, + timestamp: U256::from(attributes.timestamp), + prevrandao: Some(attributes.prev_randao), + difficulty: U256::ZERO, + // TODO (scroll): update once the Scroll chain spec is available + // TODO (scroll): this shouldn't be 0 at curie fork + basefee: U256::ZERO, + gas_limit: U256::from(header.gas_limit), + ..Default::default() + }; + assert_eq!(block_env, expected); + + Ok(()) + } +} From f828ab410d48aceba130d003a1e85b34560af071 Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Sat, 30 Nov 2024 13:53:13 +0100 Subject: [PATCH 10/31] add tests for `ScrollExecutionStrategy` Signed-off-by: Gregory Edison --- crates/scroll/consensus/src/curie.rs | 10 +- crates/scroll/consensus/src/lib.rs | 5 +- crates/scroll/evm/Cargo.toml | 1 + crates/scroll/evm/src/execute.rs | 184 +++++++++++++++++++++++- crates/scroll/execution/src/finalize.rs | 11 +- 5 files changed, 203 insertions(+), 8 deletions(-) diff --git a/crates/scroll/consensus/src/curie.rs b/crates/scroll/consensus/src/curie.rs index a816b8c94d6e..6a9cc714e175 100644 --- a/crates/scroll/consensus/src/curie.rs +++ b/crates/scroll/consensus/src/curie.rs @@ -5,9 +5,13 @@ use revm::{ Database, State, }; -const L1_GAS_PRICE_ORACLE_ADDRESS: Address = address!("5300000000000000000000000000000000000002"); -const CURIE_L1_GAS_PRICE_ORACLE_BYTECODE: Bytes = bytes!("608060405234801561000f575f80fd5b5060043610610132575f3560e01c8063715018a6116100b4578063a911d77f11610079578063a911d77f1461024c578063bede39b514610254578063de26c4a114610267578063e88a60ad1461027a578063f2fde38b1461028d578063f45e65d8146102a0575f80fd5b8063715018a6146101eb57806384189161146101f35780638da5cb5b146101fc57806393e59dc114610226578063944b247f14610239575f80fd5b80633d0f963e116100fa5780633d0f963e146101a057806349948e0e146101b3578063519b4bd3146101c65780636a5e67e5146101cf57806370465597146101d8575f80fd5b80630c18c1621461013657806313dad5be1461015257806323e524ac1461016f5780633577afc51461017857806339455d3a1461018d575b5f80fd5b61013f60025481565b6040519081526020015b60405180910390f35b60085461015f9060ff1681565b6040519015158152602001610149565b61013f60065481565b61018b6101863660046109b3565b6102a9565b005b61018b61019b3660046109ca565b61033b565b61018b6101ae3660046109ea565b610438565b61013f6101c1366004610a2b565b6104bb565b61013f60015481565b61013f60075481565b61018b6101e63660046109b3565b6104e0565b61018b61056e565b61013f60055481565b5f5461020e906001600160a01b031681565b6040516001600160a01b039091168152602001610149565b60045461020e906001600160a01b031681565b61018b6102473660046109b3565b6105a2565b61018b61062e565b61018b6102623660046109b3565b61068a565b61013f610275366004610a2b565b610747565b61018b6102883660046109b3565b610764565b61018b61029b3660046109ea565b6107f0565b61013f60035481565b5f546001600160a01b031633146102db5760405162461bcd60e51b81526004016102d290610ad6565b60405180910390fd5b621c9c388111156102ff57604051635742c80560e11b815260040160405180910390fd5b60028190556040518181527f32740b35c0ea213650f60d44366b4fb211c9033b50714e4a1d34e65d5beb9bb4906020015b60405180910390a150565b6004805460405163efc7840160e01b815233928101929092526001600160a01b03169063efc7840190602401602060405180830381865afa158015610382573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103a69190610b0d565b6103c3576040516326b3506d60e11b815260040160405180910390fd5b600182905560058190556040518281527f351fb23757bb5ea0546c85b7996ddd7155f96b939ebaa5ff7bc49c75f27f2c449060200160405180910390a16040518181527f9a14bfb5d18c4c3cf14cae19c23d7cf1bcede357ea40ca1f75cd49542c71c214906020015b60405180910390a15050565b5f546001600160a01b031633146104615760405162461bcd60e51b81526004016102d290610ad6565b600480546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f22d1c35fe072d2e42c3c8f9bd4a0d34aa84a0101d020a62517b33fdb3174e5f7910161042c565b6008545f9060ff16156104d7576104d18261087b565b92915050565b6104d1826108c1565b5f546001600160a01b031633146105095760405162461bcd60e51b81526004016102d290610ad6565b610519633b9aca006103e8610b40565b81111561053957604051631e44fdeb60e11b815260040160405180910390fd5b60038190556040518181527f3336cd9708eaf2769a0f0dc0679f30e80f15dcd88d1921b5a16858e8b85c591a90602001610330565b5f546001600160a01b031633146105975760405162461bcd60e51b81526004016102d290610ad6565b6105a05f610904565b565b5f546001600160a01b031633146105cb5760405162461bcd60e51b81526004016102d290610ad6565b6105d9633b9aca0080610b40565b8111156105f95760405163874f603160e01b815260040160405180910390fd5b60068190556040518181527f2ab3f5a4ebbcbf3c24f62f5454f52f10e1a8c9dcc5acac8f19199ce881a6a10890602001610330565b5f546001600160a01b031633146106575760405162461bcd60e51b81526004016102d290610ad6565b60085460ff161561067b576040516379f9c57560e01b815260040160405180910390fd5b6008805460ff19166001179055565b6004805460405163efc7840160e01b815233928101929092526001600160a01b03169063efc7840190602401602060405180830381865afa1580156106d1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106f59190610b0d565b610712576040516326b3506d60e11b815260040160405180910390fd5b60018190556040518181527f351fb23757bb5ea0546c85b7996ddd7155f96b939ebaa5ff7bc49c75f27f2c4490602001610330565b6008545f9060ff161561075b57505f919050565b6104d182610953565b5f546001600160a01b0316331461078d5760405162461bcd60e51b81526004016102d290610ad6565b61079b633b9aca0080610b40565b8111156107bb5760405163f37ec21560e01b815260040160405180910390fd5b60078190556040518181527f6b332a036d8c3ead57dcb06c87243bd7a2aed015ddf2d0528c2501dae56331aa90602001610330565b5f546001600160a01b031633146108195760405162461bcd60e51b81526004016102d290610ad6565b6001600160a01b03811661086f5760405162461bcd60e51b815260206004820152601d60248201527f6e6577206f776e657220697320746865207a65726f206164647265737300000060448201526064016102d2565b61087881610904565b50565b5f633b9aca0060055483516007546108939190610b40565b61089d9190610b40565b6001546006546108ad9190610b40565b6108b79190610b57565b6104d19190610b6a565b5f806108cc83610953565b90505f600154826108dd9190610b40565b9050633b9aca00600354826108f29190610b40565b6108fc9190610b6a565b949350505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80515f908190815b818110156109a45784818151811061097557610975610b89565b01602001516001600160f81b0319165f036109955760048301925061099c565b6010830192505b60010161095b565b50506002540160400192915050565b5f602082840312156109c3575f80fd5b5035919050565b5f80604083850312156109db575f80fd5b50508035926020909101359150565b5f602082840312156109fa575f80fd5b81356001600160a01b0381168114610a10575f80fd5b9392505050565b634e487b7160e01b5f52604160045260245ffd5b5f60208284031215610a3b575f80fd5b813567ffffffffffffffff80821115610a52575f80fd5b818401915084601f830112610a65575f80fd5b813581811115610a7757610a77610a17565b604051601f8201601f19908116603f01168101908382118183101715610a9f57610a9f610a17565b81604052828152876020848701011115610ab7575f80fd5b826020860160208301375f928101602001929092525095945050505050565b60208082526017908201527f63616c6c6572206973206e6f7420746865206f776e6572000000000000000000604082015260600190565b5f60208284031215610b1d575f80fd5b81518015158114610a10575f80fd5b634e487b7160e01b5f52601160045260245ffd5b80820281158282048414176104d1576104d1610b2c565b808201808211156104d1576104d1610b2c565b5f82610b8457634e487b7160e01b5f52601260045260245ffd5b500490565b634e487b7160e01b5f52603260045260245ffdfea26469706673582212200c2ac583f18be4f94ab169ae6f2ea3a708a7c0d4424746b120b177adb39e626064736f6c63430008180033"); -const CURIE_L1_GAS_PRICE_ORACLE_STORAGE: [(U256, U256); 4] = [ +/// L1 gas price oracle address. +pub const L1_GAS_PRICE_ORACLE_ADDRESS: Address = + address!("5300000000000000000000000000000000000002"); +/// Bytecode of L1 gas price oracle after Curie transition. +pub const CURIE_L1_GAS_PRICE_ORACLE_BYTECODE: Bytes = bytes!("608060405234801561000f575f80fd5b5060043610610132575f3560e01c8063715018a6116100b4578063a911d77f11610079578063a911d77f1461024c578063bede39b514610254578063de26c4a114610267578063e88a60ad1461027a578063f2fde38b1461028d578063f45e65d8146102a0575f80fd5b8063715018a6146101eb57806384189161146101f35780638da5cb5b146101fc57806393e59dc114610226578063944b247f14610239575f80fd5b80633d0f963e116100fa5780633d0f963e146101a057806349948e0e146101b3578063519b4bd3146101c65780636a5e67e5146101cf57806370465597146101d8575f80fd5b80630c18c1621461013657806313dad5be1461015257806323e524ac1461016f5780633577afc51461017857806339455d3a1461018d575b5f80fd5b61013f60025481565b6040519081526020015b60405180910390f35b60085461015f9060ff1681565b6040519015158152602001610149565b61013f60065481565b61018b6101863660046109b3565b6102a9565b005b61018b61019b3660046109ca565b61033b565b61018b6101ae3660046109ea565b610438565b61013f6101c1366004610a2b565b6104bb565b61013f60015481565b61013f60075481565b61018b6101e63660046109b3565b6104e0565b61018b61056e565b61013f60055481565b5f5461020e906001600160a01b031681565b6040516001600160a01b039091168152602001610149565b60045461020e906001600160a01b031681565b61018b6102473660046109b3565b6105a2565b61018b61062e565b61018b6102623660046109b3565b61068a565b61013f610275366004610a2b565b610747565b61018b6102883660046109b3565b610764565b61018b61029b3660046109ea565b6107f0565b61013f60035481565b5f546001600160a01b031633146102db5760405162461bcd60e51b81526004016102d290610ad6565b60405180910390fd5b621c9c388111156102ff57604051635742c80560e11b815260040160405180910390fd5b60028190556040518181527f32740b35c0ea213650f60d44366b4fb211c9033b50714e4a1d34e65d5beb9bb4906020015b60405180910390a150565b6004805460405163efc7840160e01b815233928101929092526001600160a01b03169063efc7840190602401602060405180830381865afa158015610382573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103a69190610b0d565b6103c3576040516326b3506d60e11b815260040160405180910390fd5b600182905560058190556040518281527f351fb23757bb5ea0546c85b7996ddd7155f96b939ebaa5ff7bc49c75f27f2c449060200160405180910390a16040518181527f9a14bfb5d18c4c3cf14cae19c23d7cf1bcede357ea40ca1f75cd49542c71c214906020015b60405180910390a15050565b5f546001600160a01b031633146104615760405162461bcd60e51b81526004016102d290610ad6565b600480546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f22d1c35fe072d2e42c3c8f9bd4a0d34aa84a0101d020a62517b33fdb3174e5f7910161042c565b6008545f9060ff16156104d7576104d18261087b565b92915050565b6104d1826108c1565b5f546001600160a01b031633146105095760405162461bcd60e51b81526004016102d290610ad6565b610519633b9aca006103e8610b40565b81111561053957604051631e44fdeb60e11b815260040160405180910390fd5b60038190556040518181527f3336cd9708eaf2769a0f0dc0679f30e80f15dcd88d1921b5a16858e8b85c591a90602001610330565b5f546001600160a01b031633146105975760405162461bcd60e51b81526004016102d290610ad6565b6105a05f610904565b565b5f546001600160a01b031633146105cb5760405162461bcd60e51b81526004016102d290610ad6565b6105d9633b9aca0080610b40565b8111156105f95760405163874f603160e01b815260040160405180910390fd5b60068190556040518181527f2ab3f5a4ebbcbf3c24f62f5454f52f10e1a8c9dcc5acac8f19199ce881a6a10890602001610330565b5f546001600160a01b031633146106575760405162461bcd60e51b81526004016102d290610ad6565b60085460ff161561067b576040516379f9c57560e01b815260040160405180910390fd5b6008805460ff19166001179055565b6004805460405163efc7840160e01b815233928101929092526001600160a01b03169063efc7840190602401602060405180830381865afa1580156106d1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106f59190610b0d565b610712576040516326b3506d60e11b815260040160405180910390fd5b60018190556040518181527f351fb23757bb5ea0546c85b7996ddd7155f96b939ebaa5ff7bc49c75f27f2c4490602001610330565b6008545f9060ff161561075b57505f919050565b6104d182610953565b5f546001600160a01b0316331461078d5760405162461bcd60e51b81526004016102d290610ad6565b61079b633b9aca0080610b40565b8111156107bb5760405163f37ec21560e01b815260040160405180910390fd5b60078190556040518181527f6b332a036d8c3ead57dcb06c87243bd7a2aed015ddf2d0528c2501dae56331aa90602001610330565b5f546001600160a01b031633146108195760405162461bcd60e51b81526004016102d290610ad6565b6001600160a01b03811661086f5760405162461bcd60e51b815260206004820152601d60248201527f6e6577206f776e657220697320746865207a65726f206164647265737300000060448201526064016102d2565b61087881610904565b50565b5f633b9aca0060055483516007546108939190610b40565b61089d9190610b40565b6001546006546108ad9190610b40565b6108b79190610b57565b6104d19190610b6a565b5f806108cc83610953565b90505f600154826108dd9190610b40565b9050633b9aca00600354826108f29190610b40565b6108fc9190610b6a565b949350505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80515f908190815b818110156109a45784818151811061097557610975610b89565b01602001516001600160f81b0319165f036109955760048301925061099c565b6010830192505b60010161095b565b50506002540160400192915050565b5f602082840312156109c3575f80fd5b5035919050565b5f80604083850312156109db575f80fd5b50508035926020909101359150565b5f602082840312156109fa575f80fd5b81356001600160a01b0381168114610a10575f80fd5b9392505050565b634e487b7160e01b5f52604160045260245ffd5b5f60208284031215610a3b575f80fd5b813567ffffffffffffffff80821115610a52575f80fd5b818401915084601f830112610a65575f80fd5b813581811115610a7757610a77610a17565b604051601f8201601f19908116603f01168101908382118183101715610a9f57610a9f610a17565b81604052828152876020848701011115610ab7575f80fd5b826020860160208301375f928101602001929092525095945050505050565b60208082526017908201527f63616c6c6572206973206e6f7420746865206f776e6572000000000000000000604082015260600190565b5f60208284031215610b1d575f80fd5b81518015158114610a10575f80fd5b634e487b7160e01b5f52601160045260245ffd5b80820281158282048414176104d1576104d1610b2c565b808201808211156104d1576104d1610b2c565b5f82610b8457634e487b7160e01b5f52601260045260245ffd5b500490565b634e487b7160e01b5f52603260045260245ffdfea26469706673582212200c2ac583f18be4f94ab169ae6f2ea3a708a7c0d4424746b120b177adb39e626064736f6c63430008180033"); +/// Storage update of L1 gas price oracle after Curie transition. +pub const CURIE_L1_GAS_PRICE_ORACLE_STORAGE: [(U256, U256); 4] = [ (L1_BLOB_BASE_FEE_SLOT, INITIAL_L1_BLOB_BASE_FEE), (COMMIT_SCALAR_SLOT, INITIAL_COMMIT_SCALAR), (BLOB_SCALAR_SLOT, INITIAL_BLOB_SCALAR), diff --git a/crates/scroll/consensus/src/lib.rs b/crates/scroll/consensus/src/lib.rs index 86c2e0029221..b83d8b60a519 100644 --- a/crates/scroll/consensus/src/lib.rs +++ b/crates/scroll/consensus/src/lib.rs @@ -1,4 +1,7 @@ //! Scroll consensus implementation. -pub use curie::apply_curie_hard_fork; +pub use curie::{ + apply_curie_hard_fork, CURIE_L1_GAS_PRICE_ORACLE_BYTECODE, CURIE_L1_GAS_PRICE_ORACLE_STORAGE, + L1_GAS_PRICE_ORACLE_ADDRESS, +}; mod curie; diff --git a/crates/scroll/evm/Cargo.toml b/crates/scroll/evm/Cargo.toml index 132808293f1b..3410ef4a1b19 100644 --- a/crates/scroll/evm/Cargo.toml +++ b/crates/scroll/evm/Cargo.toml @@ -40,6 +40,7 @@ tracing.workspace = true [dev-dependencies] eyre.workspace = true +reth-scroll-execution = { workspace = true, features = ["scroll", "test-utils"] } [features] optimism = [] diff --git a/crates/scroll/evm/src/execute.rs b/crates/scroll/evm/src/execute.rs index c4e01b70f75f..d59b22f07736 100644 --- a/crates/scroll/evm/src/execute.rs +++ b/crates/scroll/evm/src/execute.rs @@ -20,13 +20,16 @@ use revm::{ primitives::{bytes::BytesMut, BlockEnv, EnvWithHandlerCfg, ResultAndState}, Database, DatabaseCommit, State, }; -use std::fmt::{Debug, Display}; +use std::{ + fmt::{Debug, Display}, + sync::Arc, +}; /// The Scroll block execution strategy. #[derive(Debug)] pub struct ScrollExecutionStrategy { /// Chain specification. - chain_spec: ChainSpec, + chain_spec: Arc, /// Evm configuration. evm_config: EvmConfig, /// Current state for the execution. @@ -35,7 +38,7 @@ pub struct ScrollExecutionStrategy { impl ScrollExecutionStrategy { /// Returns an instance of [`ScrollExecutionStrategy`]. - pub const fn new(chain_spec: ChainSpec, evm_config: EvmConfig, state: State) -> Self { + pub const fn new(chain_spec: Arc, evm_config: EvmConfig, state: State) -> Self { Self { chain_spec, evm_config, state } } } @@ -216,3 +219,178 @@ where Ok(()) } } + +#[cfg(test)] +mod tests { + use super::*; + use crate::ScrollEvmConfig; + use reth_chainspec::ChainSpecBuilder; + use reth_primitives::{Block, BlockBody, TransactionSigned}; + use reth_scroll_consensus::{ + CURIE_L1_GAS_PRICE_ORACLE_BYTECODE, CURIE_L1_GAS_PRICE_ORACLE_STORAGE, + L1_GAS_PRICE_ORACLE_ADDRESS, + }; + use revm::{ + db::states::{bundle_state::BundleRetention, StorageSlot}, + primitives::{Address, TxType, B256}, + Bytecode, EmptyDBTyped, TxKind, + }; + + fn strategy() -> ScrollExecutionStrategy, ScrollEvmConfig> { + // TODO (scroll): change this to `ScrollChainSpecBuilder::mainnet()`. + let chain_spec = Arc::new(ChainSpecBuilder::mainnet().build()); + let config = ScrollEvmConfig::new(chain_spec.clone()); + let db = EmptyDBTyped::::new(); + let state = + State::builder().with_database(db).with_bundle_update().without_state_clear().build(); + + ScrollExecutionStrategy::new(chain_spec, config, state) + } + + fn transaction(typ: TxType, gas_limit: u64) -> TransactionSigned { + let pk = B256::random(); + let transaction = match typ { + TxType::BlobTx => reth_primitives::Transaction::Eip4844(alloy_consensus::TxEip4844 { + gas_limit, + to: Address::ZERO, + ..Default::default() + }), + _ => reth_primitives::Transaction::Legacy(alloy_consensus::TxLegacy { + gas_limit, + to: TxKind::Call(Address::ZERO), + ..Default::default() + }), + }; + let signature = reth_primitives::sign_message(pk, transaction.signature_hash()).unwrap(); + reth_primitives::TransactionSigned::new_unhashed(transaction, signature) + } + + #[test] + fn test_apply_pre_execution_changes_at_curie_block() -> eyre::Result<()> { + // init strategy + let mut strategy = strategy(); + + // init curie transition block + let curie_block = BlockWithSenders { + block: Block { + header: Header { number: 7096836, ..Default::default() }, + ..Default::default() + }, + senders: vec![], + }; + + // apply pre execution change + strategy.apply_pre_execution_changes(&curie_block, U256::ZERO)?; + + // take bundle + let mut state = strategy.state; + state.merge_transitions(BundleRetention::Reverts); + let bundle = state.take_bundle(); + + // assert oracle contract contains updated bytecode and storage + let oracle = bundle.state.get(&L1_GAS_PRICE_ORACLE_ADDRESS).unwrap().clone(); + let bytecode = Bytecode::new_raw(CURIE_L1_GAS_PRICE_ORACLE_BYTECODE); + assert_eq!(oracle.info.unwrap().code.unwrap(), bytecode); + + // check oracle storage changeset + let mut storage = oracle.storage.into_iter().collect::>(); + storage.sort_by(|(a, _), (b, _)| a.cmp(b)); + for (got, expected) in storage.into_iter().zip(CURIE_L1_GAS_PRICE_ORACLE_STORAGE) { + assert_eq!(got.0, expected.0); + assert_eq!(got.1, StorageSlot { present_value: expected.1, ..Default::default() }); + } + + Ok(()) + } + + #[test] + fn test_apply_pre_execution_changes_not_at_curie_block() -> eyre::Result<()> { + // init strategy + let mut strategy = strategy(); + + // init curie transition block + let curie_block = BlockWithSenders { + block: Block { + header: Header { number: 7096837, ..Default::default() }, + ..Default::default() + }, + senders: vec![], + }; + + // apply pre execution change + strategy.apply_pre_execution_changes(&curie_block, U256::ZERO)?; + + // take bundle + let mut state = strategy.state; + state.merge_transitions(BundleRetention::Reverts); + let bundle = state.take_bundle(); + + // assert oracle contract contains updated bytecode and storage + let oracle = bundle.state.get(&L1_GAS_PRICE_ORACLE_ADDRESS); + assert!(oracle.is_none()); + + Ok(()) + } + + #[test] + fn test_execute_transaction_exceeds_block_gas_limit() -> eyre::Result<()> { + // init strategy + let mut strategy = strategy(); + + // prepare transactions exceeding block gas limit + let gas_limit = 10_000_000; + let transaction = transaction(TxType::Legacy, gas_limit + 1); + let senders = vec![transaction.recover_signer().unwrap()]; + let block = BlockWithSenders { + block: Block { + header: Header { number: 7096837, gas_limit, ..Default::default() }, + body: BlockBody { transactions: vec![transaction], ..Default::default() }, + }, + senders: senders.clone(), + }; + + // load accounts in state + strategy.state.insert_account(Address::ZERO, Default::default()); + strategy.state.insert_account(L1_GAS_PRICE_ORACLE_ADDRESS, Default::default()); + for add in senders { + strategy.state.insert_account(add, Default::default()); + } + + let res = strategy.execute_transactions(&block, U256::ZERO); + assert_eq!( + res.unwrap_err().to_string(), + "transaction gas limit 10000001 is more than blocks available gas 10000000" + ); + + Ok(()) + } + + #[test] + fn test_execute_transaction_eip4844() -> eyre::Result<()> { + // init strategy + let mut strategy = strategy(); + + // prepare transactions exceeding block gas limit + let transaction = transaction(TxType::BlobTx, 1_000); + let senders = vec![transaction.recover_signer().unwrap()]; + let block = BlockWithSenders { + block: Block { + header: Header { number: 7096837, gas_limit: 10_000_000, ..Default::default() }, + body: BlockBody { transactions: vec![transaction], ..Default::default() }, + }, + senders: senders.clone(), + }; + + // load accounts in state + strategy.state.insert_account(Address::ZERO, Default::default()); + strategy.state.insert_account(L1_GAS_PRICE_ORACLE_ADDRESS, Default::default()); + for add in senders { + strategy.state.insert_account(add, Default::default()); + } + + let res = strategy.execute_transactions(&block, U256::ZERO); + assert_eq!(res.unwrap_err().to_string(), "EIP-4844 transactions are disabled"); + + Ok(()) + } +} diff --git a/crates/scroll/execution/src/finalize.rs b/crates/scroll/execution/src/finalize.rs index b9f5e49d3679..86d678e9073b 100644 --- a/crates/scroll/execution/src/finalize.rs +++ b/crates/scroll/execution/src/finalize.rs @@ -4,7 +4,7 @@ use reth_revm::{ cached::CachedReadsDbMut, database::StateProviderDatabase, revm::CacheDB, DatabaseRef, }; -use reth_revm::{database::EvmStateProvider, revm::State}; +use reth_revm::{database::EvmStateProvider, revm::State, EmptyDBTyped}; #[cfg(feature = "scroll")] use reth_scroll_storage::ScrollStateProviderDatabase; @@ -72,3 +72,12 @@ impl FinalizeExecution for State> { self.take_bundle().into() } } + +#[cfg(feature = "test-utils")] +impl FinalizeExecution for State> { + type Output = reth_revm::db::BundleState; + + fn finalize(&mut self) -> Self::Output { + self.take_bundle().into() + } +} From 9d1c225e3ce2618dfe624cbb9e6e007af2d98281 Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Sun, 1 Dec 2024 10:14:11 +0100 Subject: [PATCH 11/31] add l1 message test for `ScrollExecutionStrategy` Signed-off-by: Gregory Edison --- crates/scroll/evm/Cargo.toml | 1 + crates/scroll/evm/src/config.rs | 3 +- crates/scroll/evm/src/execute.rs | 60 ++++++++++++++++++++++++++------ 3 files changed, 52 insertions(+), 12 deletions(-) diff --git a/crates/scroll/evm/Cargo.toml b/crates/scroll/evm/Cargo.toml index 3410ef4a1b19..79b93d0ca6a2 100644 --- a/crates/scroll/evm/Cargo.toml +++ b/crates/scroll/evm/Cargo.toml @@ -41,6 +41,7 @@ tracing.workspace = true [dev-dependencies] eyre.workspace = true reth-scroll-execution = { workspace = true, features = ["scroll", "test-utils"] } +reth-scroll-primitives.workspace = true [features] optimism = [] diff --git a/crates/scroll/evm/src/config.rs b/crates/scroll/evm/src/config.rs index 24318e88c06b..7155ecdf299e 100644 --- a/crates/scroll/evm/src/config.rs +++ b/crates/scroll/evm/src/config.rs @@ -1,7 +1,6 @@ use reth_chainspec::{ChainSpec, Head}; use reth_evm::{ConfigureEvm, ConfigureEvmEnv, NextBlockEnvAttributes}; -use reth_primitives::TransactionSigned; -use reth_primitives_traits::FillTxEnv; +use reth_primitives::{transaction::FillTxEnv, TransactionSigned}; use reth_revm::{inspector_handle_register, Database, Evm, GetInspector, TxEnv}; use revm::{ precompile::{Address, Bytes}, diff --git a/crates/scroll/evm/src/execute.rs b/crates/scroll/evm/src/execute.rs index d59b22f07736..85059bb7168a 100644 --- a/crates/scroll/evm/src/execute.rs +++ b/crates/scroll/evm/src/execute.rs @@ -225,14 +225,15 @@ mod tests { use super::*; use crate::ScrollEvmConfig; use reth_chainspec::ChainSpecBuilder; - use reth_primitives::{Block, BlockBody, TransactionSigned}; + use reth_evm::execute::ExecuteOutput; + use reth_primitives::{Block, BlockBody, Receipt, TransactionSigned, TxType}; use reth_scroll_consensus::{ CURIE_L1_GAS_PRICE_ORACLE_BYTECODE, CURIE_L1_GAS_PRICE_ORACLE_STORAGE, L1_GAS_PRICE_ORACLE_ADDRESS, }; use revm::{ db::states::{bundle_state::BundleRetention, StorageSlot}, - primitives::{Address, TxType, B256}, + primitives::{Address, B256, U256}, Bytecode, EmptyDBTyped, TxKind, }; @@ -250,11 +251,19 @@ mod tests { fn transaction(typ: TxType, gas_limit: u64) -> TransactionSigned { let pk = B256::random(); let transaction = match typ { - TxType::BlobTx => reth_primitives::Transaction::Eip4844(alloy_consensus::TxEip4844 { + TxType::Eip4844 => reth_primitives::Transaction::Eip4844(alloy_consensus::TxEip4844 { gas_limit, to: Address::ZERO, ..Default::default() }), + TxType::L1Message => { + reth_primitives::Transaction::L1Message(reth_scroll_primitives::TxL1Message { + gas_limit, + sender: Address::random(), + to: Address::ZERO, + ..Default::default() + }) + } _ => reth_primitives::Transaction::Legacy(alloy_consensus::TxLegacy { gas_limit, to: TxKind::Call(Address::ZERO), @@ -266,7 +275,7 @@ mod tests { } #[test] - fn test_apply_pre_execution_changes_at_curie_block() -> eyre::Result<()> { + fn test_apply_pre_execution_changes_curie_block() -> eyre::Result<()> { // init strategy let mut strategy = strategy(); @@ -304,7 +313,7 @@ mod tests { } #[test] - fn test_apply_pre_execution_changes_not_at_curie_block() -> eyre::Result<()> { + fn test_apply_pre_execution_changes_not_curie_block() -> eyre::Result<()> { // init strategy let mut strategy = strategy(); @@ -350,12 +359,12 @@ mod tests { }; // load accounts in state - strategy.state.insert_account(Address::ZERO, Default::default()); strategy.state.insert_account(L1_GAS_PRICE_ORACLE_ADDRESS, Default::default()); for add in senders { strategy.state.insert_account(add, Default::default()); } + // execute and verify error let res = strategy.execute_transactions(&block, U256::ZERO); assert_eq!( res.unwrap_err().to_string(), @@ -371,7 +380,30 @@ mod tests { let mut strategy = strategy(); // prepare transactions exceeding block gas limit - let transaction = transaction(TxType::BlobTx, 1_000); + let transaction = transaction(TxType::Eip4844, 1_000); + let senders = vec![transaction.recover_signer().unwrap()]; + let block = BlockWithSenders { + block: Block { + header: Header { number: 7096837, gas_limit: 10_000_000, ..Default::default() }, + body: BlockBody { transactions: vec![transaction], ..Default::default() }, + }, + senders: senders.clone(), + }; + + // execute and verify error + let res = strategy.execute_transactions(&block, U256::ZERO); + assert_eq!(res.unwrap_err().to_string(), "EIP-4844 transactions are disabled"); + + Ok(()) + } + + #[test] + fn test_execute_transaction_l1_message() -> eyre::Result<()> { + // init strategy + let mut strategy = strategy(); + + // prepare transactions exceeding block gas limit + let transaction = transaction(TxType::L1Message, 21_000); let senders = vec![transaction.recover_signer().unwrap()]; let block = BlockWithSenders { block: Block { @@ -382,14 +414,22 @@ mod tests { }; // load accounts in state - strategy.state.insert_account(Address::ZERO, Default::default()); strategy.state.insert_account(L1_GAS_PRICE_ORACLE_ADDRESS, Default::default()); for add in senders { strategy.state.insert_account(add, Default::default()); } - let res = strategy.execute_transactions(&block, U256::ZERO); - assert_eq!(res.unwrap_err().to_string(), "EIP-4844 transactions are disabled"); + // execute and verify output + let ExecuteOutput { receipts, .. } = strategy.execute_transactions(&block, U256::ZERO)?; + let expected = vec![Receipt { + tx_type: TxType::L1Message, + cumulative_gas_used: 21_000, + success: true, + l1_fee: U256::ZERO, + ..Default::default() + }]; + + assert_eq!(receipts, expected); Ok(()) } From 5a100beff0ae2e67262d4a81f0c17c7a08d7800a Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Sun, 1 Dec 2024 11:13:19 +0100 Subject: [PATCH 12/31] add legacy tx execution test for `ScrollExecutionStrategy` Signed-off-by: Gregory Edison --- crates/scroll/consensus/src/curie.rs | 26 +++- crates/scroll/consensus/src/lib.rs | 6 +- crates/scroll/evm/src/execute.rs | 190 ++++++++++++++++++--------- 3 files changed, 151 insertions(+), 71 deletions(-) diff --git a/crates/scroll/consensus/src/curie.rs b/crates/scroll/consensus/src/curie.rs index 6a9cc714e175..4181092df61c 100644 --- a/crates/scroll/consensus/src/curie.rs +++ b/crates/scroll/consensus/src/curie.rs @@ -8,9 +8,9 @@ use revm::{ /// L1 gas price oracle address. pub const L1_GAS_PRICE_ORACLE_ADDRESS: Address = address!("5300000000000000000000000000000000000002"); -/// Bytecode of L1 gas price oracle after Curie transition. +/// Bytecode of L1 gas price oracle at Curie transition. pub const CURIE_L1_GAS_PRICE_ORACLE_BYTECODE: Bytes = bytes!("608060405234801561000f575f80fd5b5060043610610132575f3560e01c8063715018a6116100b4578063a911d77f11610079578063a911d77f1461024c578063bede39b514610254578063de26c4a114610267578063e88a60ad1461027a578063f2fde38b1461028d578063f45e65d8146102a0575f80fd5b8063715018a6146101eb57806384189161146101f35780638da5cb5b146101fc57806393e59dc114610226578063944b247f14610239575f80fd5b80633d0f963e116100fa5780633d0f963e146101a057806349948e0e146101b3578063519b4bd3146101c65780636a5e67e5146101cf57806370465597146101d8575f80fd5b80630c18c1621461013657806313dad5be1461015257806323e524ac1461016f5780633577afc51461017857806339455d3a1461018d575b5f80fd5b61013f60025481565b6040519081526020015b60405180910390f35b60085461015f9060ff1681565b6040519015158152602001610149565b61013f60065481565b61018b6101863660046109b3565b6102a9565b005b61018b61019b3660046109ca565b61033b565b61018b6101ae3660046109ea565b610438565b61013f6101c1366004610a2b565b6104bb565b61013f60015481565b61013f60075481565b61018b6101e63660046109b3565b6104e0565b61018b61056e565b61013f60055481565b5f5461020e906001600160a01b031681565b6040516001600160a01b039091168152602001610149565b60045461020e906001600160a01b031681565b61018b6102473660046109b3565b6105a2565b61018b61062e565b61018b6102623660046109b3565b61068a565b61013f610275366004610a2b565b610747565b61018b6102883660046109b3565b610764565b61018b61029b3660046109ea565b6107f0565b61013f60035481565b5f546001600160a01b031633146102db5760405162461bcd60e51b81526004016102d290610ad6565b60405180910390fd5b621c9c388111156102ff57604051635742c80560e11b815260040160405180910390fd5b60028190556040518181527f32740b35c0ea213650f60d44366b4fb211c9033b50714e4a1d34e65d5beb9bb4906020015b60405180910390a150565b6004805460405163efc7840160e01b815233928101929092526001600160a01b03169063efc7840190602401602060405180830381865afa158015610382573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103a69190610b0d565b6103c3576040516326b3506d60e11b815260040160405180910390fd5b600182905560058190556040518281527f351fb23757bb5ea0546c85b7996ddd7155f96b939ebaa5ff7bc49c75f27f2c449060200160405180910390a16040518181527f9a14bfb5d18c4c3cf14cae19c23d7cf1bcede357ea40ca1f75cd49542c71c214906020015b60405180910390a15050565b5f546001600160a01b031633146104615760405162461bcd60e51b81526004016102d290610ad6565b600480546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f22d1c35fe072d2e42c3c8f9bd4a0d34aa84a0101d020a62517b33fdb3174e5f7910161042c565b6008545f9060ff16156104d7576104d18261087b565b92915050565b6104d1826108c1565b5f546001600160a01b031633146105095760405162461bcd60e51b81526004016102d290610ad6565b610519633b9aca006103e8610b40565b81111561053957604051631e44fdeb60e11b815260040160405180910390fd5b60038190556040518181527f3336cd9708eaf2769a0f0dc0679f30e80f15dcd88d1921b5a16858e8b85c591a90602001610330565b5f546001600160a01b031633146105975760405162461bcd60e51b81526004016102d290610ad6565b6105a05f610904565b565b5f546001600160a01b031633146105cb5760405162461bcd60e51b81526004016102d290610ad6565b6105d9633b9aca0080610b40565b8111156105f95760405163874f603160e01b815260040160405180910390fd5b60068190556040518181527f2ab3f5a4ebbcbf3c24f62f5454f52f10e1a8c9dcc5acac8f19199ce881a6a10890602001610330565b5f546001600160a01b031633146106575760405162461bcd60e51b81526004016102d290610ad6565b60085460ff161561067b576040516379f9c57560e01b815260040160405180910390fd5b6008805460ff19166001179055565b6004805460405163efc7840160e01b815233928101929092526001600160a01b03169063efc7840190602401602060405180830381865afa1580156106d1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106f59190610b0d565b610712576040516326b3506d60e11b815260040160405180910390fd5b60018190556040518181527f351fb23757bb5ea0546c85b7996ddd7155f96b939ebaa5ff7bc49c75f27f2c4490602001610330565b6008545f9060ff161561075b57505f919050565b6104d182610953565b5f546001600160a01b0316331461078d5760405162461bcd60e51b81526004016102d290610ad6565b61079b633b9aca0080610b40565b8111156107bb5760405163f37ec21560e01b815260040160405180910390fd5b60078190556040518181527f6b332a036d8c3ead57dcb06c87243bd7a2aed015ddf2d0528c2501dae56331aa90602001610330565b5f546001600160a01b031633146108195760405162461bcd60e51b81526004016102d290610ad6565b6001600160a01b03811661086f5760405162461bcd60e51b815260206004820152601d60248201527f6e6577206f776e657220697320746865207a65726f206164647265737300000060448201526064016102d2565b61087881610904565b50565b5f633b9aca0060055483516007546108939190610b40565b61089d9190610b40565b6001546006546108ad9190610b40565b6108b79190610b57565b6104d19190610b6a565b5f806108cc83610953565b90505f600154826108dd9190610b40565b9050633b9aca00600354826108f29190610b40565b6108fc9190610b6a565b949350505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80515f908190815b818110156109a45784818151811061097557610975610b89565b01602001516001600160f81b0319165f036109955760048301925061099c565b6010830192505b60010161095b565b50506002540160400192915050565b5f602082840312156109c3575f80fd5b5035919050565b5f80604083850312156109db575f80fd5b50508035926020909101359150565b5f602082840312156109fa575f80fd5b81356001600160a01b0381168114610a10575f80fd5b9392505050565b634e487b7160e01b5f52604160045260245ffd5b5f60208284031215610a3b575f80fd5b813567ffffffffffffffff80821115610a52575f80fd5b818401915084601f830112610a65575f80fd5b813581811115610a7757610a77610a17565b604051601f8201601f19908116603f01168101908382118183101715610a9f57610a9f610a17565b81604052828152876020848701011115610ab7575f80fd5b826020860160208301375f928101602001929092525095945050505050565b60208082526017908201527f63616c6c6572206973206e6f7420746865206f776e6572000000000000000000604082015260600190565b5f60208284031215610b1d575f80fd5b81518015158114610a10575f80fd5b634e487b7160e01b5f52601160045260245ffd5b80820281158282048414176104d1576104d1610b2c565b808201808211156104d1576104d1610b2c565b5f82610b8457634e487b7160e01b5f52601260045260245ffd5b500490565b634e487b7160e01b5f52603260045260245ffdfea26469706673582212200c2ac583f18be4f94ab169ae6f2ea3a708a7c0d4424746b120b177adb39e626064736f6c63430008180033"); -/// Storage update of L1 gas price oracle after Curie transition. +/// Storage update of L1 gas price oracle at Curie transition. pub const CURIE_L1_GAS_PRICE_ORACLE_STORAGE: [(U256, U256); 4] = [ (L1_BLOB_BASE_FEE_SLOT, INITIAL_L1_BLOB_BASE_FEE), (COMMIT_SCALAR_SLOT, INITIAL_COMMIT_SCALAR), @@ -18,16 +18,28 @@ pub const CURIE_L1_GAS_PRICE_ORACLE_STORAGE: [(U256, U256); 4] = [ (IS_CURIE_SLOT, IS_CURIE), ]; -const L1_BLOB_BASE_FEE_SLOT: U256 = U256::from_limbs([5, 0, 0, 0]); +/// L1 gas price oracle base fee slot. +pub const L1_BASE_FEE_SLOT: U256 = U256::from_limbs([1, 0, 0, 0]); +/// L1 gas price oracle over head slot. +pub const OVER_HEAD_SLOT: U256 = U256::from_limbs([2, 0, 0, 0]); +/// L1 gas price oracle scalar slot. +pub const SCALAR_SLOT: U256 = U256::from_limbs([3, 0, 0, 0]); + +/// L1 gas price oracle blob base fee slot. Added in the Curie fork. +pub const L1_BLOB_BASE_FEE_SLOT: U256 = U256::from_limbs([5, 0, 0, 0]); +/// L1 gas price oracle commit scalar slot. Added in the Curie fork. +pub const COMMIT_SCALAR_SLOT: U256 = U256::from_limbs([6, 0, 0, 0]); +/// L1 gas price oracle blob scalar slot. Added in the Curie fork. +pub const BLOB_SCALAR_SLOT: U256 = U256::from_limbs([7, 0, 0, 0]); +/// L1 gas price oracle "is Curie" slot. Added in the Curie fork. +pub const IS_CURIE_SLOT: U256 = U256::from_limbs([8, 0, 0, 0]); + const INITIAL_L1_BLOB_BASE_FEE: U256 = U256::from_limbs([1, 0, 0, 0]); -const COMMIT_SCALAR_SLOT: U256 = U256::from_limbs([6, 0, 0, 0]); const INITIAL_COMMIT_SCALAR: U256 = U256::from_limbs([230759955285, 0, 0, 0]); -const BLOB_SCALAR_SLOT: U256 = U256::from_limbs([7, 0, 0, 0]); const INITIAL_BLOB_SCALAR: U256 = U256::from_limbs([417565260, 0, 0, 0]); -const IS_CURIE_SLOT: U256 = U256::from_limbs([8, 0, 0, 0]); const IS_CURIE: U256 = U256::from_limbs([1, 0, 0, 0]); -/// Applies the Scroll curie hard fork to the state. +/// Applies the Scroll Curie hard fork to the state. pub fn apply_curie_hard_fork(state: &mut State) -> Result<(), DB::Error> { let oracle = state.load_cache_account(L1_GAS_PRICE_ORACLE_ADDRESS)?; diff --git a/crates/scroll/consensus/src/lib.rs b/crates/scroll/consensus/src/lib.rs index b83d8b60a519..ad09850189bd 100644 --- a/crates/scroll/consensus/src/lib.rs +++ b/crates/scroll/consensus/src/lib.rs @@ -1,7 +1,9 @@ //! Scroll consensus implementation. pub use curie::{ - apply_curie_hard_fork, CURIE_L1_GAS_PRICE_ORACLE_BYTECODE, CURIE_L1_GAS_PRICE_ORACLE_STORAGE, - L1_GAS_PRICE_ORACLE_ADDRESS, + apply_curie_hard_fork, BLOB_SCALAR_SLOT, COMMIT_SCALAR_SLOT, + CURIE_L1_GAS_PRICE_ORACLE_BYTECODE, CURIE_L1_GAS_PRICE_ORACLE_STORAGE, IS_CURIE_SLOT, + L1_BASE_FEE_SLOT, L1_BLOB_BASE_FEE_SLOT, L1_GAS_PRICE_ORACLE_ADDRESS, OVER_HEAD_SLOT, + SCALAR_SLOT, }; mod curie; diff --git a/crates/scroll/evm/src/execute.rs b/crates/scroll/evm/src/execute.rs index 85059bb7168a..1094e93be448 100644 --- a/crates/scroll/evm/src/execute.rs +++ b/crates/scroll/evm/src/execute.rs @@ -223,17 +223,19 @@ where #[cfg(test)] mod tests { use super::*; - use crate::ScrollEvmConfig; - use reth_chainspec::ChainSpecBuilder; + use crate::{ScrollEvmConfig, ScrollExecutionStrategy}; + use reth_chainspec::{ChainSpecBuilder, MIN_TRANSACTION_GAS}; use reth_evm::execute::ExecuteOutput; - use reth_primitives::{Block, BlockBody, Receipt, TransactionSigned, TxType}; + use reth_primitives::{Block, BlockBody, BlockWithSenders, Receipt, TransactionSigned, TxType}; use reth_scroll_consensus::{ - CURIE_L1_GAS_PRICE_ORACLE_BYTECODE, CURIE_L1_GAS_PRICE_ORACLE_STORAGE, - L1_GAS_PRICE_ORACLE_ADDRESS, + BLOB_SCALAR_SLOT, COMMIT_SCALAR_SLOT, CURIE_L1_GAS_PRICE_ORACLE_BYTECODE, + CURIE_L1_GAS_PRICE_ORACLE_STORAGE, IS_CURIE_SLOT, L1_BASE_FEE_SLOT, L1_BLOB_BASE_FEE_SLOT, + L1_GAS_PRICE_ORACLE_ADDRESS, OVER_HEAD_SLOT, SCALAR_SLOT, }; use revm::{ db::states::{bundle_state::BundleRetention, StorageSlot}, primitives::{Address, B256, U256}, + shared::AccountInfo, Bytecode, EmptyDBTyped, TxKind, }; @@ -248,6 +250,18 @@ mod tests { ScrollExecutionStrategy::new(chain_spec, config, state) } + const BLOCK_GAS_LIMIT: u64 = 10_000_000; + fn block(number: u64, transactions: Vec) -> BlockWithSenders { + let senders = transactions.iter().map(|t| t.recover_signer().unwrap()).collect(); + BlockWithSenders { + block: Block { + header: Header { number, gas_limit: BLOCK_GAS_LIMIT, ..Default::default() }, + body: BlockBody { transactions, ..Default::default() }, + }, + senders, + } + } + fn transaction(typ: TxType, gas_limit: u64) -> TransactionSigned { let pk = B256::random(); let transaction = match typ { @@ -280,13 +294,7 @@ mod tests { let mut strategy = strategy(); // init curie transition block - let curie_block = BlockWithSenders { - block: Block { - header: Header { number: 7096836, ..Default::default() }, - ..Default::default() - }, - senders: vec![], - }; + let curie_block = block(7096836, vec![]); // apply pre execution change strategy.apply_pre_execution_changes(&curie_block, U256::ZERO)?; @@ -296,12 +304,12 @@ mod tests { state.merge_transitions(BundleRetention::Reverts); let bundle = state.take_bundle(); - // assert oracle contract contains updated bytecode and storage + // assert oracle contract contains updated bytecode let oracle = bundle.state.get(&L1_GAS_PRICE_ORACLE_ADDRESS).unwrap().clone(); let bytecode = Bytecode::new_raw(CURIE_L1_GAS_PRICE_ORACLE_BYTECODE); assert_eq!(oracle.info.unwrap().code.unwrap(), bytecode); - // check oracle storage changeset + // check oracle contract contains storage changeset let mut storage = oracle.storage.into_iter().collect::>(); storage.sort_by(|(a, _), (b, _)| a.cmp(b)); for (got, expected) in storage.into_iter().zip(CURIE_L1_GAS_PRICE_ORACLE_STORAGE) { @@ -317,24 +325,18 @@ mod tests { // init strategy let mut strategy = strategy(); - // init curie transition block - let curie_block = BlockWithSenders { - block: Block { - header: Header { number: 7096837, ..Default::default() }, - ..Default::default() - }, - senders: vec![], - }; + // init block + let not_curie_block = block(7096837, vec![]); // apply pre execution change - strategy.apply_pre_execution_changes(&curie_block, U256::ZERO)?; + strategy.apply_pre_execution_changes(¬_curie_block, U256::ZERO)?; // take bundle let mut state = strategy.state; state.merge_transitions(BundleRetention::Reverts); let bundle = state.take_bundle(); - // assert oracle contract contains updated bytecode and storage + // assert oracle contract is empty let oracle = bundle.state.get(&L1_GAS_PRICE_ORACLE_ADDRESS); assert!(oracle.is_none()); @@ -346,23 +348,9 @@ mod tests { // init strategy let mut strategy = strategy(); - // prepare transactions exceeding block gas limit - let gas_limit = 10_000_000; - let transaction = transaction(TxType::Legacy, gas_limit + 1); - let senders = vec![transaction.recover_signer().unwrap()]; - let block = BlockWithSenders { - block: Block { - header: Header { number: 7096837, gas_limit, ..Default::default() }, - body: BlockBody { transactions: vec![transaction], ..Default::default() }, - }, - senders: senders.clone(), - }; - - // load accounts in state - strategy.state.insert_account(L1_GAS_PRICE_ORACLE_ADDRESS, Default::default()); - for add in senders { - strategy.state.insert_account(add, Default::default()); - } + // prepare transaction exceeding block gas limit + let transaction = transaction(TxType::Legacy, BLOCK_GAS_LIMIT + 1); + let block = block(7096837, vec![transaction]); // execute and verify error let res = strategy.execute_transactions(&block, U256::ZERO); @@ -381,14 +369,7 @@ mod tests { // prepare transactions exceeding block gas limit let transaction = transaction(TxType::Eip4844, 1_000); - let senders = vec![transaction.recover_signer().unwrap()]; - let block = BlockWithSenders { - block: Block { - header: Header { number: 7096837, gas_limit: 10_000_000, ..Default::default() }, - body: BlockBody { transactions: vec![transaction], ..Default::default() }, - }, - senders: senders.clone(), - }; + let block = block(7096837, vec![transaction]); // execute and verify error let res = strategy.execute_transactions(&block, U256::ZERO); @@ -398,32 +379,25 @@ mod tests { } #[test] - fn test_execute_transaction_l1_message() -> eyre::Result<()> { + fn test_execute_transactions_l1_message() -> eyre::Result<()> { // init strategy let mut strategy = strategy(); // prepare transactions exceeding block gas limit - let transaction = transaction(TxType::L1Message, 21_000); - let senders = vec![transaction.recover_signer().unwrap()]; - let block = BlockWithSenders { - block: Block { - header: Header { number: 7096837, gas_limit: 10_000_000, ..Default::default() }, - body: BlockBody { transactions: vec![transaction], ..Default::default() }, - }, - senders: senders.clone(), - }; + let transaction = transaction(TxType::L1Message, MIN_TRANSACTION_GAS); + let block = block(7096837, vec![transaction]); // load accounts in state strategy.state.insert_account(L1_GAS_PRICE_ORACLE_ADDRESS, Default::default()); - for add in senders { - strategy.state.insert_account(add, Default::default()); + for add in &block.senders { + strategy.state.insert_account(*add, Default::default()); } // execute and verify output let ExecuteOutput { receipts, .. } = strategy.execute_transactions(&block, U256::ZERO)?; let expected = vec![Receipt { tx_type: TxType::L1Message, - cumulative_gas_used: 21_000, + cumulative_gas_used: MIN_TRANSACTION_GAS, success: true, l1_fee: U256::ZERO, ..Default::default() @@ -433,4 +407,96 @@ mod tests { Ok(()) } + + #[test] + fn test_execute_transactions_curie_fork() -> eyre::Result<()> { + // init strategy + let mut strategy = strategy(); + + // prepare transactions exceeding block gas limit + let transaction = transaction(TxType::Legacy, MIN_TRANSACTION_GAS); + let block = block(7096837, vec![transaction]); + + // load l1 gas price oracle with l1 block info in storage + strategy.state.insert_account_with_storage( + L1_GAS_PRICE_ORACLE_ADDRESS, + Default::default(), + [ + (L1_BASE_FEE_SLOT, U256::from(1000)), + (OVER_HEAD_SLOT, U256::from(1000)), + (SCALAR_SLOT, U256::from(1000)), + (L1_BLOB_BASE_FEE_SLOT, U256::from(1000)), + (COMMIT_SCALAR_SLOT, U256::from(1000)), + (BLOB_SCALAR_SLOT, U256::from(1000)), + (IS_CURIE_SLOT, U256::from(1)), + ] + .into_iter() + .collect(), + ); + // load accounts in state + for add in &block.senders { + strategy + .state + .insert_account(*add, AccountInfo { balance: U256::MAX, ..Default::default() }); + } + + // execute and verify output + let ExecuteOutput { receipts, .. } = strategy.execute_transactions(&block, U256::ZERO)?; + let expected = vec![Receipt { + tx_type: TxType::Legacy, + cumulative_gas_used: MIN_TRANSACTION_GAS, + success: true, + // TODO (scroll): set this to the correct value (should be different from + // not_curie_fork) + l1_fee: U256::from(3), + ..Default::default() + }]; + + assert_eq!(receipts, expected); + + Ok(()) + } + + #[test] + fn test_execute_transactions_not_curie_fork() -> eyre::Result<()> { + // init strategy + let mut strategy = strategy(); + + // prepare transactions exceeding block gas limit + let transaction = transaction(TxType::Legacy, MIN_TRANSACTION_GAS); + let block = block(7096835, vec![transaction]); + + // load l1 gas price oracle with l1 block info in storage + strategy.state.insert_account_with_storage( + L1_GAS_PRICE_ORACLE_ADDRESS, + Default::default(), + [ + (L1_BASE_FEE_SLOT, U256::from(1000)), + (OVER_HEAD_SLOT, U256::from(1000)), + (SCALAR_SLOT, U256::from(1000)), + ] + .into_iter() + .collect(), + ); + // load accounts in state + for add in &block.senders { + strategy + .state + .insert_account(*add, AccountInfo { balance: U256::MAX, ..Default::default() }); + } + + // execute and verify output + let ExecuteOutput { receipts, .. } = strategy.execute_transactions(&block, U256::ZERO)?; + let expected = vec![Receipt { + tx_type: TxType::Legacy, + cumulative_gas_used: MIN_TRANSACTION_GAS, + success: true, + l1_fee: U256::from(2), + ..Default::default() + }]; + + assert_eq!(receipts, expected); + + Ok(()) + } } From ed2f7366f2b04f886564a4697d03c8f442ed8ed4 Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Mon, 2 Dec 2024 18:26:22 +0100 Subject: [PATCH 13/31] use revm scroll fork Signed-off-by: Gregory Edison --- Cargo.lock | 49 +++++++++++++++++++------ Cargo.toml | 4 ++ crates/primitives-traits/src/account.rs | 8 ++++ crates/scroll/revm/Cargo.toml | 2 +- crates/scroll/revm/src/test_utils.rs | 4 ++ 5 files changed, 54 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 796f43f985fc..5cffd708441b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1345,6 +1345,19 @@ dependencies = [ "zeroize", ] +[[package]] +name = "bn254" +version = "0.1.0" +source = "git+https://github.com/scroll-tech/bn254.git?branch=master#81e1dcc92ee9a2798b13b84b24de182e9c42256e" +dependencies = [ + "ff", + "getrandom 0.2.15", + "rand 0.8.5", + "rand_core 0.6.4", + "sp1-intrinsics", + "subtle", +] + [[package]] name = "bn254" version = "0.1.0" @@ -4617,7 +4630,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -5757,12 +5770,22 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +[[package]] +name = "poseidon-bn254" +version = "0.1.0" +source = "git+https://github.com/scroll-tech/poseidon-bn254?branch=master#254baa0e3e85c0975c16fe6f33042b1fa9ae0a44" +dependencies = [ + "bn254 0.1.0 (git+https://github.com/scroll-tech/bn254.git?branch=master)", + "itertools 0.13.0", + "sp1-intrinsics", +] + [[package]] name = "poseidon-bn254" version = "0.1.0" source = "git+https://github.com/scroll-tech/poseidon-bn254?rev=526a64a#526a64a81419bcab6bd8280a8a3f9808189e0373" dependencies = [ - "bn254", + "bn254 0.1.0 (git+https://github.com/scroll-tech/bn254)", "itertools 0.13.0", ] @@ -9150,6 +9173,7 @@ dependencies = [ name = "reth-scroll-consensus" version = "1.1.2" dependencies = [ + "eyre", "reth-scroll-revm", ] @@ -9161,14 +9185,17 @@ dependencies = [ "alloy-eips", "auto_impl", "derive_more 1.0.0", + "eyre", "reth-chainspec", "reth-consensus", "reth-ethereum-consensus", "reth-evm", "reth-primitives", + "reth-primitives-traits", "reth-revm", "reth-scroll-consensus", "reth-scroll-execution", + "reth-scroll-primitives", "reth-scroll-revm", "thiserror 1.0.69", "tracing", @@ -9195,7 +9222,7 @@ dependencies = [ "bincode", "bytes", "modular-bitfield", - "poseidon-bn254", + "poseidon-bn254 0.1.0 (git+https://github.com/scroll-tech/poseidon-bn254?rev=526a64a)", "proptest", "proptest-arbitrary-interop", "rand 0.8.5", @@ -9637,8 +9664,7 @@ dependencies = [ [[package]] name = "revm" version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15689a3c6a8d14b647b4666f2e236ef47b5a5133cdfd423f545947986fff7013" +source = "git+https://github.com/greged93/revm.git?branch=scroll-evm-executor/update/v50#5bb5e1caab6b652b07ccfb2efae0cde9f87ed200" dependencies = [ "auto_impl", "cfg-if", @@ -9671,9 +9697,9 @@ dependencies = [ [[package]] name = "revm-interpreter" version = "14.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74e3f11d0fed049a4a10f79820c59113a79b38aed4ebec786a79d5c667bfeb51" +source = "git+https://github.com/greged93/revm.git?branch=scroll-evm-executor/update/v50#5bb5e1caab6b652b07ccfb2efae0cde9f87ed200" dependencies = [ + "cfg-if", "revm-primitives", "serde", ] @@ -9681,8 +9707,7 @@ dependencies = [ [[package]] name = "revm-precompile" version = "15.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e381060af24b750069a2b2d2c54bba273d84e8f5f9e8026fc9262298e26cc336" +source = "git+https://github.com/greged93/revm.git?branch=scroll-evm-executor/update/v50#5bb5e1caab6b652b07ccfb2efae0cde9f87ed200" dependencies = [ "aurora-engine-modexp", "blst", @@ -9701,8 +9726,7 @@ dependencies = [ [[package]] name = "revm-primitives" version = "14.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3702f132bb484f4f0d0ca4f6fbde3c82cfd745041abbedd6eda67730e1868ef0" +source = "git+https://github.com/greged93/revm.git?branch=scroll-evm-executor/update/v50#5bb5e1caab6b652b07ccfb2efae0cde9f87ed200" dependencies = [ "alloy-eip2930", "alloy-eip7702", @@ -9715,6 +9739,7 @@ dependencies = [ "dyn-clone", "enumn", "hex", + "poseidon-bn254 0.1.0 (git+https://github.com/scroll-tech/poseidon-bn254?branch=master)", "serde", ] @@ -11385,7 +11410,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3637e734239e12ab152cd269302500bd063f37624ee210cd04b4936ed671f3b1" dependencies = [ "cc", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index df8e8b40ebb6..406370a55a48 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -660,3 +660,7 @@ tracy-client = "0.17.3" #op-alloy-network = { git = "https://github.com/alloy-rs/op-alloy", rev = "6a042e7681b1" } #op-alloy-rpc-types = { git = "https://github.com/alloy-rs/op-alloy", rev = "6a042e7681b1" } #op-alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/op-alloy", rev = "6a042e7681b1" } + +[patch.crates-io] +revm = { git = "https://github.com/greged93/revm.git", branch = "scroll-evm-executor/update/v50" } +revm-primitives = { git = "https://github.com/greged93/revm.git", branch = "scroll-evm-executor/update/v50" } diff --git a/crates/primitives-traits/src/account.rs b/crates/primitives-traits/src/account.rs index 03790dd982a8..62c8d09abf78 100644 --- a/crates/primitives-traits/src/account.rs +++ b/crates/primitives-traits/src/account.rs @@ -246,7 +246,15 @@ impl From for revm_primitives::shared::AccountInfo { Self { balance: reth_acc.balance, nonce: reth_acc.nonce, + code_size: reth_acc + .account_extension + .map(|acc| acc.code_size as usize) + .unwrap_or_default(), code_hash: reth_acc.bytecode_hash.unwrap_or(KECCAK_EMPTY), + poseidon_code_hash: reth_acc + .account_extension + .and_then(|acc| acc.poseidon_code_hash) + .unwrap_or(reth_scroll_primitives::POSEIDON_EMPTY), code: None, } } diff --git a/crates/scroll/revm/Cargo.toml b/crates/scroll/revm/Cargo.toml index 7f1d25b9e9a2..8c8671b42e21 100644 --- a/crates/scroll/revm/Cargo.toml +++ b/crates/scroll/revm/Cargo.toml @@ -36,7 +36,7 @@ serde = [ "serde/std", "reth-scroll-primitives/serde" ] -scroll = [] +scroll = ["revm/scroll-poseidon-codehash"] test-utils = ["revm/test-utils"] std = [ "revm/std", diff --git a/crates/scroll/revm/src/test_utils.rs b/crates/scroll/revm/src/test_utils.rs index f6538100dd87..1bd65ea5623f 100644 --- a/crates/scroll/revm/src/test_utils.rs +++ b/crates/scroll/revm/src/test_utils.rs @@ -92,6 +92,10 @@ impl From for AccountInfo { nonce: info.nonce, code_hash: info.code_hash, code: info.code, + #[cfg(feature = "scroll")] + code_size: info.code_size as usize, + #[cfg(feature = "scroll")] + poseidon_code_hash: info.poseidon_code_hash, } } } From dc30358b4a705d14d3ff01c339550149e09e3f1d Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Mon, 2 Dec 2024 18:26:45 +0100 Subject: [PATCH 14/31] introduce `ScrollExecutionStrategyFactory` Signed-off-by: Gregory Edison --- crates/scroll/evm/src/config.rs | 2 +- crates/scroll/evm/src/error.rs | 37 ++++++++------------ crates/scroll/evm/src/execute.rs | 59 +++++++++++++++++++++++++++----- crates/scroll/evm/src/lib.rs | 4 +-- 4 files changed, 67 insertions(+), 35 deletions(-) diff --git a/crates/scroll/evm/src/config.rs b/crates/scroll/evm/src/config.rs index 7155ecdf299e..9fa4ea5e044b 100644 --- a/crates/scroll/evm/src/config.rs +++ b/crates/scroll/evm/src/config.rs @@ -21,7 +21,7 @@ pub struct ScrollEvmConfig { impl ScrollEvmConfig { /// Returns a new instance of [`ScrollEvmConfig`]. - pub fn new(chain_spec: Arc) -> Self { + pub const fn new(chain_spec: Arc) -> Self { Self { chain_spec } } diff --git a/crates/scroll/evm/src/error.rs b/crates/scroll/evm/src/error.rs index 1a9e8786b024..3e697c6c07c1 100644 --- a/crates/scroll/evm/src/error.rs +++ b/crates/scroll/evm/src/error.rs @@ -1,15 +1,12 @@ use derive_more::{Display, From}; -use reth_consensus::ConsensusError; -use reth_evm::execute::{BlockExecutionError, BlockValidationError, ProviderError}; +use reth_evm::execute::BlockExecutionError; /// Execution error for Scroll. #[derive(thiserror::Error, Display, From, Debug)] pub enum ScrollBlockExecutionError { - /// Error occurred at block execution. - BlockExecution(BlockExecutionError), /// Error occurred at a hard fork. - #[display("failed to apply hard fork: {_0}")] - HardFork(HardForkError), + #[display("failed to apply fork: {_0}")] + Fork(ForkError), /// Error occurred at L1 fee computation. #[display("failed to compute l1 fee: {reason}")] L1FeeComputation { @@ -18,6 +15,12 @@ pub enum ScrollBlockExecutionError { }, } +impl From for BlockExecutionError { + fn from(value: ScrollBlockExecutionError) -> Self { + Self::other(value) + } +} + impl ScrollBlockExecutionError { /// Returns a [`ScrollBlockExecutionError`] with the `L1FeeComputation` variant. pub const fn l1_fee(reason: &'static str) -> Self { @@ -25,27 +28,15 @@ impl ScrollBlockExecutionError { } } -/// Scroll hard fork error. +/// Scroll fork error. #[derive(Debug, Display)] -pub enum HardForkError { +pub enum ForkError { /// Error occurred at the Curie hard fork. Curie, } -impl From for ScrollBlockExecutionError { - fn from(value: ProviderError) -> Self { - Self::BlockExecution(value.into()) - } -} - -impl From for ScrollBlockExecutionError { - fn from(value: BlockValidationError) -> Self { - Self::BlockExecution(value.into()) - } -} - -impl From for ScrollBlockExecutionError { - fn from(value: ConsensusError) -> Self { - Self::BlockExecution(value.into()) +impl From for BlockExecutionError { + fn from(value: ForkError) -> Self { + ScrollBlockExecutionError::Fork(value).into() } } diff --git a/crates/scroll/evm/src/execute.rs b/crates/scroll/evm/src/execute.rs index 1094e93be448..207fa699640a 100644 --- a/crates/scroll/evm/src/execute.rs +++ b/crates/scroll/evm/src/execute.rs @@ -1,12 +1,15 @@ //! Implementation of the [`BlockExecutionStrategy`] for Scroll. -use crate::{HardForkError, ScrollBlockExecutionError}; +use crate::{ForkError, ScrollBlockExecutionError, ScrollEvmConfig}; use alloy_consensus::{Header, Transaction}; use alloy_eips::{eip2718::Encodable2718, eip7685::Requests}; use reth_chainspec::{ChainSpec, EthereumHardfork, EthereumHardforks}; use reth_consensus::ConsensusError; use reth_evm::{ - execute::{BlockExecutionStrategy, BlockValidationError, ExecuteOutput, ProviderError}, + execute::{ + BlockExecutionError, BlockExecutionStrategy, BlockExecutionStrategyFactory, + BlockValidationError, ExecuteOutput, ProviderError, + }, ConfigureEvm, ConfigureEvmEnv, }; use reth_primitives::{ @@ -67,7 +70,7 @@ where State: FinalizeExecution, EvmConfig: ConfigureEvm
, { - type Error = ScrollBlockExecutionError; + type Error = BlockExecutionError; fn apply_pre_execution_changes( &mut self, @@ -79,7 +82,7 @@ where if self.chain_spec.fork(EthereumHardfork::Dao).transitions_at_block(block.number) { if let Err(err) = apply_curie_hard_fork(&mut self.state) { tracing::debug!(%err, "failed to apply curie hardfork"); - return Err(HardForkError::Curie.into()); + return Err(ForkError::Curie.into()); }; } @@ -220,13 +223,53 @@ where } } +/// The factory for a [`ScrollExecutionStrategy`]. +#[derive(Clone, Debug)] +pub struct ScrollExecutionStrategyFactory { + /// The chain specification for the [`ScrollExecutionStrategy`]. + chain_spec: Arc, + /// The Evm configuration for the [`ScrollExecutionStrategy`]. + evm_config: EvmConfig, +} + +impl ScrollExecutionStrategyFactory { + /// Returns a new instance of the [`ScrollExecutionStrategyFactory`]. + pub fn new(chain_spec: Arc) -> Self { + let evm_config = ScrollEvmConfig::new(chain_spec.clone()); + Self { chain_spec, evm_config } + } +} + +impl BlockExecutionStrategyFactory for ScrollExecutionStrategyFactory +where + EvmConfig: ConfigureEvm
, +{ + /// Associated strategy type. + type Strategy + Display>> + = ScrollExecutionStrategy + where + State: FinalizeExecution; + + /// Creates a strategy using the give database. + fn create_strategy(&self, db: DB) -> Self::Strategy + where + DB: Database + Display>, + State: FinalizeExecution, + { + let state = + State::builder().with_database(db).without_state_clear().with_bundle_update().build(); + ScrollExecutionStrategy::new(self.chain_spec.clone(), self.evm_config.clone(), state) + } +} + #[cfg(test)] mod tests { use super::*; - use crate::{ScrollEvmConfig, ScrollExecutionStrategy}; + use crate::{ScrollEvmConfig, ScrollExecutionStrategy, ScrollExecutionStrategyFactory}; use reth_chainspec::{ChainSpecBuilder, MIN_TRANSACTION_GAS}; use reth_evm::execute::ExecuteOutput; use reth_primitives::{Block, BlockBody, BlockWithSenders, Receipt, TransactionSigned, TxType}; + use reth_primitives_traits::transaction::signed::SignedTransaction; use reth_scroll_consensus::{ BLOB_SCALAR_SLOT, COMMIT_SCALAR_SLOT, CURIE_L1_GAS_PRICE_ORACLE_BYTECODE, CURIE_L1_GAS_PRICE_ORACLE_STORAGE, IS_CURIE_SLOT, L1_BASE_FEE_SLOT, L1_BLOB_BASE_FEE_SLOT, @@ -242,12 +285,10 @@ mod tests { fn strategy() -> ScrollExecutionStrategy, ScrollEvmConfig> { // TODO (scroll): change this to `ScrollChainSpecBuilder::mainnet()`. let chain_spec = Arc::new(ChainSpecBuilder::mainnet().build()); - let config = ScrollEvmConfig::new(chain_spec.clone()); + let factory = ScrollExecutionStrategyFactory::new(chain_spec); let db = EmptyDBTyped::::new(); - let state = - State::builder().with_database(db).with_bundle_update().without_state_clear().build(); - ScrollExecutionStrategy::new(chain_spec, config, state) + factory.create_strategy(db) } const BLOCK_GAS_LIMIT: u64 = 10_000_000; diff --git a/crates/scroll/evm/src/lib.rs b/crates/scroll/evm/src/lib.rs index 5e734d9d7a04..a190e85d77f9 100644 --- a/crates/scroll/evm/src/lib.rs +++ b/crates/scroll/evm/src/lib.rs @@ -4,8 +4,8 @@ pub use config::ScrollEvmConfig; mod config; -pub use error::{HardForkError, ScrollBlockExecutionError}; +pub use error::{ForkError, ScrollBlockExecutionError}; mod error; -pub use execute::ScrollExecutionStrategy; +pub use execute::{ScrollExecutionStrategy, ScrollExecutionStrategyFactory}; mod execute; From 5c9ec2d597c13a7fcd3731ee4ca087144501855a Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Wed, 4 Dec 2024 11:40:21 +0100 Subject: [PATCH 15/31] feat: patch revm crate to scroll fork Signed-off-by: Gregory Edison --- Cargo.lock | 14 ++++++-------- Cargo.toml | 8 ++++++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5cffd708441b..7571008b9f85 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -170,8 +170,7 @@ dependencies = [ [[package]] name = "alloy-eip2930" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0069cf0642457f87a01a014f6dc29d5d893cd4fd8fddf0c3cdfad1bb3ebafc41" +source = "git+https://github.com/scroll-tech/alloy-eips?branch=v0.3.2#8d5fc83fc257b09510dc8d76561188218d9c0c32" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -3173,8 +3172,7 @@ dependencies = [ [[package]] name = "ff" version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +source = "git+https://github.com/scroll-tech/ff?branch=feat/sp1#244b1098f6be1d19c5fd3f0ec60117ac2940e6ca" dependencies = [ "bitvec", "rand_core 0.6.4", @@ -9664,7 +9662,7 @@ dependencies = [ [[package]] name = "revm" version = "18.0.0" -source = "git+https://github.com/greged93/revm.git?branch=scroll-evm-executor/update/v50#5bb5e1caab6b652b07ccfb2efae0cde9f87ed200" +source = "git+https://github.com/scroll-tech/revm.git?branch=scroll-evm-executor/reth/v50#a740f3d8086395c00fa77fad5474bc4fde5b195d" dependencies = [ "auto_impl", "cfg-if", @@ -9697,7 +9695,7 @@ dependencies = [ [[package]] name = "revm-interpreter" version = "14.0.0" -source = "git+https://github.com/greged93/revm.git?branch=scroll-evm-executor/update/v50#5bb5e1caab6b652b07ccfb2efae0cde9f87ed200" +source = "git+https://github.com/scroll-tech/revm.git?branch=scroll-evm-executor/reth/v50#a740f3d8086395c00fa77fad5474bc4fde5b195d" dependencies = [ "cfg-if", "revm-primitives", @@ -9707,7 +9705,7 @@ dependencies = [ [[package]] name = "revm-precompile" version = "15.0.0" -source = "git+https://github.com/greged93/revm.git?branch=scroll-evm-executor/update/v50#5bb5e1caab6b652b07ccfb2efae0cde9f87ed200" +source = "git+https://github.com/scroll-tech/revm.git?branch=scroll-evm-executor/reth/v50#a740f3d8086395c00fa77fad5474bc4fde5b195d" dependencies = [ "aurora-engine-modexp", "blst", @@ -9726,7 +9724,7 @@ dependencies = [ [[package]] name = "revm-primitives" version = "14.0.0" -source = "git+https://github.com/greged93/revm.git?branch=scroll-evm-executor/update/v50#5bb5e1caab6b652b07ccfb2efae0cde9f87ed200" +source = "git+https://github.com/scroll-tech/revm.git?branch=scroll-evm-executor/reth/v50#a740f3d8086395c00fa77fad5474bc4fde5b195d" dependencies = [ "alloy-eip2930", "alloy-eip7702", diff --git a/Cargo.toml b/Cargo.toml index 406370a55a48..de4b9ba3064e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -662,5 +662,9 @@ tracy-client = "0.17.3" #op-alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/op-alloy", rev = "6a042e7681b1" } [patch.crates-io] -revm = { git = "https://github.com/greged93/revm.git", branch = "scroll-evm-executor/update/v50" } -revm-primitives = { git = "https://github.com/greged93/revm.git", branch = "scroll-evm-executor/update/v50" } +revm = { git = "https://github.com/scroll-tech/revm.git", branch = "scroll-evm-executor/reth/v50" } +revm-primitives = { git = "https://github.com/scroll-tech/revm.git", branch = "scroll-evm-executor/reth/v50" } + +ff = { git = "https://github.com/scroll-tech/ff", branch = "feat/sp1" } + +alloy-eip2930 = { git = "https://github.com/scroll-tech/alloy-eips", branch = "v0.3.2" } From f6293f4c7854ecbe8b8b655a3fa8026136931c06 Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Wed, 4 Dec 2024 11:42:50 +0100 Subject: [PATCH 16/31] fix: lints Signed-off-by: Gregory Edison --- .github/workflows/lint.yml | 2 +- crates/chainspec/Cargo.toml | 2 +- crates/engine/tree/benches/channel_perf.rs | 2 ++ crates/engine/tree/src/tree/root.rs | 2 ++ crates/evm/src/metrics.rs | 2 ++ crates/optimism/payload/Cargo.toml | 2 +- crates/scroll/consensus/Cargo.toml | 5 +++- crates/scroll/consensus/src/lib.rs | 2 ++ crates/scroll/evm/Cargo.toml | 31 +++++++++++++++------- crates/scroll/evm/src/error.rs | 4 +-- crates/scroll/evm/src/execute.rs | 7 ++--- crates/scroll/evm/src/lib.rs | 2 +- crates/scroll/execution/Cargo.toml | 2 +- crates/scroll/execution/src/lib.rs | 2 ++ crates/scroll/revm/src/lib.rs | 2 +- crates/trie/trie/src/state.rs | 2 ++ 16 files changed, 50 insertions(+), 21 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 384761ee5bf6..96c4832ae51a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -158,7 +158,7 @@ jobs: cargo udeps --workspace --lib --examples --tests --benches --all-features --locked \ --exclude "reth-optimism-*" --exclude op-reth --exclude "example-*" --exclude reth \ --exclude reth-e2e-test-utils --exclude reth-ethereum-payload-builder --exclude reth-exex-test-utils \ - --exclude reth-node-ethereum + --exclude reth-node-ethereum --exclude reth-scroll-evm book: name: book diff --git a/crates/chainspec/Cargo.toml b/crates/chainspec/Cargo.toml index 93fae173ac6f..23b81d79c115 100644 --- a/crates/chainspec/Cargo.toml +++ b/crates/chainspec/Cargo.toml @@ -66,4 +66,4 @@ test-utils = [ scroll = [ "reth-trie-common/scroll", "reth-primitives-traits/scroll" -] \ No newline at end of file +] diff --git a/crates/engine/tree/benches/channel_perf.rs b/crates/engine/tree/benches/channel_perf.rs index c1c65e0a68e1..0103733691b1 100644 --- a/crates/engine/tree/benches/channel_perf.rs +++ b/crates/engine/tree/benches/channel_perf.rs @@ -1,6 +1,7 @@ //! Benchmark comparing `std::sync::mpsc` and `crossbeam` channels for `StateRootTask`. #![allow(missing_docs)] +#![allow(clippy::needless_update)] use criterion::{criterion_group, criterion_main, BatchSize, BenchmarkId, Criterion}; use revm_primitives::{ @@ -23,6 +24,7 @@ fn create_bench_state(num_accounts: usize) -> EvmState { nonce: 10, code_hash: B256::random(), code: Default::default(), + ..Default::default() }, storage, status: AccountStatus::Loaded, diff --git a/crates/engine/tree/src/tree/root.rs b/crates/engine/tree/src/tree/root.rs index c760f479e711..208a42e2e5fe 100644 --- a/crates/engine/tree/src/tree/root.rs +++ b/crates/engine/tree/src/tree/root.rs @@ -536,6 +536,7 @@ fn update_sparse_trie( #[cfg(test)] mod tests { + #![allow(clippy::needless_update)] use super::*; use reth_primitives::{Account as RethAccount, StorageEntry}; use reth_provider::{ @@ -594,6 +595,7 @@ mod tests { nonce: rng.gen::(), code_hash: KECCAK_EMPTY, code: Some(Default::default()), + ..Default::default() }, storage, status: AccountStatus::Touched, diff --git a/crates/evm/src/metrics.rs b/crates/evm/src/metrics.rs index 3464bb96f4c7..6f1b0cab47cc 100644 --- a/crates/evm/src/metrics.rs +++ b/crates/evm/src/metrics.rs @@ -143,6 +143,7 @@ impl ExecutorMetrics { #[cfg(test)] mod tests { + #![allow(clippy::needless_update)] use super::*; use alloy_eips::eip7685::Requests; use metrics_util::debugging::{DebugValue, DebuggingRecorder, Snapshotter}; @@ -261,6 +262,7 @@ mod tests { nonce: 10, code_hash: B256::random(), code: Default::default(), + ..Default::default() }, storage, status: AccountStatus::Loaded, diff --git a/crates/optimism/payload/Cargo.toml b/crates/optimism/payload/Cargo.toml index b73dcfc5926f..8873da14605e 100644 --- a/crates/optimism/payload/Cargo.toml +++ b/crates/optimism/payload/Cargo.toml @@ -60,4 +60,4 @@ optimism = [ "reth-execution-types/optimism", "reth-optimism-consensus/optimism" ] -scroll = [] +scroll = [] \ No newline at end of file diff --git a/crates/scroll/consensus/Cargo.toml b/crates/scroll/consensus/Cargo.toml index aed40406f1a2..beec5c27120d 100644 --- a/crates/scroll/consensus/Cargo.toml +++ b/crates/scroll/consensus/Cargo.toml @@ -13,7 +13,10 @@ workspace = true [dependencies] # revm -revm = { workspace = true, features = ["scroll"] } +revm.workspace = true [dev-dependencies] eyre.workspace = true + +[features] +scroll = ["revm/scroll"] diff --git a/crates/scroll/consensus/src/lib.rs b/crates/scroll/consensus/src/lib.rs index ad09850189bd..2d23c5e40021 100644 --- a/crates/scroll/consensus/src/lib.rs +++ b/crates/scroll/consensus/src/lib.rs @@ -1,5 +1,7 @@ //! Scroll consensus implementation. +#![cfg(feature = "scroll")] + pub use curie::{ apply_curie_hard_fork, BLOB_SCALAR_SLOT, COMMIT_SCALAR_SLOT, CURIE_L1_GAS_PRICE_ORACLE_BYTECODE, CURIE_L1_GAS_PRICE_ORACLE_STORAGE, IS_CURIE_SLOT, diff --git a/crates/scroll/evm/Cargo.toml b/crates/scroll/evm/Cargo.toml index 79b93d0ca6a2..79dfef9d76e7 100644 --- a/crates/scroll/evm/Cargo.toml +++ b/crates/scroll/evm/Cargo.toml @@ -13,16 +13,16 @@ workspace = true [dependencies] # reth -reth-chainspec = { workspace = true, features = ["scroll"] } +reth-chainspec.workspace = true reth-consensus.workspace = true reth-ethereum-consensus.workspace = true -reth-evm = { workspace = true, features = ["scroll"] } -reth-primitives = { workspace = true, features = ["scroll"] } -reth-primitives-traits = { workspace = true, features = ["scroll"] } -reth-revm = { workspace = true, features = ["scroll"] } +reth-evm.workspace = true +reth-primitives.workspace = true +reth-primitives-traits.workspace = true +reth-revm.workspace = true # revm -revm = { workspace = true, features = ["scroll", "optional_no_base_fee"] } +revm = { workspace = true, features = ["optional_no_base_fee"] } # alloy alloy-consensus.workspace = true @@ -30,7 +30,7 @@ alloy-eips.workspace = true # scroll reth-scroll-consensus.workspace = true -reth-scroll-execution = { workspace = true, features = ["scroll"] } +reth-scroll-execution.workspace = true # misc auto_impl.workspace = true @@ -40,8 +40,21 @@ tracing.workspace = true [dev-dependencies] eyre.workspace = true -reth-scroll-execution = { workspace = true, features = ["scroll", "test-utils"] } +reth-scroll-execution = { workspace = true, features = ["test-utils"] } reth-scroll-primitives.workspace = true [features] -optimism = [] +optimism = [ + "reth-primitives/optimism", + "revm/optimism" +] +scroll = [ + "reth-chainspec/scroll", + "reth-evm/scroll", + "reth-primitives/scroll", + "reth-primitives-traits/scroll", + "reth-revm/scroll", + "reth-scroll-consensus/scroll", + "reth-scroll-execution/scroll", + "revm/scroll" +] diff --git a/crates/scroll/evm/src/error.rs b/crates/scroll/evm/src/error.rs index 3e697c6c07c1..8901aa4fe2ec 100644 --- a/crates/scroll/evm/src/error.rs +++ b/crates/scroll/evm/src/error.rs @@ -4,7 +4,7 @@ use reth_evm::execute::BlockExecutionError; /// Execution error for Scroll. #[derive(thiserror::Error, Display, From, Debug)] pub enum ScrollBlockExecutionError { - /// Error occurred at a hard fork. + /// Error occurred at fork transition. #[display("failed to apply fork: {_0}")] Fork(ForkError), /// Error occurred at L1 fee computation. @@ -31,7 +31,7 @@ impl ScrollBlockExecutionError { /// Scroll fork error. #[derive(Debug, Display)] pub enum ForkError { - /// Error occurred at the Curie hard fork. + /// Error occurred at Curie fork. Curie, } diff --git a/crates/scroll/evm/src/execute.rs b/crates/scroll/evm/src/execute.rs index 207fa699640a..1a9d0d2c6f52 100644 --- a/crates/scroll/evm/src/execute.rs +++ b/crates/scroll/evm/src/execute.rs @@ -32,6 +32,7 @@ use std::{ #[derive(Debug)] pub struct ScrollExecutionStrategy { /// Chain specification. + // TODO (scroll): update to the Scroll chain spec chain_spec: Arc, /// Evm configuration. evm_config: EvmConfig, @@ -137,7 +138,6 @@ where hash: transaction.recalculate_hash(), error: Box::new(err.map_db_err(|e| e.into())), })?; - evm.db_mut().commit(state); let l1_fee = if transaction.is_l1_message() { @@ -227,6 +227,7 @@ where #[derive(Clone, Debug)] pub struct ScrollExecutionStrategyFactory { /// The chain specification for the [`ScrollExecutionStrategy`]. + // TODO (scroll): update to the Scroll chain spec chain_spec: Arc, /// The Evm configuration for the [`ScrollExecutionStrategy`]. evm_config: EvmConfig, @@ -304,7 +305,6 @@ mod tests { } fn transaction(typ: TxType, gas_limit: u64) -> TransactionSigned { - let pk = B256::random(); let transaction = match typ { TxType::Eip4844 => reth_primitives::Transaction::Eip4844(alloy_consensus::TxEip4844 { gas_limit, @@ -325,8 +325,9 @@ mod tests { ..Default::default() }), }; + let pk = B256::random(); let signature = reth_primitives::sign_message(pk, transaction.signature_hash()).unwrap(); - reth_primitives::TransactionSigned::new_unhashed(transaction, signature) + TransactionSigned::new_unhashed(transaction, signature) } #[test] diff --git a/crates/scroll/evm/src/lib.rs b/crates/scroll/evm/src/lib.rs index a190e85d77f9..680a4f5b9fef 100644 --- a/crates/scroll/evm/src/lib.rs +++ b/crates/scroll/evm/src/lib.rs @@ -1,5 +1,5 @@ //! Scroll evm execution implementation. -#![cfg(not(feature = "optimism"))] +#![cfg(all(feature = "scroll", not(feature = "optimism")))] pub use config::ScrollEvmConfig; mod config; diff --git a/crates/scroll/execution/Cargo.toml b/crates/scroll/execution/Cargo.toml index a333d592778c..ad6a369a9c05 100644 --- a/crates/scroll/execution/Cargo.toml +++ b/crates/scroll/execution/Cargo.toml @@ -23,4 +23,4 @@ scroll = [ "reth-scroll-storage/scroll", "reth-revm/scroll" ] -test-utils = ["reth-revm/test-utils"] \ No newline at end of file +test-utils = ["reth-revm/test-utils"] diff --git a/crates/scroll/execution/src/lib.rs b/crates/scroll/execution/src/lib.rs index d787a8c2c7dc..5328229afe0f 100644 --- a/crates/scroll/execution/src/lib.rs +++ b/crates/scroll/execution/src/lib.rs @@ -1,4 +1,6 @@ //! Scroll execution related implementations. +#![warn(unused_crate_dependencies)] + pub use finalize::FinalizeExecution; mod finalize; diff --git a/crates/scroll/revm/src/lib.rs b/crates/scroll/revm/src/lib.rs index 750d8fdd1dec..0e918bb35109 100644 --- a/crates/scroll/revm/src/lib.rs +++ b/crates/scroll/revm/src/lib.rs @@ -7,7 +7,7 @@ pub mod states; #[cfg(feature = "test-utils")] mod test_utils; -#[cfg(feature = "optimism")] +#[cfg(all(feature = "optimism", not(feature = "scroll")))] pub use revm::{primitives::OptimismFields, L1BlockInfo, L1_BLOCK_CONTRACT}; pub use revm::{ diff --git a/crates/trie/trie/src/state.rs b/crates/trie/trie/src/state.rs index d2536f41d51d..943b1372b11e 100644 --- a/crates/trie/trie/src/state.rs +++ b/crates/trie/trie/src/state.rs @@ -353,6 +353,7 @@ impl HashedStorageSorted { #[cfg(test)] mod tests { + #![allow(clippy::needless_update)] use super::*; use alloy_primitives::{Address, Bytes}; use revm::{ @@ -497,6 +498,7 @@ mod tests { nonce: 5, code_hash: B256::random(), code: None, + ..Default::default() }; let mut storage = PlainStorage::default(); From 178979e412c85916b4f1650ba8b078bda43c8b16 Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Wed, 4 Dec 2024 15:44:54 +0100 Subject: [PATCH 17/31] fix: deny Signed-off-by: Gregory Edison --- deny.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/deny.toml b/deny.toml index 6dc51dba0a93..fe19655d7321 100644 --- a/deny.toml +++ b/deny.toml @@ -100,5 +100,8 @@ allow-git = [ "https://github.com/paradigmxyz/revm-inspectors", "https://github.com/scroll-tech/bn254", "https://github.com/scroll-tech/sp1-intrinsics", - "https://github.com/scroll-tech/poseidon-bn254" + "https://github.com/scroll-tech/poseidon-bn254", + "https://github.com/scroll-tech/alloy-eips", + "https://github.com/scroll-tech/ff", + "https://github.com/scroll-tech/revm.git" ] From da4631e2a9d4d94cf922eb917ca7ac4744ff829c Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Sat, 7 Dec 2024 15:05:35 +0100 Subject: [PATCH 18/31] answer comments Signed-off-by: Gregory Edison --- Cargo.lock | 2 +- crates/scroll/consensus/src/curie.rs | 29 +++++++++++++++++++++++++++- crates/scroll/consensus/src/lib.rs | 2 +- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c82e898e0324..5e9a99e1b6e5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9194,7 +9194,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "auto_impl", - "derive_more 1.0.0", + "derive_more", "eyre", "reth-chainspec", "reth-consensus", diff --git a/crates/scroll/consensus/src/curie.rs b/crates/scroll/consensus/src/curie.rs index 4181092df61c..6824b11027e0 100644 --- a/crates/scroll/consensus/src/curie.rs +++ b/crates/scroll/consensus/src/curie.rs @@ -1,3 +1,22 @@ +//! Curie fork transition for Scroll. +//! +//! On block 7096836, Scroll performed a transition to the Curie fork state, which brought various +//! changes to the protocol: +//! 1. Fee reduction cost thanks to the use of compressed blobs on the L1. +//! 2. Modified [EIP-1559](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md) pricing +//! model along with support for EIP-1559 and EIP-2930 transactions. +//! 3. Support for `MLOAD`, `TLOAD` and `MCOPY` ([EIP-1153](https://eips.ethereum.org/EIPS/eip-1153) +//! and [EIP-5656](https://eips.ethereum.org/EIPS/eip-5656)). +//! 4. Dynamic block time. +//! +//! Compressed blobs allowed for more transactions to be stored in each blob, reducing the DA cost +//! per transactions. Accordingly, the L1 gas oracle contract's bytecode was updated in order to +//! reflect the update in the DA costs: +//! - original formula: `(l1GasUsed(txRlp) + overhead) * l1BaseFee * scalar`. +//! - updated formula: `l1BaseFee * commitScalar + len(txRlp) * l1BlobBaseFee * blobScalar`. +//! +//! More details on the Curie update: + use revm::{ db::states::StorageSlot, primitives::{address, bytes, Address, Bytecode, Bytes, U256}, @@ -6,6 +25,7 @@ use revm::{ }; /// L1 gas price oracle address. +/// pub const L1_GAS_PRICE_ORACLE_ADDRESS: Address = address!("5300000000000000000000000000000000000002"); /// Bytecode of L1 gas price oracle at Curie transition. @@ -34,12 +54,19 @@ pub const BLOB_SCALAR_SLOT: U256 = U256::from_limbs([7, 0, 0, 0]); /// L1 gas price oracle "is Curie" slot. Added in the Curie fork. pub const IS_CURIE_SLOT: U256 = U256::from_limbs([8, 0, 0, 0]); +/// The initial blob base fee used by the oracle contract. const INITIAL_L1_BLOB_BASE_FEE: U256 = U256::from_limbs([1, 0, 0, 0]); +/// The initial commit scalar used by the oracle contract. const INITIAL_COMMIT_SCALAR: U256 = U256::from_limbs([230759955285, 0, 0, 0]); +/// The initial blob scalar used by the oracle contract. const INITIAL_BLOB_SCALAR: U256 = U256::from_limbs([417565260, 0, 0, 0]); +/// Curie slot is set to 1 (true) after the Curie block fork. const IS_CURIE: U256 = U256::from_limbs([1, 0, 0, 0]); -/// Applies the Scroll Curie hard fork to the state. +/// Applies the Scroll Curie hard fork to the state: +/// - Updates the L1 oracle contract bytecode to reflect the DA cost reduction. +/// - Sets the initial blob base fee, commit and blob scalar and sets the `isCurie` slot to 1 +/// (true). pub fn apply_curie_hard_fork(state: &mut State) -> Result<(), DB::Error> { let oracle = state.load_cache_account(L1_GAS_PRICE_ORACLE_ADDRESS)?; diff --git a/crates/scroll/consensus/src/lib.rs b/crates/scroll/consensus/src/lib.rs index 2d23c5e40021..6d4e4562a5bd 100644 --- a/crates/scroll/consensus/src/lib.rs +++ b/crates/scroll/consensus/src/lib.rs @@ -2,10 +2,10 @@ #![cfg(feature = "scroll")] +mod curie; pub use curie::{ apply_curie_hard_fork, BLOB_SCALAR_SLOT, COMMIT_SCALAR_SLOT, CURIE_L1_GAS_PRICE_ORACLE_BYTECODE, CURIE_L1_GAS_PRICE_ORACLE_STORAGE, IS_CURIE_SLOT, L1_BASE_FEE_SLOT, L1_BLOB_BASE_FEE_SLOT, L1_GAS_PRICE_ORACLE_ADDRESS, OVER_HEAD_SLOT, SCALAR_SLOT, }; -mod curie; From 66e61a18b8bc8bd7426849a6c3d836173b9be578 Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Mon, 9 Dec 2024 09:49:54 +0100 Subject: [PATCH 19/31] fill `TxEnv.rlp_bytes` only for !is_l1_message Signed-off-by: Gregory Edison --- crates/scroll/evm/src/execute.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/scroll/evm/src/execute.rs b/crates/scroll/evm/src/execute.rs index 1a9d0d2c6f52..7cacf7b81b54 100644 --- a/crates/scroll/evm/src/execute.rs +++ b/crates/scroll/evm/src/execute.rs @@ -123,13 +123,13 @@ where self.evm_config.fill_tx_env(evm.tx_mut(), transaction, *sender); if transaction.is_l1_message() { evm.context.evm.env.cfg.disable_base_fee = true; // disable base fee for l1 msg + } else { + // RLP encode the transaction following eip 2718 + let mut buf = BytesMut::with_capacity(transaction.encode_2718_len()); + transaction.encode_2718(&mut buf); + let transaction_rlp_bytes = buf.freeze(); + evm.context.evm.env.tx.scroll.rlp_bytes = Some(transaction_rlp_bytes.into()); } - - // RLP encode the transaction following eip 2718 - let mut buf = BytesMut::with_capacity(transaction.encode_2718_len()); - transaction.encode_2718(&mut buf); - let transaction_rlp_bytes = buf.freeze(); - evm.context.evm.env.tx.scroll.rlp_bytes = Some(transaction_rlp_bytes.into()); evm.context.evm.env.tx.scroll.is_l1_msg = transaction.is_l1_message(); // execute the transaction and commit the result to the database From 1e6724e789ae866fd7047d620bdd97c9165b2149 Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Mon, 9 Dec 2024 09:50:05 +0100 Subject: [PATCH 20/31] lints Signed-off-by: Gregory Edison --- crates/primitives-traits/src/account.rs | 2 +- crates/scroll/execution/src/finalize.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/primitives-traits/src/account.rs b/crates/primitives-traits/src/account.rs index eb5f496997a0..57cfc2a531f5 100644 --- a/crates/primitives-traits/src/account.rs +++ b/crates/primitives-traits/src/account.rs @@ -273,7 +273,7 @@ impl From for revm_primitives::shared::AccountInfo { poseidon_code_hash: reth_acc .account_extension .and_then(|acc| acc.poseidon_code_hash) - .unwrap_or(reth_scroll_primitives::POSEIDON_EMPTY), + .unwrap_or(reth_scroll_primitives::poseidon::POSEIDON_EMPTY), code: None, } } diff --git a/crates/scroll/execution/src/finalize.rs b/crates/scroll/execution/src/finalize.rs index 86d678e9073b..940c19d06c3c 100644 --- a/crates/scroll/execution/src/finalize.rs +++ b/crates/scroll/execution/src/finalize.rs @@ -1,10 +1,13 @@ #![allow(clippy::useless_conversion)] +use reth_revm::{database::EvmStateProvider, revm::State}; + +#[cfg(feature = "test-utils")] +use reth_revm::EmptyDBTyped; #[cfg(any(not(feature = "scroll"), feature = "test-utils"))] use reth_revm::{ cached::CachedReadsDbMut, database::StateProviderDatabase, revm::CacheDB, DatabaseRef, }; -use reth_revm::{database::EvmStateProvider, revm::State, EmptyDBTyped}; #[cfg(feature = "scroll")] use reth_scroll_storage::ScrollStateProviderDatabase; From 8b9487b37fa879cb629c10f338e55eab41d8addd Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Mon, 9 Dec 2024 09:50:22 +0100 Subject: [PATCH 21/31] switch revm to scroll default branch Signed-off-by: Gregory Edison --- Cargo.lock | 448 ++++++++++++++++++++++++++++++++--------------------- Cargo.toml | 9 +- 2 files changed, 280 insertions(+), 177 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7b42094346a3..ce1aea752432 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -110,7 +110,7 @@ version = "0.1.48" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0161082e0edd9013d23083465cc04b20e44b7a15646d36ba7b0cdb7cd6fe18f" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "arbitrary", "num_enum", @@ -126,7 +126,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae09ffd7c29062431dd86061deefe4e3c6f07fa0d674930095f8dcedb0baf02c" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "alloy-serde", "arbitrary", @@ -145,10 +145,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66430a72d5bf5edead101c8c2f0a24bada5ec9f3cf9909b3e08b6d6899b4803e" dependencies = [ "alloy-dyn-abi", - "alloy-json-abi", + "alloy-json-abi 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-network", "alloy-network-primitives", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-provider", "alloy-rpc-types-eth", "alloy-sol-types", @@ -164,9 +164,9 @@ version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80759b3f57b3b20fa7cd8fef6479930fc95461b58ff8adea6e87e618449c8a1d" dependencies = [ - "alloy-json-abi", - "alloy-primitives", - "alloy-sol-type-parser", + "alloy-json-abi 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-sol-type-parser 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-sol-types", "const-hex", "derive_more", @@ -179,9 +179,9 @@ dependencies = [ [[package]] name = "alloy-eip2930" version = "0.1.0" -source = "git+https://github.com/scroll-tech/alloy-eips?branch=v0.3.2#8d5fc83fc257b09510dc8d76561188218d9c0c32" +source = "git+https://github.com/scroll-tech/alloy-eips?branch=v0.4.2#92b2892d7b5b325c1f2f3e90a5befadbb5e610d4" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "arbitrary", "rand 0.8.5", @@ -191,10 +191,9 @@ dependencies = [ [[package]] name = "alloy-eip7702" version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c986539255fb839d1533c128e190e557e52ff652c9ef62939e233a81dd93f7e" +source = "git+https://github.com/scroll-tech/alloy-eips?branch=v0.4.2#92b2892d7b5b325c1f2f3e90a5befadbb5e610d4" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "arbitrary", "derive_more", @@ -212,7 +211,7 @@ checksum = "5b6aa3961694b30ba53d41006131a2fca3bdab22e4c344e46db2c639e7c2dfdd" dependencies = [ "alloy-eip2930", "alloy-eip7702", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "alloy-serde", "arbitrary", @@ -231,7 +230,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e53f7877ded3921d18a0a9556d55bedf84535567198c9edab2aa23106da91855" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-serde", "serde", ] @@ -242,8 +241,19 @@ version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac4b22b3e51cac09fd2adfcc73b55f447b4df669f983c13f7894ec82b607c63f" dependencies = [ - "alloy-primitives", - "alloy-sol-type-parser", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-sol-type-parser 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-json-abi" +version = "0.8.14" +source = "git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14#26fc0b5215544e71bc730e5e306fdb958cf30154" +dependencies = [ + "alloy-primitives 0.8.14 (git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14)", + "alloy-sol-type-parser 0.8.14 (git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14)", "serde", "serde_json", ] @@ -254,7 +264,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3694b7e480728c0b3e228384f223937f14c10caef5a4c766021190fc8f283d35" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-sol-types", "serde", "serde_json", @@ -272,7 +282,7 @@ dependencies = [ "alloy-eips", "alloy-json-rpc", "alloy-network-primitives", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-eth", "alloy-serde", "alloy-signer", @@ -293,7 +303,7 @@ checksum = "df9f3e281005943944d15ee8491534a1c7b3cbf7a7de26f8c433b842b93eb5f9" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-serde", "serde", ] @@ -305,7 +315,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9805d126f24be459b958973c0569c73e1aadd27d4535eee82b2b6764aa03616" dependencies = [ "alloy-genesis", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "k256", "rand 0.8.5", "serde_json", @@ -347,6 +357,33 @@ dependencies = [ "tiny-keccak", ] +[[package]] +name = "alloy-primitives" +version = "0.8.14" +source = "git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14#26fc0b5215544e71bc730e5e306fdb958cf30154" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more", + "foldhash", + "hashbrown 0.15.2", + "hex-literal", + "indexmap 2.7.0", + "itoa", + "k256", + "keccak-asm", + "paste", + "proptest", + "rand 0.8.5", + "ruint", + "rustc-hash 2.1.0", + "serde", + "sha3", + "tiny-keccak", +] + [[package]] name = "alloy-provider" version = "0.6.4" @@ -359,7 +396,7 @@ dependencies = [ "alloy-json-rpc", "alloy-network", "alloy-network-primitives", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-pubsub", "alloy-rpc-client", "alloy-rpc-types-admin", @@ -395,7 +432,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90f1f34232f77341076541c405482e4ae12f0ee7153d8f9969fc1691201b2247" dependencies = [ "alloy-json-rpc", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-transport", "bimap", "futures", @@ -436,7 +473,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "374dbe0dc3abdc2c964f36b3d3edf9cdb3db29d16bda34aa123f03d810bec1dd" dependencies = [ "alloy-json-rpc", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-pubsub", "alloy-transport", "alloy-transport-http", @@ -460,7 +497,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c74832aa474b670309c20fffc2a869fa141edab7c79ff7963fad0a08de60bae1" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-engine", "alloy-rpc-types-eth", "alloy-serde", @@ -474,7 +511,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bfd9b2cc3a1985f1f6da5afc41120256f9f9316fcd89e054cea99dbb10172f6" dependencies = [ "alloy-genesis", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "serde", "serde_json", ] @@ -485,7 +522,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ca97963132f78ddfc60e43a017348e6d52eea983925c23652f5b330e8e02291" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-eth", "alloy-serde", "serde", @@ -498,7 +535,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "922fa76678d2f9f07ea1b19309b5cfbf244c6029dcba3515227b515fdd6ed4a7" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-engine", "serde", "serde_with", @@ -511,7 +548,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba2253bee958658ebd614c07a61c40580e09dd1fad3f017684314442332ab753" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "serde", ] @@ -523,7 +560,7 @@ checksum = "3f56294dce86af23ad6ee8df46cf8b0d292eb5d1ff67dc88a0886051e32b1faf" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "alloy-serde", "derive_more", @@ -545,7 +582,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-network-primitives", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "alloy-serde", "alloy-sol-types", @@ -564,7 +601,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8647f8135ee3d5de1cf196706c905c05728a4e38bb4a5b61a7214bd1ba8f60a6" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-serde", "serde", "serde_json", @@ -576,7 +613,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ecd8b4877ef520c138af702097477cdd19504a8e1e4675ba37e92ba40f2d3c6f" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-eth", "alloy-serde", "serde", @@ -590,7 +627,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d4ab49acf90a71f7fb894dc5fd485f1f07a1e348966c714c4d1e0b7478850a8" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-eth", "alloy-serde", "serde", @@ -602,7 +639,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dfa4a7ccf15b2492bb68088692481fd6b2604ccbee1d0d6c44c21427ae4df83" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "arbitrary", "serde", "serde_json", @@ -614,7 +651,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e10aec39d60dc27edcac447302c7803d2371946fb737245320a05b78eb2fafd" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "async-trait", "auto_impl", "elliptic-curve", @@ -630,7 +667,7 @@ checksum = "d8396f6dff60700bc1d215ee03d86ff56de268af96e2bf833a14d0bafcab9882" dependencies = [ "alloy-consensus", "alloy-network", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-signer", "async-trait", "coins-bip32", @@ -646,8 +683,21 @@ version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3bfd7853b65a2b4f49629ec975fee274faf6dff15ab8894c620943398ef283c0" dependencies = [ - "alloy-sol-macro-expander", - "alloy-sol-macro-input", + "alloy-sol-macro-expander 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-sol-macro-input 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "alloy-sol-macro" +version = "0.8.14" +source = "git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14#26fc0b5215544e71bc730e5e306fdb958cf30154" +dependencies = [ + "alloy-sol-macro-expander 0.8.14 (git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14)", + "alloy-sol-macro-input 0.8.14 (git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14)", "proc-macro-error2", "proc-macro2", "quote", @@ -660,7 +710,7 @@ version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82ec42f342d9a9261699f8078e57a7a4fda8aaa73c1a212ed3987080e6a9cd13" dependencies = [ - "alloy-sol-macro-input", + "alloy-sol-macro-input 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "const-hex", "heck 0.5.0", "indexmap 2.7.0", @@ -668,7 +718,24 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.90", - "syn-solidity", + "syn-solidity 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "tiny-keccak", +] + +[[package]] +name = "alloy-sol-macro-expander" +version = "0.8.14" +source = "git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14#26fc0b5215544e71bc730e5e306fdb958cf30154" +dependencies = [ + "alloy-sol-macro-input 0.8.14 (git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14)", + "const-hex", + "heck 0.5.0", + "indexmap 2.7.0", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.90", + "syn-solidity 0.8.14 (git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14)", "tiny-keccak", ] @@ -684,7 +751,21 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.90", - "syn-solidity", + "syn-solidity 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "alloy-sol-macro-input" +version = "0.8.14" +source = "git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14#26fc0b5215544e71bc730e5e306fdb958cf30154" +dependencies = [ + "const-hex", + "dunce", + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.90", + "syn-solidity 0.8.14 (git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14)", ] [[package]] @@ -697,15 +778,23 @@ dependencies = [ "winnow", ] +[[package]] +name = "alloy-sol-type-parser" +version = "0.8.14" +source = "git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14#26fc0b5215544e71bc730e5e306fdb958cf30154" +dependencies = [ + "serde", + "winnow", +] + [[package]] name = "alloy-sol-types" version = "0.8.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9dc0fffe397aa17628160e16b89f704098bf3c9d74d5d369ebc239575936de5" +source = "git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14#26fc0b5215544e71bc730e5e306fdb958cf30154" dependencies = [ - "alloy-json-abi", - "alloy-primitives", - "alloy-sol-macro", + "alloy-json-abi 0.8.14 (git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14)", + "alloy-primitives 0.8.14 (git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14)", + "alloy-sol-macro 0.8.14 (git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14)", "const-hex", "serde", ] @@ -788,7 +877,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a5fd8fea044cc9a8c8a50bb6f28e31f0385d820f116c5b98f6f4e55d6e5590b" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "arbitrary", "arrayvec", @@ -2633,7 +2722,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "rayon", "reth-chainspec", @@ -2768,7 +2857,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70cbccfccf81d67bff0ab36e591fa536c8a935b078a7b0e58c1d00d418332fc9" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "hex", "serde", "serde_derive", @@ -2781,7 +2870,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "036c84bd29bff35e29bbee3c8fc0e2fb95db12b6f2f3cae82a827fbc97256f3a" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "ethereum_serde_utils", "itertools 0.13.0", "serde", @@ -2813,7 +2902,7 @@ name = "example-beacon-api-sidecar-fetcher" version = "0.1.0" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-beacon", "clap", "eyre", @@ -2844,7 +2933,7 @@ dependencies = [ name = "example-bsc-p2p" version = "0.0.0" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "reth-chainspec", "reth-discv4", "reth-network", @@ -2864,7 +2953,7 @@ version = "0.0.0" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-sol-macro", + "alloy-sol-macro 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-sol-types", "eyre", "reth", @@ -2881,7 +2970,7 @@ name = "example-custom-dev-node" version = "0.0.0" dependencies = [ "alloy-genesis", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "eyre", "futures-util", "reth", @@ -2898,7 +2987,7 @@ version = "0.0.0" dependencies = [ "alloy-eips", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types", "eyre", "reth", @@ -2922,7 +3011,7 @@ version = "0.0.0" dependencies = [ "alloy-consensus", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "eyre", "reth", "reth-chainspec", @@ -2940,7 +3029,7 @@ name = "example-custom-inspector" version = "0.0.0" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-eth", "clap", "futures-util", @@ -2964,7 +3053,7 @@ name = "example-custom-payload-builder" version = "0.0.0" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "eyre", "futures-util", "reth", @@ -2982,7 +3071,7 @@ dependencies = [ name = "example-custom-rlpx-subprotocol" version = "0.0.0" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "eyre", "futures", "rand 0.8.5", @@ -3000,7 +3089,7 @@ dependencies = [ name = "example-db-access" version = "0.0.0" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-eth", "eyre", "reth-chainspec", @@ -3075,7 +3164,7 @@ dependencies = [ name = "example-polygon-p2p" version = "0.0.0" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "reth-chainspec", "reth-discv4", "reth-network", @@ -3108,7 +3197,7 @@ version = "0.0.0" dependencies = [ "alloy-consensus", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "eyre", "parking_lot", "reth", @@ -3126,7 +3215,7 @@ dependencies = [ name = "example-txpool-tracing" version = "0.0.0" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-trace", "clap", "futures-util", @@ -4962,7 +5051,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc8342aaf4a3c2a1b2612bdf5cd1aa423918e0f1a0d9242aaeefbffd49457cad" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "async-sse", "bytes", "futures-util", @@ -5372,7 +5461,7 @@ checksum = "fce158d886815d419222daa67fcdf949a34f7950653a4498ebeb4963331f70ed" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "alloy-serde", "arbitrary", @@ -5390,7 +5479,7 @@ checksum = "2734e9a65efb90fe4520303f984c124766b7d2f2e5dd51cbe54d6269c85a3c91" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-sol-types", "serde", "serde_repr", @@ -5405,7 +5494,7 @@ checksum = "87e4aef8ed017004a176ab1de49df419f59c0fb4a6ce3b693a10fe099fe1afe7" dependencies = [ "alloy-consensus", "alloy-network", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-eth", "alloy-signer", "op-alloy-consensus", @@ -5421,7 +5510,7 @@ dependencies = [ "alloc-no-stdlib", "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "alloy-serde", "async-trait", @@ -5444,7 +5533,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-network-primitives", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-eth", "alloy-serde", "arbitrary", @@ -5461,7 +5550,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "864dbd5511ef4ef00b6c2c980739259b25b24048007b7751ca0069b30b1e3fee" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-engine", "alloy-serde", "derive_more", @@ -6445,7 +6534,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "alloy-rpc-types", "aquamarine", @@ -6516,7 +6605,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "futures-core", "futures-util", @@ -6545,7 +6634,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-engine", "assert_matches", "futures", @@ -6600,7 +6689,7 @@ version = "1.1.2" dependencies = [ "alloy-eips", "alloy-json-rpc", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-provider", "alloy-pubsub", "alloy-rpc-client", @@ -6637,7 +6726,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "aquamarine", "assert_matches", "linked_hash_set", @@ -6675,7 +6764,7 @@ name = "reth-blockchain-tree-api" version = "1.1.2" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "reth-consensus", "reth-execution-errors", "reth-primitives", @@ -6689,7 +6778,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-signer", "alloy-signer-local", "derive_more", @@ -6720,7 +6809,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "alloy-trie", "auto_impl", @@ -6753,7 +6842,7 @@ dependencies = [ "ahash", "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "arbitrary", "backon", @@ -6827,7 +6916,7 @@ name = "reth-cli-util" version = "1.1.2" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if", "eyre", "libc", @@ -6847,7 +6936,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-trie", "arbitrary", "bytes", @@ -6877,7 +6966,7 @@ dependencies = [ name = "reth-config" version = "1.1.2" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "eyre", "humantime-serde", "reth-network-peers", @@ -6895,7 +6984,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "auto_impl", "derive_more", "reth-primitives", @@ -6908,7 +6997,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "mockall", "rand 0.8.5", "reth-chainspec", @@ -6925,7 +7014,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-provider", "alloy-rpc-types-engine", "alloy-rpc-types-eth", @@ -6947,7 +7036,7 @@ name = "reth-db" version = "1.1.2" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "arbitrary", "assert_matches", "bytes", @@ -6990,7 +7079,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "arbitrary", "bytes", "derive_more", @@ -7018,7 +7107,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "boyer-moore-magiclen", "eyre", "reth-chainspec", @@ -7047,7 +7136,7 @@ name = "reth-db-models" version = "1.1.2" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "arbitrary", "bytes", "modular-bitfield", @@ -7063,7 +7152,7 @@ dependencies = [ name = "reth-discv4" version = "1.1.2" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "assert_matches", "discv5", @@ -7090,7 +7179,7 @@ dependencies = [ name = "reth-discv5" version = "1.1.2" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "derive_more", "discv5", @@ -7115,7 +7204,7 @@ name = "reth-dns-discovery" version = "1.1.2" dependencies = [ "alloy-chains", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "data-encoding", "enr", @@ -7144,7 +7233,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "assert_matches", "futures", @@ -7184,7 +7273,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-network", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "alloy-rpc-types-engine", "alloy-rpc-types-eth", @@ -7230,7 +7319,7 @@ name = "reth-ecies" version = "1.1.2" dependencies = [ "aes", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "block-padding", "byteorder", @@ -7259,7 +7348,7 @@ dependencies = [ name = "reth-engine-local" version = "1.1.2" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-engine", "eyre", "futures-util", @@ -7291,7 +7380,7 @@ name = "reth-engine-primitives" version = "1.1.2" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-engine", "futures", "reth-errors", @@ -7340,7 +7429,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "alloy-rpc-types-engine", "assert_matches", @@ -7396,7 +7485,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-engine", "eyre", "futures", @@ -7441,7 +7530,7 @@ version = "1.1.2" dependencies = [ "alloy-chains", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "arbitrary", "async-stream", @@ -7480,7 +7569,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "arbitrary", "bytes", @@ -7513,7 +7602,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "reth-chainspec", "reth-consensus", "reth-consensus-common", @@ -7527,7 +7616,7 @@ name = "reth-ethereum-engine-primitives" version = "1.1.2" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "alloy-rpc-types-engine", "reth-chain-state", @@ -7548,7 +7637,7 @@ version = "1.1.2" dependencies = [ "alloy-chains", "alloy-consensus", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "arbitrary", "auto_impl", @@ -7568,7 +7657,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "reth-basic-payload-builder", "reth-chain-state", "reth-chainspec", @@ -7591,7 +7680,7 @@ dependencies = [ name = "reth-etl" version = "1.1.2" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "rayon", "reth-db-api", "tempfile", @@ -7603,7 +7692,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "auto_impl", "futures-util", "metrics", @@ -7633,7 +7722,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-sol-types", "reth-chainspec", "reth-consensus", @@ -7656,7 +7745,7 @@ name = "reth-execution-errors" version = "1.1.2" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "derive_more", "nybbles", @@ -7672,7 +7761,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "arbitrary", "bincode", "rand 0.8.5", @@ -7693,7 +7782,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "eyre", "futures", "itertools 0.13.0", @@ -7768,7 +7857,7 @@ name = "reth-exex-types" version = "1.1.2" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "arbitrary", "bincode", "rand 0.8.5", @@ -7794,7 +7883,7 @@ name = "reth-invalid-block-hooks" version = "1.1.2" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "alloy-rpc-types-debug", "eyre", @@ -7884,7 +7973,7 @@ dependencies = [ name = "reth-net-banlist" version = "1.1.2" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -7908,7 +7997,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-node-bindings", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-provider", "alloy-rlp", "aquamarine", @@ -7968,7 +8057,7 @@ dependencies = [ name = "reth-network-api" version = "1.1.2" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-admin", "auto_impl", "derive_more", @@ -7992,7 +8081,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "auto_impl", "derive_more", "futures", @@ -8012,7 +8101,7 @@ dependencies = [ name = "reth-network-peers" version = "1.1.2" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "enr", "rand 0.8.5", @@ -8081,7 +8170,7 @@ name = "reth-node-builder" version = "1.1.2" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types", "aquamarine", "eyre", @@ -8147,7 +8236,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-engine", "clap", "const_format", @@ -8199,7 +8288,7 @@ dependencies = [ "alloy-contract", "alloy-eips", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-provider", "alloy-rpc-types-beacon", "alloy-rpc-types-engine", @@ -8246,7 +8335,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-engine", "futures", "humantime", @@ -8305,7 +8394,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more", "once_cell", "op-alloy-rpc-types", @@ -8323,7 +8412,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "clap", "derive_more", @@ -8373,7 +8462,7 @@ name = "reth-optimism-consensus" version = "1.1.2" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-trie", "reth-chainspec", "reth-consensus", @@ -8392,7 +8481,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more", "op-alloy-consensus", "reth-chainspec", @@ -8419,7 +8508,7 @@ name = "reth-optimism-forks" version = "1.1.2" dependencies = [ "alloy-chains", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "once_cell", "reth-ethereum-forks", "serde", @@ -8433,7 +8522,7 @@ dependencies = [ "alloy-eips", "alloy-genesis", "alloy-network", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-engine", "alloy-signer-local", "clap", @@ -8485,7 +8574,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "alloy-rpc-types-debug", "alloy-rpc-types-engine", @@ -8521,7 +8610,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "arbitrary", "bytes", @@ -8540,7 +8629,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-debug", "alloy-rpc-types-eth", "derive_more", @@ -8595,7 +8684,7 @@ name = "reth-payload-builder" version = "1.1.2" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types", "async-trait", "futures-util", @@ -8630,7 +8719,7 @@ name = "reth-payload-primitives" version = "1.1.2" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-engine", "op-alloy-rpc-types-engine", "reth-chain-state", @@ -8648,7 +8737,7 @@ name = "reth-payload-util" version = "1.1.2" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "reth-primitives", ] @@ -8670,7 +8759,7 @@ dependencies = [ "alloy-eips", "alloy-genesis", "alloy-network", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "alloy-rpc-types", "alloy-serde", @@ -8717,7 +8806,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "arbitrary", "auto_impl", @@ -8745,7 +8834,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-engine", "assert_matches", "auto_impl", @@ -8796,7 +8885,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "assert_matches", "itertools 0.13.0", "metrics", @@ -8826,7 +8915,7 @@ dependencies = [ name = "reth-prune-types" version = "1.1.2" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "arbitrary", "assert_matches", "bytes", @@ -8848,7 +8937,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "reth-ethereum-forks", "reth-execution-errors", "reth-primitives", @@ -8870,7 +8959,7 @@ dependencies = [ "alloy-eips", "alloy-genesis", "alloy-network", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "alloy-rpc-types", "alloy-rpc-types-admin", @@ -8940,7 +9029,7 @@ version = "1.1.2" dependencies = [ "alloy-eips", "alloy-json-rpc", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types", "alloy-rpc-types-admin", "alloy-rpc-types-anvil", @@ -8963,7 +9052,7 @@ name = "reth-rpc-api-testing-util" version = "1.1.2" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-eth", "alloy-rpc-types-trace", "futures", @@ -8983,7 +9072,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-engine", "alloy-rpc-types-eth", "alloy-rpc-types-trace", @@ -9033,7 +9122,7 @@ name = "reth-rpc-engine-api" version = "1.1.2" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "alloy-rpc-types-engine", "assert_matches", @@ -9075,7 +9164,7 @@ dependencies = [ "alloy-eips", "alloy-json-rpc", "alloy-network", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-eth", "alloy-rpc-types-mev", "alloy-serde", @@ -9115,7 +9204,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-eth", "alloy-sol-types", "derive_more", @@ -9174,7 +9263,7 @@ name = "reth-rpc-server-types" version = "1.1.2" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-engine", "jsonrpsee-core", "jsonrpsee-types", @@ -9190,7 +9279,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "alloy-rpc-types-engine", "alloy-rpc-types-eth", @@ -9248,7 +9337,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "alloy-serde", "arbitrary", @@ -9279,10 +9368,10 @@ name = "reth-scroll-state-commitment" version = "1.1.2" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "metrics", - "poseidon-bn254", + "poseidon-bn254 0.1.0 (git+https://github.com/scroll-tech/poseidon-bn254?rev=526a64a)", "proptest", "proptest-arbitrary-interop", "reth-db", @@ -9308,7 +9397,7 @@ dependencies = [ name = "reth-scroll-storage" version = "1.1.2" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "eyre", "reth-codecs", "reth-primitives-traits", @@ -9322,7 +9411,7 @@ dependencies = [ name = "reth-scroll-trie" version = "1.1.2" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-trie", "hex-literal", "proptest-arbitrary-interop", @@ -9337,7 +9426,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "assert_matches", "bincode", @@ -9388,7 +9477,7 @@ dependencies = [ name = "reth-stages-api" version = "1.1.2" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "aquamarine", "assert_matches", "auto_impl", @@ -9416,7 +9505,7 @@ dependencies = [ name = "reth-stages-types" version = "1.1.2" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "arbitrary", "bytes", "modular-bitfield", @@ -9433,7 +9522,7 @@ dependencies = [ name = "reth-static-file" version = "1.1.2" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "assert_matches", "parking_lot", "rayon", @@ -9457,7 +9546,7 @@ dependencies = [ name = "reth-static-file-types" version = "1.1.2" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "clap", "derive_more", "serde", @@ -9470,7 +9559,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-engine", "auto_impl", "reth-chainspec", @@ -9493,7 +9582,7 @@ name = "reth-storage-errors" version = "1.1.2" dependencies = [ "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "derive_more", "reth-fs-util", @@ -9524,7 +9613,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.8.5", "reth-primitives", "reth-primitives-traits", @@ -9560,7 +9649,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "aquamarine", "assert_matches", @@ -9606,7 +9695,7 @@ name = "reth-trie" version = "1.1.2" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "alloy-trie", "auto_impl", @@ -9636,7 +9725,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-genesis", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "alloy-trie", "arbitrary", @@ -9664,7 +9753,7 @@ name = "reth-trie-db" version = "1.1.2" dependencies = [ "alloy-consensus", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "derive_more", "metrics", @@ -9693,7 +9782,7 @@ dependencies = [ name = "reth-trie-parallel" version = "1.1.2" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "criterion", "derive_more", @@ -9720,7 +9809,7 @@ dependencies = [ name = "reth-trie-sparse" version = "1.1.2" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rlp", "arbitrary", "assert_matches", @@ -9742,7 +9831,7 @@ dependencies = [ [[package]] name = "revm" version = "18.0.0" -source = "git+https://github.com/scroll-tech/revm.git?branch=scroll-evm-executor/reth/v50#a740f3d8086395c00fa77fad5474bc4fde5b195d" +source = "git+https://github.com/scroll-tech/revm.git?branch=scroll-evm-executor/v50#9df25c5085f9ca477944b52bca972a6c920bcc8d" dependencies = [ "auto_impl", "cfg-if", @@ -9759,7 +9848,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "747291a18ad6726a08dd73f8b6a6b3a844db582ecae2063ccf0a04880c44f482" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "alloy-rpc-types-eth", "alloy-rpc-types-trace", "alloy-sol-types", @@ -9775,7 +9864,7 @@ dependencies = [ [[package]] name = "revm-interpreter" version = "14.0.0" -source = "git+https://github.com/scroll-tech/revm.git?branch=scroll-evm-executor/reth/v50#a740f3d8086395c00fa77fad5474bc4fde5b195d" +source = "git+https://github.com/scroll-tech/revm.git?branch=scroll-evm-executor/v50#9df25c5085f9ca477944b52bca972a6c920bcc8d" dependencies = [ "cfg-if", "revm-primitives", @@ -9785,7 +9874,7 @@ dependencies = [ [[package]] name = "revm-precompile" version = "15.0.0" -source = "git+https://github.com/scroll-tech/revm.git?branch=scroll-evm-executor/reth/v50#a740f3d8086395c00fa77fad5474bc4fde5b195d" +source = "git+https://github.com/scroll-tech/revm.git?branch=scroll-evm-executor/v50#9df25c5085f9ca477944b52bca972a6c920bcc8d" dependencies = [ "aurora-engine-modexp", "blst", @@ -9804,11 +9893,11 @@ dependencies = [ [[package]] name = "revm-primitives" version = "14.0.0" -source = "git+https://github.com/scroll-tech/revm.git?branch=scroll-evm-executor/reth/v50#a740f3d8086395c00fa77fad5474bc4fde5b195d" +source = "git+https://github.com/scroll-tech/revm.git?branch=scroll-evm-executor/v50#9df25c5085f9ca477944b52bca972a6c920bcc8d" dependencies = [ "alloy-eip2930", "alloy-eip7702", - "alloy-primitives", + "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "auto_impl", "bitflags 2.6.0", "bitvec", @@ -10863,6 +10952,17 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "syn-solidity" +version = "0.8.14" +source = "git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14#26fc0b5215544e71bc730e5e306fdb958cf30154" +dependencies = [ + "paste", + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "sync_wrapper" version = "0.1.2" diff --git a/Cargo.toml b/Cargo.toml index 847337fc1afa..ecac0a6a5a38 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -666,9 +666,12 @@ tracy-client = "0.17.3" #op-alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/op-alloy", rev = "6a042e7681b1" } [patch.crates-io] -revm = { git = "https://github.com/scroll-tech/revm.git", branch = "scroll-evm-executor/reth/v50" } -revm-primitives = { git = "https://github.com/scroll-tech/revm.git", branch = "scroll-evm-executor/reth/v50" } +revm = { git = "https://github.com/scroll-tech/revm.git", branch = "scroll-evm-executor/v50" } +revm-primitives = { git = "https://github.com/scroll-tech/revm.git", branch = "scroll-evm-executor/v50" } ff = { git = "https://github.com/scroll-tech/ff", branch = "feat/sp1" } -alloy-eip2930 = { git = "https://github.com/scroll-tech/alloy-eips", branch = "v0.3.2" } +alloy-eip2930 = { git = "https://github.com/scroll-tech/alloy-eips", branch = "v0.4.2" } +alloy-eip7702 = { git = "https://github.com/scroll-tech/alloy-eips", branch = "v0.4.2" } + +alloy-sol-types = { git = "https://github.com/scroll-tech/alloy-core", branch = "v0.8.14" } From e680a9af2fd9adee13c2a80cf0391d672acb23a8 Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Mon, 9 Dec 2024 09:54:51 +0100 Subject: [PATCH 22/31] fix: deny Signed-off-by: Gregory Edison --- deny.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deny.toml b/deny.toml index 53170e19d9b6..71715c505f30 100644 --- a/deny.toml +++ b/deny.toml @@ -105,5 +105,6 @@ allow-git = [ "https://github.com/scroll-tech/gobuild.git", "https://github.com/scroll-tech/alloy-eips", "https://github.com/scroll-tech/ff", - "https://github.com/scroll-tech/revm.git" + "https://github.com/scroll-tech/revm.git", + "https://github.com/scroll-tech/alloy-core.git" ] From 1ee60507826e0d9fa434debae3af2fea5b466661 Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Mon, 9 Dec 2024 10:06:53 +0100 Subject: [PATCH 23/31] fix: remove alloy-sol-types patch Signed-off-by: Gregory Edison --- Cargo.lock | 433 ++++++++++++++++++++--------------------------------- Cargo.toml | 2 - 2 files changed, 166 insertions(+), 269 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ce1aea752432..8e8985b29da6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -110,7 +110,7 @@ version = "0.1.48" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0161082e0edd9013d23083465cc04b20e44b7a15646d36ba7b0cdb7cd6fe18f" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "arbitrary", "num_enum", @@ -126,7 +126,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae09ffd7c29062431dd86061deefe4e3c6f07fa0d674930095f8dcedb0baf02c" dependencies = [ "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "alloy-serde", "arbitrary", @@ -145,10 +145,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66430a72d5bf5edead101c8c2f0a24bada5ec9f3cf9909b3e08b6d6899b4803e" dependencies = [ "alloy-dyn-abi", - "alloy-json-abi 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-json-abi", "alloy-network", "alloy-network-primitives", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-provider", "alloy-rpc-types-eth", "alloy-sol-types", @@ -164,9 +164,9 @@ version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80759b3f57b3b20fa7cd8fef6479930fc95461b58ff8adea6e87e618449c8a1d" dependencies = [ - "alloy-json-abi 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", - "alloy-sol-type-parser 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-json-abi", + "alloy-primitives", + "alloy-sol-type-parser", "alloy-sol-types", "const-hex", "derive_more", @@ -181,7 +181,7 @@ name = "alloy-eip2930" version = "0.1.0" source = "git+https://github.com/scroll-tech/alloy-eips?branch=v0.4.2#92b2892d7b5b325c1f2f3e90a5befadbb5e610d4" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "arbitrary", "rand 0.8.5", @@ -193,7 +193,7 @@ name = "alloy-eip7702" version = "0.4.2" source = "git+https://github.com/scroll-tech/alloy-eips?branch=v0.4.2#92b2892d7b5b325c1f2f3e90a5befadbb5e610d4" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "arbitrary", "derive_more", @@ -211,7 +211,7 @@ checksum = "5b6aa3961694b30ba53d41006131a2fca3bdab22e4c344e46db2c639e7c2dfdd" dependencies = [ "alloy-eip2930", "alloy-eip7702", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "alloy-serde", "arbitrary", @@ -230,7 +230,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e53f7877ded3921d18a0a9556d55bedf84535567198c9edab2aa23106da91855" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-serde", "serde", ] @@ -241,19 +241,8 @@ version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac4b22b3e51cac09fd2adfcc73b55f447b4df669f983c13f7894ec82b607c63f" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", - "alloy-sol-type-parser 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", - "serde", - "serde_json", -] - -[[package]] -name = "alloy-json-abi" -version = "0.8.14" -source = "git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14#26fc0b5215544e71bc730e5e306fdb958cf30154" -dependencies = [ - "alloy-primitives 0.8.14 (git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14)", - "alloy-sol-type-parser 0.8.14 (git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14)", + "alloy-primitives", + "alloy-sol-type-parser", "serde", "serde_json", ] @@ -264,7 +253,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3694b7e480728c0b3e228384f223937f14c10caef5a4c766021190fc8f283d35" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-sol-types", "serde", "serde_json", @@ -282,7 +271,7 @@ dependencies = [ "alloy-eips", "alloy-json-rpc", "alloy-network-primitives", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-eth", "alloy-serde", "alloy-signer", @@ -303,7 +292,7 @@ checksum = "df9f3e281005943944d15ee8491534a1c7b3cbf7a7de26f8c433b842b93eb5f9" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-serde", "serde", ] @@ -315,7 +304,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9805d126f24be459b958973c0569c73e1aadd27d4535eee82b2b6764aa03616" dependencies = [ "alloy-genesis", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "k256", "rand 0.8.5", "serde_json", @@ -357,33 +346,6 @@ dependencies = [ "tiny-keccak", ] -[[package]] -name = "alloy-primitives" -version = "0.8.14" -source = "git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14#26fc0b5215544e71bc730e5e306fdb958cf30154" -dependencies = [ - "alloy-rlp", - "bytes", - "cfg-if", - "const-hex", - "derive_more", - "foldhash", - "hashbrown 0.15.2", - "hex-literal", - "indexmap 2.7.0", - "itoa", - "k256", - "keccak-asm", - "paste", - "proptest", - "rand 0.8.5", - "ruint", - "rustc-hash 2.1.0", - "serde", - "sha3", - "tiny-keccak", -] - [[package]] name = "alloy-provider" version = "0.6.4" @@ -396,7 +358,7 @@ dependencies = [ "alloy-json-rpc", "alloy-network", "alloy-network-primitives", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-pubsub", "alloy-rpc-client", "alloy-rpc-types-admin", @@ -432,7 +394,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90f1f34232f77341076541c405482e4ae12f0ee7153d8f9969fc1691201b2247" dependencies = [ "alloy-json-rpc", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-transport", "bimap", "futures", @@ -473,7 +435,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "374dbe0dc3abdc2c964f36b3d3edf9cdb3db29d16bda34aa123f03d810bec1dd" dependencies = [ "alloy-json-rpc", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-pubsub", "alloy-transport", "alloy-transport-http", @@ -497,7 +459,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c74832aa474b670309c20fffc2a869fa141edab7c79ff7963fad0a08de60bae1" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-engine", "alloy-rpc-types-eth", "alloy-serde", @@ -511,7 +473,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bfd9b2cc3a1985f1f6da5afc41120256f9f9316fcd89e054cea99dbb10172f6" dependencies = [ "alloy-genesis", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "serde", "serde_json", ] @@ -522,7 +484,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ca97963132f78ddfc60e43a017348e6d52eea983925c23652f5b330e8e02291" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-eth", "alloy-serde", "serde", @@ -535,7 +497,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "922fa76678d2f9f07ea1b19309b5cfbf244c6029dcba3515227b515fdd6ed4a7" dependencies = [ "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-engine", "serde", "serde_with", @@ -548,7 +510,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba2253bee958658ebd614c07a61c40580e09dd1fad3f017684314442332ab753" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "serde", ] @@ -560,7 +522,7 @@ checksum = "3f56294dce86af23ad6ee8df46cf8b0d292eb5d1ff67dc88a0886051e32b1faf" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "alloy-serde", "derive_more", @@ -582,7 +544,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-network-primitives", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "alloy-serde", "alloy-sol-types", @@ -601,7 +563,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8647f8135ee3d5de1cf196706c905c05728a4e38bb4a5b61a7214bd1ba8f60a6" dependencies = [ "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-serde", "serde", "serde_json", @@ -613,7 +575,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ecd8b4877ef520c138af702097477cdd19504a8e1e4675ba37e92ba40f2d3c6f" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-eth", "alloy-serde", "serde", @@ -627,7 +589,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d4ab49acf90a71f7fb894dc5fd485f1f07a1e348966c714c4d1e0b7478850a8" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-eth", "alloy-serde", "serde", @@ -639,7 +601,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dfa4a7ccf15b2492bb68088692481fd6b2604ccbee1d0d6c44c21427ae4df83" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "arbitrary", "serde", "serde_json", @@ -651,7 +613,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e10aec39d60dc27edcac447302c7803d2371946fb737245320a05b78eb2fafd" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "async-trait", "auto_impl", "elliptic-curve", @@ -667,7 +629,7 @@ checksum = "d8396f6dff60700bc1d215ee03d86ff56de268af96e2bf833a14d0bafcab9882" dependencies = [ "alloy-consensus", "alloy-network", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-signer", "async-trait", "coins-bip32", @@ -683,21 +645,8 @@ version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3bfd7853b65a2b4f49629ec975fee274faf6dff15ab8894c620943398ef283c0" dependencies = [ - "alloy-sol-macro-expander 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", - "alloy-sol-macro-input 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-error2", - "proc-macro2", - "quote", - "syn 2.0.90", -] - -[[package]] -name = "alloy-sol-macro" -version = "0.8.14" -source = "git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14#26fc0b5215544e71bc730e5e306fdb958cf30154" -dependencies = [ - "alloy-sol-macro-expander 0.8.14 (git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14)", - "alloy-sol-macro-input 0.8.14 (git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14)", + "alloy-sol-macro-expander", + "alloy-sol-macro-input", "proc-macro-error2", "proc-macro2", "quote", @@ -710,7 +659,7 @@ version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82ec42f342d9a9261699f8078e57a7a4fda8aaa73c1a212ed3987080e6a9cd13" dependencies = [ - "alloy-sol-macro-input 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-sol-macro-input", "const-hex", "heck 0.5.0", "indexmap 2.7.0", @@ -718,24 +667,7 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.90", - "syn-solidity 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", - "tiny-keccak", -] - -[[package]] -name = "alloy-sol-macro-expander" -version = "0.8.14" -source = "git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14#26fc0b5215544e71bc730e5e306fdb958cf30154" -dependencies = [ - "alloy-sol-macro-input 0.8.14 (git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14)", - "const-hex", - "heck 0.5.0", - "indexmap 2.7.0", - "proc-macro-error2", - "proc-macro2", - "quote", - "syn 2.0.90", - "syn-solidity 0.8.14 (git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14)", + "syn-solidity", "tiny-keccak", ] @@ -751,21 +683,7 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.90", - "syn-solidity 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "alloy-sol-macro-input" -version = "0.8.14" -source = "git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14#26fc0b5215544e71bc730e5e306fdb958cf30154" -dependencies = [ - "const-hex", - "dunce", - "heck 0.5.0", - "proc-macro2", - "quote", - "syn 2.0.90", - "syn-solidity 0.8.14 (git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14)", + "syn-solidity", ] [[package]] @@ -778,23 +696,15 @@ dependencies = [ "winnow", ] -[[package]] -name = "alloy-sol-type-parser" -version = "0.8.14" -source = "git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14#26fc0b5215544e71bc730e5e306fdb958cf30154" -dependencies = [ - "serde", - "winnow", -] - [[package]] name = "alloy-sol-types" version = "0.8.14" -source = "git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14#26fc0b5215544e71bc730e5e306fdb958cf30154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9dc0fffe397aa17628160e16b89f704098bf3c9d74d5d369ebc239575936de5" dependencies = [ - "alloy-json-abi 0.8.14 (git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14)", - "alloy-primitives 0.8.14 (git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14)", - "alloy-sol-macro 0.8.14 (git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14)", + "alloy-json-abi", + "alloy-primitives", + "alloy-sol-macro", "const-hex", "serde", ] @@ -877,7 +787,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a5fd8fea044cc9a8c8a50bb6f28e31f0385d820f116c5b98f6f4e55d6e5590b" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "arbitrary", "arrayvec", @@ -2722,7 +2632,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "rayon", "reth-chainspec", @@ -2857,7 +2767,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70cbccfccf81d67bff0ab36e591fa536c8a935b078a7b0e58c1d00d418332fc9" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "hex", "serde", "serde_derive", @@ -2870,7 +2780,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "036c84bd29bff35e29bbee3c8fc0e2fb95db12b6f2f3cae82a827fbc97256f3a" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "ethereum_serde_utils", "itertools 0.13.0", "serde", @@ -2902,7 +2812,7 @@ name = "example-beacon-api-sidecar-fetcher" version = "0.1.0" dependencies = [ "alloy-consensus", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-beacon", "clap", "eyre", @@ -2933,7 +2843,7 @@ dependencies = [ name = "example-bsc-p2p" version = "0.0.0" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "reth-chainspec", "reth-discv4", "reth-network", @@ -2953,7 +2863,7 @@ version = "0.0.0" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-sol-macro 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-sol-macro", "alloy-sol-types", "eyre", "reth", @@ -2970,7 +2880,7 @@ name = "example-custom-dev-node" version = "0.0.0" dependencies = [ "alloy-genesis", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "eyre", "futures-util", "reth", @@ -2987,7 +2897,7 @@ version = "0.0.0" dependencies = [ "alloy-eips", "alloy-genesis", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types", "eyre", "reth", @@ -3011,7 +2921,7 @@ version = "0.0.0" dependencies = [ "alloy-consensus", "alloy-genesis", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "eyre", "reth", "reth-chainspec", @@ -3029,7 +2939,7 @@ name = "example-custom-inspector" version = "0.0.0" dependencies = [ "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-eth", "clap", "futures-util", @@ -3053,7 +2963,7 @@ name = "example-custom-payload-builder" version = "0.0.0" dependencies = [ "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "eyre", "futures-util", "reth", @@ -3071,7 +2981,7 @@ dependencies = [ name = "example-custom-rlpx-subprotocol" version = "0.0.0" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "eyre", "futures", "rand 0.8.5", @@ -3089,7 +2999,7 @@ dependencies = [ name = "example-db-access" version = "0.0.0" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-eth", "eyre", "reth-chainspec", @@ -3164,7 +3074,7 @@ dependencies = [ name = "example-polygon-p2p" version = "0.0.0" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "reth-chainspec", "reth-discv4", "reth-network", @@ -3197,7 +3107,7 @@ version = "0.0.0" dependencies = [ "alloy-consensus", "alloy-genesis", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "eyre", "parking_lot", "reth", @@ -3215,7 +3125,7 @@ dependencies = [ name = "example-txpool-tracing" version = "0.0.0" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-trace", "clap", "futures-util", @@ -5051,7 +4961,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc8342aaf4a3c2a1b2612bdf5cd1aa423918e0f1a0d9242aaeefbffd49457cad" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "async-sse", "bytes", "futures-util", @@ -5461,7 +5371,7 @@ checksum = "fce158d886815d419222daa67fcdf949a34f7950653a4498ebeb4963331f70ed" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "alloy-serde", "arbitrary", @@ -5479,7 +5389,7 @@ checksum = "2734e9a65efb90fe4520303f984c124766b7d2f2e5dd51cbe54d6269c85a3c91" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-sol-types", "serde", "serde_repr", @@ -5494,7 +5404,7 @@ checksum = "87e4aef8ed017004a176ab1de49df419f59c0fb4a6ce3b693a10fe099fe1afe7" dependencies = [ "alloy-consensus", "alloy-network", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-eth", "alloy-signer", "op-alloy-consensus", @@ -5510,7 +5420,7 @@ dependencies = [ "alloc-no-stdlib", "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "alloy-serde", "async-trait", @@ -5533,7 +5443,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-network-primitives", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-eth", "alloy-serde", "arbitrary", @@ -5550,7 +5460,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "864dbd5511ef4ef00b6c2c980739259b25b24048007b7751ca0069b30b1e3fee" dependencies = [ "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-engine", "alloy-serde", "derive_more", @@ -6534,7 +6444,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "alloy-rpc-types", "aquamarine", @@ -6605,7 +6515,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "futures-core", "futures-util", @@ -6634,7 +6544,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-engine", "assert_matches", "futures", @@ -6689,7 +6599,7 @@ version = "1.1.2" dependencies = [ "alloy-eips", "alloy-json-rpc", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-provider", "alloy-pubsub", "alloy-rpc-client", @@ -6726,7 +6636,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "aquamarine", "assert_matches", "linked_hash_set", @@ -6764,7 +6674,7 @@ name = "reth-blockchain-tree-api" version = "1.1.2" dependencies = [ "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "reth-consensus", "reth-execution-errors", "reth-primitives", @@ -6778,7 +6688,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-signer", "alloy-signer-local", "derive_more", @@ -6809,7 +6719,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "alloy-trie", "auto_impl", @@ -6842,7 +6752,7 @@ dependencies = [ "ahash", "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "arbitrary", "backon", @@ -6916,7 +6826,7 @@ name = "reth-cli-util" version = "1.1.2" dependencies = [ "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "cfg-if", "eyre", "libc", @@ -6936,7 +6846,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-trie", "arbitrary", "bytes", @@ -6966,7 +6876,7 @@ dependencies = [ name = "reth-config" version = "1.1.2" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "eyre", "humantime-serde", "reth-network-peers", @@ -6984,7 +6894,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "auto_impl", "derive_more", "reth-primitives", @@ -6997,7 +6907,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "mockall", "rand 0.8.5", "reth-chainspec", @@ -7014,7 +6924,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-provider", "alloy-rpc-types-engine", "alloy-rpc-types-eth", @@ -7036,7 +6946,7 @@ name = "reth-db" version = "1.1.2" dependencies = [ "alloy-consensus", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "arbitrary", "assert_matches", "bytes", @@ -7079,7 +6989,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-genesis", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "arbitrary", "bytes", "derive_more", @@ -7107,7 +7017,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-genesis", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "boyer-moore-magiclen", "eyre", "reth-chainspec", @@ -7136,7 +7046,7 @@ name = "reth-db-models" version = "1.1.2" dependencies = [ "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "arbitrary", "bytes", "modular-bitfield", @@ -7152,7 +7062,7 @@ dependencies = [ name = "reth-discv4" version = "1.1.2" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "assert_matches", "discv5", @@ -7179,7 +7089,7 @@ dependencies = [ name = "reth-discv5" version = "1.1.2" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "derive_more", "discv5", @@ -7204,7 +7114,7 @@ name = "reth-dns-discovery" version = "1.1.2" dependencies = [ "alloy-chains", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "data-encoding", "enr", @@ -7233,7 +7143,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "assert_matches", "futures", @@ -7273,7 +7183,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-network", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "alloy-rpc-types-engine", "alloy-rpc-types-eth", @@ -7319,7 +7229,7 @@ name = "reth-ecies" version = "1.1.2" dependencies = [ "aes", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "block-padding", "byteorder", @@ -7348,7 +7258,7 @@ dependencies = [ name = "reth-engine-local" version = "1.1.2" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-engine", "eyre", "futures-util", @@ -7380,7 +7290,7 @@ name = "reth-engine-primitives" version = "1.1.2" dependencies = [ "alloy-consensus", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-engine", "futures", "reth-errors", @@ -7429,7 +7339,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "alloy-rpc-types-engine", "assert_matches", @@ -7485,7 +7395,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-engine", "eyre", "futures", @@ -7530,7 +7440,7 @@ version = "1.1.2" dependencies = [ "alloy-chains", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "arbitrary", "async-stream", @@ -7569,7 +7479,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "arbitrary", "bytes", @@ -7602,7 +7512,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "reth-chainspec", "reth-consensus", "reth-consensus-common", @@ -7616,7 +7526,7 @@ name = "reth-ethereum-engine-primitives" version = "1.1.2" dependencies = [ "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "alloy-rpc-types-engine", "reth-chain-state", @@ -7637,7 +7547,7 @@ version = "1.1.2" dependencies = [ "alloy-chains", "alloy-consensus", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "arbitrary", "auto_impl", @@ -7657,7 +7567,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "reth-basic-payload-builder", "reth-chain-state", "reth-chainspec", @@ -7680,7 +7590,7 @@ dependencies = [ name = "reth-etl" version = "1.1.2" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "rayon", "reth-db-api", "tempfile", @@ -7692,7 +7602,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "auto_impl", "futures-util", "metrics", @@ -7722,7 +7632,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-sol-types", "reth-chainspec", "reth-consensus", @@ -7745,7 +7655,7 @@ name = "reth-execution-errors" version = "1.1.2" dependencies = [ "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "derive_more", "nybbles", @@ -7761,7 +7671,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "arbitrary", "bincode", "rand 0.8.5", @@ -7782,7 +7692,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "eyre", "futures", "itertools 0.13.0", @@ -7857,7 +7767,7 @@ name = "reth-exex-types" version = "1.1.2" dependencies = [ "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "arbitrary", "bincode", "rand 0.8.5", @@ -7883,7 +7793,7 @@ name = "reth-invalid-block-hooks" version = "1.1.2" dependencies = [ "alloy-consensus", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "alloy-rpc-types-debug", "eyre", @@ -7973,7 +7883,7 @@ dependencies = [ name = "reth-net-banlist" version = "1.1.2" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", ] [[package]] @@ -7997,7 +7907,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-node-bindings", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-provider", "alloy-rlp", "aquamarine", @@ -8057,7 +7967,7 @@ dependencies = [ name = "reth-network-api" version = "1.1.2" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-admin", "auto_impl", "derive_more", @@ -8081,7 +7991,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "auto_impl", "derive_more", "futures", @@ -8101,7 +8011,7 @@ dependencies = [ name = "reth-network-peers" version = "1.1.2" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "enr", "rand 0.8.5", @@ -8170,7 +8080,7 @@ name = "reth-node-builder" version = "1.1.2" dependencies = [ "alloy-consensus", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types", "aquamarine", "eyre", @@ -8236,7 +8146,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-engine", "clap", "const_format", @@ -8288,7 +8198,7 @@ dependencies = [ "alloy-contract", "alloy-eips", "alloy-genesis", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-provider", "alloy-rpc-types-beacon", "alloy-rpc-types-engine", @@ -8335,7 +8245,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-engine", "futures", "humantime", @@ -8394,7 +8304,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "derive_more", "once_cell", "op-alloy-rpc-types", @@ -8412,7 +8322,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "clap", "derive_more", @@ -8462,7 +8372,7 @@ name = "reth-optimism-consensus" version = "1.1.2" dependencies = [ "alloy-consensus", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-trie", "reth-chainspec", "reth-consensus", @@ -8481,7 +8391,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "derive_more", "op-alloy-consensus", "reth-chainspec", @@ -8508,7 +8418,7 @@ name = "reth-optimism-forks" version = "1.1.2" dependencies = [ "alloy-chains", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "once_cell", "reth-ethereum-forks", "serde", @@ -8522,7 +8432,7 @@ dependencies = [ "alloy-eips", "alloy-genesis", "alloy-network", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-engine", "alloy-signer-local", "clap", @@ -8574,7 +8484,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "alloy-rpc-types-debug", "alloy-rpc-types-engine", @@ -8610,7 +8520,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "arbitrary", "bytes", @@ -8629,7 +8539,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-debug", "alloy-rpc-types-eth", "derive_more", @@ -8684,7 +8594,7 @@ name = "reth-payload-builder" version = "1.1.2" dependencies = [ "alloy-consensus", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types", "async-trait", "futures-util", @@ -8719,7 +8629,7 @@ name = "reth-payload-primitives" version = "1.1.2" dependencies = [ "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-engine", "op-alloy-rpc-types-engine", "reth-chain-state", @@ -8737,7 +8647,7 @@ name = "reth-payload-util" version = "1.1.2" dependencies = [ "alloy-consensus", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "reth-primitives", ] @@ -8759,7 +8669,7 @@ dependencies = [ "alloy-eips", "alloy-genesis", "alloy-network", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "alloy-rpc-types", "alloy-serde", @@ -8806,7 +8716,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "arbitrary", "auto_impl", @@ -8834,7 +8744,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-engine", "assert_matches", "auto_impl", @@ -8885,7 +8795,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "assert_matches", "itertools 0.13.0", "metrics", @@ -8915,7 +8825,7 @@ dependencies = [ name = "reth-prune-types" version = "1.1.2" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "arbitrary", "assert_matches", "bytes", @@ -8937,7 +8847,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "reth-ethereum-forks", "reth-execution-errors", "reth-primitives", @@ -8959,7 +8869,7 @@ dependencies = [ "alloy-eips", "alloy-genesis", "alloy-network", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "alloy-rpc-types", "alloy-rpc-types-admin", @@ -9029,7 +8939,7 @@ version = "1.1.2" dependencies = [ "alloy-eips", "alloy-json-rpc", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types", "alloy-rpc-types-admin", "alloy-rpc-types-anvil", @@ -9052,7 +8962,7 @@ name = "reth-rpc-api-testing-util" version = "1.1.2" dependencies = [ "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-eth", "alloy-rpc-types-trace", "futures", @@ -9072,7 +8982,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-engine", "alloy-rpc-types-eth", "alloy-rpc-types-trace", @@ -9122,7 +9032,7 @@ name = "reth-rpc-engine-api" version = "1.1.2" dependencies = [ "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "alloy-rpc-types-engine", "assert_matches", @@ -9164,7 +9074,7 @@ dependencies = [ "alloy-eips", "alloy-json-rpc", "alloy-network", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-eth", "alloy-rpc-types-mev", "alloy-serde", @@ -9204,7 +9114,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-eth", "alloy-sol-types", "derive_more", @@ -9263,7 +9173,7 @@ name = "reth-rpc-server-types" version = "1.1.2" dependencies = [ "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-engine", "jsonrpsee-core", "jsonrpsee-types", @@ -9279,7 +9189,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "alloy-rpc-types-engine", "alloy-rpc-types-eth", @@ -9337,7 +9247,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "alloy-serde", "arbitrary", @@ -9368,7 +9278,7 @@ name = "reth-scroll-state-commitment" version = "1.1.2" dependencies = [ "alloy-consensus", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "metrics", "poseidon-bn254 0.1.0 (git+https://github.com/scroll-tech/poseidon-bn254?rev=526a64a)", @@ -9397,7 +9307,7 @@ dependencies = [ name = "reth-scroll-storage" version = "1.1.2" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "eyre", "reth-codecs", "reth-primitives-traits", @@ -9411,7 +9321,7 @@ dependencies = [ name = "reth-scroll-trie" version = "1.1.2" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-trie", "hex-literal", "proptest-arbitrary-interop", @@ -9426,7 +9336,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "assert_matches", "bincode", @@ -9477,7 +9387,7 @@ dependencies = [ name = "reth-stages-api" version = "1.1.2" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "aquamarine", "assert_matches", "auto_impl", @@ -9505,7 +9415,7 @@ dependencies = [ name = "reth-stages-types" version = "1.1.2" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "arbitrary", "bytes", "modular-bitfield", @@ -9522,7 +9432,7 @@ dependencies = [ name = "reth-static-file" version = "1.1.2" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "assert_matches", "parking_lot", "rayon", @@ -9546,7 +9456,7 @@ dependencies = [ name = "reth-static-file-types" version = "1.1.2" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "clap", "derive_more", "serde", @@ -9559,7 +9469,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-engine", "auto_impl", "reth-chainspec", @@ -9582,7 +9492,7 @@ name = "reth-storage-errors" version = "1.1.2" dependencies = [ "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "derive_more", "reth-fs-util", @@ -9613,7 +9523,7 @@ dependencies = [ "alloy-consensus", "alloy-eips", "alloy-genesis", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "rand 0.8.5", "reth-primitives", "reth-primitives-traits", @@ -9649,7 +9559,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-eips", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "aquamarine", "assert_matches", @@ -9695,7 +9605,7 @@ name = "reth-trie" version = "1.1.2" dependencies = [ "alloy-consensus", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "alloy-trie", "auto_impl", @@ -9725,7 +9635,7 @@ version = "1.1.2" dependencies = [ "alloy-consensus", "alloy-genesis", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "alloy-trie", "arbitrary", @@ -9753,7 +9663,7 @@ name = "reth-trie-db" version = "1.1.2" dependencies = [ "alloy-consensus", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "derive_more", "metrics", @@ -9782,7 +9692,7 @@ dependencies = [ name = "reth-trie-parallel" version = "1.1.2" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "criterion", "derive_more", @@ -9809,7 +9719,7 @@ dependencies = [ name = "reth-trie-sparse" version = "1.1.2" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "arbitrary", "assert_matches", @@ -9848,7 +9758,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "747291a18ad6726a08dd73f8b6a6b3a844db582ecae2063ccf0a04880c44f482" dependencies = [ - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types-eth", "alloy-rpc-types-trace", "alloy-sol-types", @@ -9897,7 +9807,7 @@ source = "git+https://github.com/scroll-tech/revm.git?branch=scroll-evm-executor dependencies = [ "alloy-eip2930", "alloy-eip7702", - "alloy-primitives 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "auto_impl", "bitflags 2.6.0", "bitvec", @@ -10952,17 +10862,6 @@ dependencies = [ "syn 2.0.90", ] -[[package]] -name = "syn-solidity" -version = "0.8.14" -source = "git+https://github.com/scroll-tech/alloy-core?branch=v0.8.14#26fc0b5215544e71bc730e5e306fdb958cf30154" -dependencies = [ - "paste", - "proc-macro2", - "quote", - "syn 2.0.90", -] - [[package]] name = "sync_wrapper" version = "0.1.2" diff --git a/Cargo.toml b/Cargo.toml index ecac0a6a5a38..e0f93785990b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -673,5 +673,3 @@ ff = { git = "https://github.com/scroll-tech/ff", branch = "feat/sp1" } alloy-eip2930 = { git = "https://github.com/scroll-tech/alloy-eips", branch = "v0.4.2" } alloy-eip7702 = { git = "https://github.com/scroll-tech/alloy-eips", branch = "v0.4.2" } - -alloy-sol-types = { git = "https://github.com/scroll-tech/alloy-core", branch = "v0.8.14" } From ca0580f4d671312fa3e82d0c2c1feb42624e1ccb Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Mon, 9 Dec 2024 13:11:33 +0100 Subject: [PATCH 24/31] feat: propagate scroll chain spec in execution Signed-off-by: Gregory Edison --- .github/workflows/unit.yml | 2 +- Cargo.lock | 55 ++++++------ Cargo.toml | 8 +- crates/scroll/chainspec/src/genesis.rs | 27 +++++- crates/scroll/chainspec/src/lib.rs | 2 +- crates/scroll/evm/Cargo.toml | 4 + crates/scroll/evm/src/config.rs | 113 +++++++++++-------------- crates/scroll/evm/src/execute.rs | 41 ++++----- 8 files changed, 136 insertions(+), 116 deletions(-) diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index fe76e1a4ceb7..b9d3f3fb8e65 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -42,7 +42,7 @@ jobs: partition: 2 total_partitions: 2 - type: scroll - args: -p reth-scroll-state-commitment --locked --features "scroll" + args: --locked --features "scroll" --workspace --exclude ef-tests -E 'package(reth-scroll-*)' partition: 1 total_partitions: 1 - type: book diff --git a/Cargo.lock b/Cargo.lock index 51bc87f1ac3d..b80d6e78dd76 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -179,7 +179,7 @@ dependencies = [ [[package]] name = "alloy-eip2930" version = "0.1.0" -source = "git+https://github.com/scroll-tech/alloy-eips?branch=v0.4.2#92b2892d7b5b325c1f2f3e90a5befadbb5e610d4" +source = "git+https://github.com/scroll-tech/alloy-eips?branch=v0.3.2#8d5fc83fc257b09510dc8d76561188218d9c0c32" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -191,7 +191,8 @@ dependencies = [ [[package]] name = "alloy-eip7702" version = "0.4.2" -source = "git+https://github.com/scroll-tech/alloy-eips?branch=v0.4.2#92b2892d7b5b325c1f2f3e90a5befadbb5e610d4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c986539255fb839d1533c128e190e557e52ff652c9ef62939e233a81dd93f7e" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -9226,32 +9227,34 @@ dependencies = [ name = "reth-scroll-consensus" version = "1.1.2" dependencies = [ - "eyre", - "reth-scroll-revm", + "eyre", + "reth-scroll-revm", ] [[package]] name = "reth-scroll-evm" version = "1.1.2" dependencies = [ - "alloy-consensus", - "alloy-eips", - "auto_impl", - "derive_more", - "eyre", - "reth-chainspec", - "reth-consensus", - "reth-ethereum-consensus", - "reth-evm", - "reth-primitives", - "reth-primitives-traits", - "reth-revm", - "reth-scroll-consensus", - "reth-scroll-execution", - "reth-scroll-primitives", - "reth-scroll-revm", - "thiserror 1.0.69", - "tracing", + "alloy-consensus", + "alloy-eips", + "auto_impl", + "derive_more", + "eyre", + "reth-chainspec", + "reth-consensus", + "reth-ethereum-consensus", + "reth-evm", + "reth-primitives", + "reth-primitives-traits", + "reth-revm", + "reth-scroll-chainspec", + "reth-scroll-consensus", + "reth-scroll-execution", + "reth-scroll-forks", + "reth-scroll-primitives", + "reth-scroll-revm", + "thiserror 1.0.69", + "tracing", ] [[package]] @@ -9773,7 +9776,7 @@ dependencies = [ [[package]] name = "revm" version = "18.0.0" -source = "git+https://github.com/scroll-tech/revm.git?branch=scroll-evm-executor/v50#9df25c5085f9ca477944b52bca972a6c920bcc8d" +source = "git+https://github.com/scroll-tech/revm.git?branch=scroll-evm-executor/reth/v50#a740f3d8086395c00fa77fad5474bc4fde5b195d" dependencies = [ "auto_impl", "cfg-if", @@ -9806,7 +9809,7 @@ dependencies = [ [[package]] name = "revm-interpreter" version = "14.0.0" -source = "git+https://github.com/scroll-tech/revm.git?branch=scroll-evm-executor/v50#9df25c5085f9ca477944b52bca972a6c920bcc8d" +source = "git+https://github.com/scroll-tech/revm.git?branch=scroll-evm-executor/reth/v50#a740f3d8086395c00fa77fad5474bc4fde5b195d" dependencies = [ "cfg-if", "revm-primitives", @@ -9816,7 +9819,7 @@ dependencies = [ [[package]] name = "revm-precompile" version = "15.0.0" -source = "git+https://github.com/scroll-tech/revm.git?branch=scroll-evm-executor/v50#9df25c5085f9ca477944b52bca972a6c920bcc8d" +source = "git+https://github.com/scroll-tech/revm.git?branch=scroll-evm-executor/reth/v50#a740f3d8086395c00fa77fad5474bc4fde5b195d" dependencies = [ "aurora-engine-modexp", "blst", @@ -9835,7 +9838,7 @@ dependencies = [ [[package]] name = "revm-primitives" version = "14.0.0" -source = "git+https://github.com/scroll-tech/revm.git?branch=scroll-evm-executor/v50#9df25c5085f9ca477944b52bca972a6c920bcc8d" +source = "git+https://github.com/scroll-tech/revm.git?branch=scroll-evm-executor/reth/v50#a740f3d8086395c00fa77fad5474bc4fde5b195d" dependencies = [ "alloy-eip2930", "alloy-eip7702", diff --git a/Cargo.toml b/Cargo.toml index e2446dde29c1..532698a2a534 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -413,6 +413,7 @@ reth-rpc-eth-types = { path = "crates/rpc/rpc-eth-types", default-features = fal reth-rpc-layer = { path = "crates/rpc/rpc-layer" } reth-rpc-server-types = { path = "crates/rpc/rpc-server-types" } reth-rpc-types-compat = { path = "crates/rpc/rpc-types-compat" } +reth-scroll-chainspec = { path = "crates/scroll/chainspec" } reth-scroll-consensus = { path = "crates/scroll/consensus" } reth-scroll-evm = { path = "crates/scroll/evm" } reth-scroll-execution = { path = "crates/scroll/execution" } @@ -669,10 +670,9 @@ tracy-client = "0.17.3" #op-alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/op-alloy", rev = "6a042e7681b1" } [patch.crates-io] -revm = { git = "https://github.com/scroll-tech/revm.git", branch = "scroll-evm-executor/v50" } -revm-primitives = { git = "https://github.com/scroll-tech/revm.git", branch = "scroll-evm-executor/v50" } +revm = { git = "https://github.com/scroll-tech/revm.git", branch = "scroll-evm-executor/reth/v50" } +revm-primitives = { git = "https://github.com/scroll-tech/revm.git", branch = "scroll-evm-executor/reth/v50" } ff = { git = "https://github.com/scroll-tech/ff", branch = "feat/sp1" } -alloy-eip2930 = { git = "https://github.com/scroll-tech/alloy-eips", branch = "v0.4.2" } -alloy-eip7702 = { git = "https://github.com/scroll-tech/alloy-eips", branch = "v0.4.2" } +alloy-eip2930 = { git = "https://github.com/scroll-tech/alloy-eips", branch = "v0.3.2" } diff --git a/crates/scroll/chainspec/src/genesis.rs b/crates/scroll/chainspec/src/genesis.rs index ceb646a288ba..9319a68110d5 100644 --- a/crates/scroll/chainspec/src/genesis.rs +++ b/crates/scroll/chainspec/src/genesis.rs @@ -1,6 +1,6 @@ //! Scroll types for genesis data. -use alloy_primitives::Address; +use alloy_primitives::{address, Address}; use alloy_serde::OtherFields; use serde::de::Error; @@ -115,6 +115,31 @@ impl ScrollChainConfig { pub fn extract_from(others: &OtherFields) -> Option { Self::try_from(others).ok() } + + /// Returns the [`ScrollChainConfig`] for Scroll Mainnet. + pub const fn mainnet() -> Self { + Self { + fee_vault_address: Some(address!("5300000000000000000000000000000000000005")), + l1_config: L1Config { + l1_chain_id: 1, + l1_message_queue_address: address!("0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B"), + scroll_chain_address: address!("a13BAF47339d63B743e7Da8741db5456DAc1E556"), + num_l1_messages_per_block: 10, + }, + } + } + /// Returns the [`ScrollChainConfig`] for Scroll Sepolia. + pub const fn sepolia() -> Self { + Self { + fee_vault_address: Some(address!("5300000000000000000000000000000000000005")), + l1_config: L1Config { + l1_chain_id: 11155111, + l1_message_queue_address: address!("F0B2293F5D834eAe920c6974D50957A1732de763"), + scroll_chain_address: address!("2D567EcE699Eabe5afCd141eDB7A4f2D0D6ce8a0"), + num_l1_messages_per_block: 10, + }, + } + } } impl TryFrom<&OtherFields> for ScrollChainConfig { diff --git a/crates/scroll/chainspec/src/lib.rs b/crates/scroll/chainspec/src/lib.rs index d628af48e0ea..7224af82b707 100644 --- a/crates/scroll/chainspec/src/lib.rs +++ b/crates/scroll/chainspec/src/lib.rs @@ -33,7 +33,7 @@ mod dev; pub use dev::SCROLL_DEV; mod genesis; -pub use genesis::ScrollChainInfo; +pub use genesis::{ScrollChainConfig, ScrollChainInfo}; mod scroll; pub use scroll::SCROLL_MAINNET; diff --git a/crates/scroll/evm/Cargo.toml b/crates/scroll/evm/Cargo.toml index 79dfef9d76e7..28653851c6d6 100644 --- a/crates/scroll/evm/Cargo.toml +++ b/crates/scroll/evm/Cargo.toml @@ -24,6 +24,10 @@ reth-revm.workspace = true # revm revm = { workspace = true, features = ["optional_no_base_fee"] } +# scroll +reth-scroll-chainspec.workspace = true +reth-scroll-forks.workspace = true + # alloy alloy-consensus.workspace = true alloy-eips.workspace = true diff --git a/crates/scroll/evm/src/config.rs b/crates/scroll/evm/src/config.rs index 9fa4ea5e044b..67215d2f5905 100644 --- a/crates/scroll/evm/src/config.rs +++ b/crates/scroll/evm/src/config.rs @@ -1,7 +1,9 @@ -use reth_chainspec::{ChainSpec, Head}; +use reth_chainspec::Head; use reth_evm::{ConfigureEvm, ConfigureEvmEnv, NextBlockEnvAttributes}; use reth_primitives::{transaction::FillTxEnv, TransactionSigned}; use reth_revm::{inspector_handle_register, Database, Evm, GetInspector, TxEnv}; +use reth_scroll_chainspec::{ScrollChainConfig, ScrollChainSpec}; +use reth_scroll_forks::ScrollHardfork; use revm::{ precompile::{Address, Bytes}, primitives::{ @@ -15,30 +17,27 @@ use std::{convert::Infallible, sync::Arc}; #[derive(Clone, Debug)] pub struct ScrollEvmConfig { /// The chain spec for Scroll. - // TODO (scroll): update to ScrollChainSpec. - chain_spec: Arc, + chain_spec: Arc, + /// Additional Scroll configuration. + scroll_config: ScrollChainConfig, } impl ScrollEvmConfig { /// Returns a new instance of [`ScrollEvmConfig`]. - pub const fn new(chain_spec: Arc) -> Self { - Self { chain_spec } + pub const fn new(chain_spec: Arc, scroll_config: ScrollChainConfig) -> Self { + Self { chain_spec, scroll_config } } /// Returns the spec id at the given head. - pub fn spec_id_at_head(&self, _head: &Head) -> SpecId { - // TODO (scroll): uncomment once the Scroll chain spec is available - // let chain_spec = &self.chain_spec; - // if chain_spec.fork(ScrollHardfork::Euclid).active_at_head(head) { - // SpecId::EUCLID - // } else if chain_spec.fork(ScrollHardfork::Curie).active_at_head(head) { - // SpecId::CURIE - // } else if chain_spec.fork(ScrollHardfork::Bernouilli).active_at_head(head) { - // SpecId::BERNOULLI - // } else { - // SpecId::PRE_BERNOULLI - // } - SpecId::PRE_BERNOULLI + pub fn spec_id_at_head(&self, head: &Head) -> SpecId { + let chain_spec = &self.chain_spec; + if chain_spec.fork(ScrollHardfork::Curie).active_at_head(head) { + SpecId::CURIE + } else if chain_spec.fork(ScrollHardfork::Bernoulli).active_at_head(head) { + SpecId::BERNOULLI + } else { + SpecId::PRE_BERNOULLI + } } } @@ -107,10 +106,9 @@ impl ConfigureEvmEnv for ScrollEvmConfig { fn fill_block_env(&self, block_env: &mut BlockEnv, header: &Self::Header, after_merge: bool) { block_env.number = U256::from(header.number); block_env.coinbase = header.beneficiary; - // TODO (scroll): uncomment once the Scroll chain spec is available - // if let Some(vault_address) = self.chain_spec.fee_vault_address { - // block_env.coinbase = vault_address; - // } + if let Some(vault_address) = self.scroll_config.fee_vault_address { + block_env.coinbase = vault_address; + } block_env.timestamp = U256::from(header.timestamp); if after_merge { block_env.prevrandao = Some(header.mix_hash); @@ -138,11 +136,11 @@ impl ConfigureEvmEnv for ScrollEvmConfig { ..Default::default() }); - let coinbase = attributes.suggested_fee_recipient; - // TODO (scroll): uncomment once the Scroll chain spec is available - // if let Some(vault_address) = self.chain_spec.fee_vault_address { - // block_env.coinbase = vault_address; - // } + let coinbase = if let Some(vault_address) = self.scroll_config.fee_vault_address { + vault_address + } else { + attributes.suggested_fee_recipient + }; let block_env = BlockEnv { number: U256::from(parent.number + 1), @@ -152,9 +150,8 @@ impl ConfigureEvmEnv for ScrollEvmConfig { prevrandao: Some(attributes.prev_randao), gas_limit: U256::from(parent.gas_limit), // calculate basefee based on parent block's gas usage - basefee: U256::ZERO, - // TODO (scroll): uncomment once the Scroll chain spec is available - // self.chain_spec.next_block_base_fee(parent, attributes.timestamp)?, + // TODO(scroll): update with correct block fee calculation for block building. + basefee: U256::from(parent.base_fee_per_gas.unwrap_or_default()), blob_excess_gas_and_price: None, }; @@ -172,21 +169,22 @@ mod tests { use super::*; use alloy_consensus::Header; use reth_chainspec::NamedChain::Scroll; - use revm::primitives::{address, SpecId, B256}; + use reth_scroll_chainspec::ScrollChainSpecBuilder; + use revm::primitives::{SpecId, B256}; #[test] fn test_spec_at_head() { - // TODO (scroll): change this to `ScrollChainSpecBuilder::mainnet()`. - let config = ScrollEvmConfig::new(ChainSpec::default().into()); + let config = ScrollEvmConfig::new( + ScrollChainSpecBuilder::scroll_mainnet().build().into(), + ScrollChainConfig::default(), + ); // prepare all fork heads - let euclid_head = &Head { number: u64::MAX, ..Default::default() }; let curie_head = &Head { number: 7096836, ..Default::default() }; let bernouilli_head = &Head { number: 5220340, ..Default::default() }; let pre_bernouilli_head = &Head { number: 0, ..Default::default() }; // check correct spec id - assert_eq!(config.spec_id_at_head(euclid_head), SpecId::EUCLID); assert_eq!(config.spec_id_at_head(curie_head), SpecId::CURIE); assert_eq!(config.spec_id_at_head(bernouilli_head), SpecId::BERNOULLI); assert_eq!(config.spec_id_at_head(pre_bernouilli_head), SpecId::PRE_BERNOULLI); @@ -194,21 +192,10 @@ mod tests { #[test] fn test_fill_cfg_env() { - // TODO (scroll): change this to `ScrollChainSpecBuilder::mainnet()`. - let config = ScrollEvmConfig::new(ChainSpec::default().into()); - - // euclid header - let mut cfg_env = CfgEnvWithHandlerCfg::new(Default::default(), Default::default()); - let euclid_header = Header { number: u64::MAX, ..Default::default() }; - - // fill cfg env - config.fill_cfg_env(&mut cfg_env, &euclid_header, U256::ZERO); - - // check correct cfg env - assert_eq!(cfg_env.chain_id, Scroll as u64); - assert_eq!(cfg_env.perf_analyse_created_bytecodes, AnalysisKind::Analyse); - assert_eq!(cfg_env.handler_cfg.spec_id, SpecId::EUCLID); - assert!(cfg_env.handler_cfg.is_scroll); + let config = ScrollEvmConfig::new( + ScrollChainSpecBuilder::scroll_mainnet().build().into(), + ScrollChainConfig::default(), + ); // curie let mut cfg_env = CfgEnvWithHandlerCfg::new(Default::default(), Default::default()); @@ -223,7 +210,7 @@ mod tests { assert_eq!(cfg_env.handler_cfg.spec_id, SpecId::CURIE); assert!(cfg_env.handler_cfg.is_scroll); - // bernouilli + // bernoulli let mut cfg_env = CfgEnvWithHandlerCfg::new(Default::default(), Default::default()); let bernouilli_header = Header { number: 5220340, ..Default::default() }; @@ -236,7 +223,7 @@ mod tests { assert_eq!(cfg_env.handler_cfg.spec_id, SpecId::BERNOULLI); assert!(cfg_env.handler_cfg.is_scroll); - // pre-bernouilli + // pre-bernoulli let mut cfg_env = CfgEnvWithHandlerCfg::new(Default::default(), Default::default()); let pre_bernouilli_header = Header { number: 0, ..Default::default() }; @@ -252,8 +239,10 @@ mod tests { #[test] fn test_fill_block_env() { - // TODO (scroll): change this to `ScrollChainSpecBuilder::mainnet()`. - let config = ScrollEvmConfig::new(ChainSpec::default().into()); + let config = ScrollEvmConfig::new( + ScrollChainSpecBuilder::scroll_mainnet().build().into(), + ScrollChainConfig::mainnet(), + ); let mut block_env = BlockEnv::default(); // curie header @@ -271,11 +260,9 @@ mod tests { config.fill_block_env(&mut block_env, &header, true); // verify block env correctly updated - // TODO (scroll): replace with `config.chain_spec.fee_vault_address.unwrap()` - const FEE_VAULT_ADDRESS: Address = address!("5300000000000000000000000000000000000005"); let expected = BlockEnv { number: U256::from(header.number), - coinbase: FEE_VAULT_ADDRESS, + coinbase: config.scroll_config.fee_vault_address.unwrap(), timestamp: U256::from(header.timestamp), prevrandao: Some(header.mix_hash), difficulty: U256::ZERO, @@ -288,8 +275,10 @@ mod tests { #[test] fn test_next_cfg_and_block_env() -> eyre::Result<()> { - // TODO (scroll): change this to `ScrollChainSpecBuilder::mainnet()`. - let config = ScrollEvmConfig::new(ChainSpec::default().into()); + let config = ScrollEvmConfig::new( + ScrollChainSpecBuilder::scroll_mainnet().build().into(), + ScrollChainConfig::mainnet(), + ); // pre curie header let header = Header { @@ -318,18 +307,16 @@ mod tests { assert!(cfg_env.handler_cfg.is_scroll); // verify block env - // TODO (scroll): replace with `config.chain_spec.fee_vault_address.unwrap()` - const FEE_VAULT_ADDRESS: Address = address!("5300000000000000000000000000000000000005"); let expected = BlockEnv { number: U256::from(header.number + 1), - coinbase: FEE_VAULT_ADDRESS, + coinbase: config.scroll_config.fee_vault_address.unwrap(), timestamp: U256::from(attributes.timestamp), prevrandao: Some(attributes.prev_randao), difficulty: U256::ZERO, - // TODO (scroll): update once the Scroll chain spec is available // TODO (scroll): this shouldn't be 0 at curie fork basefee: U256::ZERO, gas_limit: U256::from(header.gas_limit), + blob_excess_gas_and_price: None, ..Default::default() }; assert_eq!(block_env, expected); diff --git a/crates/scroll/evm/src/execute.rs b/crates/scroll/evm/src/execute.rs index 7cacf7b81b54..1eaeb73b2d4b 100644 --- a/crates/scroll/evm/src/execute.rs +++ b/crates/scroll/evm/src/execute.rs @@ -3,7 +3,7 @@ use crate::{ForkError, ScrollBlockExecutionError, ScrollEvmConfig}; use alloy_consensus::{Header, Transaction}; use alloy_eips::{eip2718::Encodable2718, eip7685::Requests}; -use reth_chainspec::{ChainSpec, EthereumHardfork, EthereumHardforks}; +use reth_chainspec::EthereumHardforks; use reth_consensus::ConsensusError; use reth_evm::{ execute::{ @@ -16,8 +16,10 @@ use reth_primitives::{ gas_spent_by_transactions, BlockWithSenders, GotExpected, InvalidTransactionError, Receipt, }; use reth_revm::primitives::{CfgEnvWithHandlerCfg, U256}; +use reth_scroll_chainspec::{ScrollChainConfig, ScrollChainSpec}; use reth_scroll_consensus::apply_curie_hard_fork; use reth_scroll_execution::FinalizeExecution; +use reth_scroll_forks::ScrollHardfork; use revm::{ db::BundleState, primitives::{bytes::BytesMut, BlockEnv, EnvWithHandlerCfg, ResultAndState}, @@ -32,8 +34,7 @@ use std::{ #[derive(Debug)] pub struct ScrollExecutionStrategy { /// Chain specification. - // TODO (scroll): update to the Scroll chain spec - chain_spec: Arc, + chain_spec: Arc, /// Evm configuration. evm_config: EvmConfig, /// Current state for the execution. @@ -42,7 +43,11 @@ pub struct ScrollExecutionStrategy { impl ScrollExecutionStrategy { /// Returns an instance of [`ScrollExecutionStrategy`]. - pub const fn new(chain_spec: Arc, evm_config: EvmConfig, state: State) -> Self { + pub const fn new( + chain_spec: Arc, + evm_config: EvmConfig, + state: State, + ) -> Self { Self { chain_spec, evm_config, state } } } @@ -78,9 +83,7 @@ where block: &BlockWithSenders, _total_difficulty: U256, ) -> Result<(), Self::Error> { - // TODO (scroll): update to the Scroll chain spec - // TODO (scroll): update to the Curie hardfork - if self.chain_spec.fork(EthereumHardfork::Dao).transitions_at_block(block.number) { + if self.chain_spec.fork(ScrollHardfork::Curie).transitions_at_block(block.number) { if let Err(err) = apply_curie_hard_fork(&mut self.state) { tracing::debug!(%err, "failed to apply curie hardfork"); return Err(ForkError::Curie.into()); @@ -227,16 +230,15 @@ where #[derive(Clone, Debug)] pub struct ScrollExecutionStrategyFactory { /// The chain specification for the [`ScrollExecutionStrategy`]. - // TODO (scroll): update to the Scroll chain spec - chain_spec: Arc, + chain_spec: Arc, /// The Evm configuration for the [`ScrollExecutionStrategy`]. evm_config: EvmConfig, } impl ScrollExecutionStrategyFactory { /// Returns a new instance of the [`ScrollExecutionStrategyFactory`]. - pub fn new(chain_spec: Arc) -> Self { - let evm_config = ScrollEvmConfig::new(chain_spec.clone()); + pub fn new(chain_spec: Arc, scroll_config: ScrollChainConfig) -> Self { + let evm_config = ScrollEvmConfig::new(chain_spec.clone(), scroll_config); Self { chain_spec, evm_config } } } @@ -267,10 +269,11 @@ where mod tests { use super::*; use crate::{ScrollEvmConfig, ScrollExecutionStrategy, ScrollExecutionStrategyFactory}; - use reth_chainspec::{ChainSpecBuilder, MIN_TRANSACTION_GAS}; + use reth_chainspec::MIN_TRANSACTION_GAS; use reth_evm::execute::ExecuteOutput; use reth_primitives::{Block, BlockBody, BlockWithSenders, Receipt, TransactionSigned, TxType}; use reth_primitives_traits::transaction::signed::SignedTransaction; + use reth_scroll_chainspec::ScrollChainSpecBuilder; use reth_scroll_consensus::{ BLOB_SCALAR_SLOT, COMMIT_SCALAR_SLOT, CURIE_L1_GAS_PRICE_ORACLE_BYTECODE, CURIE_L1_GAS_PRICE_ORACLE_STORAGE, IS_CURIE_SLOT, L1_BASE_FEE_SLOT, L1_BLOB_BASE_FEE_SLOT, @@ -284,9 +287,9 @@ mod tests { }; fn strategy() -> ScrollExecutionStrategy, ScrollEvmConfig> { - // TODO (scroll): change this to `ScrollChainSpecBuilder::mainnet()`. - let chain_spec = Arc::new(ChainSpecBuilder::mainnet().build()); - let factory = ScrollExecutionStrategyFactory::new(chain_spec); + let chain_spec = Arc::new(ScrollChainSpecBuilder::scroll_mainnet().build()); + let config = ScrollChainConfig::mainnet(); + let factory = ScrollExecutionStrategyFactory::new(chain_spec, config); let db = EmptyDBTyped::::new(); factory.create_strategy(db) @@ -467,9 +470,9 @@ mod tests { (L1_BASE_FEE_SLOT, U256::from(1000)), (OVER_HEAD_SLOT, U256::from(1000)), (SCALAR_SLOT, U256::from(1000)), - (L1_BLOB_BASE_FEE_SLOT, U256::from(1000)), + (L1_BLOB_BASE_FEE_SLOT, U256::from(10000)), (COMMIT_SCALAR_SLOT, U256::from(1000)), - (BLOB_SCALAR_SLOT, U256::from(1000)), + (BLOB_SCALAR_SLOT, U256::from(10000)), (IS_CURIE_SLOT, U256::from(1)), ] .into_iter() @@ -488,9 +491,7 @@ mod tests { tx_type: TxType::Legacy, cumulative_gas_used: MIN_TRANSACTION_GAS, success: true, - // TODO (scroll): set this to the correct value (should be different from - // not_curie_fork) - l1_fee: U256::from(3), + l1_fee: U256::from(9), ..Default::default() }]; From 1ce370c7d0ebafdd6913b5266433d6cad21015da Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Mon, 9 Dec 2024 13:38:18 +0100 Subject: [PATCH 25/31] fix: scroll ci Signed-off-by: Gregory Edison --- .github/workflows/unit.yml | 2 +- crates/scroll/evm/src/config.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index b9d3f3fb8e65..539396277c2a 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -42,7 +42,7 @@ jobs: partition: 2 total_partitions: 2 - type: scroll - args: --locked --features "scroll" --workspace --exclude ef-tests -E 'package(reth-scroll-*)' + args: -p "reth-scroll-*" --locked --features "scroll" partition: 1 total_partitions: 1 - type: book diff --git a/crates/scroll/evm/src/config.rs b/crates/scroll/evm/src/config.rs index 67215d2f5905..cb47169d7996 100644 --- a/crates/scroll/evm/src/config.rs +++ b/crates/scroll/evm/src/config.rs @@ -313,7 +313,7 @@ mod tests { timestamp: U256::from(attributes.timestamp), prevrandao: Some(attributes.prev_randao), difficulty: U256::ZERO, - // TODO (scroll): this shouldn't be 0 at curie fork + // TODO(scroll): this shouldn't be 0 at curie fork basefee: U256::ZERO, gas_limit: U256::from(header.gas_limit), blob_excess_gas_and_price: None, From ca0275b06df08d13618212deb23f7b4fb264f63b Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Mon, 9 Dec 2024 14:25:23 +0100 Subject: [PATCH 26/31] chore: bump `trust-dns-resolver` to 0.25 alpha4 to fix deny Signed-off-by: Gregory Edison --- Cargo.lock | 174 +++++++++++++++++---------------- crates/net/dns/Cargo.toml | 3 +- crates/net/dns/src/resolver.rs | 12 +-- 3 files changed, 98 insertions(+), 91 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b80d6e78dd76..f23c27925b2b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1079,6 +1079,17 @@ dependencies = [ "zstd-safe", ] +[[package]] +name = "async-recursion" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "async-sse" version = "5.1.0" @@ -3673,6 +3684,52 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "hickory-proto" +version = "0.25.0-alpha.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d063c0692ee669aa6d261988aa19ca5510f1cc40e4f211024f50c888499a35d7" +dependencies = [ + "async-recursion", + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna", + "ipnet", + "once_cell", + "rand 0.8.5", + "thiserror 2.0.4", + "tinyvec", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "hickory-resolver" +version = "0.25.0-alpha.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42bc352e4412fb657e795f79b4efcf2bd60b59ee5ca0187f3554194cd1107a27" +dependencies = [ + "cfg-if", + "futures-util", + "hickory-proto", + "ipconfig", + "moka", + "once_cell", + "parking_lot", + "rand 0.8.5", + "resolv-conf", + "smallvec", + "thiserror 2.0.4", + "tokio", + "tracing", +] + [[package]] name = "hkdf" version = "0.12.4" @@ -4060,16 +4117,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "idna" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "1.0.3" @@ -4660,7 +4707,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -4825,15 +4872,6 @@ dependencies = [ "hashbrown 0.15.2", ] -[[package]] -name = "lru-cache" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" -dependencies = [ - "linked-hash-map", -] - [[package]] name = "lz4_flex" version = "0.11.3" @@ -5078,6 +5116,26 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "moka" +version = "0.12.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32cf62eb4dd975d2dde76432fb1075c49e3ee2331cf36f1f8fd4b66550d32b6f" +dependencies = [ + "crossbeam-channel", + "crossbeam-epoch", + "crossbeam-utils", + "once_cell", + "parking_lot", + "quanta", + "rustc_version 0.4.1", + "smallvec", + "tagptr", + "thiserror 1.0.69", + "triomphe", + "uuid", +] + [[package]] name = "more-asserts" version = "0.3.1" @@ -7119,6 +7177,7 @@ dependencies = [ "alloy-rlp", "data-encoding", "enr", + "hickory-resolver", "linked_hash_set", "parking_lot", "rand 0.8.5", @@ -7135,7 +7194,6 @@ dependencies = [ "tokio", "tokio-stream", "tracing", - "trust-dns-resolver", ] [[package]] @@ -10936,6 +10994,12 @@ dependencies = [ "windows 0.57.0", ] +[[package]] +name = "tagptr" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" + [[package]] name = "tap" version = "1.0.1" @@ -11540,7 +11604,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3637e734239e12ab152cd269302500bd063f37624ee210cd04b4936ed671f3b1" dependencies = [ "cc", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -11554,51 +11618,10 @@ dependencies = [ ] [[package]] -name = "trust-dns-proto" -version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3119112651c157f4488931a01e586aa459736e9d6046d3bd9105ffb69352d374" -dependencies = [ - "async-trait", - "cfg-if", - "data-encoding", - "enum-as-inner", - "futures-channel", - "futures-io", - "futures-util", - "idna 0.4.0", - "ipnet", - "once_cell", - "rand 0.8.5", - "smallvec", - "thiserror 1.0.69", - "tinyvec", - "tokio", - "tracing", - "url", -] - -[[package]] -name = "trust-dns-resolver" -version = "0.23.2" +name = "triomphe" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a3e6c3aff1718b3c73e395d1f35202ba2ffa847c6a62eea0db8fb4cfe30be6" -dependencies = [ - "cfg-if", - "futures-util", - "ipconfig", - "lru-cache", - "once_cell", - "parking_lot", - "rand 0.8.5", - "resolv-conf", - "serde", - "smallvec", - "thiserror 1.0.69", - "tokio", - "tracing", - "trust-dns-proto", -] +checksum = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3" [[package]] name = "try-lock" @@ -11674,27 +11697,12 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" -[[package]] -name = "unicode-bidi" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" - [[package]] name = "unicode-ident" version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" -[[package]] -name = "unicode-normalization" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" -dependencies = [ - "tinyvec", -] - [[package]] name = "unicode-segmentation" version = "1.12.0" @@ -11759,7 +11767,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", - "idna 1.0.3", + "idna", "percent-encoding", "serde", ] @@ -12032,7 +12040,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] diff --git a/crates/net/dns/Cargo.toml b/crates/net/dns/Cargo.toml index a52f65057443..c8aa4c658daa 100644 --- a/crates/net/dns/Cargo.toml +++ b/crates/net/dns/Cargo.toml @@ -27,7 +27,7 @@ tokio = { workspace = true, features = ["io-util", "net", "time"] } tokio-stream.workspace = true # trust-dns -trust-dns-resolver = "0.23" +hickory-resolver = { version = "0.25.0-alpha.4" } # misc data-encoding = "2" @@ -58,5 +58,4 @@ serde = [ "parking_lot/serde", "rand/serde", "secp256k1/serde", - "trust-dns-resolver/serde" ] diff --git a/crates/net/dns/src/resolver.rs b/crates/net/dns/src/resolver.rs index 42c444f89a75..7816580aeba1 100644 --- a/crates/net/dns/src/resolver.rs +++ b/crates/net/dns/src/resolver.rs @@ -1,10 +1,10 @@ //! Perform DNS lookups +use hickory_resolver::name_server::ConnectionProvider; +pub use hickory_resolver::{ResolveError, TokioResolver}; use parking_lot::RwLock; use std::{collections::HashMap, future::Future}; use tracing::trace; -pub use trust_dns_resolver::{error::ResolveError, TokioAsyncResolver}; -use trust_dns_resolver::{name_server::ConnectionProvider, AsyncResolver}; /// A type that can lookup DNS entries pub trait Resolver: Send + Sync + Unpin + 'static { @@ -12,7 +12,7 @@ pub trait Resolver: Send + Sync + Unpin + 'static { fn lookup_txt(&self, query: &str) -> impl Future> + Send; } -impl Resolver for AsyncResolver

{ +impl Resolver for hickory_resolver::Resolver

{ async fn lookup_txt(&self, query: &str) -> Option { // See: [AsyncResolver::txt_lookup] // > *hint* queries that end with a '.' are fully qualified names and are cheaper lookups @@ -46,13 +46,13 @@ impl Resolver for AsyncResolver

{ /// [`ResolverOpts`](trust_dns_resolver::config::ResolverOpts) which configures 2 attempts (1 retry) /// by default. #[derive(Clone, Debug)] -pub struct DnsResolver(TokioAsyncResolver); +pub struct DnsResolver(TokioResolver); // === impl DnsResolver === impl DnsResolver { /// Create a new resolver by wrapping the given [`AsyncResolver`] - pub const fn new(resolver: TokioAsyncResolver) -> Self { + pub const fn new(resolver: TokioResolver) -> Self { Self(resolver) } @@ -60,7 +60,7 @@ impl DnsResolver { /// /// This will use `/etc/resolv.conf` on Unix OSes and the registry on Windows. pub fn from_system_conf() -> Result { - TokioAsyncResolver::tokio_from_system_conf().map(Self::new) + TokioResolver::tokio_from_system_conf().map(Self::new) } } From a3204e2757ece63634fe6ca27fa9a8465d5e490b Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Mon, 9 Dec 2024 14:28:08 +0100 Subject: [PATCH 27/31] fix: propagate serde feature Signed-off-by: Gregory Edison --- Cargo.lock | 2 ++ crates/net/dns/Cargo.toml | 1 + 2 files changed, 3 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index f23c27925b2b..eb2db392b928 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3702,6 +3702,7 @@ dependencies = [ "ipnet", "once_cell", "rand 0.8.5", + "serde", "thiserror 2.0.4", "tinyvec", "tokio", @@ -3724,6 +3725,7 @@ dependencies = [ "parking_lot", "rand 0.8.5", "resolv-conf", + "serde", "smallvec", "thiserror 2.0.4", "tokio", diff --git a/crates/net/dns/Cargo.toml b/crates/net/dns/Cargo.toml index c8aa4c658daa..1c3e298413f0 100644 --- a/crates/net/dns/Cargo.toml +++ b/crates/net/dns/Cargo.toml @@ -58,4 +58,5 @@ serde = [ "parking_lot/serde", "rand/serde", "secp256k1/serde", + "hickory-resolver/serde" ] From c3cdac53996f70f51bf6a3026469f576b5178092 Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Mon, 9 Dec 2024 15:05:35 +0100 Subject: [PATCH 28/31] fix: docs Signed-off-by: Gregory Edison --- crates/net/dns/src/resolver.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/net/dns/src/resolver.rs b/crates/net/dns/src/resolver.rs index 7816580aeba1..eec3ea2a23d2 100644 --- a/crates/net/dns/src/resolver.rs +++ b/crates/net/dns/src/resolver.rs @@ -33,7 +33,7 @@ impl Resolver for hickory_resolver::Resolver

{ /// An asynchronous DNS resolver /// -/// See also [`TokioAsyncResolver`] +/// See also [`TokioResolver`] /// /// ``` /// # fn t() { @@ -43,7 +43,7 @@ impl Resolver for hickory_resolver::Resolver

{ /// ``` /// /// Note: This [Resolver] can send multiple lookup attempts, See also -/// [`ResolverOpts`](trust_dns_resolver::config::ResolverOpts) which configures 2 attempts (1 retry) +/// [`ResolverOpts`](hickory_resolver::config::ResolverOpts) which configures 2 attempts (1 retry) /// by default. #[derive(Clone, Debug)] pub struct DnsResolver(TokioResolver); @@ -51,7 +51,7 @@ pub struct DnsResolver(TokioResolver); // === impl DnsResolver === impl DnsResolver { - /// Create a new resolver by wrapping the given [`AsyncResolver`] + /// Create a new resolver by wrapping the given [`TokioResolver`] pub const fn new(resolver: TokioResolver) -> Self { Self(resolver) } From 2d78cc442668e63fc556ee7c1406fa397ee865a5 Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Tue, 10 Dec 2024 09:14:24 +0100 Subject: [PATCH 29/31] answer comments Signed-off-by: Gregory Edison --- crates/scroll/chainspec/src/constants.rs | 41 +++ crates/scroll/chainspec/src/genesis.rs | 27 +- crates/scroll/chainspec/src/lib.rs | 7 + crates/scroll/evm/src/config.rs | 5 +- crates/scroll/evm/src/error.rs | 15 +- crates/scroll/evm/src/execute.rs | 333 +++++++++++++---------- 6 files changed, 254 insertions(+), 174 deletions(-) create mode 100644 crates/scroll/chainspec/src/constants.rs diff --git a/crates/scroll/chainspec/src/constants.rs b/crates/scroll/chainspec/src/constants.rs new file mode 100644 index 000000000000..302fe9b3157e --- /dev/null +++ b/crates/scroll/chainspec/src/constants.rs @@ -0,0 +1,41 @@ +use crate::genesis::L1Config; +use alloy_primitives::{address, Address}; + +/// The transaction fee recipient on the L2. +pub const SCROLL_FEE_VAULT_ADDRESS: Address = address!("5300000000000000000000000000000000000005"); + +/// The L1 message queue address for Scroll mainnet. +/// . +pub const SCROLL_MAINNET_L1_MESSAGE_QUEUE_ADDRESS: Address = + address!("0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B"); + +/// The L1 proxy address for Scroll mainnet. +/// . +pub const SCROLL_MAINNET_L1_PROXY_ADDRESS: Address = + address!("a13BAF47339d63B743e7Da8741db5456DAc1E556"); + +/// The L1 configuration for Scroll mainnet. +pub const SCROLL_MAINNET_L1_CONFIG: L1Config = L1Config { + l1_chain_id: 1, + l1_message_queue_address: SCROLL_MAINNET_L1_MESSAGE_QUEUE_ADDRESS, + scroll_chain_address: SCROLL_MAINNET_L1_PROXY_ADDRESS, + num_l1_messages_per_block: 10, +}; + +/// The L1 message queue address for Scroll sepolia. +/// . +pub const SCROLL_SEPOLIA_L1_MESSAGE_QUEUE_ADDRESS: Address = + address!("F0B2293F5D834eAe920c6974D50957A1732de763"); + +/// The L1 proxy address for Scroll sepolia. +/// +pub const SCROLL_SEPOLIA_L1_PROXY_ADDRESS: Address = + address!("2D567EcE699Eabe5afCd141eDB7A4f2D0D6ce8a0"); + +/// The L1 configuration for Scroll sepolia. +pub const SCROLL_SEPOLIA_L1_CONFIG: L1Config = L1Config { + l1_chain_id: 11155111, + l1_message_queue_address: SCROLL_SEPOLIA_L1_MESSAGE_QUEUE_ADDRESS, + scroll_chain_address: SCROLL_SEPOLIA_L1_PROXY_ADDRESS, + num_l1_messages_per_block: 10, +}; diff --git a/crates/scroll/chainspec/src/genesis.rs b/crates/scroll/chainspec/src/genesis.rs index 9319a68110d5..4a86958d14ee 100644 --- a/crates/scroll/chainspec/src/genesis.rs +++ b/crates/scroll/chainspec/src/genesis.rs @@ -1,5 +1,8 @@ //! Scroll types for genesis data. +use crate::constants::{ + SCROLL_FEE_VAULT_ADDRESS, SCROLL_MAINNET_L1_CONFIG, SCROLL_SEPOLIA_L1_CONFIG, +}; use alloy_primitives::{address, Address}; use alloy_serde::OtherFields; use serde::de::Error; @@ -80,15 +83,9 @@ pub struct L1Config { pub l1_chain_id: u64, /// The L1 contract address of the contract that handles the message queue targeting the Scroll /// rollup. - /// - /// Scroll mainnet l1 message queue address: . - /// Scroll sepolia l1 message queue address: . pub l1_message_queue_address: Address, /// The L1 contract address of the proxy contract which is responsible for Scroll rollup /// settlement. - /// - /// Scroll mainnet l1 chain proxy address: . - /// Scroll sepolia l1 chain proxy address: pub scroll_chain_address: Address, /// The maximum number of L1 messages to be consumed per L2 rollup block. pub num_l1_messages_per_block: u64, @@ -119,25 +116,15 @@ impl ScrollChainConfig { /// Returns the [`ScrollChainConfig`] for Scroll Mainnet. pub const fn mainnet() -> Self { Self { - fee_vault_address: Some(address!("5300000000000000000000000000000000000005")), - l1_config: L1Config { - l1_chain_id: 1, - l1_message_queue_address: address!("0d7E906BD9cAFa154b048cFa766Cc1E54E39AF9B"), - scroll_chain_address: address!("a13BAF47339d63B743e7Da8741db5456DAc1E556"), - num_l1_messages_per_block: 10, - }, + fee_vault_address: Some(SCROLL_FEE_VAULT_ADDRESS), + l1_config: SCROLL_MAINNET_L1_CONFIG, } } /// Returns the [`ScrollChainConfig`] for Scroll Sepolia. pub const fn sepolia() -> Self { Self { - fee_vault_address: Some(address!("5300000000000000000000000000000000000005")), - l1_config: L1Config { - l1_chain_id: 11155111, - l1_message_queue_address: address!("F0B2293F5D834eAe920c6974D50957A1732de763"), - scroll_chain_address: address!("2D567EcE699Eabe5afCd141eDB7A4f2D0D6ce8a0"), - num_l1_messages_per_block: 10, - }, + fee_vault_address: Some(SCROLL_FEE_VAULT_ADDRESS), + l1_config: SCROLL_SEPOLIA_L1_CONFIG, } } } diff --git a/crates/scroll/chainspec/src/lib.rs b/crates/scroll/chainspec/src/lib.rs index 7224af82b707..14f6286f7e65 100644 --- a/crates/scroll/chainspec/src/lib.rs +++ b/crates/scroll/chainspec/src/lib.rs @@ -29,6 +29,13 @@ use std::sync::LazyLock; extern crate alloc; +mod constants; +pub use constants::{ + SCROLL_FEE_VAULT_ADDRESS, SCROLL_MAINNET_L1_CONFIG, SCROLL_MAINNET_L1_MESSAGE_QUEUE_ADDRESS, + SCROLL_MAINNET_L1_PROXY_ADDRESS, SCROLL_SEPOLIA_L1_CONFIG, + SCROLL_SEPOLIA_L1_MESSAGE_QUEUE_ADDRESS, SCROLL_SEPOLIA_L1_PROXY_ADDRESS, +}; + mod dev; pub use dev::SCROLL_DEV; diff --git a/crates/scroll/evm/src/config.rs b/crates/scroll/evm/src/config.rs index cb47169d7996..e2ced0b7c605 100644 --- a/crates/scroll/evm/src/config.rs +++ b/crates/scroll/evm/src/config.rs @@ -105,10 +105,13 @@ impl ConfigureEvmEnv for ScrollEvmConfig { fn fill_block_env(&self, block_env: &mut BlockEnv, header: &Self::Header, after_merge: bool) { block_env.number = U256::from(header.number); - block_env.coinbase = header.beneficiary; + if let Some(vault_address) = self.scroll_config.fee_vault_address { block_env.coinbase = vault_address; + } else { + block_env.coinbase = header.beneficiary; } + block_env.timestamp = U256::from(header.timestamp); if after_merge { block_env.prevrandao = Some(header.mix_hash); diff --git a/crates/scroll/evm/src/error.rs b/crates/scroll/evm/src/error.rs index 8901aa4fe2ec..3e2f469a4a6e 100644 --- a/crates/scroll/evm/src/error.rs +++ b/crates/scroll/evm/src/error.rs @@ -7,12 +7,6 @@ pub enum ScrollBlockExecutionError { /// Error occurred at fork transition. #[display("failed to apply fork: {_0}")] Fork(ForkError), - /// Error occurred at L1 fee computation. - #[display("failed to compute l1 fee: {reason}")] - L1FeeComputation { - /// The reason for the fee computation error. - reason: &'static str, - }, } impl From for BlockExecutionError { @@ -21,18 +15,11 @@ impl From for BlockExecutionError { } } -impl ScrollBlockExecutionError { - /// Returns a [`ScrollBlockExecutionError`] with the `L1FeeComputation` variant. - pub const fn l1_fee(reason: &'static str) -> Self { - Self::L1FeeComputation { reason } - } -} - /// Scroll fork error. #[derive(Debug, Display)] pub enum ForkError { /// Error occurred at Curie fork. - Curie, + Curie(String), } impl From for BlockExecutionError { diff --git a/crates/scroll/evm/src/execute.rs b/crates/scroll/evm/src/execute.rs index 1eaeb73b2d4b..9642bfecd742 100644 --- a/crates/scroll/evm/src/execute.rs +++ b/crates/scroll/evm/src/execute.rs @@ -1,6 +1,6 @@ //! Implementation of the [`BlockExecutionStrategy`] for Scroll. -use crate::{ForkError, ScrollBlockExecutionError, ScrollEvmConfig}; +use crate::{ForkError, ScrollEvmConfig}; use alloy_consensus::{Header, Transaction}; use alloy_eips::{eip2718::Encodable2718, eip7685::Requests}; use reth_chainspec::EthereumHardforks; @@ -14,12 +14,13 @@ use reth_evm::{ }; use reth_primitives::{ gas_spent_by_transactions, BlockWithSenders, GotExpected, InvalidTransactionError, Receipt, + TxType, }; use reth_revm::primitives::{CfgEnvWithHandlerCfg, U256}; use reth_scroll_chainspec::{ScrollChainConfig, ScrollChainSpec}; use reth_scroll_consensus::apply_curie_hard_fork; use reth_scroll_execution::FinalizeExecution; -use reth_scroll_forks::ScrollHardfork; +use reth_scroll_forks::{ScrollHardfork, ScrollHardforks}; use revm::{ db::BundleState, primitives::{bytes::BytesMut, BlockEnv, EnvWithHandlerCfg, ResultAndState}, @@ -86,7 +87,7 @@ where if self.chain_spec.fork(ScrollHardfork::Curie).transitions_at_block(block.number) { if let Err(err) = apply_curie_hard_fork(&mut self.state) { tracing::debug!(%err, "failed to apply curie hardfork"); - return Err(ForkError::Curie.into()); + return Err(ForkError::Curie(err.to_string()).into()); }; } @@ -116,12 +117,34 @@ where .into()) } - if transaction.is_eip4844() { - return Err(ConsensusError::InvalidTransaction( - InvalidTransactionError::Eip4844Disabled, - ) - .into()) - } + // verify the transaction type is accepted by the current fork. + match transaction.tx_type() { + TxType::Eip2930 if !self.chain_spec.is_curie_active_at_block(block.number) => { + return Err(ConsensusError::InvalidTransaction( + InvalidTransactionError::Eip2930Disabled, + ) + .into()) + } + TxType::Eip1559 if !self.chain_spec.is_curie_active_at_block(block.number) => { + return Err(ConsensusError::InvalidTransaction( + InvalidTransactionError::Eip1559Disabled, + ) + .into()) + } + TxType::Eip4844 => { + return Err(ConsensusError::InvalidTransaction( + InvalidTransactionError::Eip4844Disabled, + ) + .into()) + } + TxType::Eip7702 => { + return Err(ConsensusError::InvalidTransaction( + InvalidTransactionError::Eip7702Disabled, + ) + .into()) + } + _ => (), + }; self.evm_config.fill_tx_env(evm.tx_mut(), transaction, *sender); if transaction.is_l1_message() { @@ -148,13 +171,9 @@ where } else { // compute l1 fee for all non-l1 transaction let l1_block_info = - evm.context.evm.inner.l1_block_info.as_ref().ok_or_else(|| { - ScrollBlockExecutionError::l1_fee("missing l1 block info") - })?; + evm.context.evm.inner.l1_block_info.as_ref().expect("l1_block_info loaded"); let transaction_rlp_bytes = - evm.context.evm.env.tx.scroll.rlp_bytes.as_ref().ok_or_else(|| { - ScrollBlockExecutionError::l1_fee("missing transaction rlp bytes") - })?; + evm.context.evm.env.tx.scroll.rlp_bytes.as_ref().expect("rlp_bytes loaded"); l1_block_info.calculate_tx_l1_cost(transaction_rlp_bytes, evm.handler.cfg.spec_id) }; @@ -286,6 +305,11 @@ mod tests { Bytecode, EmptyDBTyped, TxKind, }; + const BLOCK_GAS_LIMIT: u64 = 10_000_000; + const SCROLL_CHAIN_ID: u64 = 534352; + const NOT_CURIE_BLOCK_NUMBER: u64 = 7096835; + const CURIE_BLOCK_NUMBER: u64 = 7096837; + fn strategy() -> ScrollExecutionStrategy, ScrollEvmConfig> { let chain_spec = Arc::new(ScrollChainSpecBuilder::scroll_mainnet().build()); let config = ScrollChainConfig::mainnet(); @@ -295,7 +319,6 @@ mod tests { factory.create_strategy(db) } - const BLOCK_GAS_LIMIT: u64 = 10_000_000; fn block(number: u64, transactions: Vec) -> BlockWithSenders { let senders = transactions.iter().map(|t| t.recover_signer().unwrap()).collect(); BlockWithSenders { @@ -308,31 +331,111 @@ mod tests { } fn transaction(typ: TxType, gas_limit: u64) -> TransactionSigned { - let transaction = match typ { + let mut transaction = match typ { + TxType::Legacy => reth_primitives::Transaction::Legacy(alloy_consensus::TxLegacy { + to: TxKind::Call(Address::ZERO), + ..Default::default() + }), + TxType::Eip2930 => reth_primitives::Transaction::Eip2930(alloy_consensus::TxEip2930 { + to: TxKind::Call(Address::ZERO), + ..Default::default() + }), + TxType::Eip1559 => reth_primitives::Transaction::Eip1559(alloy_consensus::TxEip1559 { + to: TxKind::Call(Address::ZERO), + ..Default::default() + }), TxType::Eip4844 => reth_primitives::Transaction::Eip4844(alloy_consensus::TxEip4844 { - gas_limit, + to: Address::ZERO, + ..Default::default() + }), + TxType::Eip7702 => reth_primitives::Transaction::Eip7702(alloy_consensus::TxEip7702 { to: Address::ZERO, ..Default::default() }), TxType::L1Message => { reth_primitives::Transaction::L1Message(reth_scroll_primitives::TxL1Message { - gas_limit, sender: Address::random(), to: Address::ZERO, ..Default::default() }) } - _ => reth_primitives::Transaction::Legacy(alloy_consensus::TxLegacy { - gas_limit, - to: TxKind::Call(Address::ZERO), - ..Default::default() - }), }; + transaction.set_chain_id(SCROLL_CHAIN_ID); + transaction.set_gas_limit(gas_limit); + let pk = B256::random(); let signature = reth_primitives::sign_message(pk, transaction.signature_hash()).unwrap(); TransactionSigned::new_unhashed(transaction, signature) } + fn execute_transactions( + tx_type: TxType, + block_number: u64, + expected_l1_fee: U256, + expected_error: Option<&str>, + ) -> eyre::Result<()> { + // init strategy + let mut strategy = strategy(); + + // prepare transaction + let transaction = transaction(tx_type, MIN_TRANSACTION_GAS); + let block = block(block_number, vec![transaction]); + + // determine l1 gas oracle storage + let l1_gas_oracle_storage = if strategy.chain_spec.is_curie_active_at_block(block_number) { + vec![ + (L1_BASE_FEE_SLOT, U256::from(1000)), + (OVER_HEAD_SLOT, U256::from(1000)), + (SCALAR_SLOT, U256::from(1000)), + (L1_BLOB_BASE_FEE_SLOT, U256::from(10000)), + (COMMIT_SCALAR_SLOT, U256::from(1000)), + (BLOB_SCALAR_SLOT, U256::from(10000)), + (IS_CURIE_SLOT, U256::from(1)), + ] + } else { + vec![ + (L1_BASE_FEE_SLOT, U256::from(1000)), + (OVER_HEAD_SLOT, U256::from(1000)), + (SCALAR_SLOT, U256::from(1000)), + ] + } + .into_iter() + .collect(); + + // load accounts in state + strategy.state.insert_account_with_storage( + L1_GAS_PRICE_ORACLE_ADDRESS, + Default::default(), + l1_gas_oracle_storage, + ); + for add in &block.senders { + strategy + .state + .insert_account(*add, AccountInfo { balance: U256::MAX, ..Default::default() }); + } + + // execute and verify output + let res = strategy.execute_transactions(&block, U256::ZERO); + + // check for error or execution outcome + if let Some(error) = expected_error { + assert_eq!(res.unwrap_err().to_string(), error); + } else { + let ExecuteOutput { receipts, .. } = res?; + let expected = vec![Receipt { + tx_type, + cumulative_gas_used: MIN_TRANSACTION_GAS, + success: true, + l1_fee: expected_l1_fee, + ..Default::default() + }]; + + assert_eq!(receipts, expected); + } + + Ok(()) + } + #[test] fn test_apply_pre_execution_changes_curie_block() -> eyre::Result<()> { // init strategy @@ -389,7 +492,7 @@ mod tests { } #[test] - fn test_execute_transaction_exceeds_block_gas_limit() -> eyre::Result<()> { + fn test_execute_transactions_exceeds_block_gas_limit() -> eyre::Result<()> { // init strategy let mut strategy = strategy(); @@ -408,138 +511,90 @@ mod tests { } #[test] - fn test_execute_transaction_eip4844() -> eyre::Result<()> { - // init strategy - let mut strategy = strategy(); - - // prepare transactions exceeding block gas limit - let transaction = transaction(TxType::Eip4844, 1_000); - let block = block(7096837, vec![transaction]); - - // execute and verify error - let res = strategy.execute_transactions(&block, U256::ZERO); - assert_eq!(res.unwrap_err().to_string(), "EIP-4844 transactions are disabled"); + fn test_execute_transactions_eip4844() -> eyre::Result<()> { + // Execute eip4844 transaction + execute_transactions( + TxType::Eip4844, + CURIE_BLOCK_NUMBER, + U256::ZERO, + Some("EIP-4844 transactions are disabled"), + )?; + Ok(()) + } + #[test] + fn test_execute_transactions_eip7702() -> eyre::Result<()> { + // Execute eip7702 transaction + execute_transactions( + TxType::Eip7702, + CURIE_BLOCK_NUMBER, + U256::ZERO, + Some("EIP-7702 transactions are disabled"), + )?; Ok(()) } #[test] fn test_execute_transactions_l1_message() -> eyre::Result<()> { - // init strategy - let mut strategy = strategy(); - - // prepare transactions exceeding block gas limit - let transaction = transaction(TxType::L1Message, MIN_TRANSACTION_GAS); - let block = block(7096837, vec![transaction]); - - // load accounts in state - strategy.state.insert_account(L1_GAS_PRICE_ORACLE_ADDRESS, Default::default()); - for add in &block.senders { - strategy.state.insert_account(*add, Default::default()); - } - - // execute and verify output - let ExecuteOutput { receipts, .. } = strategy.execute_transactions(&block, U256::ZERO)?; - let expected = vec![Receipt { - tx_type: TxType::L1Message, - cumulative_gas_used: MIN_TRANSACTION_GAS, - success: true, - l1_fee: U256::ZERO, - ..Default::default() - }]; - - assert_eq!(receipts, expected); - + // Execute l1 message on curie block + let expected_l1_fee = U256::ZERO; + execute_transactions(TxType::L1Message, CURIE_BLOCK_NUMBER, expected_l1_fee, None)?; Ok(()) } #[test] - fn test_execute_transactions_curie_fork() -> eyre::Result<()> { - // init strategy - let mut strategy = strategy(); - - // prepare transactions exceeding block gas limit - let transaction = transaction(TxType::Legacy, MIN_TRANSACTION_GAS); - let block = block(7096837, vec![transaction]); - - // load l1 gas price oracle with l1 block info in storage - strategy.state.insert_account_with_storage( - L1_GAS_PRICE_ORACLE_ADDRESS, - Default::default(), - [ - (L1_BASE_FEE_SLOT, U256::from(1000)), - (OVER_HEAD_SLOT, U256::from(1000)), - (SCALAR_SLOT, U256::from(1000)), - (L1_BLOB_BASE_FEE_SLOT, U256::from(10000)), - (COMMIT_SCALAR_SLOT, U256::from(1000)), - (BLOB_SCALAR_SLOT, U256::from(10000)), - (IS_CURIE_SLOT, U256::from(1)), - ] - .into_iter() - .collect(), - ); - // load accounts in state - for add in &block.senders { - strategy - .state - .insert_account(*add, AccountInfo { balance: U256::MAX, ..Default::default() }); - } - - // execute and verify output - let ExecuteOutput { receipts, .. } = strategy.execute_transactions(&block, U256::ZERO)?; - let expected = vec![Receipt { - tx_type: TxType::Legacy, - cumulative_gas_used: MIN_TRANSACTION_GAS, - success: true, - l1_fee: U256::from(9), - ..Default::default() - }]; - - assert_eq!(receipts, expected); - + fn test_execute_transactions_legacy_curie_fork() -> eyre::Result<()> { + // Execute legacy transaction on curie block + let expected_l1_fee = U256::from(10); + execute_transactions(TxType::Legacy, CURIE_BLOCK_NUMBER, expected_l1_fee, None)?; Ok(()) } #[test] - fn test_execute_transactions_not_curie_fork() -> eyre::Result<()> { - // init strategy - let mut strategy = strategy(); - - // prepare transactions exceeding block gas limit - let transaction = transaction(TxType::Legacy, MIN_TRANSACTION_GAS); - let block = block(7096835, vec![transaction]); + fn test_execute_transactions_legacy_not_curie_fork() -> eyre::Result<()> { + // Execute legacy before curie block + let expected_l1_fee = U256::from(2); + execute_transactions(TxType::Legacy, NOT_CURIE_BLOCK_NUMBER, expected_l1_fee, None)?; + Ok(()) + } - // load l1 gas price oracle with l1 block info in storage - strategy.state.insert_account_with_storage( - L1_GAS_PRICE_ORACLE_ADDRESS, - Default::default(), - [ - (L1_BASE_FEE_SLOT, U256::from(1000)), - (OVER_HEAD_SLOT, U256::from(1000)), - (SCALAR_SLOT, U256::from(1000)), - ] - .into_iter() - .collect(), - ); - // load accounts in state - for add in &block.senders { - strategy - .state - .insert_account(*add, AccountInfo { balance: U256::MAX, ..Default::default() }); - } + #[test] + fn test_execute_transactions_eip2930_curie_fork() -> eyre::Result<()> { + // Execute eip2930 transaction on curie block + let expected_l1_fee = U256::from(10); + execute_transactions(TxType::Eip2930, CURIE_BLOCK_NUMBER, expected_l1_fee, None)?; + Ok(()) + } - // execute and verify output - let ExecuteOutput { receipts, .. } = strategy.execute_transactions(&block, U256::ZERO)?; - let expected = vec![Receipt { - tx_type: TxType::Legacy, - cumulative_gas_used: MIN_TRANSACTION_GAS, - success: true, - l1_fee: U256::from(2), - ..Default::default() - }]; + #[test] + fn test_execute_transactions_eip2930_not_curie_fork() -> eyre::Result<()> { + // Execute eip2930 transaction before curie block + execute_transactions( + TxType::Eip2930, + NOT_CURIE_BLOCK_NUMBER, + U256::ZERO, + Some("EIP-2930 transactions are disabled"), + )?; + Ok(()) + } - assert_eq!(receipts, expected); + #[test] + fn test_execute_transactions_eip1559_curie_fork() -> eyre::Result<()> { + // Execute eip1559 transaction on curie block + let expected_l1_fee = U256::from(10); + execute_transactions(TxType::Eip1559, CURIE_BLOCK_NUMBER, expected_l1_fee, None)?; + Ok(()) + } + #[test] + fn test_execute_transactions_eip_not_curie_fork() -> eyre::Result<()> { + // Execute eip1559 transaction before curie block + execute_transactions( + TxType::Eip1559, + NOT_CURIE_BLOCK_NUMBER, + U256::ZERO, + Some("EIP-1559 transactions are disabled"), + )?; Ok(()) } } From 108c35557fcd062e2bdd23245d207f9819b364a6 Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Tue, 10 Dec 2024 09:37:59 +0100 Subject: [PATCH 30/31] lint Signed-off-by: Gregory Edison --- crates/scroll/chainspec/src/genesis.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/scroll/chainspec/src/genesis.rs b/crates/scroll/chainspec/src/genesis.rs index 4a86958d14ee..301343a21dbe 100644 --- a/crates/scroll/chainspec/src/genesis.rs +++ b/crates/scroll/chainspec/src/genesis.rs @@ -3,7 +3,7 @@ use crate::constants::{ SCROLL_FEE_VAULT_ADDRESS, SCROLL_MAINNET_L1_CONFIG, SCROLL_SEPOLIA_L1_CONFIG, }; -use alloy_primitives::{address, Address}; +use alloy_primitives::Address; use alloy_serde::OtherFields; use serde::de::Error; From 05f2a852767cffac1de2f835b3e5328821ad647c Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Tue, 10 Dec 2024 11:23:37 +0100 Subject: [PATCH 31/31] answer comments Signed-off-by: Gregory Edison --- crates/scroll/chainspec/src/constants.rs | 14 ++++++++++---- crates/scroll/chainspec/src/lib.rs | 3 ++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/crates/scroll/chainspec/src/constants.rs b/crates/scroll/chainspec/src/constants.rs index 302fe9b3157e..98ef129c05a1 100644 --- a/crates/scroll/chainspec/src/constants.rs +++ b/crates/scroll/chainspec/src/constants.rs @@ -14,12 +14,15 @@ pub const SCROLL_MAINNET_L1_MESSAGE_QUEUE_ADDRESS: Address = pub const SCROLL_MAINNET_L1_PROXY_ADDRESS: Address = address!("a13BAF47339d63B743e7Da8741db5456DAc1E556"); +/// The maximum allowed l1 messages per block for Scroll mainnet. +pub const SCROLL_MAINNET_MAX_L1_MESSAGES: u64 = 10; + /// The L1 configuration for Scroll mainnet. pub const SCROLL_MAINNET_L1_CONFIG: L1Config = L1Config { - l1_chain_id: 1, + l1_chain_id: alloy_chains::NamedChain::Mainnet as u64, l1_message_queue_address: SCROLL_MAINNET_L1_MESSAGE_QUEUE_ADDRESS, scroll_chain_address: SCROLL_MAINNET_L1_PROXY_ADDRESS, - num_l1_messages_per_block: 10, + num_l1_messages_per_block: SCROLL_MAINNET_MAX_L1_MESSAGES, }; /// The L1 message queue address for Scroll sepolia. @@ -32,10 +35,13 @@ pub const SCROLL_SEPOLIA_L1_MESSAGE_QUEUE_ADDRESS: Address = pub const SCROLL_SEPOLIA_L1_PROXY_ADDRESS: Address = address!("2D567EcE699Eabe5afCd141eDB7A4f2D0D6ce8a0"); +/// The maximum allowed l1 messages per block for Scroll sepolia. +pub const SCROLL_SEPOLIA_MAX_L1_MESSAGES: u64 = 10; + /// The L1 configuration for Scroll sepolia. pub const SCROLL_SEPOLIA_L1_CONFIG: L1Config = L1Config { - l1_chain_id: 11155111, + l1_chain_id: alloy_chains::NamedChain::Sepolia as u64, l1_message_queue_address: SCROLL_SEPOLIA_L1_MESSAGE_QUEUE_ADDRESS, scroll_chain_address: SCROLL_SEPOLIA_L1_PROXY_ADDRESS, - num_l1_messages_per_block: 10, + num_l1_messages_per_block: SCROLL_SEPOLIA_MAX_L1_MESSAGES, }; diff --git a/crates/scroll/chainspec/src/lib.rs b/crates/scroll/chainspec/src/lib.rs index 14f6286f7e65..a9bcfd5fb857 100644 --- a/crates/scroll/chainspec/src/lib.rs +++ b/crates/scroll/chainspec/src/lib.rs @@ -32,8 +32,9 @@ extern crate alloc; mod constants; pub use constants::{ SCROLL_FEE_VAULT_ADDRESS, SCROLL_MAINNET_L1_CONFIG, SCROLL_MAINNET_L1_MESSAGE_QUEUE_ADDRESS, - SCROLL_MAINNET_L1_PROXY_ADDRESS, SCROLL_SEPOLIA_L1_CONFIG, + SCROLL_MAINNET_L1_PROXY_ADDRESS, SCROLL_MAINNET_MAX_L1_MESSAGES, SCROLL_SEPOLIA_L1_CONFIG, SCROLL_SEPOLIA_L1_MESSAGE_QUEUE_ADDRESS, SCROLL_SEPOLIA_L1_PROXY_ADDRESS, + SCROLL_SEPOLIA_MAX_L1_MESSAGES, }; mod dev;