From 15927fd020593f0cb73da6a5526036adbbe64176 Mon Sep 17 00:00:00 2001 From: Stas Stepanov Date: Tue, 25 Jun 2024 21:46:12 +0600 Subject: [PATCH 1/2] code max size --- crates/rpc/rpc/src/eth/api/transactions.rs | 2 ++ crates/transaction-pool/src/validate/constants.rs | 4 ++-- examples/exex/rollup/src/execution.rs | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/rpc/rpc/src/eth/api/transactions.rs b/crates/rpc/rpc/src/eth/api/transactions.rs index 8829a0434..2846ec950 100644 --- a/crates/rpc/rpc/src/eth/api/transactions.rs +++ b/crates/rpc/rpc/src/eth/api/transactions.rs @@ -52,6 +52,7 @@ use crate::eth::revm_utils::FillableTransaction; #[cfg(feature = "optimism")] use reth_rpc_types::OptimismTransactionReceiptFields; use revm_primitives::db::{Database, DatabaseRef}; +use revm_primitives::WASM_MAX_CODE_SIZE; /// Helper alias type for the state's [`CacheDB`] pub(crate) type StateCacheDB = CacheDB>; @@ -1072,6 +1073,7 @@ where R: Send + 'static, { let (cfg, block_env, at) = self.evm_env_at(at).await?; + cfg.limit_contract_code_size = Some(WASM_MAX_CODE_SIZE); let this = self.clone(); self.inner .blocking_task_pool diff --git a/crates/transaction-pool/src/validate/constants.rs b/crates/transaction-pool/src/validate/constants.rs index 489677057..bc039dd5a 100644 --- a/crates/transaction-pool/src/validate/constants.rs +++ b/crates/transaction-pool/src/validate/constants.rs @@ -9,10 +9,10 @@ pub const TX_SLOT_BYTE_SIZE: usize = 32 * 1024; /// more expensive to propagate; larger transactions also take more resources /// to validate whether they fit into the pool or not. Default is 4 times [`TX_SLOT_BYTE_SIZE`], /// which defaults to 32 KiB, so 128 KiB. -pub const DEFAULT_MAX_TX_INPUT_BYTES: usize = 4 * TX_SLOT_BYTE_SIZE; // 128KB +pub const DEFAULT_MAX_TX_INPUT_BYTES: usize = 4 * TX_SLOT_BYTE_SIZE * 8; // 1MB /// Maximum bytecode to permit for a contract. -pub const MAX_CODE_BYTE_SIZE: usize = 24576; +pub const MAX_CODE_BYTE_SIZE: usize = 0x100000; // 1MB /// Maximum initcode to permit in a creation transaction and create instructions. pub const MAX_INIT_CODE_BYTE_SIZE: usize = 2 * MAX_CODE_BYTE_SIZE; diff --git a/examples/exex/rollup/src/execution.rs b/examples/exex/rollup/src/execution.rs index e1fcfb5c4..a1dfb8411 100644 --- a/examples/exex/rollup/src/execution.rs +++ b/examples/exex/rollup/src/execution.rs @@ -2,6 +2,7 @@ use crate::{db::Database, RollupContract, CHAIN_ID, CHAIN_SPEC}; use alloy_consensus::{Blob, SidecarCoder, SimpleCoder}; use alloy_rlp::Decodable as _; use eyre::OptionExt; +use reth::primitives::revm_primitives::WASM_MAX_CODE_SIZE; use reth::transaction_pool::TransactionPool; use reth_execution_errors::BlockValidationError; use reth_node_api::{ConfigureEvm, ConfigureEvmEnv}; @@ -114,6 +115,7 @@ fn configure_evm<'a>( header, U256::ZERO, ); + cfg.cfg_env.limit_contract_code_size = Some(WASM_MAX_CODE_SIZE); *evm.cfg_mut() = cfg.cfg_env; evm From 92414b50ee8919bc6156c2cb38fab8198464acf2 Mon Sep 17 00:00:00 2001 From: d1r1 Date: Tue, 25 Jun 2024 18:27:25 +0200 Subject: [PATCH 2/2] update fluentbase-sdk to use correct constants --- Cargo.lock | 30 +++++++++++----------- crates/rpc/rpc/src/eth/api/transactions.rs | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e18f495ac..e944e9cfb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3146,7 +3146,7 @@ dependencies = [ [[package]] name = "fluentbase-codec" version = "0.1.0" -source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#f71b94db689b85ad08e4ab86c945f3c18edd9a10" +source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#af4ffab98b1f25dd534159b310d61f7162149a28" dependencies = [ "alloy-primitives", "byteorder", @@ -3160,7 +3160,7 @@ dependencies = [ [[package]] name = "fluentbase-codec-derive" version = "0.1.0" -source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#f71b94db689b85ad08e4ab86c945f3c18edd9a10" +source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#af4ffab98b1f25dd534159b310d61f7162149a28" dependencies = [ "convert_case 0.6.0", "crypto-hashes", @@ -3172,7 +3172,7 @@ dependencies = [ [[package]] name = "fluentbase-core" version = "0.1.0" -source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#f71b94db689b85ad08e4ab86c945f3c18edd9a10" +source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#af4ffab98b1f25dd534159b310d61f7162149a28" dependencies = [ "alloy-rlp", "byteorder", @@ -3190,7 +3190,7 @@ dependencies = [ [[package]] name = "fluentbase-genesis" version = "0.1.0" -source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#f71b94db689b85ad08e4ab86c945f3c18edd9a10" +source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#af4ffab98b1f25dd534159b310d61f7162149a28" dependencies = [ "alloy-genesis", "byteorder", @@ -3208,7 +3208,7 @@ dependencies = [ [[package]] name = "fluentbase-poseidon" version = "0.1.0" -source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#f71b94db689b85ad08e4ab86c945f3c18edd9a10" +source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#af4ffab98b1f25dd534159b310d61f7162149a28" dependencies = [ "bitvec", "halo2curves 0.6.1 (git+https://github.com/privacy-scaling-explorations/halo2curves?tag=v0.6.1)", @@ -3220,7 +3220,7 @@ dependencies = [ [[package]] name = "fluentbase-runtime" version = "0.1.0" -source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#f71b94db689b85ad08e4ab86c945f3c18edd9a10" +source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#af4ffab98b1f25dd534159b310d61f7162149a28" dependencies = [ "byteorder", "chrono", @@ -3240,7 +3240,7 @@ dependencies = [ [[package]] name = "fluentbase-sdk" version = "0.1.0" -source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#f71b94db689b85ad08e4ab86c945f3c18edd9a10" +source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#af4ffab98b1f25dd534159b310d61f7162149a28" dependencies = [ "alloy-rlp", "byteorder", @@ -3257,7 +3257,7 @@ dependencies = [ [[package]] name = "fluentbase-sdk-derive" version = "0.1.0" -source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#f71b94db689b85ad08e4ab86c945f3c18edd9a10" +source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#af4ffab98b1f25dd534159b310d61f7162149a28" dependencies = [ "convert_case 0.6.0", "crypto-hashes", @@ -3273,7 +3273,7 @@ dependencies = [ [[package]] name = "fluentbase-types" version = "0.1.0" -source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#f71b94db689b85ad08e4ab86c945f3c18edd9a10" +source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#af4ffab98b1f25dd534159b310d61f7162149a28" dependencies = [ "alloy-primitives", "rwasm", @@ -3283,7 +3283,7 @@ dependencies = [ [[package]] name = "fluentbase-zktrie" version = "0.1.0" -source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#f71b94db689b85ad08e4ab86c945f3c18edd9a10" +source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#af4ffab98b1f25dd534159b310d61f7162149a28" dependencies = [ "byteorder", "fluentbase-poseidon", @@ -4750,7 +4750,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d" dependencies = [ "cfg-if", - "windows-targets 0.52.5", + "windows-targets 0.48.5", ] [[package]] @@ -8821,7 +8821,7 @@ dependencies = [ [[package]] name = "revm-fluent" version = "9.0.0" -source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#f71b94db689b85ad08e4ab86c945f3c18edd9a10" +source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#af4ffab98b1f25dd534159b310d61f7162149a28" dependencies = [ "auto_impl", "cfg-if", @@ -8859,7 +8859,7 @@ dependencies = [ [[package]] name = "revm-interpreter-fluent" version = "5.0.0" -source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#f71b94db689b85ad08e4ab86c945f3c18edd9a10" +source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#af4ffab98b1f25dd534159b310d61f7162149a28" dependencies = [ "revm-primitives", "serde", @@ -8868,7 +8868,7 @@ dependencies = [ [[package]] name = "revm-precompile" version = "7.0.0" -source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#f71b94db689b85ad08e4ab86c945f3c18edd9a10" +source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#af4ffab98b1f25dd534159b310d61f7162149a28" dependencies = [ "aurora-engine-modexp", "blst", @@ -8886,7 +8886,7 @@ dependencies = [ [[package]] name = "revm-primitives" version = "4.0.0" -source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#f71b94db689b85ad08e4ab86c945f3c18edd9a10" +source = "git+https://github.com/fluentlabs-xyz/fluentbase?branch=devel#af4ffab98b1f25dd534159b310d61f7162149a28" dependencies = [ "alloy-primitives", "auto_impl", diff --git a/crates/rpc/rpc/src/eth/api/transactions.rs b/crates/rpc/rpc/src/eth/api/transactions.rs index 2846ec950..f66957c77 100644 --- a/crates/rpc/rpc/src/eth/api/transactions.rs +++ b/crates/rpc/rpc/src/eth/api/transactions.rs @@ -1072,7 +1072,7 @@ where F: FnOnce(&mut StateCacheDB, EnvWithHandlerCfg) -> EthResult + Send + 'static, R: Send + 'static, { - let (cfg, block_env, at) = self.evm_env_at(at).await?; + let (mut cfg, block_env, at) = self.evm_env_at(at).await?; cfg.limit_contract_code_size = Some(WASM_MAX_CODE_SIZE); let this = self.clone(); self.inner