Skip to content

Commit

Permalink
Merge pull request #7 from fluentlabs-xyz/feat/max_size
Browse files Browse the repository at this point in the history
code max size
  • Loading branch information
dmitry123 authored Jun 25, 2024
2 parents 6a3e985 + 92414b5 commit 09d1965
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
30 changes: 15 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion crates/rpc/rpc/src/eth/api/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<StateProviderDatabase<StateProviderBox>>;
Expand Down Expand Up @@ -1071,7 +1072,8 @@ where
F: FnOnce(&mut StateCacheDB, EnvWithHandlerCfg) -> EthResult<R> + 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
.blocking_task_pool
Expand Down
4 changes: 2 additions & 2 deletions crates/transaction-pool/src/validate/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 2 additions & 0 deletions examples/exex/rollup/src/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 09d1965

Please sign in to comment.