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

Implement CheckMetadataHash extension #4274

Merged
merged 80 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from 66 commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
e8330ea
Implement first version of metadata hashing
bkchr Nov 10, 2023
cab41ce
Temporary fix to make westend work
bkchr Nov 12, 2023
4db047f
Fix node build
bkchr Nov 13, 2023
938e72e
Merge remote-tracking branch 'origin/master' into bkchr-metadata-hash
bkchr Mar 11, 2024
809d466
Start moving to merkleized-metadata
bkchr Mar 11, 2024
d7d4325
Some fixes
bkchr Mar 18, 2024
7bf1e42
Merge remote-tracking branch 'origin/master' into bkchr-metadata-hash
bkchr Mar 19, 2024
85dda5a
Make it compile
bkchr Mar 19, 2024
ad099b0
Merge remote-tracking branch 'origin/master' into bkchr-metadata-hash
bkchr Apr 4, 2024
8631d3d
Updates Cargo.lock
bkchr Apr 4, 2024
642ccc3
Merge remote-tracking branch 'origin/master' into bkchr-metadata-hash
bkchr Apr 8, 2024
724f857
Move to its own crate to speed-up compilation
bkchr Apr 8, 2024
e22bdd2
Start switching to sc-executor
bkchr Apr 11, 2024
c93a095
Make it work using `sc-executor`
bkchr Apr 14, 2024
59d24cf
Work on some docs and improvements
bkchr Apr 15, 2024
26d61f3
Merge remote-tracking branch 'origin/master' into bkchr-metadata-hash
bkchr Apr 15, 2024
6880543
Merge remote-tracking branch 'origin/master' into bkchr-metadata-hash
bkchr Apr 15, 2024
3b4d9e9
Fix according to the RFC
bkchr Apr 15, 2024
590d8f6
Docs
bkchr Apr 16, 2024
13300f4
.
bkchr Apr 16, 2024
0180a3e
wasm-builder: Make it easier to build a WASM binary
bkchr Apr 17, 2024
93b326b
PRDOC
bkchr Apr 17, 2024
2b9ca6c
proper array
bkchr Apr 17, 2024
2d4fe6d
Merge remote-tracking branch 'origin/bkchr-wasm-builder-simplify' int…
bkchr Apr 17, 2024
b80a425
More docs and tests
bkchr Apr 17, 2024
b57ab6a
Cleanup and docs
bkchr Apr 17, 2024
1ebabdb
Put more behind the feature
bkchr Apr 18, 2024
63757a1
Fixes
bkchr Apr 24, 2024
e823ddf
Extract ss58prefix instead of passing it
bkchr Apr 24, 2024
2baaa68
Improve docs
bkchr Apr 24, 2024
d305bfc
More docs
bkchr Apr 24, 2024
f057b57
Integrate it into more runtimes
bkchr Apr 24, 2024
ce0479e
Add CI check
bkchr Apr 24, 2024
64da707
Merge remote-tracking branch 'origin/master' into bkchr-metadata-hash
bkchr Apr 24, 2024
9043a6e
Merge remote-tracking branch 'origin/master' into bkchr-metadata-hash
bkchr Apr 24, 2024
9a840a5
Fix compilation
bkchr Apr 24, 2024
8568537
FMT
bkchr Apr 24, 2024
26304de
Fix errors
bkchr Apr 25, 2024
1518e38
Fix toml formatting
bkchr Apr 25, 2024
dd41f61
Fix build.rs scripts
bkchr Apr 29, 2024
78e3629
Fixes
bkchr Apr 29, 2024
7de8149
Update substrate/frame/metadata-hash-extension/Cargo.toml
bkchr May 10, 2024
9beb315
Merge remote-tracking branch 'origin/master' into bkchr-metadata-hash
bkchr May 10, 2024
95943e3
Update the Cargo.toml
bkchr May 10, 2024
3724ce5
Use enum for `mode`
bkchr May 10, 2024
aa09447
Work on a test
bkchr May 13, 2024
8d55e5b
Extend test and add some more comments
bkchr May 13, 2024
6d27949
Start working on a guide
bkchr May 14, 2024
488f08d
Finish the guide
bkchr May 14, 2024
43a0fc2
Merge remote-tracking branch 'origin/master' into bkchr-metadata-hash
bkchr May 14, 2024
d158415
Fix test
bkchr May 14, 2024
ceb9ddf
Fix compile errors
bkchr May 14, 2024
840ad78
Update docs/sdk/src/guides/enable_metadata_hash.rs
bkchr May 15, 2024
cf5d049
Fix test
bkchr May 15, 2024
6b576ee
Add some warning
bkchr May 15, 2024
8a1d79c
Merge branch 'master' into bkchr-metadata-hash
liamaharon May 15, 2024
91f9cd8
Fix building rococo
bkchr May 15, 2024
92223ec
Merge remote-tracking branch 'origin/master' into bkchr-metadata-hash
bkchr May 15, 2024
2329eb4
Merge branch 'bkchr-metadata-hash' of github.com:paritytech/polkadot-…
bkchr May 15, 2024
bcb1ad9
Format toml files
bkchr May 15, 2024
1097a4d
Bring back old naming
bkchr May 15, 2024
deeb6b4
Get a better error message
bkchr May 16, 2024
a6dee16
Some more debugging
bkchr May 16, 2024
cdfc8c3
Fetch metadata from on chain
bkchr May 16, 2024
dca0a78
Pass the correct Cargo.toml file
bkchr May 16, 2024
d8200c9
Bump the transaction versions
bkchr May 16, 2024
1a3ef07
Update docs/sdk/src/guides/enable_metadata_hash.rs
bkchr May 17, 2024
b2724bd
Update docs/sdk/src/guides/enable_metadata_hash.rs
bkchr May 17, 2024
f81033b
Remove `EncodeNoneToEmpty`
bkchr May 17, 2024
a180178
Remove unneeded test
bkchr May 17, 2024
6713988
Add `CheckMetadataHash` to the `kitchensink-runtime`
bkchr May 17, 2024
822a363
Use workspace homepage
bkchr May 17, 2024
73d3981
PRDOC
bkchr May 17, 2024
352f8d5
Use crates.io release
bkchr May 21, 2024
7bbab81
Skip wasm build for check semver
bkchr May 21, 2024
600fc4f
Merge branch 'master' into bkchr-metadata-hash
bkchr May 22, 2024
2628f12
Fix tests
bkchr May 22, 2024
eb4d9e0
Mention all crates
bkchr May 22, 2024
d13d9aa
Fix the benchmarks
bkchr May 22, 2024
0a2f399
Make it major
bkchr May 22, 2024
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
11 changes: 11 additions & 0 deletions .gitlab/pipeline/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,17 @@ check-tracing:
- time cargo test --locked --manifest-path ./substrate/primitives/tracing/Cargo.toml --no-default-features
- time cargo test --locked --manifest-path ./substrate/primitives/tracing/Cargo.toml --no-default-features --features=with-tracing

# Check that `westend-runtime` compiles with the `metadata-hash` feature enabled.
check-metadata-hash:
stage: test
extends:
- .docker-env
- .common-refs
- .run-immediately
- .pipeline-stopper-artifacts
script:
- time cargo build --locked -p westend-runtime --features metadata-hash

# more information about this job can be found here:
# https://github.com/paritytech/substrate/pull/3778
test-full-crypto-feature:
Expand Down
81 changes: 81 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ members = [
"substrate/frame/membership",
"substrate/frame/merkle-mountain-range",
"substrate/frame/message-queue",
"substrate/frame/metadata-hash-extension",
"substrate/frame/migrations",
"substrate/frame/mixnet",
"substrate/frame/multisig",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ assert_matches = "1.5.0"
sp-runtime = { path = "../../../../../../../substrate/primitives/runtime", default-features = false }
sp-keyring = { path = "../../../../../../../substrate/primitives/keyring", default-features = false }
sp-core = { path = "../../../../../../../substrate/primitives/core", default-features = false }
frame-metadata-hash-extension = { path = "../../../../../../../substrate/frame/metadata-hash-extension" }
frame-support = { path = "../../../../../../../substrate/frame/support", default-features = false }
frame-system = { path = "../../../../../../../substrate/frame/system", default-features = false }
pallet-balances = { path = "../../../../../../../substrate/frame/balances", default-features = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ fn construct_extrinsic_westend(
),
frame_system::CheckWeight::<Runtime>::new(),
pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip),
frame_metadata_hash_extension::CheckMetadataHash::<Runtime>::new(false),
);
let raw_payload = westend_runtime::SignedPayload::new(call, extra).unwrap();
let signature = raw_payload.using_encoded(|payload| sender.sign(payload));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ scale-info = { version = "2.11.1", default-features = false, features = ["derive
# Substrate
frame-benchmarking = { path = "../../../../../substrate/frame/benchmarking", default-features = false, optional = true }
frame-executive = { path = "../../../../../substrate/frame/executive", default-features = false }
frame-metadata-hash-extension = { path = "../../../../../substrate/frame/metadata-hash-extension", default-features = false }
frame-support = { path = "../../../../../substrate/frame/support", default-features = false }
frame-system = { path = "../../../../../substrate/frame/system", default-features = false }
frame-system-benchmarking = { path = "../../../../../substrate/frame/system/benchmarking", default-features = false, optional = true }
Expand Down Expand Up @@ -189,6 +190,7 @@ std = [
"cumulus-primitives-utility/std",
"frame-benchmarking?/std",
"frame-executive/std",
"frame-metadata-hash-extension/std",
"frame-support/std",
"frame-system-benchmarking?/std",
"frame-system-rpc-runtime-api/std",
Expand Down Expand Up @@ -248,7 +250,10 @@ std = [
"xcm/std",
]

# Enable the metadata hash generation in the wasm builder.
metadata-hash = ["substrate-wasm-builder/metadata-hash"]

# A feature that should be enabled when the runtime should be built for on-chain
# deployment. This will disable stuff that shouldn't be part of the on-chain wasm
# to make it smaller, like logging for example.
on-chain-release-build = ["sp-api/disable-logging"]
on-chain-release-build = ["metadata-hash", "sp-api/disable-logging"]
9 changes: 8 additions & 1 deletion cumulus/parachains/runtimes/assets/asset-hub-rococo/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#[cfg(feature = "std")]
#[cfg(all(not(feature = "metadata-hash"), feature = "std"))]
fn main() {
substrate_wasm_builder::WasmBuilder::build_using_defaults();
}

#[cfg(all(feature = "metadata-hash", feature = "std"))]
fn main() {
substrate_wasm_builder::WasmBuilder::init_with_defaults()
.enable_metadata_hash("ROC", 12)
.build();
}

#[cfg(not(feature = "std"))]
fn main() {}
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_version: 1_011_000,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 15,
transaction_version: 16,
state_version: 1,
};

Expand Down Expand Up @@ -970,6 +970,7 @@ pub type SignedExtra = (
frame_system::CheckWeight<Runtime>,
pallet_asset_conversion_tx_payment::ChargeAssetTxPayment<Runtime>,
cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim<Runtime>,
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
);
/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ scale-info = { version = "2.11.1", default-features = false, features = ["derive
# Substrate
frame-benchmarking = { path = "../../../../../substrate/frame/benchmarking", default-features = false, optional = true }
frame-executive = { path = "../../../../../substrate/frame/executive", default-features = false }
frame-metadata-hash-extension = { path = "../../../../../substrate/frame/metadata-hash-extension", default-features = false }
frame-support = { path = "../../../../../substrate/frame/support", default-features = false }
frame-system = { path = "../../../../../substrate/frame/system", default-features = false }
frame-system-benchmarking = { path = "../../../../../substrate/frame/system/benchmarking", default-features = false, optional = true }
Expand Down Expand Up @@ -189,6 +190,7 @@ std = [
"cumulus-primitives-utility/std",
"frame-benchmarking?/std",
"frame-executive/std",
"frame-metadata-hash-extension/std",
"frame-support/std",
"frame-system-benchmarking?/std",
"frame-system-rpc-runtime-api/std",
Expand Down Expand Up @@ -247,7 +249,10 @@ std = [
"xcm/std",
]

# Enable the metadata hash generation in the wasm builder.
metadata-hash = ["substrate-wasm-builder/metadata-hash"]

# A feature that should be enabled when the runtime should be built for on-chain
# deployment. This will disable stuff that shouldn't be part of the on-chain wasm
# to make it smaller, like logging for example.
on-chain-release-build = ["sp-api/disable-logging"]
on-chain-release-build = ["metadata-hash", "sp-api/disable-logging"]
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#[cfg(feature = "std")]
#[cfg(all(not(feature = "metadata-hash"), feature = "std"))]
fn main() {
substrate_wasm_builder::WasmBuilder::build_using_defaults();
}

#[cfg(all(feature = "metadata-hash", feature = "std"))]
fn main() {
substrate_wasm_builder::WasmBuilder::init_with_defaults()
.enable_metadata_hash("WND", 12)
.build();
}

#[cfg(not(feature = "std"))]
fn main() {}
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_version: 1_011_000,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 15,
transaction_version: 16,
state_version: 1,
};

Expand Down Expand Up @@ -965,6 +965,7 @@ pub type SignedExtra = (
frame_system::CheckWeight<Runtime>,
pallet_asset_conversion_tx_payment::ChargeAssetTxPayment<Runtime>,
cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim<Runtime>,
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
);
/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic =
Expand Down
1 change: 1 addition & 0 deletions docs/sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ frame-system = { path = "../../substrate/frame/system", default-features = false
frame-support = { path = "../../substrate/frame/support", default-features = false }
frame-executive = { path = "../../substrate/frame/executive", default-features = false }
pallet-example-single-block-migrations = { path = "../../substrate/frame/examples/single-block-migrations" }
frame-metadata-hash-extension = { path = "../../substrate/frame/metadata-hash-extension" }

# Substrate Client
sc-network = { path = "../../substrate/client/network" }
Expand Down
Loading
Loading