From 878c172ea50ad67c13bb7a48421cd12e70fd2812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erce=20Can=20Bekt=C3=BCre?= Date: Thu, 12 Dec 2024 17:05:29 +0300 Subject: [PATCH 01/13] Test kzg point eval precompile tx to revert --- Cargo.lock | 1 + crates/evm/Cargo.toml | 1 + .../src/evm/test_data/KZGPointEvaluation.abi | 1 + .../src/evm/test_data/KZGPointEvaluation.bin | 1 + .../src/evm/test_data/KZGPointEvaluation.sol | 26 ++++ .../smart_contracts/kzg_point_evaluation.rs | 49 +++++++ crates/evm/src/smart_contracts/mod.rs | 2 + crates/evm/src/tests/fork_tests.rs | 128 +++++++++++++++++- 8 files changed, 206 insertions(+), 3 deletions(-) create mode 100644 crates/evm/src/evm/test_data/KZGPointEvaluation.abi create mode 100644 crates/evm/src/evm/test_data/KZGPointEvaluation.bin create mode 100644 crates/evm/src/evm/test_data/KZGPointEvaluation.sol create mode 100644 crates/evm/src/smart_contracts/kzg_point_evaluation.rs diff --git a/Cargo.lock b/Cargo.lock index 703b3ad13..5f205cd7f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1893,6 +1893,7 @@ dependencies = [ "secp256k1", "serde", "serde_json", + "sha2", "sov-modules-api", "sov-prover-storage-manager", "sov-rollup-interface", diff --git a/crates/evm/Cargo.toml b/crates/evm/Cargo.toml index ea6336030..51fe998e4 100644 --- a/crates/evm/Cargo.toml +++ b/crates/evm/Cargo.toml @@ -56,6 +56,7 @@ reth-chainspec = { workspace = true } reth-db = { workspace = true } reth-errors = { workspace = true } revm = { workspace = true, features = ["optional_block_gas_limit", "optional_eip3607", "optional_no_base_fee", "secp256k1"] } +sha2 = { workspace = true } sov-modules-api = { path = "../sovereign-sdk/module-system/sov-modules-api", features = ["macros"] } sov-prover-storage-manager = { path = "../sovereign-sdk/full-node/sov-prover-storage-manager", features = ["test-utils"] } sov-rollup-interface = { path = "../sovereign-sdk/rollup-interface", features = ["testing"] } diff --git a/crates/evm/src/evm/test_data/KZGPointEvaluation.abi b/crates/evm/src/evm/test_data/KZGPointEvaluation.abi new file mode 100644 index 000000000..f5bbbc1ef --- /dev/null +++ b/crates/evm/src/evm/test_data/KZGPointEvaluation.abi @@ -0,0 +1 @@ +[{"inputs":[{"internalType":"bytes","name":"input","type":"bytes"}],"name":"verifyPointEvaluation","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/crates/evm/src/evm/test_data/KZGPointEvaluation.bin b/crates/evm/src/evm/test_data/KZGPointEvaluation.bin new file mode 100644 index 000000000..cef131023 --- /dev/null +++ b/crates/evm/src/evm/test_data/KZGPointEvaluation.bin @@ -0,0 +1 @@ +6080604052348015600e575f5ffd5b506102548061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610029575f3560e01c806325a05f401461002d575b5f5ffd5b61004760048036038101906100429190610128565b61005d565b604051610054919061018d565b60405180910390f35b5f60c083839050146100a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009b90610200565b60405180910390fd5b60c0835f375f5f60c05f600a5afa809150815f555092915050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f8401126100e8576100e76100c7565b5b8235905067ffffffffffffffff811115610105576101046100cb565b5b602083019150836001820283011115610121576101206100cf565b5b9250929050565b5f5f6020838503121561013e5761013d6100bf565b5b5f83013567ffffffffffffffff81111561015b5761015a6100c3565b5b610167858286016100d3565b92509250509250929050565b5f8115159050919050565b61018781610173565b82525050565b5f6020820190506101a05f83018461017e565b92915050565b5f82825260208201905092915050565b7f496e76616c696420696e7075742073697a6500000000000000000000000000005f82015250565b5f6101ea6012836101a6565b91506101f5826101b6565b602082019050919050565b5f6020820190508181035f830152610217816101de565b905091905056fea2646970667358221220e03af26fa30332b4f2090a2bfbac161d953bd76df1516e079517b16b7dce880964736f6c634300081c0033 \ No newline at end of file diff --git a/crates/evm/src/evm/test_data/KZGPointEvaluation.sol b/crates/evm/src/evm/test_data/KZGPointEvaluation.sol new file mode 100644 index 000000000..f8d7fa377 --- /dev/null +++ b/crates/evm/src/evm/test_data/KZGPointEvaluation.sol @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.28; + +contract KZGPointEvaluation { + /// @notice Calls the 0x0A precompile to perform point evaluation + /// @param input A 192-byte input representing the polynomial versioned hash, commitment, point, and proof + function verifyPointEvaluation( + bytes calldata input // 192 bytes + ) external returns (bool success) { + require(input.length == 192, "Invalid input size"); + + assembly { + // Copy the 192-byte input data from calldata to memory at position 0 + calldatacopy(0, input.offset, 192) + + // Call the precompile at address 0x0A (0x0A is the precompile address) + let result := staticcall(gas(), 0x0A, 0, 192, 0, 0) + + // Set the success flag based on the precompile result + success := result + + // Store the result (success) in the contract's storage at slot 0 + sstore(0, success) + } + } +} \ No newline at end of file diff --git a/crates/evm/src/smart_contracts/kzg_point_evaluation.rs b/crates/evm/src/smart_contracts/kzg_point_evaluation.rs new file mode 100644 index 000000000..e7746e2ef --- /dev/null +++ b/crates/evm/src/smart_contracts/kzg_point_evaluation.rs @@ -0,0 +1,49 @@ +use alloy_sol_types::{sol, SolCall}; +use reth_primitives::Bytes; + +use super::TestContract; + +// KZGPointEvaluationContract wrapper. +sol! { + #[sol(abi)] + KZGPointEvaluation, + "./src/evm/test_data/KZGPointEvaluation.abi" +} + +/// KZGPointEvaluationContract wrapper. +pub struct KZGPointEvaluationContract { + bytecode: Vec, +} + +impl Default for KZGPointEvaluationContract { + fn default() -> Self { + let bytecode = { + let bytecode_hex = + include_str!("../../../evm/src/evm/test_data/KZGPointEvaluation.bin"); + hex::decode(bytecode_hex).unwrap() + }; + + Self { bytecode } + } +} + +impl TestContract for KZGPointEvaluationContract { + fn byte_code(&self) -> Vec { + self.byte_code() + } +} + +impl KZGPointEvaluationContract { + /// KZGPointEvaluation bytecode. + pub fn byte_code(&self) -> Vec { + self.bytecode.clone() + } + + /// Claims the gift. + pub fn call_kzg_point_evaluation( + &self, + input: Bytes, // 192 bytes + ) -> Vec { + KZGPointEvaluation::verifyPointEvaluationCall { input }.abi_encode() + } +} diff --git a/crates/evm/src/smart_contracts/mod.rs b/crates/evm/src/smart_contracts/mod.rs index d32c43648..2734a6d3c 100644 --- a/crates/evm/src/smart_contracts/mod.rs +++ b/crates/evm/src/smart_contracts/mod.rs @@ -6,6 +6,7 @@ mod caller_contract; mod coinbase_contract; mod hive_contract; mod infinite_loop_contract; +mod kzg_point_evaluation; mod logs_contract; mod mcopy_contract; mod payable_contract; @@ -20,6 +21,7 @@ pub use caller_contract::CallerContract; pub use coinbase_contract::CoinbaseContract; pub use hive_contract::HiveContract; pub use infinite_loop_contract::InfiniteLoopContract; +pub use kzg_point_evaluation::KZGPointEvaluationContract; pub use logs_contract::{AnotherLogEvent, LogEvent, LogsContract}; pub use mcopy_contract::McopyContract; pub use payable_contract::SimplePayableContract; diff --git a/crates/evm/src/tests/fork_tests.rs b/crates/evm/src/tests/fork_tests.rs index 13e32dfaf..06e07925c 100644 --- a/crates/evm/src/tests/fork_tests.rs +++ b/crates/evm/src/tests/fork_tests.rs @@ -1,7 +1,8 @@ use std::str::FromStr; -use reth_primitives::{address, keccak256, Address, TxKind}; +use reth_primitives::{address, keccak256, Address, Bytes, TxKind}; use revm::primitives::U256; +use sha2::Digest; use sov_modules_api::default_context::DefaultContext; use sov_modules_api::hooks::HookSoftConfirmationInfo; use sov_modules_api::utils::generate_address; @@ -11,8 +12,8 @@ use sov_rollup_interface::spec::SpecId as SovSpecId; use crate::call::CallMessage; use crate::evm::DbAccount; use crate::smart_contracts::{ - BlobBaseFeeContract, McopyContract, SelfdestructingConstructorContract, - TransientStorageContract, + BlobBaseFeeContract, KZGPointEvaluationContract, McopyContract, + SelfdestructingConstructorContract, TransientStorageContract, }; use crate::tests::test_signer::TestSigner; use crate::tests::utils::{create_contract_message, get_evm, get_evm_config}; @@ -22,6 +23,8 @@ type C = DefaultContext; use super::call_tests::send_money_to_contract_message; use super::utils::create_contract_message_with_bytecode; +const VERSIONED_HASH_VERSION_KZG: u8 = 1; + fn claim_gift_from_transient_storage_contract_transaction( contract_addr: Address, dev_signer: &TestSigner, @@ -56,6 +59,23 @@ fn store_blob_base_fee_transaction( .unwrap() } +fn call_kzg_point_evaluation_transaction( + contract_addr: Address, + dev_signer: &TestSigner, + nonce: u64, + input: Bytes, +) -> RlpEvmTransaction { + let contract = KZGPointEvaluationContract::default(); + dev_signer + .sign_default_transaction( + TxKind::Call(contract_addr), + contract.call_kzg_point_evaluation(input), + nonce, + 0, + ) + .unwrap() +} + #[test] fn test_cancun_transient_storage_activation() { let (config, dev_signer, contract_addr) = @@ -535,3 +555,105 @@ fn test_blob_base_fee_should_return_1() { assert_eq!(storage_value, U256::from(1)); } + +#[test] +fn test_kzg_point_eval_should_revert() { + let (config, dev_signer, contract_addr) = + get_evm_config(U256::from_str("100000000000000000000").unwrap(), None); + + let (mut evm, mut working_set) = get_evm(&config); + let l1_fee_rate = 0; + let mut l2_height = 2; + + let soft_confirmation_info = HookSoftConfirmationInfo { + l2_height, + da_slot_hash: [5u8; 32], + da_slot_height: 1, + da_slot_txs_commitment: [42u8; 32], + pre_state_root: [10u8; 32].to_vec(), + current_spec: SovSpecId::Fork1, + pub_key: vec![], + deposit_data: vec![], + l1_fee_rate, + timestamp: 0, + }; + + // Deploy transient storage contract + let sender_address = generate_address::("sender"); + evm.begin_soft_confirmation_hook(&soft_confirmation_info, &mut working_set); + { + let context = C::new(sender_address, l2_height, SovSpecId::Fork1, l1_fee_rate); + + let deploy_message = + create_contract_message(&dev_signer, 0, KZGPointEvaluationContract::default()); + + evm.call( + CallMessage { + txs: vec![deploy_message], + }, + &context, + &mut working_set, + ) + .unwrap(); + } + evm.end_soft_confirmation_hook(&soft_confirmation_info, &mut working_set); + evm.finalize_hook(&[99u8; 32].into(), &mut working_set.accessory_state()); + + l2_height += 1; + + // Implementation taken from https://eips.ethereum.org/EIPS/eip-4844#point-evaluation-precompile + fn kzg_to_versioned_hash(commitment: Bytes) -> Bytes { + let mut commitment_hash = sha2::Sha256::digest(commitment).to_vec(); + commitment_hash[0] = VERSIONED_HASH_VERSION_KZG; + Bytes::from(commitment_hash) + } + + // data is taken from: https://github.com/ethereum/c-kzg-4844/tree/main/tests/verify_kzg_proof/kzg-mainnet/verify_kzg_proof_case_correct_proof_d0992bc0387790a4 + let commitment= Bytes::from_str("8f59a8d2a1a625a17f3fea0fe5eb8c896db3764f3185481bc22f91b4aaffcca25f26936857bc3a7c2539ea8ec3a952b7").unwrap(); + let versioned_hash = kzg_to_versioned_hash(commitment.clone()); + let z = Bytes::from_str("5eb7004fe57383e6c88b99d839937fddf3f99279353aaf8d5c9a75f91ce33c62") + .unwrap(); + let y = Bytes::from_str("4882cf0609af8c7cd4c256e63a35838c95a9ebbf6122540ab344b42fd66d32e1") + .unwrap(); + let proof = Bytes::from_str("0x987ea6df69bbe97c23e0dd948cf2d4490824ba7fea5af812721b2393354b0810a9dba2c231ea7ae30f26c412c7ea6e3a").unwrap(); + + // The data is encoded as follows: versioned_hash | z | y | commitment | proof | with z and y being padded 32 byte big endian values + // ref: https://eips.ethereum.org/EIPS/eip-4844#point-evaluation-precompile + let mut input = vec![]; + input.extend_from_slice(&versioned_hash); + input.extend_from_slice(&z); + input.extend_from_slice(&y); + input.extend_from_slice(&commitment); + input.extend_from_slice(&proof); + + evm.begin_soft_confirmation_hook(&soft_confirmation_info, &mut working_set); + { + let context = C::new(sender_address, l2_height, SovSpecId::Fork1, l1_fee_rate); + + let deploy_message = call_kzg_point_evaluation_transaction( + contract_addr, + &dev_signer, + 1, + Bytes::try_from(input).unwrap(), + ); + + evm.call( + CallMessage { + txs: vec![deploy_message], + }, + &context, + &mut working_set, + ) + .unwrap(); + } + evm.end_soft_confirmation_hook(&soft_confirmation_info, &mut working_set); + evm.finalize_hook(&[99u8; 32].into(), &mut working_set.accessory_state()); + + // expect this call to fail because we do not have the kzg feature of revm enabled on fork1 + let receipts: Vec<_> = evm + .receipts + .iter(&mut working_set.accessory_state()) + .collect(); + + assert!(!receipts.last().unwrap().receipt.success); +} From e93fc46fd6cc60ebc0c90012d88e7c2acb23ca28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erce=20Can=20Bekt=C3=BCre?= Date: Fri, 13 Dec 2024 01:00:55 +0300 Subject: [PATCH 02/13] Add test_offchain_contract_storage_evm --- crates/evm/src/tests/fork_tests.rs | 149 ++++++++++++++++++++++++++++- 1 file changed, 148 insertions(+), 1 deletion(-) diff --git a/crates/evm/src/tests/fork_tests.rs b/crates/evm/src/tests/fork_tests.rs index 06e07925c..8f147403b 100644 --- a/crates/evm/src/tests/fork_tests.rs +++ b/crates/evm/src/tests/fork_tests.rs @@ -1,4 +1,5 @@ use std::str::FromStr; +use std::thread::sleep; use reth_primitives::{address, keccak256, Address, Bytes, TxKind}; use revm::primitives::U256; @@ -13,7 +14,7 @@ use crate::call::CallMessage; use crate::evm::DbAccount; use crate::smart_contracts::{ BlobBaseFeeContract, KZGPointEvaluationContract, McopyContract, - SelfdestructingConstructorContract, TransientStorageContract, + SelfdestructingConstructorContract, SimpleStorageContract, TransientStorageContract, }; use crate::tests::test_signer::TestSigner; use crate::tests::utils::{create_contract_message, get_evm, get_evm_config}; @@ -657,3 +658,149 @@ fn test_kzg_point_eval_should_revert() { assert!(!receipts.last().unwrap().receipt.success); } + +#[test] +fn test_offchain_contract_storage_evm() { + let (config, dev_signer, contract_addr) = + get_evm_config(U256::from_str("100000000000000000000").unwrap(), None); + + let (mut evm, mut working_set) = get_evm(&config); + let l1_fee_rate = 0; + let mut l2_height = 2; + + // Deployed a contract in genesis fork + let soft_confirmation_info = HookSoftConfirmationInfo { + l2_height, + da_slot_hash: [5u8; 32], + da_slot_height: 1, + da_slot_txs_commitment: [42u8; 32], + pre_state_root: [10u8; 32].to_vec(), + current_spec: SovSpecId::Genesis, + pub_key: vec![], + deposit_data: vec![], + l1_fee_rate, + timestamp: 0, + }; + + // Deploy transient storage contract + let sender_address = generate_address::("sender"); + evm.begin_soft_confirmation_hook(&soft_confirmation_info, &mut working_set); + { + let context = C::new(sender_address, l2_height, SovSpecId::Genesis, l1_fee_rate); + + let deploy_message = + create_contract_message(&dev_signer, 0, KZGPointEvaluationContract::default()); + + evm.call( + CallMessage { + txs: vec![deploy_message], + }, + &context, + &mut working_set, + ) + .unwrap(); + } + evm.end_soft_confirmation_hook(&soft_confirmation_info, &mut working_set); + evm.finalize_hook(&[99u8; 32].into(), &mut working_set.accessory_state()); + + l2_height += 1; + + sleep(std::time::Duration::from_secs(2)); + + //try to get it from offchain storage and expect it to not exist + let contract_info = evm.accounts.get(&contract_addr, &mut working_set); + let code_hash = contract_info.unwrap().code_hash.unwrap(); + + let offchain_code = evm + .offchain_code + .get(&code_hash, &mut working_set.offchain_state()); + + assert!(offchain_code.is_none()); + + // activate fork and then try to get it from offchain storage and expect it to exist + // Deployed a contract in genesis fork + let soft_confirmation_info = HookSoftConfirmationInfo { + l2_height, + da_slot_hash: [5u8; 32], + da_slot_height: 1, + da_slot_txs_commitment: [42u8; 32], + pre_state_root: [10u8; 32].to_vec(), + current_spec: SovSpecId::Fork1, + pub_key: vec![], + deposit_data: vec![], + l1_fee_rate, + timestamp: 0, + }; + evm.begin_soft_confirmation_hook(&soft_confirmation_info, &mut working_set); + evm.end_soft_confirmation_hook(&soft_confirmation_info, &mut working_set); + evm.finalize_hook(&[99u8; 32].into(), &mut working_set.accessory_state()); + sleep(std::time::Duration::from_secs(2)); + l2_height += 1; + + let offchain_code = evm + .offchain_code + .get(&code_hash, &mut working_set.offchain_state()); + + assert!(offchain_code.is_none()); + + let evm_code = evm.code.get(&code_hash, &mut working_set).unwrap(); + + let code = evm + .get_code( + contract_addr, + Some(alloy_eips::BlockId::Number( + alloy_eips::BlockNumberOrTag::Latest, + )), + &mut working_set, + ) + .unwrap(); + + assert_eq!(code, evm_code.original_bytes()); + + // Deploy contract in fork1 + evm.begin_soft_confirmation_hook(&soft_confirmation_info, &mut working_set); + { + let context = C::new(sender_address, l2_height, SovSpecId::Fork1, l1_fee_rate); + + let deploy_message = + create_contract_message(&dev_signer, 1, SimpleStorageContract::default()); + + evm.call( + CallMessage { + txs: vec![deploy_message], + }, + &context, + &mut working_set, + ) + .unwrap(); + sleep(std::time::Duration::from_secs(2)); + } + evm.end_soft_confirmation_hook(&soft_confirmation_info, &mut working_set); + evm.finalize_hook(&[99u8; 32].into(), &mut working_set.accessory_state()); + + let new_contract_address = address!("d26ff5586e488e65d86bcc3f0fe31551e381a596"); + + let contract_info = evm.accounts.get(&new_contract_address, &mut working_set); + let code_hash = contract_info.unwrap().code_hash.unwrap(); + + let offchain_code = evm + .offchain_code + .get(&code_hash, &mut working_set.offchain_state()); + + assert!(offchain_code.is_some()); + + let evm_code = evm.code.get(&code_hash, &mut working_set); + assert!(evm_code.is_none()); + + let code = evm + .get_code( + new_contract_address, + Some(alloy_eips::BlockId::Number( + alloy_eips::BlockNumberOrTag::Latest, + )), + &mut working_set, + ) + .unwrap(); + + assert_eq!(offchain_code.unwrap().original_bytes(), code); +} From c6d5903b7ea7f9c750ad65ebd04702f85eeadc2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erce=20Can=20Bekt=C3=BCre?= Date: Fri, 13 Dec 2024 01:03:07 +0300 Subject: [PATCH 03/13] Lint --- crates/evm/src/tests/fork_tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/evm/src/tests/fork_tests.rs b/crates/evm/src/tests/fork_tests.rs index 8f147403b..4890a39bd 100644 --- a/crates/evm/src/tests/fork_tests.rs +++ b/crates/evm/src/tests/fork_tests.rs @@ -635,7 +635,7 @@ fn test_kzg_point_eval_should_revert() { contract_addr, &dev_signer, 1, - Bytes::try_from(input).unwrap(), + Bytes::from(input), ); evm.call( From 93e31f969c129040c8668989555612404c2ed103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erce=20Can=20Bekt=C3=BCre?= Date: Fri, 13 Dec 2024 01:26:38 +0300 Subject: [PATCH 04/13] Fix test --- crates/evm/src/tests/fork_tests.rs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/crates/evm/src/tests/fork_tests.rs b/crates/evm/src/tests/fork_tests.rs index 4890a39bd..7dc4c8459 100644 --- a/crates/evm/src/tests/fork_tests.rs +++ b/crates/evm/src/tests/fork_tests.rs @@ -791,16 +791,4 @@ fn test_offchain_contract_storage_evm() { let evm_code = evm.code.get(&code_hash, &mut working_set); assert!(evm_code.is_none()); - - let code = evm - .get_code( - new_contract_address, - Some(alloy_eips::BlockId::Number( - alloy_eips::BlockNumberOrTag::Latest, - )), - &mut working_set, - ) - .unwrap(); - - assert_eq!(offchain_code.unwrap().original_bytes(), code); } From 4c899017289ab3298939e8a41928a0aeb1401ddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erce=20Can=20Bekt=C3=BCre?= Date: Mon, 16 Dec 2024 10:43:43 +0300 Subject: [PATCH 05/13] Rename contract --- ...uation.abi => KZGPointEvaluationCaller.abi} | 0 ...uation.bin => KZGPointEvaluationCaller.bin} | 2 +- ...uation.sol => KZGPointEvaluationCaller.sol} | 2 +- ...ation.rs => kzg_point_evaluation_caller.rs} | 18 +++++++++--------- crates/evm/src/smart_contracts/mod.rs | 4 ++-- crates/evm/src/tests/fork_tests.rs | 8 ++++---- 6 files changed, 17 insertions(+), 17 deletions(-) rename crates/evm/src/evm/test_data/{KZGPointEvaluation.abi => KZGPointEvaluationCaller.abi} (100%) rename crates/evm/src/evm/test_data/{KZGPointEvaluation.bin => KZGPointEvaluationCaller.bin} (92%) rename crates/evm/src/evm/test_data/{KZGPointEvaluation.sol => KZGPointEvaluationCaller.sol} (96%) rename crates/evm/src/smart_contracts/{kzg_point_evaluation.rs => kzg_point_evaluation_caller.rs} (63%) diff --git a/crates/evm/src/evm/test_data/KZGPointEvaluation.abi b/crates/evm/src/evm/test_data/KZGPointEvaluationCaller.abi similarity index 100% rename from crates/evm/src/evm/test_data/KZGPointEvaluation.abi rename to crates/evm/src/evm/test_data/KZGPointEvaluationCaller.abi diff --git a/crates/evm/src/evm/test_data/KZGPointEvaluation.bin b/crates/evm/src/evm/test_data/KZGPointEvaluationCaller.bin similarity index 92% rename from crates/evm/src/evm/test_data/KZGPointEvaluation.bin rename to crates/evm/src/evm/test_data/KZGPointEvaluationCaller.bin index cef131023..602857c6e 100644 --- a/crates/evm/src/evm/test_data/KZGPointEvaluation.bin +++ b/crates/evm/src/evm/test_data/KZGPointEvaluationCaller.bin @@ -1 +1 @@ -6080604052348015600e575f5ffd5b506102548061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610029575f3560e01c806325a05f401461002d575b5f5ffd5b61004760048036038101906100429190610128565b61005d565b604051610054919061018d565b60405180910390f35b5f60c083839050146100a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009b90610200565b60405180910390fd5b60c0835f375f5f60c05f600a5afa809150815f555092915050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f8401126100e8576100e76100c7565b5b8235905067ffffffffffffffff811115610105576101046100cb565b5b602083019150836001820283011115610121576101206100cf565b5b9250929050565b5f5f6020838503121561013e5761013d6100bf565b5b5f83013567ffffffffffffffff81111561015b5761015a6100c3565b5b610167858286016100d3565b92509250509250929050565b5f8115159050919050565b61018781610173565b82525050565b5f6020820190506101a05f83018461017e565b92915050565b5f82825260208201905092915050565b7f496e76616c696420696e7075742073697a6500000000000000000000000000005f82015250565b5f6101ea6012836101a6565b91506101f5826101b6565b602082019050919050565b5f6020820190508181035f830152610217816101de565b905091905056fea2646970667358221220e03af26fa30332b4f2090a2bfbac161d953bd76df1516e079517b16b7dce880964736f6c634300081c0033 \ No newline at end of file +6080604052348015600e575f5ffd5b506102548061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610029575f3560e01c806325a05f401461002d575b5f5ffd5b61004760048036038101906100429190610128565b61005d565b604051610054919061018d565b60405180910390f35b5f60c083839050146100a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009b90610200565b60405180910390fd5b60c0835f375f5f60c05f600a5afa809150815f555092915050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f8401126100e8576100e76100c7565b5b8235905067ffffffffffffffff811115610105576101046100cb565b5b602083019150836001820283011115610121576101206100cf565b5b9250929050565b5f5f6020838503121561013e5761013d6100bf565b5b5f83013567ffffffffffffffff81111561015b5761015a6100c3565b5b610167858286016100d3565b92509250509250929050565b5f8115159050919050565b61018781610173565b82525050565b5f6020820190506101a05f83018461017e565b92915050565b5f82825260208201905092915050565b7f496e76616c696420696e7075742073697a6500000000000000000000000000005f82015250565b5f6101ea6012836101a6565b91506101f5826101b6565b602082019050919050565b5f6020820190508181035f830152610217816101de565b905091905056fea264697066735822122000f1c4bdfc1b3652d31fd67bb4b1b62dbbcbf8f300888b500dd03b43f7ba3f9664736f6c634300081c0033 \ No newline at end of file diff --git a/crates/evm/src/evm/test_data/KZGPointEvaluation.sol b/crates/evm/src/evm/test_data/KZGPointEvaluationCaller.sol similarity index 96% rename from crates/evm/src/evm/test_data/KZGPointEvaluation.sol rename to crates/evm/src/evm/test_data/KZGPointEvaluationCaller.sol index f8d7fa377..9c026a8dc 100644 --- a/crates/evm/src/evm/test_data/KZGPointEvaluation.sol +++ b/crates/evm/src/evm/test_data/KZGPointEvaluationCaller.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.28; -contract KZGPointEvaluation { +contract KZGPointEvaluationCaller { /// @notice Calls the 0x0A precompile to perform point evaluation /// @param input A 192-byte input representing the polynomial versioned hash, commitment, point, and proof function verifyPointEvaluation( diff --git a/crates/evm/src/smart_contracts/kzg_point_evaluation.rs b/crates/evm/src/smart_contracts/kzg_point_evaluation_caller.rs similarity index 63% rename from crates/evm/src/smart_contracts/kzg_point_evaluation.rs rename to crates/evm/src/smart_contracts/kzg_point_evaluation_caller.rs index e7746e2ef..11859edc8 100644 --- a/crates/evm/src/smart_contracts/kzg_point_evaluation.rs +++ b/crates/evm/src/smart_contracts/kzg_point_evaluation_caller.rs @@ -3,23 +3,23 @@ use reth_primitives::Bytes; use super::TestContract; -// KZGPointEvaluationContract wrapper. +// KZGPointEvaluationCallerContract wrapper. sol! { #[sol(abi)] - KZGPointEvaluation, - "./src/evm/test_data/KZGPointEvaluation.abi" + KZGPointEvaluationCaller, + "./src/evm/test_data/KZGPointEvaluationCaller.abi" } /// KZGPointEvaluationContract wrapper. -pub struct KZGPointEvaluationContract { +pub struct KZGPointEvaluationCallerContract { bytecode: Vec, } -impl Default for KZGPointEvaluationContract { +impl Default for KZGPointEvaluationCallerContract { fn default() -> Self { let bytecode = { let bytecode_hex = - include_str!("../../../evm/src/evm/test_data/KZGPointEvaluation.bin"); + include_str!("../../../evm/src/evm/test_data/KZGPointEvaluationCaller.bin"); hex::decode(bytecode_hex).unwrap() }; @@ -27,13 +27,13 @@ impl Default for KZGPointEvaluationContract { } } -impl TestContract for KZGPointEvaluationContract { +impl TestContract for KZGPointEvaluationCallerContract { fn byte_code(&self) -> Vec { self.byte_code() } } -impl KZGPointEvaluationContract { +impl KZGPointEvaluationCallerContract { /// KZGPointEvaluation bytecode. pub fn byte_code(&self) -> Vec { self.bytecode.clone() @@ -44,6 +44,6 @@ impl KZGPointEvaluationContract { &self, input: Bytes, // 192 bytes ) -> Vec { - KZGPointEvaluation::verifyPointEvaluationCall { input }.abi_encode() + KZGPointEvaluationCaller::verifyPointEvaluationCall { input }.abi_encode() } } diff --git a/crates/evm/src/smart_contracts/mod.rs b/crates/evm/src/smart_contracts/mod.rs index 2734a6d3c..d35dee325 100644 --- a/crates/evm/src/smart_contracts/mod.rs +++ b/crates/evm/src/smart_contracts/mod.rs @@ -6,7 +6,7 @@ mod caller_contract; mod coinbase_contract; mod hive_contract; mod infinite_loop_contract; -mod kzg_point_evaluation; +mod kzg_point_evaluation_caller; mod logs_contract; mod mcopy_contract; mod payable_contract; @@ -21,7 +21,7 @@ pub use caller_contract::CallerContract; pub use coinbase_contract::CoinbaseContract; pub use hive_contract::HiveContract; pub use infinite_loop_contract::InfiniteLoopContract; -pub use kzg_point_evaluation::KZGPointEvaluationContract; +pub use kzg_point_evaluation_caller::KZGPointEvaluationCallerContract; pub use logs_contract::{AnotherLogEvent, LogEvent, LogsContract}; pub use mcopy_contract::McopyContract; pub use payable_contract::SimplePayableContract; diff --git a/crates/evm/src/tests/fork_tests.rs b/crates/evm/src/tests/fork_tests.rs index 7dc4c8459..dcec8d325 100644 --- a/crates/evm/src/tests/fork_tests.rs +++ b/crates/evm/src/tests/fork_tests.rs @@ -13,7 +13,7 @@ use sov_rollup_interface::spec::SpecId as SovSpecId; use crate::call::CallMessage; use crate::evm::DbAccount; use crate::smart_contracts::{ - BlobBaseFeeContract, KZGPointEvaluationContract, McopyContract, + BlobBaseFeeContract, KZGPointEvaluationCallerContract, McopyContract, SelfdestructingConstructorContract, SimpleStorageContract, TransientStorageContract, }; use crate::tests::test_signer::TestSigner; @@ -66,7 +66,7 @@ fn call_kzg_point_evaluation_transaction( nonce: u64, input: Bytes, ) -> RlpEvmTransaction { - let contract = KZGPointEvaluationContract::default(); + let contract = KZGPointEvaluationCallerContract::default(); dev_signer .sign_default_transaction( TxKind::Call(contract_addr), @@ -586,7 +586,7 @@ fn test_kzg_point_eval_should_revert() { let context = C::new(sender_address, l2_height, SovSpecId::Fork1, l1_fee_rate); let deploy_message = - create_contract_message(&dev_signer, 0, KZGPointEvaluationContract::default()); + create_contract_message(&dev_signer, 0, KZGPointEvaluationCallerContract::default()); evm.call( CallMessage { @@ -689,7 +689,7 @@ fn test_offchain_contract_storage_evm() { let context = C::new(sender_address, l2_height, SovSpecId::Genesis, l1_fee_rate); let deploy_message = - create_contract_message(&dev_signer, 0, KZGPointEvaluationContract::default()); + create_contract_message(&dev_signer, 0, KZGPointEvaluationCallerContract::default()); evm.call( CallMessage { From 89f347e5226f9c9390a0034fe436947b3c0c8a17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erce=20Can=20Bekt=C3=BCre?= Date: Mon, 16 Dec 2024 10:44:33 +0300 Subject: [PATCH 06/13] Remove wrong comments --- crates/evm/src/tests/fork_tests.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/crates/evm/src/tests/fork_tests.rs b/crates/evm/src/tests/fork_tests.rs index dcec8d325..b57f39caf 100644 --- a/crates/evm/src/tests/fork_tests.rs +++ b/crates/evm/src/tests/fork_tests.rs @@ -255,7 +255,6 @@ fn test_cancun_mcopy_activation() { timestamp: 0, }; - // Deploy transient storage contract let sender_address = generate_address::("sender"); evm.begin_soft_confirmation_hook(&soft_confirmation_info, &mut working_set); { @@ -457,7 +456,6 @@ fn test_blob_base_fee_should_return_1() { timestamp: 0, }; - // Deploy transient storage contract let sender_address = generate_address::("sender"); evm.begin_soft_confirmation_hook(&soft_confirmation_info, &mut working_set); { @@ -579,7 +577,6 @@ fn test_kzg_point_eval_should_revert() { timestamp: 0, }; - // Deploy transient storage contract let sender_address = generate_address::("sender"); evm.begin_soft_confirmation_hook(&soft_confirmation_info, &mut working_set); { @@ -682,7 +679,6 @@ fn test_offchain_contract_storage_evm() { timestamp: 0, }; - // Deploy transient storage contract let sender_address = generate_address::("sender"); evm.begin_soft_confirmation_hook(&soft_confirmation_info, &mut working_set); { From 74f5b52e601033bcd7be76eb2036c0ee7b08a67c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erce=20Can=20Bekt=C3=BCre?= Date: Mon, 16 Dec 2024 11:38:26 +0300 Subject: [PATCH 07/13] Test prefork contract stored offchain after postfork tx --- crates/evm/src/tests/fork_tests.rs | 53 +++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/crates/evm/src/tests/fork_tests.rs b/crates/evm/src/tests/fork_tests.rs index b57f39caf..b7cea143b 100644 --- a/crates/evm/src/tests/fork_tests.rs +++ b/crates/evm/src/tests/fork_tests.rs @@ -2,6 +2,7 @@ use std::str::FromStr; use std::thread::sleep; use reth_primitives::{address, keccak256, Address, Bytes, TxKind}; +use revm::interpreter::opcode::eof_printer::print_eof_code; use revm::primitives::U256; use sha2::Digest; use sov_modules_api::default_context::DefaultContext; @@ -13,11 +14,11 @@ use sov_rollup_interface::spec::SpecId as SovSpecId; use crate::call::CallMessage; use crate::evm::DbAccount; use crate::smart_contracts::{ - BlobBaseFeeContract, KZGPointEvaluationCallerContract, McopyContract, + BlobBaseFeeContract, KZGPointEvaluationCallerContract, McopyContract, SelfDestructorContract, SelfdestructingConstructorContract, SimpleStorageContract, TransientStorageContract, }; use crate::tests::test_signer::TestSigner; -use crate::tests::utils::{create_contract_message, get_evm, get_evm_config}; +use crate::tests::utils::{create_contract_message, get_evm, get_evm_config, set_arg_message}; use crate::RlpEvmTransaction; type C = DefaultContext; @@ -685,7 +686,7 @@ fn test_offchain_contract_storage_evm() { let context = C::new(sender_address, l2_height, SovSpecId::Genesis, l1_fee_rate); let deploy_message = - create_contract_message(&dev_signer, 0, KZGPointEvaluationCallerContract::default()); + create_contract_message(&dev_signer, 0, SimpleStorageContract::default()); evm.call( CallMessage { @@ -759,7 +760,7 @@ fn test_offchain_contract_storage_evm() { let context = C::new(sender_address, l2_height, SovSpecId::Fork1, l1_fee_rate); let deploy_message = - create_contract_message(&dev_signer, 1, SimpleStorageContract::default()); + create_contract_message(&dev_signer, 1, SelfDestructorContract::default()); evm.call( CallMessage { @@ -769,10 +770,10 @@ fn test_offchain_contract_storage_evm() { &mut working_set, ) .unwrap(); - sleep(std::time::Duration::from_secs(2)); } evm.end_soft_confirmation_hook(&soft_confirmation_info, &mut working_set); evm.finalize_hook(&[99u8; 32].into(), &mut working_set.accessory_state()); + l2_height += 1; let new_contract_address = address!("d26ff5586e488e65d86bcc3f0fe31551e381a596"); @@ -787,4 +788,46 @@ fn test_offchain_contract_storage_evm() { let evm_code = evm.code.get(&code_hash, &mut working_set); assert!(evm_code.is_none()); + + // make tx on the contract that was deployed before fork1 and see that you can read it from offchain storage afterwards + let soft_confirmation_info = HookSoftConfirmationInfo { + l2_height, + da_slot_hash: [5u8; 32], + da_slot_height: 1, + da_slot_txs_commitment: [42u8; 32], + pre_state_root: [10u8; 32].to_vec(), + current_spec: SovSpecId::Fork1, + pub_key: vec![], + deposit_data: vec![], + l1_fee_rate, + timestamp: 0, + }; + + evm.begin_soft_confirmation_hook(&soft_confirmation_info, &mut working_set); + { + let context = C::new(sender_address, l2_height, SovSpecId::Fork1, l1_fee_rate); + + let call_message = set_arg_message(contract_addr, &dev_signer, 2, 99); + + evm.call( + CallMessage { + txs: vec![call_message], + }, + &context, + &mut working_set, + ) + .unwrap(); + } + evm.end_soft_confirmation_hook(&soft_confirmation_info, &mut working_set); + evm.finalize_hook(&[99u8; 32].into(), &mut working_set.accessory_state()); + + // Now I should be able to read the contract from offchain storage + let contract_info = evm.accounts.get(&contract_addr, &mut working_set); + let code_hash = contract_info.unwrap().code_hash.unwrap(); + + let offchain_code = evm + .offchain_code + .get(&code_hash, &mut working_set.offchain_state()); + + assert!(offchain_code.is_some()); } From 57ee7cb2119e8a5c89d04e725a2de0aac531efa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erce=20Can=20Bekt=C3=BCre?= Date: Mon, 16 Dec 2024 11:44:20 +0300 Subject: [PATCH 08/13] Lint --- crates/evm/src/tests/fork_tests.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/evm/src/tests/fork_tests.rs b/crates/evm/src/tests/fork_tests.rs index b7cea143b..30fec18cd 100644 --- a/crates/evm/src/tests/fork_tests.rs +++ b/crates/evm/src/tests/fork_tests.rs @@ -2,7 +2,6 @@ use std::str::FromStr; use std::thread::sleep; use reth_primitives::{address, keccak256, Address, Bytes, TxKind}; -use revm::interpreter::opcode::eof_printer::print_eof_code; use revm::primitives::U256; use sha2::Digest; use sov_modules_api::default_context::DefaultContext; From 22b668da78c49337ce6d59ddfd6a4cfd46b3753e Mon Sep 17 00:00:00 2001 From: okkothejawa Date: Tue, 17 Dec 2024 00:10:29 +0300 Subject: [PATCH 09/13] Change KZG evaluation contract and test case --- crates/evm/Cargo.toml | 5 ++-- .../test_data/KZGPointEvaluationCaller.bin | 2 +- .../test_data/KZGPointEvaluationCaller.sol | 28 +++++++++---------- crates/evm/src/tests/fork_tests.rs | 10 +++++++ 4 files changed, 28 insertions(+), 17 deletions(-) diff --git a/crates/evm/Cargo.toml b/crates/evm/Cargo.toml index 51fe998e4..91a1c0951 100644 --- a/crates/evm/Cargo.toml +++ b/crates/evm/Cargo.toml @@ -40,7 +40,7 @@ reth-rpc-eth-types = { workspace = true, optional = true } reth-rpc-server-types = { workspace = true, optional = true } reth-rpc-types = { workspace = true, optional = true } reth-rpc-types-compat = { workspace = true, optional = true } -revm = { workspace = true, features = ["secp256k1"] } +revm = { workspace = true, default-features = false, features = ["secp256k1"] } revm-inspectors = { workspace = true, optional = true } secp256k1 = { workspace = true, optional = true } @@ -55,7 +55,7 @@ rayon = { workspace = true } reth-chainspec = { workspace = true } reth-db = { workspace = true } reth-errors = { workspace = true } -revm = { workspace = true, features = ["optional_block_gas_limit", "optional_eip3607", "optional_no_base_fee", "secp256k1"] } +revm = { workspace = true, default-features = false, features = ["optional_block_gas_limit", "optional_eip3607", "optional_no_base_fee", "secp256k1"] } sha2 = { workspace = true } sov-modules-api = { path = "../sovereign-sdk/module-system/sov-modules-api", features = ["macros"] } sov-prover-storage-manager = { path = "../sovereign-sdk/full-node/sov-prover-storage-manager", features = ["test-utils"] } @@ -75,6 +75,7 @@ native = [ "reth-rpc-eth-types", "reth-rpc-server-types", "reth-rpc-types-compat", + "revm/serde", "revm-inspectors", "reth-provider", "alloy-rlp", diff --git a/crates/evm/src/evm/test_data/KZGPointEvaluationCaller.bin b/crates/evm/src/evm/test_data/KZGPointEvaluationCaller.bin index 602857c6e..a4f08955b 100644 --- a/crates/evm/src/evm/test_data/KZGPointEvaluationCaller.bin +++ b/crates/evm/src/evm/test_data/KZGPointEvaluationCaller.bin @@ -1 +1 @@ -6080604052348015600e575f5ffd5b506102548061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610029575f3560e01c806325a05f401461002d575b5f5ffd5b61004760048036038101906100429190610128565b61005d565b604051610054919061018d565b60405180910390f35b5f60c083839050146100a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009b90610200565b60405180910390fd5b60c0835f375f5f60c05f600a5afa809150815f555092915050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f8401126100e8576100e76100c7565b5b8235905067ffffffffffffffff811115610105576101046100cb565b5b602083019150836001820283011115610121576101206100cf565b5b9250929050565b5f5f6020838503121561013e5761013d6100bf565b5b5f83013567ffffffffffffffff81111561015b5761015a6100c3565b5b610167858286016100d3565b92509250509250929050565b5f8115159050919050565b61018781610173565b82525050565b5f6020820190506101a05f83018461017e565b92915050565b5f82825260208201905092915050565b7f496e76616c696420696e7075742073697a6500000000000000000000000000005f82015250565b5f6101ea6012836101a6565b91506101f5826101b6565b602082019050919050565b5f6020820190508181035f830152610217816101de565b905091905056fea264697066735822122000f1c4bdfc1b3652d31fd67bb4b1b62dbbcbf8f300888b500dd03b43f7ba3f9664736f6c634300081c0033 \ No newline at end of file +6080604052348015600e575f5ffd5b506101f48061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610029575f3560e01c806325a05f401461002d575b5f5ffd5b61004061003b366004610141565b610054565b604051901515815260200160405180910390f35b5f60c0821461009e5760405162461bcd60e51b8152602060048201526012602482015271496e76616c696420696e7075742073697a6560701b604482015260640160405180910390fd5b6060600a6001600160a01b031684846040516100bb9291906101af565b5f60405180830381855afa9150503d805f81146100f3576040519150601f19603f3d011682016040523d82523d5f602084013e6100f8565b606091505b5060408101515f5590925090508161010e575f5ffd5b7f73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff000000015f541461013a575f5ffd5b5092915050565b5f5f60208385031215610152575f5ffd5b823567ffffffffffffffff811115610168575f5ffd5b8301601f81018513610178575f5ffd5b803567ffffffffffffffff81111561018e575f5ffd5b85602082840101111561019f575f5ffd5b6020919091019590945092505050565b818382375f910190815291905056fea264697066735822122010054b15f2c9a0211a93251f59f5ec0a6420f19958357a448ed5b5aea879aab964736f6c634300081b0033 \ No newline at end of file diff --git a/crates/evm/src/evm/test_data/KZGPointEvaluationCaller.sol b/crates/evm/src/evm/test_data/KZGPointEvaluationCaller.sol index 9c026a8dc..a7d9434c9 100644 --- a/crates/evm/src/evm/test_data/KZGPointEvaluationCaller.sol +++ b/crates/evm/src/evm/test_data/KZGPointEvaluationCaller.sol @@ -1,26 +1,26 @@ + // SPDX-License-Identifier: MIT -pragma solidity ^0.8.28; +pragma solidity ^0.8.26; -contract KZGPointEvaluationCaller { +contract KZGPointEvaluation { /// @notice Calls the 0x0A precompile to perform point evaluation /// @param input A 192-byte input representing the polynomial versioned hash, commitment, point, and proof function verifyPointEvaluation( bytes calldata input // 192 bytes ) external returns (bool success) { require(input.length == 192, "Invalid input size"); - + bytes memory out; + (success, out) = address(10).staticcall(input); + // Write the 32 bytes of out to first storage slot assembly { - // Copy the 192-byte input data from calldata to memory at position 0 - calldatacopy(0, input.offset, 192) - - // Call the precompile at address 0x0A (0x0A is the precompile address) - let result := staticcall(gas(), 0x0A, 0, 192, 0, 0) - - // Set the success flag based on the precompile result - success := result - - // Store the result (success) in the contract's storage at slot 0 - sstore(0, success) + sstore(0, mload(add(out, 64))) + } + require(success); + // Read the first storage slot and assert it to be 52435875175126190479447740508185965837690552500527637822603658699938581184513 + assembly { + if iszero(eq(sload(0), 52435875175126190479447740508185965837690552500527637822603658699938581184513)) { + revert(0, 0) + } } } } \ No newline at end of file diff --git a/crates/evm/src/tests/fork_tests.rs b/crates/evm/src/tests/fork_tests.rs index 30fec18cd..0ec0213aa 100644 --- a/crates/evm/src/tests/fork_tests.rs +++ b/crates/evm/src/tests/fork_tests.rs @@ -654,6 +654,16 @@ fn test_kzg_point_eval_should_revert() { .collect(); assert!(!receipts.last().unwrap().receipt.success); + + let db_account = DbAccount::new(contract_addr); + let storage_value = db_account + .storage + .get(&U256::ZERO, &mut working_set) + .unwrap(); + assert_ne!( + storage_value, + U256::from_str("52435875175126190479447740508185965837690552500527637822603658699938581184513").unwrap() + ); } #[test] From 69750c19b947b05e4c0ed01a018e6202e3640c14 Mon Sep 17 00:00:00 2001 From: eyusufatik Date: Tue, 17 Dec 2024 02:02:31 +0300 Subject: [PATCH 10/13] remove citrea-primitives unnecessary feature --- crates/batch-prover/Cargo.toml | 2 +- crates/fullnode/Cargo.toml | 2 +- crates/primitives/Cargo.toml | 10 ---------- crates/prover-services/Cargo.toml | 2 +- crates/pruning/Cargo.toml | 2 +- 5 files changed, 4 insertions(+), 14 deletions(-) diff --git a/crates/batch-prover/Cargo.toml b/crates/batch-prover/Cargo.toml index a5be76779..d78339a9b 100644 --- a/crates/batch-prover/Cargo.toml +++ b/crates/batch-prover/Cargo.toml @@ -11,7 +11,7 @@ repository.workspace = true [dependencies] # Citrea Deps citrea-common = { path = "../common" } -citrea-primitives = { path = "../primitives", features = ["native"] } +citrea-primitives = { path = "../primitives" } # Sov SDK deps sov-db = { path = "../sovereign-sdk/full-node/db/sov-db" } diff --git a/crates/fullnode/Cargo.toml b/crates/fullnode/Cargo.toml index 72397abfa..20f77a7ae 100644 --- a/crates/fullnode/Cargo.toml +++ b/crates/fullnode/Cargo.toml @@ -11,7 +11,7 @@ repository.workspace = true [dependencies] # Citrea Deps citrea-common = { path = "../common" } -citrea-primitives = { path = "../primitives", features = ["native"] } +citrea-primitives = { path = "../primitives" } citrea-pruning = { path = "../pruning" } # Sov SDK deps diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index b19b5b4d5..32c5898f8 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -15,23 +15,13 @@ alloy-eips = { workspace = true } anyhow = { workspace = true } brotli = { workspace = true } reth-primitives = { workspace = true } -serde = { workspace = true, optional = true } -tokio = { workspace = true, optional = true } -tracing = { workspace = true, optional = true } [dev-dependencies] # Sov SDK deps sov-rollup-interface = { path = "../sovereign-sdk/rollup-interface", features = ["testing"] } [features] -native = [ - "dep:serde", - "dep:tokio", - "dep:tracing", - "sov-rollup-interface/native", -] testing = [ - "native", "short-prefix", ] short-prefix = [] diff --git a/crates/prover-services/Cargo.toml b/crates/prover-services/Cargo.toml index 9d935ff3d..5fa4f737d 100644 --- a/crates/prover-services/Cargo.toml +++ b/crates/prover-services/Cargo.toml @@ -10,7 +10,7 @@ repository.workspace = true [dependencies] # Citrea Deps -citrea-primitives = { path = "../primitives", features = ["native"] } +citrea-primitives = { path = "../primitives" } citrea-stf = { path = "../citrea-stf" } # Sov SDK deps diff --git a/crates/pruning/Cargo.toml b/crates/pruning/Cargo.toml index 1c6c06640..874045cd2 100644 --- a/crates/pruning/Cargo.toml +++ b/crates/pruning/Cargo.toml @@ -11,7 +11,7 @@ repository.workspace = true [dependencies] # Citrea dependencies citrea-evm = { path = "../evm", features = ["native"] } -citrea-primitives = { path = "../primitives", features = ["native"] } +citrea-primitives = { path = "../primitives" } # Sov SDK deps sov-db = { path = "../sovereign-sdk/full-node/db/sov-db" } From e09ecf796c2f25e5805b17dd7e38fa4ceeba4d3c Mon Sep 17 00:00:00 2001 From: eyusufatik Date: Tue, 17 Dec 2024 02:02:55 +0300 Subject: [PATCH 11/13] get rid of revm c-kzg feature --- Cargo.lock | 95 +++++++++---------- Cargo.toml | 35 +++---- crates/evm/src/tests/fork_tests.rs | 5 +- guests/risc0/batch-proof-bitcoin/Cargo.lock | 20 ++-- guests/risc0/batch-proof-mock/Cargo.lock | 14 +-- .../light-client-proof-bitcoin/Cargo.lock | 14 +-- .../risc0/light-client-proof-mock/Cargo.lock | 14 +-- 7 files changed, 100 insertions(+), 97 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 015a9169d..06118659e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2019,10 +2019,7 @@ dependencies = [ "anyhow", "brotli", "reth-primitives", - "serde", "sov-rollup-interface", - "tokio", - "tracing", ] [[package]] @@ -5632,7 +5629,7 @@ dependencies = [ [[package]] name = "reth-blockchain-tree-api" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "reth-consensus", "reth-execution-errors", @@ -5644,7 +5641,7 @@ dependencies = [ [[package]] name = "reth-chain-state" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "auto_impl", "derive_more", @@ -5666,7 +5663,7 @@ dependencies = [ [[package]] name = "reth-chainspec" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-chains", "alloy-eips", @@ -5686,7 +5683,7 @@ dependencies = [ [[package]] name = "reth-codecs" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-consensus", "alloy-eips", @@ -5702,7 +5699,7 @@ dependencies = [ [[package]] name = "reth-codecs-derive" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "convert_case 0.6.0", "proc-macro2", @@ -5713,7 +5710,7 @@ dependencies = [ [[package]] name = "reth-consensus" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "auto_impl", "reth-primitives", @@ -5723,7 +5720,7 @@ dependencies = [ [[package]] name = "reth-consensus-common" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "reth-chainspec", "reth-consensus", @@ -5733,7 +5730,7 @@ dependencies = [ [[package]] name = "reth-db" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "bytes", "derive_more", @@ -5763,7 +5760,7 @@ dependencies = [ [[package]] name = "reth-db-api" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "bytes", "derive_more", @@ -5783,7 +5780,7 @@ dependencies = [ [[package]] name = "reth-errors" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "reth-blockchain-tree-api", "reth-consensus", @@ -5796,7 +5793,7 @@ dependencies = [ [[package]] name = "reth-eth-wire-types" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-chains", "alloy-genesis", @@ -5812,7 +5809,7 @@ dependencies = [ [[package]] name = "reth-ethereum-forks" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-chains", "alloy-primitives", @@ -5829,7 +5826,7 @@ dependencies = [ [[package]] name = "reth-evm" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-eips", "auto_impl", @@ -5847,7 +5844,7 @@ dependencies = [ [[package]] name = "reth-execution-errors" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-eips", "alloy-primitives", @@ -5863,7 +5860,7 @@ dependencies = [ [[package]] name = "reth-execution-types" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "reth-execution-errors", "reth-primitives", @@ -5874,7 +5871,7 @@ dependencies = [ [[package]] name = "reth-fs-util" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "serde", "serde_json", @@ -5884,7 +5881,7 @@ dependencies = [ [[package]] name = "reth-libmdbx" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "bitflags 2.6.0", "byteorder", @@ -5900,7 +5897,7 @@ dependencies = [ [[package]] name = "reth-mdbx-sys" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "bindgen", "cc", @@ -5909,7 +5906,7 @@ dependencies = [ [[package]] name = "reth-metrics" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "metrics", "reth-metrics-derive", @@ -5918,7 +5915,7 @@ dependencies = [ [[package]] name = "reth-metrics-derive" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "once_cell", "proc-macro2", @@ -5930,7 +5927,7 @@ dependencies = [ [[package]] name = "reth-net-banlist" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-primitives", ] @@ -5938,7 +5935,7 @@ dependencies = [ [[package]] name = "reth-network-api" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-primitives", "alloy-rpc-types-admin", @@ -5961,7 +5958,7 @@ dependencies = [ [[package]] name = "reth-network-p2p" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "auto_impl", "futures", @@ -5978,7 +5975,7 @@ dependencies = [ [[package]] name = "reth-network-peers" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -5991,7 +5988,7 @@ dependencies = [ [[package]] name = "reth-network-types" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "reth-ethereum-forks", "reth-net-banlist", @@ -6004,7 +6001,7 @@ dependencies = [ [[package]] name = "reth-nippy-jar" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "anyhow", "bincode", @@ -6024,7 +6021,7 @@ dependencies = [ [[package]] name = "reth-primitives" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-eips", "alloy-genesis", @@ -6053,7 +6050,7 @@ dependencies = [ [[package]] name = "reth-primitives-traits" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-consensus", "alloy-eips", @@ -6073,7 +6070,7 @@ dependencies = [ [[package]] name = "reth-provider" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-rpc-types-engine", "auto_impl", @@ -6111,7 +6108,7 @@ dependencies = [ [[package]] name = "reth-prune-types" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-primitives", "bytes", @@ -6125,7 +6122,7 @@ dependencies = [ [[package]] name = "reth-revm" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-eips", "reth-chainspec", @@ -6141,7 +6138,7 @@ dependencies = [ [[package]] name = "reth-rpc-eth-types" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-sol-types", "derive_more", @@ -6179,7 +6176,7 @@ dependencies = [ [[package]] name = "reth-rpc-server-types" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-primitives", "jsonrpsee-core", @@ -6195,7 +6192,7 @@ dependencies = [ [[package]] name = "reth-rpc-types" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-primitives", "alloy-rpc-types", @@ -6213,7 +6210,7 @@ dependencies = [ [[package]] name = "reth-rpc-types-compat" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-rlp", "alloy-rpc-types", @@ -6225,7 +6222,7 @@ dependencies = [ [[package]] name = "reth-stages-types" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-primitives", "bytes", @@ -6238,7 +6235,7 @@ dependencies = [ [[package]] name = "reth-static-file-types" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-primitives", "derive_more", @@ -6249,7 +6246,7 @@ dependencies = [ [[package]] name = "reth-storage-api" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "auto_impl", "reth-chainspec", @@ -6266,7 +6263,7 @@ dependencies = [ [[package]] name = "reth-storage-errors" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-rlp", "reth-fs-util", @@ -6277,7 +6274,7 @@ dependencies = [ [[package]] name = "reth-tasks" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "auto_impl", "dyn-clone", @@ -6293,7 +6290,7 @@ dependencies = [ [[package]] name = "reth-tokio-util" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "tokio", "tokio-stream", @@ -6303,7 +6300,7 @@ dependencies = [ [[package]] name = "reth-tracing" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "clap", "eyre", @@ -6318,7 +6315,7 @@ dependencies = [ [[package]] name = "reth-transaction-pool" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-rlp", "aquamarine", @@ -6350,7 +6347,7 @@ dependencies = [ [[package]] name = "reth-trie" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-rlp", "auto_impl", @@ -6371,7 +6368,7 @@ dependencies = [ [[package]] name = "reth-trie-common" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-consensus", "alloy-genesis", @@ -6391,7 +6388,7 @@ dependencies = [ [[package]] name = "reth-trie-db" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-rlp", "auto_impl", diff --git a/Cargo.toml b/Cargo.toml index ab9603ef6..02eba53bd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -123,22 +123,25 @@ revm = { version = "12.1", features = ["serde"], default-features = false } # forcing cargo for this version or else chooses 3.1.1 and there is some dependency conflicts revm-primitives = { version = "8", default-features = false } revm-inspectors = { version = "=0.5.5", default-features = false } -reth-primitives = { git = "https://github.com/paradigmxyz/reth", rev = "a206eb3690e5a51d3c797fed2a6ed722e36863eb", default-features = false } -reth-chainspec = { git = "https://github.com/paradigmxyz/reth", rev = "a206eb3690e5a51d3c797fed2a6ed722e36863eb", default-features = false } -reth-errors = { git = "https://github.com/paradigmxyz/reth", rev = "a206eb3690e5a51d3c797fed2a6ed722e36863eb", default-features = false } -reth-rpc-types = { git = "https://github.com/paradigmxyz/reth", rev = "a206eb3690e5a51d3c797fed2a6ed722e36863eb", default-features = false, features = ["jsonrpsee-types"] } -reth-rpc-eth-types = { git = "https://github.com/paradigmxyz/reth", rev = "a206eb3690e5a51d3c797fed2a6ed722e36863eb", default-features = false } -reth-rpc-eth-api = { git = "https://github.com/paradigmxyz/reth", rev = "a206eb3690e5a51d3c797fed2a6ed722e36863eb", default-features = false } -reth-rpc-server-types = { git = "https://github.com/paradigmxyz/reth", rev = "a206eb3690e5a51d3c797fed2a6ed722e36863eb", default-features = false } -reth-rpc-types-compat = { git = "https://github.com/paradigmxyz/reth", rev = "a206eb3690e5a51d3c797fed2a6ed722e36863eb", default-features = false } -reth-node-api = { git = "https://github.com/paradigmxyz/reth", rev = "a206eb3690e5a51d3c797fed2a6ed722e36863eb", default-features = false } -reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth", rev = "a206eb3690e5a51d3c797fed2a6ed722e36863eb", default-features = false } -reth-provider = { git = "https://github.com/paradigmxyz/reth", rev = "a206eb3690e5a51d3c797fed2a6ed722e36863eb", default-features = false } -reth-tasks = { git = "https://github.com/paradigmxyz/reth", rev = "a206eb3690e5a51d3c797fed2a6ed722e36863eb", default-features = false } -reth-db = { git = "https://github.com/paradigmxyz/reth", rev = "a206eb3690e5a51d3c797fed2a6ed722e36863eb", default-features = false } -reth-trie = { git = "https://github.com/paradigmxyz/reth", rev = "a206eb3690e5a51d3c797fed2a6ed722e36863eb", default-features = false } -reth-rpc = { git = "https://github.com/paradigmxyz/reth", rev = "a206eb3690e5a51d3c797fed2a6ed722e36863eb", default-features = false } -reth-stages = { git = "https://github.com/paradigmxyz/reth", rev = "a206eb3690e5a51d3c797fed2a6ed722e36863eb", default-features = false } + +# temporarily moving reth crates to a fork where reth-revm is updated to not depend on revm/c-kzg +# once reth is updated check back if we can use the paradigmxyz/reth version +reth-primitives = { git = "https://github.com/eyusufatik/reth", rev = "19e733d1e69f3dd1900234141618be64284ade95", default-features = false } +reth-chainspec = { git = "https://github.com/eyusufatik/reth", rev = "19e733d1e69f3dd1900234141618be64284ade95", default-features = false } +reth-errors = { git = "https://github.com/eyusufatik/reth", rev = "19e733d1e69f3dd1900234141618be64284ade95", default-features = false } +reth-rpc-types = { git = "https://github.com/eyusufatik/reth", rev = "19e733d1e69f3dd1900234141618be64284ade95", default-features = false } +reth-rpc-eth-types = { git = "https://github.com/eyusufatik/reth", rev = "19e733d1e69f3dd1900234141618be64284ade95", default-features = false } +reth-rpc-eth-api = { git = "https://github.com/eyusufatik/reth", rev = "19e733d1e69f3dd1900234141618be64284ade95", default-features = false } +reth-rpc-server-types = { git = "https://github.com/eyusufatik/reth", rev = "19e733d1e69f3dd1900234141618be64284ade95", default-features = false } +reth-rpc-types-compat = { git = "https://github.com/eyusufatik/reth", rev = "19e733d1e69f3dd1900234141618be64284ade95", default-features = false } +reth-node-api = { git = "https://github.com/eyusufatik/reth", rev = "19e733d1e69f3dd1900234141618be64284ade95", default-features = false } +reth-transaction-pool = { git = "https://github.com/eyusufatik/reth", rev = "19e733d1e69f3dd1900234141618be64284ade95", default-features = false } +reth-provider = { git = "https://github.com/eyusufatik/reth", rev = "19e733d1e69f3dd1900234141618be64284ade95", default-features = false } +reth-tasks = { git = "https://github.com/eyusufatik/reth", rev = "19e733d1e69f3dd1900234141618be64284ade95", default-features = false } +reth-db = { git = "https://github.com/eyusufatik/reth", rev = "19e733d1e69f3dd1900234141618be64284ade95", default-features = false } +reth-trie = { git = "https://github.com/eyusufatik/reth", rev = "19e733d1e69f3dd1900234141618be64284ade95", default-features = false } +reth-rpc = { git = "https://github.com/eyusufatik/reth", rev = "19e733d1e69f3dd1900234141618be64284ade95", default-features = false } +reth-stages = { git = "https://github.com/eyusufatik/reth", rev = "19e733d1e69f3dd1900234141618be64284ade95", default-features = false } alloy-trie = { version = "0.3.8", default-features = false } alloy-rlp = { version = "0.3.8", default-features = false } diff --git a/crates/evm/src/tests/fork_tests.rs b/crates/evm/src/tests/fork_tests.rs index 0ec0213aa..6e4db1c66 100644 --- a/crates/evm/src/tests/fork_tests.rs +++ b/crates/evm/src/tests/fork_tests.rs @@ -662,7 +662,10 @@ fn test_kzg_point_eval_should_revert() { .unwrap(); assert_ne!( storage_value, - U256::from_str("52435875175126190479447740508185965837690552500527637822603658699938581184513").unwrap() + U256::from_str( + "52435875175126190479447740508185965837690552500527637822603658699938581184513" + ) + .unwrap() ); } diff --git a/guests/risc0/batch-proof-bitcoin/Cargo.lock b/guests/risc0/batch-proof-bitcoin/Cargo.lock index e37628fd4..c9dcc7f4e 100644 --- a/guests/risc0/batch-proof-bitcoin/Cargo.lock +++ b/guests/risc0/batch-proof-bitcoin/Cargo.lock @@ -210,7 +210,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cbcba3ca07cf7975f15d871b721fb18031eec8bce51103907f6dcce00b255d98" dependencies = [ "serde", - "winnow 0.6.13", + "winnow 0.6.20", ] [[package]] @@ -2255,7 +2255,7 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "reth-codecs" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-consensus", "alloy-eips", @@ -2271,7 +2271,7 @@ dependencies = [ [[package]] name = "reth-codecs-derive" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "convert_case 0.6.0", "proc-macro2", @@ -2282,7 +2282,7 @@ dependencies = [ [[package]] name = "reth-ethereum-forks" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-chains", "alloy-primitives", @@ -2299,7 +2299,7 @@ dependencies = [ [[package]] name = "reth-primitives" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-eips", "alloy-genesis", @@ -2321,7 +2321,7 @@ dependencies = [ [[package]] name = "reth-primitives-traits" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-consensus", "alloy-eips", @@ -2341,7 +2341,7 @@ dependencies = [ [[package]] name = "reth-static-file-types" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-primitives", "derive_more", @@ -2352,7 +2352,7 @@ dependencies = [ [[package]] name = "reth-trie-common" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-consensus", "alloy-genesis", @@ -3463,9 +3463,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.13" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" [[package]] name = "wyz" diff --git a/guests/risc0/batch-proof-mock/Cargo.lock b/guests/risc0/batch-proof-mock/Cargo.lock index 76445ed29..823e67c59 100644 --- a/guests/risc0/batch-proof-mock/Cargo.lock +++ b/guests/risc0/batch-proof-mock/Cargo.lock @@ -2053,7 +2053,7 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "reth-codecs" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-consensus", "alloy-eips", @@ -2069,7 +2069,7 @@ dependencies = [ [[package]] name = "reth-codecs-derive" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "convert_case 0.6.0", "proc-macro2", @@ -2080,7 +2080,7 @@ dependencies = [ [[package]] name = "reth-ethereum-forks" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-chains", "alloy-primitives", @@ -2097,7 +2097,7 @@ dependencies = [ [[package]] name = "reth-primitives" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-eips", "alloy-genesis", @@ -2119,7 +2119,7 @@ dependencies = [ [[package]] name = "reth-primitives-traits" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-consensus", "alloy-eips", @@ -2139,7 +2139,7 @@ dependencies = [ [[package]] name = "reth-static-file-types" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-primitives", "derive_more", @@ -2150,7 +2150,7 @@ dependencies = [ [[package]] name = "reth-trie-common" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-consensus", "alloy-genesis", diff --git a/guests/risc0/light-client-proof-bitcoin/Cargo.lock b/guests/risc0/light-client-proof-bitcoin/Cargo.lock index 21c77740d..2806a028a 100644 --- a/guests/risc0/light-client-proof-bitcoin/Cargo.lock +++ b/guests/risc0/light-client-proof-bitcoin/Cargo.lock @@ -2092,7 +2092,7 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reth-codecs" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-consensus", "alloy-eips", @@ -2108,7 +2108,7 @@ dependencies = [ [[package]] name = "reth-codecs-derive" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "convert_case 0.6.0", "proc-macro2", @@ -2119,7 +2119,7 @@ dependencies = [ [[package]] name = "reth-ethereum-forks" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-chains", "alloy-primitives", @@ -2136,7 +2136,7 @@ dependencies = [ [[package]] name = "reth-primitives" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-eips", "alloy-genesis", @@ -2158,7 +2158,7 @@ dependencies = [ [[package]] name = "reth-primitives-traits" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-consensus", "alloy-eips", @@ -2178,7 +2178,7 @@ dependencies = [ [[package]] name = "reth-static-file-types" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-primitives", "derive_more", @@ -2189,7 +2189,7 @@ dependencies = [ [[package]] name = "reth-trie-common" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-consensus", "alloy-genesis", diff --git a/guests/risc0/light-client-proof-mock/Cargo.lock b/guests/risc0/light-client-proof-mock/Cargo.lock index 71590c375..4ff90bc7d 100644 --- a/guests/risc0/light-client-proof-mock/Cargo.lock +++ b/guests/risc0/light-client-proof-mock/Cargo.lock @@ -1891,7 +1891,7 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reth-codecs" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-consensus", "alloy-eips", @@ -1907,7 +1907,7 @@ dependencies = [ [[package]] name = "reth-codecs-derive" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "convert_case 0.6.0", "proc-macro2", @@ -1918,7 +1918,7 @@ dependencies = [ [[package]] name = "reth-ethereum-forks" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-chains", "alloy-primitives", @@ -1935,7 +1935,7 @@ dependencies = [ [[package]] name = "reth-primitives" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-eips", "alloy-genesis", @@ -1957,7 +1957,7 @@ dependencies = [ [[package]] name = "reth-primitives-traits" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-consensus", "alloy-eips", @@ -1977,7 +1977,7 @@ dependencies = [ [[package]] name = "reth-static-file-types" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-primitives", "derive_more", @@ -1988,7 +1988,7 @@ dependencies = [ [[package]] name = "reth-trie-common" version = "1.0.4" -source = "git+https://github.com/paradigmxyz/reth?rev=a206eb3690e5a51d3c797fed2a6ed722e36863eb#a206eb3690e5a51d3c797fed2a6ed722e36863eb" +source = "git+https://github.com/eyusufatik/reth?rev=19e733d1e69f3dd1900234141618be64284ade95#19e733d1e69f3dd1900234141618be64284ade95" dependencies = [ "alloy-consensus", "alloy-genesis", From f3c3f628cc926c154e7a869a6bb6e971b46b347a Mon Sep 17 00:00:00 2001 From: Roman Proskuryakoff Date: Thu, 19 Dec 2024 03:06:19 +0400 Subject: [PATCH 12/13] Replace kgz precompile with a fake one --- crates/evm/src/evm/handler.rs | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/crates/evm/src/evm/handler.rs b/crates/evm/src/evm/handler.rs index 29aa499b3..b5fa8de2b 100644 --- a/crates/evm/src/evm/handler.rs +++ b/crates/evm/src/evm/handler.rs @@ -14,7 +14,7 @@ use revm::primitives::{ spec_to_generic, Address, EVMError, Env, HandlerCfg, InvalidTransaction, ResultAndState, Spec, SpecId, B256, U256, }; -use revm::{Context, Database, FrameResult, InnerEvmContext, JournalEntry}; +use revm::{Context, ContextPrecompiles, Database, FrameResult, InnerEvmContext, JournalEntry}; #[cfg(feature = "native")] use revm::{EvmContext, Inspector}; use sov_modules_api::{native_debug, native_error, native_warn}; @@ -290,7 +290,7 @@ where // validation.env = validation.tx_against_state = Arc::new(CitreaHandler::::validate_tx_against_state); - // pre_execution.load_accounts = + pre_execution.load_precompiles = Arc::new(CitreaHandler::::load_precompiles); // pre_execution.load_accounts = pre_execution.deduct_caller = Arc::new(CitreaHandler::::deduct_caller); // execution.last_frame_return = @@ -314,6 +314,29 @@ struct CitreaHandler { } impl CitreaHandler { + fn load_precompiles() -> ContextPrecompiles { + fn our_precompiles() -> ContextPrecompiles { + use revm::precompile::{ + u64_to_address, Bytes, Precompile, PrecompileOutput, PrecompileResult, + }; + + pub fn kzg(_input: &Bytes, _gas_limit: u64, _env: &Env) -> PrecompileResult { + pub const GAS_COST: u64 = 0; + pub const RETURN_VALUE: &[u8; 64] = &[0; 64]; + Ok(PrecompileOutput::new(GAS_COST, RETURN_VALUE.into())) + } + + let mut precompiles = revm::handler::mainnet::load_precompiles::(); + let precompiles_inner = precompiles.to_mut(); + if let Some(kzg_point_evaluation) = precompiles_inner.get_mut(&u64_to_address(0x0A)) { + // replace kzg_point_evaluation if it was enabled in the Spec + *kzg_point_evaluation = Precompile::Env(kzg).into(); + } + precompiles + } + + our_precompiles::() + } fn validate_tx_against_state( context: &mut Context, ) -> Result<(), EVMError> { From 0dfe99d01e3c2071e2577c64bb40d3811779f961 Mon Sep 17 00:00:00 2001 From: eyusufatik Date: Thu, 19 Dec 2024 16:44:42 +0300 Subject: [PATCH 13/13] remove point eval precompile on runtime --- crates/evm/src/evm/handler.rs | 20 +++++++------------ .../test_data/KZGPointEvaluationCaller.bin | 2 +- .../test_data/KZGPointEvaluationCaller.sol | 9 ++------- crates/evm/src/tests/fork_tests.rs | 4 ++-- 4 files changed, 12 insertions(+), 23 deletions(-) diff --git a/crates/evm/src/evm/handler.rs b/crates/evm/src/evm/handler.rs index ffcd8c096..a323e3110 100644 --- a/crates/evm/src/evm/handler.rs +++ b/crates/evm/src/evm/handler.rs @@ -8,6 +8,7 @@ use revm::handler::register::{EvmHandler, HandleRegisters}; #[cfg(feature = "native")] use revm::interpreter::{CallInputs, CallOutcome, CreateInputs, CreateOutcome, Interpreter}; use revm::interpreter::{Gas, InstructionResult}; +use revm::precompile::u64_to_address; #[cfg(feature = "native")] use revm::primitives::Log; use revm::primitives::{ @@ -316,22 +317,15 @@ struct CitreaHandler { impl CitreaHandler { fn load_precompiles() -> ContextPrecompiles { fn our_precompiles() -> ContextPrecompiles { - use revm::precompile::{ - u64_to_address, Bytes, Precompile, PrecompileOutput, PrecompileResult, - }; + let mut precompiles = revm::handler::mainnet::load_precompiles::(); - pub fn kzg(_input: &Bytes, _gas_limit: u64, _env: &Env) -> PrecompileResult { - pub const GAS_COST: u64 = 0; - pub const RETURN_VALUE: &[u8; 64] = &[0; 64]; - Ok(PrecompileOutput::new(GAS_COST, RETURN_VALUE.into())) + if SPEC::enabled(SpecId::CANCUN) { + precompiles + .to_mut() + .remove(&u64_to_address(0x0A)) + .expect("after cancun point eval should be removed"); } - let mut precompiles = revm::handler::mainnet::load_precompiles::(); - let precompiles_inner = precompiles.to_mut(); - if let Some(kzg_point_evaluation) = precompiles_inner.get_mut(&u64_to_address(0x0A)) { - // replace kzg_point_evaluation if it was enabled in the Spec - *kzg_point_evaluation = Precompile::Env(kzg).into(); - } precompiles } diff --git a/crates/evm/src/evm/test_data/KZGPointEvaluationCaller.bin b/crates/evm/src/evm/test_data/KZGPointEvaluationCaller.bin index a4f08955b..6afea8cd5 100644 --- a/crates/evm/src/evm/test_data/KZGPointEvaluationCaller.bin +++ b/crates/evm/src/evm/test_data/KZGPointEvaluationCaller.bin @@ -1 +1 @@ -6080604052348015600e575f5ffd5b506101f48061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610029575f3560e01c806325a05f401461002d575b5f5ffd5b61004061003b366004610141565b610054565b604051901515815260200160405180910390f35b5f60c0821461009e5760405162461bcd60e51b8152602060048201526012602482015271496e76616c696420696e7075742073697a6560701b604482015260640160405180910390fd5b6060600a6001600160a01b031684846040516100bb9291906101af565b5f60405180830381855afa9150503d805f81146100f3576040519150601f19603f3d011682016040523d82523d5f602084013e6100f8565b606091505b5060408101515f5590925090508161010e575f5ffd5b7f73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff000000015f541461013a575f5ffd5b5092915050565b5f5f60208385031215610152575f5ffd5b823567ffffffffffffffff811115610168575f5ffd5b8301601f81018513610178575f5ffd5b803567ffffffffffffffff81111561018e575f5ffd5b85602082840101111561019f575f5ffd5b6020919091019590945092505050565b818382375f910190815291905056fea264697066735822122010054b15f2c9a0211a93251f59f5ec0a6420f19958357a448ed5b5aea879aab964736f6c634300081b0033 \ No newline at end of file +6080604052348015600e575f5ffd5b506103208061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610029575f3560e01c806325a05f401461002d575b5f5ffd5b610047600480360381019061004291906101a0565b61005d565b6040516100549190610205565b60405180910390f35b5f60c083839050146100a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009b90610278565b60405180910390fd5b6060600a73ffffffffffffffffffffffffffffffffffffffff1684846040516100ce9291906102d2565b5f60405180830381855afa9150503d805f8114610106576040519150601f19603f3d011682016040523d82523d5f602084013e61010b565b606091505b5080925081935050505f815114610120575f5ffd5b60408101515f5581610130575f5ffd5b5092915050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f8401126101605761015f61013f565b5b8235905067ffffffffffffffff81111561017d5761017c610143565b5b60208301915083600182028301111561019957610198610147565b5b9250929050565b5f5f602083850312156101b6576101b5610137565b5b5f83013567ffffffffffffffff8111156101d3576101d261013b565b5b6101df8582860161014b565b92509250509250929050565b5f8115159050919050565b6101ff816101eb565b82525050565b5f6020820190506102185f8301846101f6565b92915050565b5f82825260208201905092915050565b7f496e76616c696420696e7075742073697a6500000000000000000000000000005f82015250565b5f61026260128361021e565b915061026d8261022e565b602082019050919050565b5f6020820190508181035f83015261028f81610256565b9050919050565b5f81905092915050565b828183375f83830152505050565b5f6102b98385610296565b93506102c68385846102a0565b82840190509392505050565b5f6102de8284866102ae565b9150819050939250505056fea264697066735822122052f3d3eafaae24a10a4cb029d517a2fc7b949c9ee79750ca303d13aba9fb158264736f6c634300081b0033 \ No newline at end of file diff --git a/crates/evm/src/evm/test_data/KZGPointEvaluationCaller.sol b/crates/evm/src/evm/test_data/KZGPointEvaluationCaller.sol index a7d9434c9..970b75635 100644 --- a/crates/evm/src/evm/test_data/KZGPointEvaluationCaller.sol +++ b/crates/evm/src/evm/test_data/KZGPointEvaluationCaller.sol @@ -2,7 +2,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.26; -contract KZGPointEvaluation { +contract KZGPointEvaluationCaller { /// @notice Calls the 0x0A precompile to perform point evaluation /// @param input A 192-byte input representing the polynomial versioned hash, commitment, point, and proof function verifyPointEvaluation( @@ -11,16 +11,11 @@ contract KZGPointEvaluation { require(input.length == 192, "Invalid input size"); bytes memory out; (success, out) = address(10).staticcall(input); + require(out.length == 0); // Write the 32 bytes of out to first storage slot assembly { sstore(0, mload(add(out, 64))) } require(success); - // Read the first storage slot and assert it to be 52435875175126190479447740508185965837690552500527637822603658699938581184513 - assembly { - if iszero(eq(sload(0), 52435875175126190479447740508185965837690552500527637822603658699938581184513)) { - revert(0, 0) - } - } } } \ No newline at end of file diff --git a/crates/evm/src/tests/fork_tests.rs b/crates/evm/src/tests/fork_tests.rs index d9d661559..f117f5b8c 100644 --- a/crates/evm/src/tests/fork_tests.rs +++ b/crates/evm/src/tests/fork_tests.rs @@ -653,8 +653,6 @@ fn test_kzg_point_eval_should_revert() { .iter(&mut working_set.accessory_state()) .collect(); - assert!(!receipts.last().unwrap().receipt.success); - let db_account = DbAccount::new(contract_addr); let storage_value = db_account .storage @@ -662,11 +660,13 @@ fn test_kzg_point_eval_should_revert() { .unwrap(); assert_ne!( storage_value, + // expected if point eval precompile was enabled U256::from_str( "52435875175126190479447740508185965837690552500527637822603658699938581184513" ) .unwrap() ); + assert!(receipts.last().unwrap().receipt.success); } #[test]