From 962eeb2dd6f141d81512fd8743ca589214a6e77e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Tue, 21 Oct 2025 12:22:39 +0200 Subject: [PATCH 1/4] Improve dry_run logging and increase MaxEthExtrinsicWeight --- substrate/frame/revive/src/lib.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/substrate/frame/revive/src/lib.rs b/substrate/frame/revive/src/lib.rs index 694f1e2899ce3..73f76bca8c016 100644 --- a/substrate/frame/revive/src/lib.rs +++ b/substrate/frame/revive/src/lib.rs @@ -359,7 +359,7 @@ pub mod pallet { pub const DepositPerChildTrieItem: Balance = deposit(1, 0) / 100; pub const DepositPerByte: Balance = deposit(0, 1); pub const CodeHashLockupDepositPercent: Perbill = Perbill::from_percent(0); - pub const MaxEthExtrinsicWeight: FixedU128 = FixedU128::from_rational(1, 2); + pub const MaxEthExtrinsicWeight: FixedU128 = FixedU128::from_rational(9, 10); } /// A type providing default configurations for this pallet in testing environment. @@ -1827,10 +1827,14 @@ impl Pallet { log::debug!(target: LOG_TARGET, "\ dry_run_eth_transact: \ - weight_limit={:?}: \ - eth_gas={eth_gas:?})\ + weight_limit={} \ + total_weight={total_weight} \ + max_weight={max_weight} \ + weight_left={} \ + eth_gas={eth_gas})\ ", dry_run.gas_required, + max_weight.saturating_sub(total_weight), ); dry_run.eth_gas = eth_gas; From d825192413587940e6318699f1347597b2a8f27a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Tue, 21 Oct 2025 12:37:03 +0200 Subject: [PATCH 2/4] Don't apply extrinsic cap in dry_run --- substrate/frame/revive/src/evm/call.rs | 4 +++- substrate/frame/revive/src/evm/runtime.rs | 2 +- substrate/frame/revive/src/lib.rs | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/substrate/frame/revive/src/evm/call.rs b/substrate/frame/revive/src/evm/call.rs index 1d018a54d9c22..281bb25baae7a 100644 --- a/substrate/frame/revive/src/evm/call.rs +++ b/substrate/frame/revive/src/evm/call.rs @@ -48,6 +48,7 @@ pub struct CallInfo { pub fn create_call( tx: GenericTransaction, signed_transaction: Option<(u32, Vec)>, + apply_weight_cap: bool, ) -> Result, InvalidTransaction> where T: Config, @@ -176,7 +177,8 @@ where call.set_weight_limit(weight_limit); let info = ::FeeInfo::dispatch_info(&call); - let max_weight = >::evm_max_extrinsic_weight(); + let max_weight = + if apply_weight_cap { >::evm_max_extrinsic_weight() } else { Weight::MAX }; let overweight_by = info.total_weight().saturating_sub(max_weight); let capped_weight = weight_limit.saturating_sub(overweight_by); call.set_weight_limit(capped_weight); diff --git a/substrate/frame/revive/src/evm/runtime.rs b/substrate/frame/revive/src/evm/runtime.rs index b92c87c3ba63e..016aebe31297d 100644 --- a/substrate/frame/revive/src/evm/runtime.rs +++ b/substrate/frame/revive/src/evm/runtime.rs @@ -315,7 +315,7 @@ pub trait EthExtra { log::debug!(target: LOG_TARGET, "Decoded Ethereum transaction with signer: {signer_addr:?} nonce: {nonce:?}"); let call_info = - create_call::(tx, Some((encoded_len as u32, payload.to_vec())))?; + create_call::(tx, Some((encoded_len as u32, payload.to_vec())), true)?; let storage_credit = ::Currency::withdraw( &signer, call_info.storage_deposit, diff --git a/substrate/frame/revive/src/lib.rs b/substrate/frame/revive/src/lib.rs index 73f76bca8c016..407ff66eabebd 100644 --- a/substrate/frame/revive/src/lib.rs +++ b/substrate/frame/revive/src/lib.rs @@ -1653,7 +1653,7 @@ impl Pallet { // we need to parse the weight from the transaction so that it is run // using the exact weight limit passed by the eth wallet - let mut call_info = create_call::(tx, None) + let mut call_info = create_call::(tx, None, false) .map_err(|err| EthTransactError::Message(format!("Invalid call: {err:?}")))?; // the dry-run might leave out certain fields From 39fe2d829ceeb16e65490918976126564b9f271e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Wed, 22 Oct 2025 12:52:10 +0200 Subject: [PATCH 3/4] Raise MaxEthExtrinsicWeight --- cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs | 2 +- cumulus/parachains/runtimes/testing/penpal/src/lib.rs | 2 +- substrate/bin/node/runtime/src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs index e55cfc21f1546..1faf1d0dd059e 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -1175,7 +1175,7 @@ parameter_types! { pub const DepositPerChildTrieItem: Balance = deposit(1, 0) / 100; pub const DepositPerByte: Balance = deposit(0, 1); pub CodeHashLockupDepositPercent: Perbill = Perbill::from_percent(30); - pub const MaxEthExtrinsicWeight: FixedU128 = FixedU128::from_rational(1,2); + pub const MaxEthExtrinsicWeight: FixedU128 = FixedU128::from_rational(9, 10); } impl pallet_revive::Config for Runtime { diff --git a/cumulus/parachains/runtimes/testing/penpal/src/lib.rs b/cumulus/parachains/runtimes/testing/penpal/src/lib.rs index f5c2734b3ed45..e028bdf87aec1 100644 --- a/cumulus/parachains/runtimes/testing/penpal/src/lib.rs +++ b/cumulus/parachains/runtimes/testing/penpal/src/lib.rs @@ -809,7 +809,7 @@ parameter_types! { pub const DepositPerChildTrieItem: Balance = 0; pub const DepositPerByte: Balance = 0; pub CodeHashLockupDepositPercent: Perbill = Perbill::from_percent(30); - pub const MaxEthExtrinsicWeight: FixedU128 = FixedU128::from_rational(1,2); + pub const MaxEthExtrinsicWeight: FixedU128 = FixedU128::from_rational(9, 10); } impl pallet_revive::Config for Runtime { diff --git a/substrate/bin/node/runtime/src/lib.rs b/substrate/bin/node/runtime/src/lib.rs index 9509f4133feb8..36861171fc054 100644 --- a/substrate/bin/node/runtime/src/lib.rs +++ b/substrate/bin/node/runtime/src/lib.rs @@ -1466,7 +1466,7 @@ parameter_types! { pub const DefaultDepositLimit: Balance = deposit(1024, 1024 * 1024); pub Schedule: pallet_contracts::Schedule = Default::default(); pub CodeHashLockupDepositPercent: Perbill = Perbill::from_percent(30); - pub const MaxEthExtrinsicWeight: FixedU128 = FixedU128::from_rational(1,2); + pub const MaxEthExtrinsicWeight: FixedU128 = FixedU128::from_rational(9, 10); } impl pallet_contracts::Config for Runtime { From 99438a280237f6d70e2f8de70341b526bd892b93 Mon Sep 17 00:00:00 2001 From: "cmd[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 22 Oct 2025 11:00:21 +0000 Subject: [PATCH 4/4] Update from github-actions[bot] running command 'prdoc --audience runtime_dev --audience runtime_user' --- prdoc/pr_10089.prdoc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 prdoc/pr_10089.prdoc diff --git a/prdoc/pr_10089.prdoc b/prdoc/pr_10089.prdoc new file mode 100644 index 0000000000000..88475632d98f9 --- /dev/null +++ b/prdoc/pr_10089.prdoc @@ -0,0 +1,16 @@ +title: 'pallet_revive: Raise the MaxEthExtrinsicWeight' +doc: +- audience: Runtime User + description: |- + Fixes https://github.com/paritytech/contract-issues/issues/194 + + Factory extrinsics do need more weight. It is fine to raise them to almost the full max extrinsic weight since this is still lower than the block weight. + + Also improving the error reporting during the dry run in case an extrinsic hits this limit. No more `OutOfGas` but a more descriptive error of how much it is overweight. +crates: +- name: pallet-revive + bump: major +- name: asset-hub-westend-runtime + bump: major +- name: penpal-runtime + bump: major