Skip to content

Commit

Permalink
Fix system extension weights proof size
Browse files Browse the repository at this point in the history
Signed-off-by: georgepisaltu <george.pisaltu@parity.io>
  • Loading branch information
georgepisaltu committed Oct 16, 2024
1 parent 9fb1251 commit 9cec831
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion substrate/frame/system/src/extensions/check_genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ impl<T: Config + Send + Sync> TransactionExtension<T::RuntimeCall> for CheckGene
type Val = ();
type Pre = ();
fn weight(&self, _: &T::RuntimeCall) -> sp_weights::Weight {
<T::ExtensionsWeightInfo as super::WeightInfo>::check_genesis()
// All transactions will always read the hash of the genesis block, so to avoid
// charging this multiple times in a block we manually set the proof size to 0.
<T::ExtensionsWeightInfo as super::WeightInfo>::check_genesis().set_proof_size(0)
}
impl_tx_ext_default!(T::RuntimeCall; validate prepare);
}
3 changes: 3 additions & 0 deletions substrate/frame/system/src/extensions/check_mortality.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ impl<T: Config + Send + Sync> TransactionExtension<T::RuntimeCall> for CheckMort

fn weight(&self, _: &T::RuntimeCall) -> sp_weights::Weight {
if self.0.is_immortal() {
// All immortal transactions will always read the hash of the genesis block, so to avoid
// charging this multiple times in a block we manually set the proof size to 0.
<T::ExtensionsWeightInfo as super::WeightInfo>::check_mortality_immortal_transaction()
.set_proof_size(0)
} else {
<T::ExtensionsWeightInfo as super::WeightInfo>::check_mortality_mortal_transaction()
}
Expand Down

0 comments on commit 9cec831

Please sign in to comment.