From 0cf6f5800f077b29792f7a8e112069d9445c4fd2 Mon Sep 17 00:00:00 2001 From: Valentin Chaboche Date: Tue, 10 Dec 2024 17:22:05 +0100 Subject: [PATCH 1/3] EVM/Node: force node transaction validation --- etherlink/CHANGES_NODE.md | 6 ++++ etherlink/bin_node/config/configuration.ml | 28 +++++++++++++------ etherlink/bin_node/config/configuration.mli | 1 - etherlink/bin_node/lib_dev/services.ml | 6 +--- .../bin_node/lib_dev/services_backend_sig.ml | 7 ----- etherlink/bin_node/lib_dev/simulator.ml | 12 -------- .../Alpha- Configuration RPC.out | 3 -- .../EVM Node- describe config.out | 5 +++- 8 files changed, 30 insertions(+), 38 deletions(-) diff --git a/etherlink/CHANGES_NODE.md b/etherlink/CHANGES_NODE.md index 68e4bfb65ae0..1c191df55ae7 100644 --- a/etherlink/CHANGES_NODE.md +++ b/etherlink/CHANGES_NODE.md @@ -18,6 +18,12 @@ EVM node endpoint, and will instead keep waiting for a valid blueprint to be provided. (!15751) +#### Performances + +- The transaction's validation is now performed in native OCaml instead of + using the kernel's simulation, which makes the validation of transactions + on `eth_sendRawTransaction` faster. (!15959) + ### Bug fixes - Fixes a Wasm Runtime host function that would copy only instead of moving diff --git a/etherlink/bin_node/config/configuration.ml b/etherlink/bin_node/config/configuration.ml index 07fa5ba08dfd..b5e5146df769 100644 --- a/etherlink/bin_node/config/configuration.ml +++ b/etherlink/bin_node/config/configuration.ml @@ -42,7 +42,6 @@ type rpc_server = Resto | Dream type experimental_features = { drop_duplicate_on_injection : bool; enable_send_raw_transaction : bool; - node_transaction_validation : bool; block_storage_sqlite3 : bool; overwrite_simulation_tick_limit : bool; garbage_collector : garbage_collector option; @@ -135,7 +134,6 @@ let default_experimental_features = { enable_send_raw_transaction = default_enable_send_raw_transaction; drop_duplicate_on_injection = false; - node_transaction_validation = true; block_storage_sqlite3 = false; overwrite_simulation_tick_limit = false; garbage_collector = None; @@ -697,7 +695,6 @@ let experimental_features_encoding = (fun { drop_duplicate_on_injection; enable_send_raw_transaction; - node_transaction_validation; block_storage_sqlite3; overwrite_simulation_tick_limit; garbage_collector; @@ -706,7 +703,7 @@ let experimental_features_encoding = } -> ( drop_duplicate_on_injection, enable_send_raw_transaction, - node_transaction_validation, + None, block_storage_sqlite3, overwrite_simulation_tick_limit, garbage_collector, @@ -715,7 +712,7 @@ let experimental_features_encoding = enable_websocket )) (fun ( drop_duplicate_on_injection, enable_send_raw_transaction, - node_transaction_validation, + _node_transaction_validation, block_storage_sqlite3, overwrite_simulation_tick_limit, garbage_collector, @@ -725,7 +722,6 @@ let experimental_features_encoding = { drop_duplicate_on_injection; enable_send_raw_transaction; - node_transaction_validation; block_storage_sqlite3; overwrite_simulation_tick_limit; garbage_collector; @@ -748,10 +744,12 @@ let experimental_features_encoding = "enable_send_raw_transaction" bool default_experimental_features.enable_send_raw_transaction) - (dft + (opt + ~description: + "DEPRECATED: You should remove this option from your configuration \ + file." "node_transaction_validation" - bool - default_experimental_features.node_transaction_validation) + bool) (dft "block_storage_sqlite3" ~description: @@ -1160,6 +1158,18 @@ let precheck json = `false` anymore." | _ -> return_unit in + let node_transaction_validation_conf = + json |-?> "experimental_features" |?-?> "node_transaction_validation" + |?> as_bool_opt + in + let* () = + match node_transaction_validation_conf with + | Some false -> + failwith + "`experimental_features.node_transaction_validation` cannot be \ + set to `false` anymore." + | _ -> return_unit + in return_unit) (fun _exn -> failwith "Syntax error in the configuration file") diff --git a/etherlink/bin_node/config/configuration.mli b/etherlink/bin_node/config/configuration.mli index 7d0f88140d13..73734f5cca84 100644 --- a/etherlink/bin_node/config/configuration.mli +++ b/etherlink/bin_node/config/configuration.mli @@ -69,7 +69,6 @@ type rpc_server = type experimental_features = { drop_duplicate_on_injection : bool; enable_send_raw_transaction : bool; - node_transaction_validation : bool; block_storage_sqlite3 : bool; overwrite_simulation_tick_limit : bool; garbage_collector : garbage_collector option; diff --git a/etherlink/bin_node/lib_dev/services.ml b/etherlink/bin_node/lib_dev/services.ml index 05567ab7d3fa..2983a5556a59 100644 --- a/etherlink/bin_node/lib_dev/services.ml +++ b/etherlink/bin_node/lib_dev/services.ml @@ -560,11 +560,7 @@ let dispatch_request (rpc : Configuration.rpc) (config : Configuration.t) else let f tx_raw = let txn = Ethereum_types.hex_to_bytes tx_raw in - let* is_valid = - if config.experimental_features.node_transaction_validation - then Validate.is_tx_valid (module Backend_rpc) txn - else Backend_rpc.is_tx_valid txn - in + let* is_valid = Validate.is_tx_valid (module Backend_rpc) txn in match is_valid with | Error err -> let*! () = diff --git a/etherlink/bin_node/lib_dev/services_backend_sig.ml b/etherlink/bin_node/lib_dev/services_backend_sig.ml index bc003c62fd63..0bf84386f624 100644 --- a/etherlink/bin_node/lib_dev/services_backend_sig.ml +++ b/etherlink/bin_node/lib_dev/services_backend_sig.ml @@ -115,13 +115,6 @@ module type S = sig Ethereum_types.call -> Simulation.call_result Simulation.simulation_result tzresult Lwt.t - (** [is_tx_valid tx_raw] checks if the transaction is valid. Checks - if the nonce is correct and returns the associated public key of - transaction. *) - val is_tx_valid : - string -> - Simulation.validation_result Simulation.simulation_result tzresult Lwt.t - (** [storage_at address pos block_param] returns the value at index [pos] of the account [address]'s storage on block [block_param]. *) diff --git a/etherlink/bin_node/lib_dev/simulator.ml b/etherlink/bin_node/lib_dev/simulator.ml index 8f15518ef24d..17095fc20a79 100644 --- a/etherlink/bin_node/lib_dev/simulator.ml +++ b/etherlink/bin_node/lib_dev/simulator.ml @@ -325,16 +325,4 @@ module Make (SimulationBackend : SimulationBackend) = struct in Ok (Ok {Simulation.gas_used = Some gas_used; value}) | _ -> return res - - let is_tx_valid tx_raw = - let open Lwt_result_syntax in - let* simulation_state = SimulationBackend.get_state () in - let* bytes = - call_simulation - ~log_file:"tx_validity" - ~input_encoder:Simulation.encode_tx - ~input:tx_raw - simulation_state - in - Lwt.return (Simulation.is_tx_valid bytes) end diff --git a/etherlink/tezt/tests/expected/evm_sequencer.ml/Alpha- Configuration RPC.out b/etherlink/tezt/tests/expected/evm_sequencer.ml/Alpha- Configuration RPC.out index 6d8dc266e546..7366208fb4ad 100644 --- a/etherlink/tezt/tests/expected/evm_sequencer.ml/Alpha- Configuration RPC.out +++ b/etherlink/tezt/tests/expected/evm_sequencer.ml/Alpha- Configuration RPC.out @@ -13,7 +13,6 @@ "experimental_features": { "drop_duplicate_on_injection": true, "enable_send_raw_transaction": true, - "node_transaction_validation": true, "block_storage_sqlite3": true, "overwrite_simulation_tick_limit": false, "rpc_server": "resto", @@ -64,7 +63,6 @@ "experimental_features": { "drop_duplicate_on_injection": true, "enable_send_raw_transaction": true, - "node_transaction_validation": true, "block_storage_sqlite3": true, "overwrite_simulation_tick_limit": false, "rpc_server": "resto", @@ -108,7 +106,6 @@ "experimental_features": { "drop_duplicate_on_injection": true, "enable_send_raw_transaction": true, - "node_transaction_validation": true, "block_storage_sqlite3": true, "overwrite_simulation_tick_limit": false, "rpc_server": "resto", diff --git a/etherlink/tezt/tests/expected/evm_sequencer.ml/EVM Node- describe config.out b/etherlink/tezt/tests/expected/evm_sequencer.ml/EVM Node- describe config.out index a0c819be16e1..48fdf33cd577 100644 --- a/etherlink/tezt/tests/expected/evm_sequencer.ml/EVM Node- describe config.out +++ b/etherlink/tezt/tests/expected/evm_sequencer.ml/EVM Node- describe config.out @@ -122,7 +122,10 @@ boolean /* Enable or disable the `eth_sendRawTransaction` method. DEPRECATED: You should use "rpc.restricted_rpcs" instead. */, - "node_transaction_validation"?: boolean, + "node_transaction_validation"?: + boolean + /* DEPRECATED: You should remove this option from your configuration + file. */, "block_storage_sqlite3"?: boolean /* Store the blocks and transactions in a sqlite3 database and -- GitLab From 899cf87b50291c0e3767860a69cdc1e615b6ddec Mon Sep 17 00:00:00 2001 From: Valentin Chaboche Date: Tue, 10 Dec 2024 17:26:31 +0100 Subject: [PATCH 2/3] EVM/Kernel: remove TxValidation simulation --- etherlink/CHANGES_KERNEL.md | 2 + etherlink/kernel_evm/kernel/src/simulation.rs | 370 +----------------- 2 files changed, 9 insertions(+), 363 deletions(-) diff --git a/etherlink/CHANGES_KERNEL.md b/etherlink/CHANGES_KERNEL.md index e3ce8cbf1bfd..ce12e88a0ac2 100644 --- a/etherlink/CHANGES_KERNEL.md +++ b/etherlink/CHANGES_KERNEL.md @@ -19,6 +19,8 @@ - Clear blueprints on migration (!15637) - Support for legacy untagged format for delayed transactions has been dropped. (!15366) - Avoid writing gas price twice per block by adding it to block-in-progress. (!15574) +- Transaction validation support in simulation is dropped, the + validation must be done outside of the kernel. (!15958) ### Bug fixes diff --git a/etherlink/kernel_evm/kernel/src/simulation.rs b/etherlink/kernel_evm/kernel/src/simulation.rs index a8f9d9b7afa6..e2bca3538086 100644 --- a/etherlink/kernel_evm/kernel/src/simulation.rs +++ b/etherlink/kernel_evm/kernel/src/simulation.rs @@ -10,7 +10,7 @@ use crate::block_storage; use crate::configuration::fetch_limits; -use crate::fees::{simulation_add_gas_for_fees, tx_execution_gas_limit}; +use crate::fees::simulation_add_gas_for_fees; use crate::storage::{read_sequencer_pool_address, read_tracer_input}; use crate::tick_model::constants::MAXIMUM_GAS_LIMIT; use crate::{error::Error, error::StorageError, storage}; @@ -30,14 +30,12 @@ use evm_execution::{ use evm_execution::{run_transaction, EthereumError}; use primitive_types::{H160, U256}; use rlp::{Decodable, DecoderError, Encodable, Rlp}; -use sha3::{Digest, Keccak256}; use tezos_ethereum::block::BlockConstants; use tezos_ethereum::rlp_helpers::{ append_option_u64_le, check_list, decode_field, decode_option, decode_option_u64_le, decode_timestamp, next, VersionedEncoding, }; use tezos_ethereum::transaction::TransactionObject; -use tezos_ethereum::tx_common::EthereumTransactionCommon; use tezos_evm_logging::{log, Level::*}; use tezos_evm_runtime::runtime::Runtime; use tezos_smart_rollup::types::Timestamp; @@ -51,7 +49,10 @@ pub const SIMULATION_CHUNK_TAG: u8 = 3; /// Tag indicating simulation is an evaluation. pub const EVALUATION_TAG: u8 = 0x00; /// Tag indicating simulation is a validation. -pub const VALIDATION_TAG: u8 = 0x01; +/// +/// This tag can no longer be used, if you plan to add another tag, +/// do not reuse this one to avoid mistakes. +const _VALIDATION_TAG: u8 = 0x01; /// Version of the encoding in use. pub const SIMULATION_ENCODING_VERSION: u8 = 0x01; @@ -59,17 +60,9 @@ pub const SIMULATION_ENCODING_VERSION: u8 = 0x01; pub const OK_TAG: u8 = 0x1; pub const ERR_TAG: u8 = 0x2; -const INCORRECT_SIGNATURE: &str = "Incorrect signature."; -const INVALID_CHAIN_ID: &str = "Invalid chain id."; -const NONCE_TOO_LOW: &str = "Nonce too low."; -const CANNOT_PREPAY: &str = "Cannot prepay transaction."; -const MAX_GAS_FEE_TOO_LOW: &str = "Max gas fee too low."; const OUT_OF_TICKS_MSG: &str = "The transaction would exhaust all the ticks it is allocated. Try reducing its gas consumption or splitting the call in multiple steps, if possible."; -const GAS_LIMIT_TOO_LOW: &str = "Gas limit too low."; -const GAS_LIMIT_TOO_HIGH: &str = "Gas limit (for execution) is too high."; - // Redefined Result as we cannot implement Decodable and Encodable traits on Result #[derive(Debug, PartialEq, Eq, Clone)] pub enum SimulationResult { @@ -496,174 +489,9 @@ impl Evaluation { } } -#[derive(Debug, PartialEq)] -struct TxValidation { - transaction: EthereumTransactionCommon, -} - -impl TxValidation { - // Run the transaction and ensure - // - it won't fail with out-of-ticks - // - it won't fail due to not-enough gas fees to cover da fee - pub fn validate( - host: &mut Host, - transaction: &EthereumTransactionCommon, - caller: &H160, - enable_fa_withdrawals: bool, - ) -> Result, anyhow::Error> { - let chain_id = retrieve_chain_id(host)?; - let block_fees = retrieve_block_fees(host)?; - let coinbase = read_sequencer_pool_address(host).unwrap_or_default(); - - let current_constants = match block_storage::read_current(host) { - Ok(block) => { - BlockConstants { - number: block.number + 1, - coinbase, - // The timestamp is incorrect in simulation. The simulation - // caller should provide a view of the real timestamp. - timestamp: U256::from(block.timestamp.as_u64()), - gas_limit: crate::block::GAS_LIMIT, - block_fees, - chain_id, - prevrandao: None, - } - } - Err(_) => { - let timestamp = current_timestamp(host); - let timestamp = U256::from(timestamp.as_u64()); - BlockConstants::first_block( - timestamp, - chain_id, - block_fees, - crate::block::GAS_LIMIT, - coinbase, - ) - } - }; - - let mut evm_account_storage = account_storage::init_account_storage() - .map_err(|_| Error::Storage(StorageError::AccountInitialisation))?; - let precompiles = precompiles::precompile_set::(enable_fa_withdrawals); - let tx_data_size = transaction.data.len() as u64; - let limits = fetch_limits(host); - let allocated_ticks = - tick_model::estimate_remaining_ticks_for_transaction_execution( - limits.maximum_allowed_ticks, - 0, - tx_data_size, - ); - - let Ok(gas_limit) = tx_execution_gas_limit(transaction, &block_fees, false) - else { - return Self::to_error(GAS_LIMIT_TOO_LOW); - }; - - if gas_limit > limits.maximum_gas_limit { - return Self::to_error(GAS_LIMIT_TOO_HIGH); - } - - match run_transaction( - host, - ¤t_constants, - &mut evm_account_storage, - &precompiles, - CONFIG, - transaction.to, - *caller, - transaction.data.clone(), - Some(gas_limit), // gas could be omitted - block_fees.base_fee_per_gas(), - transaction.value, - true, - allocated_ticks, - false, - false, - None, - ) { - Ok(Some(ExecutionOutcome { - result: ExecutionOutcomeResult::OutOfTicks, - .. - })) => Self::to_error(OUT_OF_TICKS_MSG), - Ok(None) => Self::to_error(CANNOT_PREPAY), - _ => Ok(SimulationResult::Ok(ValidationResult { - transaction_object: TransactionObject { - block_number: U256::zero(), - from: *caller, - to: transaction.to, - gas_used: transaction.gas_limit_with_fees().into(), - gas_price: transaction.max_fee_per_gas, - hash: Keccak256::digest(transaction.to_bytes()).into(), - input: transaction.data.clone(), - nonce: transaction.nonce, - index: 0, - value: transaction.value, - signature: transaction.signature.clone(), - }, - })), - } - } - - pub fn to_error( - msg: &str, - ) -> Result, anyhow::Error> { - Ok(SimulationResult::Err(String::from(msg))) - } - - /// Execute the simulation - pub fn run( - &self, - host: &mut Host, - enable_fa_withdrawals: bool, - ) -> Result, anyhow::Error> { - let tx = &self.transaction; - let evm_account_storage = account_storage::init_account_storage()?; - // Get the caller - let Ok(caller) = tx.caller() else { - return Self::to_error(INCORRECT_SIGNATURE); - }; - // Get the caller account - let caller_account_path = evm_execution::account_storage::account_path(&caller)?; - let caller_account = evm_account_storage.get(host, &caller_account_path)?; - // Get the nonce of the caller - let caller_nonce = match &caller_account { - Some(account) => account.nonce(host)?, - None => 0, - }; - let block_fees = retrieve_block_fees(host)?; - // Get the chain_id - let chain_id = storage::read_chain_id(host)?; - // Check if nonce is too low - if tx.nonce < caller_nonce { - return Self::to_error(NONCE_TOO_LOW); - } - // Check if the chain id is correct - if tx.chain_id.is_some() && tx.chain_id != Some(chain_id) { - return Self::to_error(INVALID_CHAIN_ID); - } - // Check if the gas price is high enough - if tx.max_fee_per_gas < block_fees.base_fee_per_gas() { - return Self::to_error(MAX_GAS_FEE_TOO_LOW); - } - // Check if running the transaction (assuming it is valid) would run out - // of ticks, or fail validation for another reason. - Self::validate(host, tx, &caller, enable_fa_withdrawals) - } -} - -impl TryFrom<&[u8]> for TxValidation { - type Error = DecoderError; - - fn try_from(bytes: &[u8]) -> Result { - let transaction = EthereumTransactionCommon::from_bytes(bytes)?; - Ok(Self { transaction }) - } -} - #[derive(Debug, PartialEq)] enum Message { Evaluation(Evaluation), - TxValidation(Box), } impl TryFrom<&[u8]> for Message { @@ -679,8 +507,6 @@ impl TryFrom<&[u8]> for Message { match tag { EVALUATION_TAG => Evaluation::from_bytes(bytes).map(Message::Evaluation), - VALIDATION_TAG => TxValidation::try_from(bytes) - .map(|tx| Message::TxValidation(Box::new(tx))), _ => Err(DecoderError::Custom("Unknown message to simulate")), } } @@ -800,10 +626,6 @@ pub fn start_simulation_mode( let outcome = simulation.run(host, tracer_input, enable_fa_withdrawals)?; storage::store_simulation_result(host, outcome) } - Message::TxValidation(tx_validation) => { - let outcome = tx_validation.run(host, enable_fa_withdrawals)?; - storage::store_simulation_result(host, outcome) - } } } @@ -811,14 +633,10 @@ pub fn start_simulation_mode( mod tests { use primitive_types::H256; - use tezos_ethereum::{ - block::BlockConstants, transaction::TransactionType, tx_signature::TxSignature, - }; + use tezos_ethereum::{block::BlockConstants, tx_signature::TxSignature}; use tezos_evm_runtime::runtime::MockKernelHost; - use crate::{ - current_timestamp, fees::gas_for_fees, retrieve_block_fees, retrieve_chain_id, - }; + use crate::{current_timestamp, retrieve_block_fees, retrieve_chain_id}; use super::*; @@ -1141,180 +959,6 @@ mod tests { assert_eq!(expected, parsed, "should have parsed a chunk"); } - #[test] - fn parse_tx_validation() { - let expected = { - let v = 2710.into(); - - let r = H256::from_slice( - &hex::decode( - "0c4604516693aafd2e74a993c280455fcad144a414f5aa580d96f3c51d4428e5", - ) - .unwrap(), - ); - - let s = H256::from_slice( - &hex::decode( - "630fb7fc1af4c1c1a82cabb4ef9d12f8fc2e54a047eb3e3bdffc9d23cd07a94e", - ) - .unwrap(), - ); - - let signature = TxSignature::new(v, r, s).unwrap(); - - EthereumTransactionCommon::new( - TransactionType::Legacy, - Some(1337.into()), - 0, - U256::default(), - U256::default(), - 2000000, - Some(H160::default()), - U256::default(), - vec![], - Vec::default(), - Some(signature), - ) - }; - - let hex = "f8628080831e84809400000000000000000000000000000000000000008080820a96a00c4604516693aafd2e74a993c280455fcad144a414f5aa580d96f3c51d4428e5a0630fb7fc1af4c1c1a82cabb4ef9d12f8fc2e54a047eb3e3bdffc9d23cd07a94e"; - let data = hex::decode(hex).unwrap(); - let tx = EthereumTransactionCommon::from_bytes(&data).unwrap(); - - assert_eq!(tx, expected); - - let mut encoded = hex::decode(hex).unwrap(); - let mut input = vec![ - parsing::SIMULATION_TAG, - SIMULATION_SIMPLE_TAG, - VALIDATION_TAG, - ]; - input.append(&mut encoded); - - let parsed = Input::parse(&input); - - assert_eq!( - Input::Simple(Box::new(Message::TxValidation(Box::new(TxValidation { - transaction: expected - })))), - parsed, - "should have been parsed as complete tx validation" - ); - } - - fn address_from_str(s: &str) -> Option { - let data = &hex::decode(s).unwrap(); - Some(H160::from_slice(data)) - } - - #[test] - fn test_tx_validation_gas_price() { - let mut host = MockKernelHost::default(); - let block_fees = crate::retrieve_block_fees(&mut host).unwrap(); - let gas_price = U256::one(); - let tx_data = vec![]; - let tx_access_list = vec![]; - let fee_gas = gas_for_fees( - block_fees.da_fee_per_byte(), - block_fees.minimum_base_fee_per_gas(), - tx_data.as_slice(), - tx_access_list.as_slice(), - ) - .expect("Should have been able to compute gas for fee"); - - let transaction = EthereumTransactionCommon::new( - TransactionType::Eip1559, - Some(U256::from(1)), - 0, - U256::zero(), - gas_price, - 21000 + fee_gas, - Some(H160::zero()), - U256::zero(), - tx_data, - tx_access_list, - None, - ); - let signed = transaction - .sign_transaction( - "e922354a3e5902b5ac474f3ff08a79cff43533826b8f451ae2190b65a9d26158" - .to_string(), - ) - .unwrap(); - let simulation = TxValidation { - transaction: signed, - }; - storage::store_chain_id(&mut host, U256::from(1)) - .expect("should be able to store a chain id"); - let evm_account_storage = account_storage::init_account_storage().unwrap(); - let _account = evm_account_storage - .get_or_create( - &host, - &account_storage::account_path( - &address_from_str("f95abdf6ede4c3703e0e9453771fbee8592d31e9") - .unwrap(), - ) - .unwrap(), - ) - .unwrap(); - let result = simulation.run(&mut host, false); - println!("{result:?}"); - assert!(result.is_ok()); - assert_eq!( - TxValidation::to_error(MAX_GAS_FEE_TOO_LOW).unwrap(), - result.unwrap() - ); - } - - #[test] - fn test_tx_validation_da_fees_not_covered() { - let mut host = MockKernelHost::default(); - let block_fees = crate::retrieve_block_fees(&mut host).unwrap(); - - let transaction = EthereumTransactionCommon::new( - TransactionType::Eip1559, - Some(U256::from(1)), - 0, - U256::from(0), - block_fees.base_fee_per_gas(), - 21000, // not covering da_fee - Some(H160::zero()), - U256::zero(), - vec![], - vec![], - None, - ); - let signed = transaction - .sign_transaction( - "e922354a3e5902b5ac474f3ff08a79cff43533826b8f451ae2190b65a9d26158" - .to_string(), - ) - .unwrap(); - let simulation = TxValidation { - transaction: signed, - }; - storage::store_chain_id(&mut host, U256::from(1)) - .expect("should be able to store a chain id"); - let evm_account_storage = account_storage::init_account_storage().unwrap(); - let _account = evm_account_storage - .get_or_create( - &host, - &account_storage::account_path( - &address_from_str("f95abdf6ede4c3703e0e9453771fbee8592d31e9") - .unwrap(), - ) - .unwrap(), - ) - .unwrap(); - let result = simulation.run(&mut host, false); - - assert!(result.is_ok()); - assert_eq!( - SimulationResult::Err(String::from(super::GAS_LIMIT_TOO_LOW)), - result.unwrap() - ); - } - pub fn check_roundtrip( v: R, ) { -- GitLab From 877c23974b8c2c1d17a2a44db6c909c0ae7ce26c Mon Sep 17 00:00:00 2001 From: Valentin Chaboche Date: Wed, 11 Dec 2024 11:42:05 +0100 Subject: [PATCH 3/3] EVM/Tezt: remove [node_transaction_validation] --- etherlink/tezt/lib/evm_node.ml | 7 +------ etherlink/tezt/lib/evm_node.mli | 9 ++++----- etherlink/tezt/lib/setup.ml | 1 - etherlink/tezt/tests/evm_rollup.ml | 7 +------ etherlink/tezt/tests/gc.ml | 1 - etherlink/tezt/tests/validate.ml | 6 +----- 6 files changed, 7 insertions(+), 24 deletions(-) diff --git a/etherlink/tezt/lib/evm_node.ml b/etherlink/tezt/lib/evm_node.ml index ca4bb9b8a906..796969835afa 100644 --- a/etherlink/tezt/lib/evm_node.ml +++ b/etherlink/tezt/lib/evm_node.ml @@ -1182,8 +1182,7 @@ type garbage_collector = { type rpc_server = Resto | Dream let patch_config_with_experimental_feature - ?(drop_duplicate_when_injection = false) - ?(node_transaction_validation = false) ?(block_storage_sqlite3 = true) + ?(drop_duplicate_when_injection = false) ?(block_storage_sqlite3 = true) ?(next_wasm_runtime = true) ?garbage_collector ?rpc_server () = let conditional_json_put ~name cond value_json json = if cond then @@ -1211,10 +1210,6 @@ let patch_config_with_experimental_feature ~name:"drop_duplicate_on_injection" (`Bool true) json - |> conditional_json_put - node_transaction_validation - ~name:"node_transaction_validation" - (`Bool true) |> conditional_json_put block_storage_sqlite3 ~name:"block_storage_sqlite3" diff --git a/etherlink/tezt/lib/evm_node.mli b/etherlink/tezt/lib/evm_node.mli index 11f4f1e981ef..eaa92a363007 100644 --- a/etherlink/tezt/lib/evm_node.mli +++ b/etherlink/tezt/lib/evm_node.mli @@ -259,14 +259,13 @@ type garbage_collector = { type rpc_server = Resto | Dream -(** [patch_config_with_experimental_feature ?node_transaction_validation - ?drop_duplicate_when_injection ?block_storage_sqlite3 ?next_wasm_runtime - ?rpc_server json_config] - patches a config to add experimental feature. Each optional argument add the +(** [patch_config_with_experimental_feature + ?drop_duplicate_when_injection ?block_storage_sqlite3 + ?next_wasm_runtime ?rpc_server json_config] patches a config to + add experimental feature. Each optional argument add the correspondent experimental feature. *) val patch_config_with_experimental_feature : ?drop_duplicate_when_injection:bool -> - ?node_transaction_validation:bool -> ?block_storage_sqlite3:bool -> ?next_wasm_runtime:bool -> ?garbage_collector:garbage_collector -> diff --git a/etherlink/tezt/lib/setup.ml b/etherlink/tezt/lib/setup.ml index c121cf042aa0..10d9629df918 100644 --- a/etherlink/tezt/lib/setup.ml +++ b/etherlink/tezt/lib/setup.ml @@ -267,7 +267,6 @@ let setup_sequencer ?max_delayed_inbox_blueprint_length ?next_wasm_runtime let patch_config = Evm_node.patch_config_with_experimental_feature ~drop_duplicate_when_injection - ~node_transaction_validation:true ?next_wasm_runtime ?block_storage_sqlite3 ?rpc_server diff --git a/etherlink/tezt/tests/evm_rollup.ml b/etherlink/tezt/tests/evm_rollup.ml index 422ce22db526..5144790478cf 100644 --- a/etherlink/tezt/tests/evm_rollup.ml +++ b/etherlink/tezt/tests/evm_rollup.ml @@ -435,11 +435,7 @@ let setup_evm_kernel ?additional_config ?(setup_kernel_root_hash = true) unit else unit in - let patch_config = - Evm_node.patch_config_with_experimental_feature - ~node_transaction_validation:true - () - in + let patch_config = Evm_node.patch_config_with_experimental_feature () in let* produce_block, evm_node = match setup_mode with | Setup_proxy -> @@ -466,7 +462,6 @@ let setup_evm_kernel ?additional_config ?(setup_kernel_root_hash = true) } -> let patch_config = Evm_node.patch_config_with_experimental_feature - ~node_transaction_validation:true ~block_storage_sqlite3 () in diff --git a/etherlink/tezt/tests/gc.ml b/etherlink/tezt/tests/gc.ml index 10a62f6fbff0..e99aae3b4cd7 100644 --- a/etherlink/tezt/tests/gc.ml +++ b/etherlink/tezt/tests/gc.ml @@ -40,7 +40,6 @@ let register ?genesis_timestamp @@ fun () -> let patch_config = Evm_node.patch_config_with_experimental_feature - ~node_transaction_validation:true ~block_storage_sqlite3:true ~garbage_collector () diff --git a/etherlink/tezt/tests/validate.ml b/etherlink/tezt/tests/validate.ml index 03914063890c..418c0aa696a4 100644 --- a/etherlink/tezt/tests/validate.ml +++ b/etherlink/tezt/tests/validate.ml @@ -36,11 +36,7 @@ let register ?maximum_gas_per_transaction ?set_account_code ?da_fee_per_byte Constant.smart_rollup_installer; ] @@ fun () -> - let patch_config = - Evm_node.patch_config_with_experimental_feature - ~node_transaction_validation:true - () - in + let patch_config = Evm_node.patch_config_with_experimental_feature () in let* sequencer = Helpers.init_sequencer_sandbox ?maximum_gas_per_transaction -- GitLab