Skip to content

Commit 1c50295

Browse files
camfairchildSamuel Daredistributedstatemachineconstsam0x17
authored
Feat/devnet companion/check metadata hash extension (#649)
* draft: hotkey swap for senate * feature-gate hash * use 1.10.0-rc2 * add feature * feat: remove schedule coldkey swap * chore: fix tests * fixes for network resumption * chore: bump spec * fix: add back arbitration check * fix: hotkey * fix: coldkey arb swap hotkey * swap delegate stake also * add test for this * swap over stakinghotkeys map * check map first * add staking hotkeys test * no take * keep old stake * add check to test * fix some tests * fix delegate test * update staking hotekys maps * init * comment out * add admin swap * fix swap * .. * hotkey staking maps fix * remove staking hotkeys * remove commented code * cargo fmt * cargo fix --workspace * bump spec_version to 165 * swap hotkey benchmark removed * add migration and tests for total coldkey hotfix * adds new test for missing hotkey value * bump migration values * fmt * lock file update * add production just target * fmt * clippy * benchmarking fix * feat: try runtime passing * chore: remove commented code * chore: make logs human readable * chore: remove comments * Update pallets/subtensor/src/lib.rs Co-authored-by: Sam Johnson <[email protected]> * fmt * use rc3 with new fix polkadot-sdk/pull/4117 * incl lock * bump CI --------- Co-authored-by: Samuel Dare <[email protected]> Co-authored-by: distributedstatemachine <[email protected]> Co-authored-by: const <[email protected]> Co-authored-by: Sam Johnson <[email protected]> Co-authored-by: Unconst <[email protected]>
1 parent ce3e87e commit 1c50295

File tree

9 files changed

+370
-280
lines changed

9 files changed

+370
-280
lines changed

Cargo.lock

Lines changed: 277 additions & 208 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 70 additions & 69 deletions
Large diffs are not rendered by default.

justfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,8 @@ lint:
4747
@echo "Running cargo clippy with automatic fixes on potentially dirty code..."
4848
just clippy-fix
4949
@echo "Running cargo clippy..."
50-
just clippy
50+
just clippy
51+
52+
production:
53+
@echo "Running cargo build with metadata-hash generation..."
54+
cargo +{{RUSTV}} build --profile production --features="runtime-benchmarks metadata-hash"

node/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ sp-io = { workspace = true }
5454
sp-timestamp = { workspace = true }
5555
sp-inherents = { workspace = true }
5656
sp-keyring = { workspace = true }
57+
frame-metadata-hash-extension = { workspace = true }
5758
frame-system = { workspace = true }
5859
pallet-transaction-payment = { workspace = true }
5960
pallet-commitments = { path = "../pallets/commitments" }

node/src/benchmarking.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ pub fn create_benchmark_extrinsic(
136136
pallet_transaction_payment::ChargeTransactionPayment::<runtime::Runtime>::from(0),
137137
pallet_subtensor::SubtensorSignedExtension::<runtime::Runtime>::new(),
138138
pallet_commitments::CommitmentsSignedExtension::<runtime::Runtime>::new(),
139+
frame_metadata_hash_extension::CheckMetadataHash::<runtime::Runtime>::new(true),
139140
);
140141

141142
let raw_payload = runtime::SignedPayload::from_raw(
@@ -152,6 +153,7 @@ pub fn create_benchmark_extrinsic(
152153
(),
153154
(),
154155
(),
156+
None,
155157
),
156158
);
157159
let signature = raw_payload.using_encoded(|e| sender.sign(e));

runtime/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ pallet-timestamp = { workspace = true }
4141
pallet-transaction-payment = { workspace = true }
4242
pallet-utility = { workspace = true }
4343
frame-executive = { workspace = true }
44+
frame-metadata-hash-extension = { workspace = true }
4445
sp-api = { workspace = true }
4546
sp-block-builder = { workspace = true }
4647
sp-consensus-aura = { workspace = true }
@@ -111,6 +112,7 @@ std = [
111112
"codec/std",
112113
"scale-info/std",
113114
"frame-executive/std",
115+
"frame-metadata-hash-extension/std",
114116
"frame-support/std",
115117
"frame-system-rpc-runtime-api/std",
116118
"frame-system/std",
@@ -204,3 +206,4 @@ try-runtime = [
204206
"pallet-commitments/try-runtime",
205207
"pallet-registry/try-runtime"
206208
]
209+
metadata-hash = ["substrate-wasm-builder/metadata-hash"]

runtime/build.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
fn main() {
2-
#[cfg(feature = "std")]
2+
#[cfg(all(feature = "std", not(feature = "metadata-hash")))]
33
{
44
substrate_wasm_builder::WasmBuilder::new()
55
.with_current_project()
66
.export_heap_base()
77
.import_memory()
88
.build();
99
}
10+
#[cfg(all(feature = "std", feature = "metadata-hash"))]
11+
{
12+
substrate_wasm_builder::WasmBuilder::new()
13+
.with_current_project()
14+
.export_heap_base()
15+
.import_memory()
16+
.enable_metadata_hash("TAO", 9)
17+
.build();
18+
}
1019
}

runtime/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,6 +1282,7 @@ pub type SignedExtra = (
12821282
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
12831283
pallet_subtensor::SubtensorSignedExtension<Runtime>,
12841284
pallet_commitments::CommitmentsSignedExtension<Runtime>,
1285+
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
12851286
);
12861287

12871288
type Migrations = pallet_grandpa::migrations::MigrateV4ToV5<Runtime>;

scripts/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
cargo build --profile production --features runtime-benchmarks
1+
cargo build --profile production --features "runtime-benchmarks metadata-hash"
22

0 commit comments

Comments
 (0)