Skip to content
Closed
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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ frame-system-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk.
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "a64eb1fb02d4012948cba024fca2f27d94732e52", default-features = false }
frame-try-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "a64eb1fb02d4012948cba024fca2f27d94732e52", default-features = false }
polkadot-sdk-frame = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "a64eb1fb02d4012948cba024fca2f27d94732e52", default-features = false }
frame-metadata-hash-extension = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "a64eb1fb02d4012948cba024fca2f27d94732e52", default-features = false }

sc-basic-authorship = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "a64eb1fb02d4012948cba024fca2f27d94732e52" }
sc-cli = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "a64eb1fb02d4012948cba024fca2f27d94732e52" }
Expand Down
5 changes: 5 additions & 0 deletions runtimes/bulletin-polkadot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ frame-executive = { workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
frame-try-runtime = { workspace = true, optional = true }
frame-metadata-hash-extension = { workspace = true }
pallet-authorship = { workspace = true }
pallet-babe = { workspace = true }
pallet-grandpa = { workspace = true }
Expand Down Expand Up @@ -235,3 +236,7 @@ try-runtime = [
"parachains-common?/try-runtime",
"sp-runtime/try-runtime",
]


# Enable the metadata hash generation in the wasm builder.
metadata-hash = ["substrate-wasm-builder/metadata-hash"]
9 changes: 8 additions & 1 deletion runtimes/bulletin-polkadot/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#[cfg(feature = "std")]
#[cfg(all(feature = "std", feature = "metadata-hash"))]
fn main() {
substrate_wasm_builder::WasmBuilder::init_with_defaults()
.enable_metadata_hash("", 0)
.build();
}

#[cfg(all(feature = "std", not(feature = "metadata-hash")))]
fn main() {
substrate_wasm_builder::WasmBuilder::build_using_defaults();
}
Expand Down
15 changes: 15 additions & 0 deletions runtimes/bulletin-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,21 @@ generate_bridge_reject_obsolete_headers_and_messages! {
}

/// The SignedExtension to the basic transaction logic.
#[cfg(all(feature = "std", feature = "metadata-hash"))]
pub type TxExtension = (
frame_system::CheckNonZeroSender<Runtime>,
frame_system::CheckSpecVersion<Runtime>,
frame_system::CheckTxVersion<Runtime>,
frame_system::CheckGenesis<Runtime>,
frame_system::CheckEra<Runtime>,
frame_system::CheckNonce<Runtime>,
frame_system::CheckWeight<Runtime>,
ValidateSigned,
BridgeRejectObsoleteHeadersAndMessages,
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
);

#[cfg(not(all(feature = "std", feature = "metadata-hash")))]
pub type TxExtension = (
frame_system::CheckNonZeroSender<Runtime>,
frame_system::CheckSpecVersion<Runtime>,
Expand Down
8 changes: 4 additions & 4 deletions runtimes/bulletin-polkadot/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ fn construct_extrinsic(
frame_system::CheckEra::<Runtime>::from(Era::immortal()),
frame_system::CheckNonce::<Runtime>::from(
frame_system::Pallet::<Runtime>::account(&account_id).nonce,
)
.into(),
),
frame_system::CheckWeight::<Runtime>::new(),
runtime::ValidateSigned,
runtime::BridgeRejectObsoleteHeadersAndMessages,
)
.into();
#[cfg(all(feature = "std", feature = "metadata-hash"))]
frame_metadata_hash_extension::CheckMetadataHash::<Runtime>::new(true),
);
let payload = SignedPayload::new(call.clone(), tx_ext.clone())?;
let signature = payload.using_encoded(|e| sender.sign(e));
Ok(UncheckedExtrinsic::new_signed(
Expand Down