Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions client/blockchain-service/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 =
<Runtime::Extension as ExtensionOperations<Runtime::Call, Runtime>>::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());

Expand Down Expand Up @@ -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.
Expand Down
16 changes: 0 additions & 16 deletions client/common/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
15 changes: 0 additions & 15 deletions runtime/parachain/src/configs/storage_hub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,6 @@ impl ExtensionOperations<crate::RuntimeCall, crate::Runtime> 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.
Expand Down
14 changes: 0 additions & 14 deletions runtime/solochain-evm/src/configs/storage_hub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,6 @@ impl ExtensionOperations<crate::RuntimeCall, crate::Runtime> 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.
Expand Down
Loading