diff --git a/client/blockchain-service/src/utils.rs b/client/blockchain-service/src/utils.rs index b1aabb25f..d532b6ffc 100644 --- a/client/blockchain-service/src/utils.rs +++ b/client/blockchain-service/src/utils.rs @@ -525,12 +525,7 @@ where Runtime::Extension, > { let function = function.into(); - let current_block_hash = client.info().best_hash; let current_block = client.info().best_number.saturated_into(); - let genesis_block = client - .hash(0) - .expect("Failed to get genesis block hash, always present; qed") - .expect("Genesis block hash should never not be on-chain; qed"); let period = BlockHashCount::get() .checked_next_power_of_two() .map(|c| c / 2) @@ -539,13 +534,13 @@ where let minimal_extra = MinimalExtension::new(generic::Era::mortal(period, current_block), nonce, tip); let extra: Runtime::Extension = Runtime::Extension::from_minimal_extension(minimal_extra); - let implicit = - >::implicit( - genesis_block, - current_block_hash, - ); - let raw_payload = SignedPayload::from_raw(function.clone(), extra.clone(), implicit); + let raw_payload = SignedPayload::new(function.clone(), extra.clone()) + .map_err(|e| { + error!(target: LOG_TARGET, "Failed to create signed payload: {:?}", e); + e + }) + .expect("Creating a signed payload should always work. Implicit data should always be available."); let caller_pub_key = Self::caller_pub_key(self.keystore.clone()); @@ -619,9 +614,12 @@ where // Each event record is composed of the `phase`, `event` and `topics` fields. // We are interested in those events whose `phase` is equal to `ApplyExtrinsic` with the index of the extrinsic. // For more information see: https://polkadot.js.org/docs/api/cookbook/blocks/#how-do-i-map-extrinsics-to-their-events + let extrinsic_index_u32: u32 = extrinsic_index + .try_into() + .expect("Extrinsic index should always be a valid u32; qed"); let events = events_in_block .into_iter() - .filter(|ev| ev.phase == frame_system::Phase::ApplyExtrinsic(extrinsic_index as u32)) + .filter(|ev| ev.phase == frame_system::Phase::ApplyExtrinsic(extrinsic_index_u32)) .collect(); // Construct the extrinsic. diff --git a/client/common/src/traits.rs b/client/common/src/traits.rs index 912fcf86d..80b48ce73 100644 --- a/client/common/src/traits.rs +++ b/client/common/src/traits.rs @@ -493,20 +493,4 @@ pub trait ExtensionOperations< /// # Returns /// A fully constructed extension ready for use in transaction signing fn from_minimal_extension(minimal: MinimalExtension) -> Self; - - /// Generates the implicit data required by this extension. - /// - /// Implicit data is information that is not explicitly included in the - /// transaction but is required for validation. This typically includes: - /// - The genesis block hash (for chain identification) - /// - The current block hash (for mortality checks) - /// - Runtime version information - /// - /// # Parameters - /// - `genesis_block_hash`: The hash of the genesis block - /// - `current_block_hash`: The hash of the current block - /// - /// # Returns - /// The implicit data structure required by this extension type - fn implicit(genesis_block_hash: Self::Hash, current_block_hash: Self::Hash) -> Self::Implicit; } diff --git a/runtime/parachain/src/configs/storage_hub.rs b/runtime/parachain/src/configs/storage_hub.rs index 0339ed2ae..1d1cd6ae4 100644 --- a/runtime/parachain/src/configs/storage_hub.rs +++ b/runtime/parachain/src/configs/storage_hub.rs @@ -36,21 +36,6 @@ impl ExtensionOperations for crate::SignedEx frame_metadata_hash_extension::CheckMetadataHash::new(false), ) } - - fn implicit(genesis_block_hash: Self::Hash, current_block_hash: Self::Hash) -> Self::Implicit { - ( - (), - crate::VERSION.spec_version, - crate::VERSION.transaction_version, - genesis_block_hash, - current_block_hash, - (), - (), - (), - (), - None, - ) - } } // Map the runtime event into the client-facing storage events enum. diff --git a/runtime/solochain-evm/src/configs/storage_hub.rs b/runtime/solochain-evm/src/configs/storage_hub.rs index 714a1a539..4cf494e56 100644 --- a/runtime/solochain-evm/src/configs/storage_hub.rs +++ b/runtime/solochain-evm/src/configs/storage_hub.rs @@ -34,20 +34,6 @@ impl ExtensionOperations for crate::TxExtens frame_metadata_hash_extension::CheckMetadataHash::new(false), ) } - - fn implicit(genesis_block_hash: Self::Hash, current_block_hash: Self::Hash) -> Self::Implicit { - ( - (), - crate::VERSION.spec_version, - crate::VERSION.transaction_version, - genesis_block_hash, - current_block_hash, - (), - (), - (), - None, - ) - } } // Map the runtime event into the client-facing storage events enum.