Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for metadata hash verification. #494

Merged
merged 4 commits into from
Sep 25, 2024
Merged
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
26 changes: 26 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cargo +nightly test
To build the project, execute

```
cargo build --release
cargo build --release --features metadata-hash
```

A successful build will create a binary under `./target/release/pendulum-node`.
Expand Down
1 change: 1 addition & 0 deletions res/foucoco-paseo-genesis-wasm.txt

Large diffs are not rendered by default.

4,068 changes: 4,068 additions & 0 deletions res/foucoco-paseo-spec-raw.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions runtime/amplitude/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ reward-distribution = { git = "https://github.com/pendulum-chain/spacewalk", def
# Substrate
frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false, optional = true }
frame-executive = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
frame-metadata-hash-extension = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
frame-system-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false, optional = true }
Expand Down Expand Up @@ -169,6 +170,7 @@ std = [
"dia-oracle-runtime-api/std",
"frame-benchmarking/std",
"frame-executive/std",
"frame-metadata-hash-extension/std",
"frame-support/std",
"frame-system-rpc-runtime-api/std",
"frame-system/std",
Expand Down Expand Up @@ -348,3 +350,5 @@ try-runtime = [
"bifrost-farming/try-runtime",
"zenlink-protocol/try-runtime",
]

metadata-hash = ["substrate-wasm-builder/metadata-hash"]
13 changes: 13 additions & 0 deletions runtime/amplitude/build.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
use substrate_wasm_builder::WasmBuilder;

#[cfg(all(feature = "std", not(feature = "metadata-hash")))]
fn main() {
WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
.build()
}
#[cfg(all(feature = "std", feature = "metadata-hash"))]
fn main() {
WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
.enable_metadata_hash("AMPE", 12)
.build();
}

#[cfg(not(feature = "std"))]
fn main() {}
2 changes: 2 additions & 0 deletions runtime/amplitude/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ pub type SignedExtra = (
frame_system::CheckWeight<Runtime>,
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
treasury_buyout_extension::CheckBuyout<Runtime>,
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
);

type EventRecord = frame_system::EventRecord<
Expand Down Expand Up @@ -1111,6 +1112,7 @@ where
frame_system::CheckWeight::<Runtime>::new(),
pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip),
treasury_buyout_extension::CheckBuyout::<Runtime>::new(),
frame_metadata_hash_extension::CheckMetadataHash::new(true),
);

let raw_payload = SignedPayload::new(call, extra).ok()?;
Expand Down
4 changes: 4 additions & 0 deletions runtime/foucoco/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ module-pallet-staking-rpc-runtime-api = { path = "../../pallets/parachain-stakin
# Substrate
frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, optional = true, branch = "release-polkadot-v1.1.0" }
frame-executive = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.1.0" }
frame-metadata-hash-extension = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
frame-support = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.1.0" }
frame-system = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.1.0" }
frame-system-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, optional = true, branch = "release-polkadot-v1.1.0" }
Expand Down Expand Up @@ -166,6 +167,7 @@ std = [
"dia-oracle/std",
'dia-oracle-runtime-api/std',
"frame-executive/std",
"frame-metadata-hash-extension/std",
"frame-support/std",
"frame-system-rpc-runtime-api/std",
"frame-system/std",
Expand Down Expand Up @@ -342,3 +344,5 @@ try-runtime = [
"bifrost-farming/try-runtime",
"zenlink-protocol/try-runtime",
]

metadata-hash = ["substrate-wasm-builder/metadata-hash"]
13 changes: 13 additions & 0 deletions runtime/foucoco/build.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
use substrate_wasm_builder::WasmBuilder;

#[cfg(all(feature = "std", not(feature = "metadata-hash")))]
fn main() {
WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
.build()
}
#[cfg(all(feature = "std", feature = "metadata-hash"))]
fn main() {
WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
.enable_metadata_hash("AMPE", 12)
.build();
}

#[cfg(not(feature = "std"))]
fn main() {}
2 changes: 2 additions & 0 deletions runtime/foucoco/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ pub type SignedExtra = (
frame_system::CheckWeight<Runtime>,
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
treasury_buyout_extension::CheckBuyout<Runtime>,
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
);

type EventRecord = frame_system::EventRecord<
Expand Down Expand Up @@ -1157,6 +1158,7 @@ where
frame_system::CheckWeight::<Runtime>::new(),
pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip),
treasury_buyout_extension::CheckBuyout::<Runtime>::new(),
frame_metadata_hash_extension::CheckMetadataHash::new(true),
);

let raw_payload = SignedPayload::new(call, extra).ok()?;
Expand Down
4 changes: 4 additions & 0 deletions runtime/pendulum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ reward-distribution = { git = "https://github.com/pendulum-chain/spacewalk", def
# Substrate
frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, optional = true, branch = "release-polkadot-v1.1.0" }
frame-executive = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.1.0" }
frame-metadata-hash-extension = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
frame-support = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.1.0" }
frame-system = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.1.0" }
frame-system-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, optional = true, branch = "release-polkadot-v1.1.0" }
Expand Down Expand Up @@ -166,6 +167,7 @@ std = [
"dia-oracle/std",
"dia-oracle-runtime-api/std",
"frame-executive/std",
"frame-metadata-hash-extension/std",
"frame-support/std",
"frame-system-rpc-runtime-api/std",
"frame-system/std",
Expand Down Expand Up @@ -340,3 +342,5 @@ try-runtime = [
"zenlink-protocol/try-runtime",
"treasury-buyout-extension/try-runtime",
]

metadata-hash = ["substrate-wasm-builder/metadata-hash"]
ebma marked this conversation as resolved.
Show resolved Hide resolved
13 changes: 13 additions & 0 deletions runtime/pendulum/build.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
use substrate_wasm_builder::WasmBuilder;

#[cfg(all(feature = "std", not(feature = "metadata-hash")))]
fn main() {
WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
.build()
}
#[cfg(all(feature = "std", feature = "metadata-hash"))]
fn main() {
WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
.enable_metadata_hash("PEN", 12)
.build();
}

#[cfg(not(feature = "std"))]
fn main() {}
2 changes: 2 additions & 0 deletions runtime/pendulum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ pub type SignedExtra = (
frame_system::CheckWeight<Runtime>,
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
treasury_buyout_extension::CheckBuyout<Runtime>,
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
);

type EventRecord = frame_system::EventRecord<
Expand Down Expand Up @@ -1134,6 +1135,7 @@ where
frame_system::CheckWeight::<Runtime>::new(),
pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip),
treasury_buyout_extension::CheckBuyout::<Runtime>::new(),
frame_metadata_hash_extension::CheckMetadataHash::new(true),
);

let raw_payload = SignedPayload::new(call, extra).ok()?;
Expand Down
Loading