diff --git a/Cargo.lock b/Cargo.lock index 8d30748e5c..22e3a2b9be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2646,9 +2646,8 @@ dependencies = [ [[package]] name = "evm" -version = "0.41.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "767f43e9630cc36cf8ff2777cbb0121b055f0d1fd6eaaa13b46a1808f0d0e7e9" +version = "0.41.2" +source = "git+https://github.com/rust-ethereum/evm?branch=v0.x#879ffe209fbdaa0e3fdfa68a7cd48c0743841e0a" dependencies = [ "auto_impl", "environmental", @@ -2668,8 +2667,7 @@ dependencies = [ [[package]] name = "evm-core" version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1da6cedc5cedb4208e59467106db0d1f50db01b920920589f8e672c02fdc04f" +source = "git+https://github.com/rust-ethereum/evm?branch=v0.x#879ffe209fbdaa0e3fdfa68a7cd48c0743841e0a" dependencies = [ "parity-scale-codec", "primitive-types", @@ -2680,8 +2678,7 @@ dependencies = [ [[package]] name = "evm-gasometer" version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dc0eb591abc5cd7b05bef6a036c2bb6c66ab6c5e0c5ce94bfe377ab670b1fd7" +source = "git+https://github.com/rust-ethereum/evm?branch=v0.x#879ffe209fbdaa0e3fdfa68a7cd48c0743841e0a" dependencies = [ "environmental", "evm-core", @@ -2692,8 +2689,7 @@ dependencies = [ [[package]] name = "evm-runtime" version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84bbe09b64ae13a29514048c1bb6fda6374ac0b4f6a1f15a443348ab88ef42cd" +source = "git+https://github.com/rust-ethereum/evm?branch=v0.x#879ffe209fbdaa0e3fdfa68a7cd48c0743841e0a" dependencies = [ "auto_impl", "environmental", diff --git a/Cargo.toml b/Cargo.toml index 65f99e1110..a13d753eac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,7 +56,7 @@ derive_more = "0.99" environmental = { version = "1.1.4", default-features = false } ethereum = { version = "0.15.0", default-features = false } ethereum-types = { version = "0.14.1", default-features = false } -evm = { version = "0.41.1", default-features = false } +evm = { git = "https://github.com/rust-ethereum/evm", branch = "v0.x", default-features = false } futures = "0.3.30" hash-db = { version = "0.16.0", default-features = false } hex = { version = "0.4.3", default-features = false, features = ["alloc"] } diff --git a/frame/ethereum/src/mock.rs b/frame/ethereum/src/mock.rs index 61ca702fb0..8b072d144f 100644 --- a/frame/ethereum/src/mock.rs +++ b/frame/ethereum/src/mock.rs @@ -307,7 +307,7 @@ pub fn new_text_ext_with_recorder( ) -> (Vec, sp_io::TestExternalities) { let (accounts, ext) = new_test_ext_with_initial_balance(accounts_len, 10_000_000); - let root = ext.backend.root().clone(); + let root = *ext.backend.root(); let db = ext.backend.into_storage(); let recorder: Recorder = Default::default(); let backend_with_reorder = TrieBackendBuilder::new(db, root) diff --git a/frame/evm/src/tests.rs b/frame/evm/src/tests.rs index 144a7f92df..5409d90cba 100644 --- a/frame/evm/src/tests.rs +++ b/frame/evm/src/tests.rs @@ -99,7 +99,7 @@ pub fn new_test_ext() -> TestExternalities { pub fn new_text_ext_with_recorder() -> TestExternalities { let text_ext = new_test_ext(); - let root = text_ext.backend.root().clone(); + let root = *text_ext.backend.root(); let db = text_ext.backend.into_storage(); let recorder: Recorder = Default::default(); let backend_with_reorder = TrieBackendBuilder::new(db, root) @@ -695,24 +695,24 @@ fn metadata_empty_dont_code_gets_cached() { // } // } -const PROOF_TEST_BYTECODE: &'static str = "6080604052348015600e575f80fd5b506101438061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610034575f3560e01c8063d6d1ee1414610038578063eeb4e36714610054575b5f80fd5b610052600480360381019061004d91906100ba565b610072565b005b61005c61007b565b60405161006991906100f4565b60405180910390f35b805f8190555050565b5f8054905090565b5f80fd5b5f819050919050565b61009981610087565b81146100a3575f80fd5b50565b5f813590506100b481610090565b92915050565b5f602082840312156100cf576100ce610083565b5b5f6100dc848285016100a6565b91505092915050565b6100ee81610087565b82525050565b5f6020820190506101075f8301846100e5565b9291505056fea26469706673582212201114104d5a56d94d03255e0f9fa699d53db26e355fb37f735caa200d7ce5158e64736f6c634300081a0033"; +const PROOF_TEST_BYTECODE: &str = "6080604052348015600e575f80fd5b506101438061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610034575f3560e01c8063d6d1ee1414610038578063eeb4e36714610054575b5f80fd5b610052600480360381019061004d91906100ba565b610072565b005b61005c61007b565b60405161006991906100f4565b60405180910390f35b805f8190555050565b5f8054905090565b5f80fd5b5f819050919050565b61009981610087565b81146100a3575f80fd5b50565b5f813590506100b481610090565b92915050565b5f602082840312156100cf576100ce610083565b5b5f6100dc848285016100a6565b91505092915050565b6100ee81610087565b82525050565b5f6020820190506101075f8301846100e5565b9291505056fea26469706673582212201114104d5a56d94d03255e0f9fa699d53db26e355fb37f735caa200d7ce5158e64736f6c634300081a0033"; #[test] fn proof_size_create_contract() { let proof_size = - || -> Option { cumulus_primitives_storage_weight_reclaim::get_proof_size() }; + || -> u64 { cumulus_primitives_storage_weight_reclaim::get_proof_size().expect("ensure the proof size host function is enabled.") }; let mut test_ext_with_recorder = new_text_ext_with_recorder(); test_ext_with_recorder.execute_with(|| { // The initial proof size should be 0 - assert_eq!(proof_size(), Some(0)); + assert_eq!(proof_size(), 0); // Read the storage increases the proof size EVM::account_basic(&H160::from_str("1000000000000000000000000000000000000002").unwrap()); - assert_eq!(proof_size(), Some(583)); + assert_eq!(proof_size(), 583); AccountCodes::::get( - &H160::from_str("1000000000000000000000000000000000000001").unwrap(), + H160::from_str("1000000000000000000000000000000000000001").unwrap(), ); - assert_eq!(proof_size(), Some(799)); + assert_eq!(proof_size(), 799); }); test_ext_with_recorder.execute_with(|| { @@ -734,15 +734,15 @@ fn proof_size_create_contract() { ) .expect("create contract failed"); let contract_addr = res.value; - assert!(AccountCodes::::get(contract_addr).len() != 0); - assert_eq!(proof_size(), Some(1196)); + assert!(!AccountCodes::::get(contract_addr).is_empty()); + assert_eq!(proof_size(), 1196); }); } #[test] fn proof_size_create_contract_with_low_proof_limit() { let proof_size = - || -> Option { cumulus_primitives_storage_weight_reclaim::get_proof_size() }; + || -> u64 { cumulus_primitives_storage_weight_reclaim::get_proof_size().expect("ensure the proof size host function is enabled.") }; let mut test_ext_with_recorder = new_text_ext_with_recorder(); test_ext_with_recorder.execute_with(|| { @@ -770,7 +770,7 @@ fn proof_size_create_contract_with_low_proof_limit() { #[test] fn proof_size_reach_limit() { let proof_size = - || -> Option { cumulus_primitives_storage_weight_reclaim::get_proof_size() }; + || -> u64 { cumulus_primitives_storage_weight_reclaim::get_proof_size().expect("ensure the proof size host function is enabled.") }; let mut test_ext_with_recorder = new_text_ext_with_recorder(); // create contract run out of proof size @@ -794,7 +794,7 @@ fn proof_size_reach_limit() { .expect("create contract failed"); assert_eq!(res.exit_reason, ExitReason::Error(ExitError::OutOfGas)); let contract_addr = res.value; - assert!(AccountCodes::::get(contract_addr).len() == 0); + assert!(AccountCodes::::get(contract_addr).is_empty()); }); // call contract run out of proof size @@ -817,7 +817,7 @@ fn proof_size_reach_limit() { ) .expect("create contract failed"); let contract_addr = res.value; - assert!(AccountCodes::::get(contract_addr).len() != 0); + assert!(!AccountCodes::::get(contract_addr).is_empty()); // set_number(6) let calldata = "d6d1ee140000000000000000000000000000000000000000000000000000000000000006"; @@ -866,7 +866,7 @@ fn proof_size_reach_limit() { #[test] fn proof_size_reach_limit_nonce_increase() { let proof_size = - || -> Option { cumulus_primitives_storage_weight_reclaim::get_proof_size() }; + || -> u64 { cumulus_primitives_storage_weight_reclaim::get_proof_size().expect("ensure the proof size host function is enabled.") }; let mut test_ext_with_recorder = new_text_ext_with_recorder(); test_ext_with_recorder.execute_with(|| { diff --git a/primitives/evm/src/validation.rs b/primitives/evm/src/validation.rs index e12ec083ff..d45a31eebc 100644 --- a/primitives/evm/src/validation.rs +++ b/primitives/evm/src/validation.rs @@ -383,7 +383,7 @@ mod tests { transaction_pov: Some(TransactionPov::new( Weight::from_parts(100, 100), 100, - Some(20), + 20, )), is_transactional, ..Default::default()