Skip to content

Commit

Permalink
P-949 Enable metadata hash for runtime (#3280)
Browse files Browse the repository at this point in the history
* enable metadata hash

* Make hash enabled by default

* update cargo lock

* bump transaction_version
  • Loading branch information
Kailai-Wang authored Mar 6, 2025
1 parent 394fe38 commit fd4a346
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 24 deletions.
57 changes: 56 additions & 1 deletion parachain/Cargo.lock

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

3 changes: 2 additions & 1 deletion parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ frame-executive = { git = "https://github.com/paritytech/polkadot-sdk", branch =
frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407", default-features = false }
frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407", default-features = false }
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407", default-features = false }
frame-metadata-hash-extension = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407", default-features = false }
frame-try-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407", default-features = false }
pallet-assets = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407", default-features = false }
pallet-aura = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407", default-features = false }
Expand Down Expand Up @@ -266,7 +267,7 @@ frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branc
frame-system-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407", default-features = false }
frame-benchmarking-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407" }
cumulus-pallet-session-benchmarking = { git = 'https://github.com/paritytech/polkadot-sdk', branch = "stable2407", default-features = false }
substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407" }
substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407", features = ["metadata-hash"] }

# local
core-primitives = { path = "../common/primitives/core", default-features = false }
Expand Down
3 changes: 2 additions & 1 deletion parachain/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ homepage = 'https://litentry.com/'
license = 'GPL-3.0'
name = 'litentry-collator'
repository = 'https://github.com/litentry/litentry-parachain'
version = '0.9.23'
version = '0.9.24'

[[bin]]
name = 'litentry-collator'
Expand Down Expand Up @@ -104,6 +104,7 @@ xcm = { workspace = true }

frame-benchmarking = { workspace = true }
frame-benchmarking-cli = { workspace = true }
frame-metadata-hash-extension = { workspace = true }
frame-system-rpc-runtime-api = { workspace = true }
frame-try-runtime = { workspace = true, optional = true }

Expand Down
5 changes: 4 additions & 1 deletion parachain/runtime/litentry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ sp-transaction-pool = { workspace = true }
sp-version = { workspace = true }

frame-executive = { workspace = true }
frame-metadata-hash-extension = { workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
frame-system-rpc-runtime-api = { workspace = true }
Expand Down Expand Up @@ -133,7 +134,7 @@ xcm-simulator = { workspace = true }
pallet-message-queue = { workspace = true, features = ["std"] }

[build-dependencies]
substrate-wasm-builder = { workspace = true }
substrate-wasm-builder = { workspace = true, optional = true }

[features]
default = ["std"]
Expand Down Expand Up @@ -216,6 +217,7 @@ std = [
"frame-support/std",
"frame-system-benchmarking?/std",
"frame-system-rpc-runtime-api/std",
"frame-metadata-hash-extension/std",
"frame-system/std",
"frame-try-runtime?/std",
"hex?/std",
Expand Down Expand Up @@ -303,6 +305,7 @@ std = [
"sp-std/std",
"sp-transaction-pool/std",
"sp-version/std",
"substrate-wasm-builder",
"xcm-builder/std",
"xcm-executor/std",
"xcm/std",
Expand Down
11 changes: 7 additions & 4 deletions parachain/runtime/litentry/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Litentry. If not, see <https://www.gnu.org/licenses/>.

use substrate_wasm_builder::WasmBuilder;

#[cfg(feature = "std")]
fn main() {
WasmBuilder::new()
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
.build()
.enable_metadata_hash("HEI", 18)
.build();
}

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

/// Unchecked extrinsic type as expected by this runtime.
Expand Down Expand Up @@ -230,10 +231,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
impl_name: create_runtime_str!("heima"),
authoring_version: 1,
// same versioning-mechanism as polkadot: use last digit for minor updates
spec_version: 9233,
spec_version: 9240,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
transaction_version: 2,
// https://hackmd.io/JagpUd8tTjuKf9HQtpvHIQ
// The trie is an abstraction that sits between the Runtime (and its Overlays) and the actual database, providing an important abstraction to the blockchain, namely storage proofs and state roots.
// The trie format has changed since this pull request(#9732) in substrate. The main new difference is, that nodes that contain values larger than 256 bits will not storage the value itself, but rather store the hash of that value. The value itself, is consequently stored in the node that lives in the path traversed by this new hash.
Expand Down
5 changes: 4 additions & 1 deletion parachain/runtime/paseo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ sp-transaction-pool = { workspace = true }
sp-version = { workspace = true }

frame-executive = { workspace = true }
frame-metadata-hash-extension = { workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
frame-system-rpc-runtime-api = { workspace = true }
Expand Down Expand Up @@ -150,7 +151,7 @@ xcm-simulator = { workspace = true }
pallet-message-queue = { workspace = true, features = ["std"] }

[build-dependencies]
substrate-wasm-builder = { workspace = true }
substrate-wasm-builder = { workspace = true, optional = true }

[features]
default = ["std"]
Expand Down Expand Up @@ -246,6 +247,7 @@ std = [
"frame-support/std",
"frame-system-benchmarking?/std",
"frame-system-rpc-runtime-api/std",
"frame-metadata-hash-extension/std",
"frame-system/std",
"frame-try-runtime?/std",
"log/std",
Expand Down Expand Up @@ -336,6 +338,7 @@ std = [
"sp-std/std",
"sp-transaction-pool/std",
"sp-version/std",
"substrate-wasm-builder",
"xcm-builder/std",
"xcm-executor/std",
"xcm/std",
Expand Down
1 change: 1 addition & 0 deletions parachain/runtime/paseo/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fn main() {
.with_current_project()
.export_heap_base()
.import_memory()
.enable_metadata_hash("HEI", 18)
.build();
}

Expand Down
5 changes: 3 additions & 2 deletions parachain/runtime/paseo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ pub type SignedExtra = (
frame_system::CheckNonce<Runtime>,
frame_system::CheckWeight<Runtime>,
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
);

/// Unchecked extrinsic type as expected by this runtime.
Expand Down Expand Up @@ -232,10 +233,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
impl_name: create_runtime_str!("heima"),
authoring_version: 1,
// same versioning-mechanism as polkadot: use last digit for minor updates
spec_version: 9233,
spec_version: 9240,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
transaction_version: 2,
// https://hackmd.io/JagpUd8tTjuKf9HQtpvHIQ
// The trie is an abstraction that sits between the Runtime (and its Overlays) and the actual database, providing an important abstraction to the blockchain, namely storage proofs and state roots.
// The trie format has changed since this pull request(#9732) in substrate. The main new difference is, that nodes that contain values larger than 256 bits will not storage the value itself, but rather store the hash of that value. The value itself, is consequently stored in the node that lives in the path traversed by this new hash.
Expand Down
10 changes: 5 additions & 5 deletions tee-worker/Cargo.lock

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

4 changes: 2 additions & 2 deletions tee-worker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ sha3 = { version = "0.10", default-features = false }
built = { version = "0.6.1", default-features = false }

url = { git = "https://github.com/domenukk/rust-url", rev = "316c868", default-features = false, features = ["alloc", "no_std_net"] }
substrate-api-client = { git = "https://github.com/Kailai-Wang/substrate-api-client", branch = "polkadot-v0.9.42-litentry", default-features = false, features = ["sync-api"] }
substrate-client-keystore = { git = "https://github.com/Kailai-Wang/substrate-api-client", branch = "polkadot-v0.9.42-litentry" }
substrate-api-client = { git = "https://github.com/encointer/substrate-api-client", branch = "v0.9.42-tag-v0.14.0-retracted-check-metadata-hash", default-features = false, features = ["sync-api"] }
substrate-client-keystore = { git = "https://github.com/encointer/substrate-api-client", branch = "v0.9.42-tag-v0.14.0-retracted-check-metadata-hash" }

# substrate
finality-grandpa = { version = "0.16.0", default-features = false, features = ["derive-codec"] }
Expand Down
8 changes: 4 additions & 4 deletions tee-worker/identity/enclave-runtime/Cargo.lock

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

0 comments on commit fd4a346

Please sign in to comment.