Skip to content

Commit 338548c

Browse files
authored
fixup unlimited contract size (#387)
Signed-off-by: Alexandru Gheorghe <[email protected]>
1 parent dba5858 commit 338548c

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

crates/revive-env/src/runtime.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ impl pallet_revive::Config for Runtime {
8787
type ChainId = ConstU64<420_420_420>;
8888
type NativeToEthRatio = ConstU32<1_000_000_000>;
8989
type FindAuthor = Self;
90+
type DebugEnabled = ConstBool<true>;
9091
}
9192

9293
impl FindAuthor<<Self as frame_system::Config>::AccountId> for Runtime {

crates/revive-strategy/src/cheatcodes/mod.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ use tracing::warn;
2626
use alloy_eips::eip7702::SignedAuthorization;
2727
use polkadot_sdk::{
2828
pallet_revive::{
29-
self, AccountInfo, AddressMapper, BalanceOf, BytecodeType, Code, ContractInfo, ExecConfig,
30-
Executable, Pallet, evm::CallTrace,
29+
self, AccountInfo, AddressMapper, BalanceOf, BytecodeType, Code, ContractInfo,
30+
DebugSettings, ExecConfig, Executable, Pallet, evm::CallTrace,
3131
},
3232
polkadot_sdk_frame::prelude::OriginFor,
3333
sp_core::{self, H160, H256},
@@ -891,6 +891,13 @@ impl foundry_cheatcodes::CheatcodeInspectorStrategyExt for PvmCheatcodeInspector
891891
_ => None,
892892
};
893893

894+
// If limits are set to max, enable debug mode to bypass them in revive
895+
if ecx.cfg.limit_contract_code_size == Some(usize::MAX)
896+
|| ecx.cfg.limit_contract_initcode_size == Some(usize::MAX)
897+
{
898+
let debug_settings = DebugSettings::new(true);
899+
debug_settings.write_to_storage::<Runtime>();
900+
}
894901
Pallet::<Runtime>::bare_instantiate(
895902
origin,
896903
evm_value,
@@ -1025,6 +1032,14 @@ impl foundry_cheatcodes::CheatcodeInspectorStrategyExt for PvmCheatcodeInspector
10251032
mock_handler: Some(Box::new(mock_handler.clone())),
10261033
is_dry_run: false,
10271034
};
1035+
// If limits are set to max, enable debug mode to bypass them in revive
1036+
if ecx.cfg.limit_contract_code_size == Some(usize::MAX)
1037+
|| ecx.cfg.limit_contract_initcode_size == Some(usize::MAX)
1038+
{
1039+
let debug_settings = DebugSettings::new(true);
1040+
debug_settings.write_to_storage::<Runtime>();
1041+
}
1042+
10281043
Pallet::<Runtime>::bare_call(
10291044
origin,
10301045
target,

0 commit comments

Comments
 (0)