From 3af7eb0476e2b317fcecb1f8b4de4978c7801937 Mon Sep 17 00:00:00 2001 From: Flouse <1297478+Flouse@users.noreply.github.com> Date: Thu, 21 Dec 2023 14:16:27 +0000 Subject: [PATCH] fix: apply default_max_contract_limit when HardforkName::Andromeda is not enabled --- core/executor/src/lib.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/core/executor/src/lib.rs b/core/executor/src/lib.rs index 9c4a803d5..2d5b0faef 100644 --- a/core/executor/src/lib.rs +++ b/core/executor/src/lib.rs @@ -28,8 +28,8 @@ use evm::CreateScheme; use common_merkle::TrieMerkle; use protocol::traits::{Backend, Executor, ExecutorAdapter}; use protocol::types::{ - logs_bloom, Config, ExecResp, SignedTransaction, TransactionAction, TxResp, ValidatorExtend, - H160, H256, RLP_NULL, U256, + default_max_contract_limit, logs_bloom, Config, ExecResp, SignedTransaction, TransactionAction, + TxResp, ValidatorExtend, H160, H256, RLP_NULL, U256, }; use crate::precompiles::build_precompile_set; @@ -414,8 +414,8 @@ impl AxonExecutor { let consensus_config = handle.get_consensus_config().unwrap(); Some(consensus_config.max_contract_limit as usize) } else { - // If the hardfork is not enabled, the limit is set to 0x6000 - evm_config.create_contract_limit + // If the hardfork is not enabled, useset default_max_contract_limit() + Some(default_max_contract_limit() as usize) } }; evm_config.create_contract_limit = create_contract_limit; @@ -511,8 +511,11 @@ mod test { use super::*; #[test] - fn test_config_contract_limit() { - let config = Config::london(); - assert_eq!(config.create_contract_limit, Some(0x6000)); + fn test_max_contract_limit() { + let london_config = Config::london(); + assert_eq!(london_config.create_contract_limit, Some(0x6000)); + + let config = AxonExecutor.config(); + assert_eq!(config.create_contract_limit, Some(0xc000)); } }