Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase code limits to ~1MB #5

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/revm/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use reth_provider::BundleStateWithReceipts;
use revm::DatabaseCommit;
#[cfg(not(feature = "optimism"))]
use tracing::{debug, trace};
use reth_primitives::revm_primitives::RWASM_MAX_INITCODE_SIZE;
use reth_primitives::revm_primitives::WASM_MAX_CODE_SIZE;
use crate::primitives::EVMError;

/// EVMProcessor is a block executor that uses revm to execute blocks or multiple blocks.
Expand Down Expand Up @@ -181,7 +181,7 @@ where
header,
total_difficulty,
);
cfg.cfg_env.limit_contract_code_size = Some(RWASM_MAX_INITCODE_SIZE);
cfg.cfg_env.limit_contract_code_size = Some(WASM_MAX_CODE_SIZE);
*self.evm.cfg_mut() = cfg.cfg_env;

// This will update the spec in case it changed
Expand Down
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 @@ -59,6 +59,7 @@ use reth_revm::optimism::RethL1BlockInfo;
use reth_rpc_types::OptimismTransactionReceiptFields;
#[cfg(feature = "optimism")]
use revm::L1BlockInfo;
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 @@ -922,7 +923,8 @@ where
F: FnOnce(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;
Loading