diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 45a76ea5..f77c3673 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -72,7 +72,7 @@ jobs: id: srtool_build uses: chevdor/srtool-actions@v0.7.0 env: - BUILD_OPTS: "" + BUILD_OPTS: "--features on-chain-release-build" with: chain: ${{ github.event.inputs.chain }} runtime_dir: ./${{ github.event.inputs.chain }}/runtime diff --git a/tinkernet/Cargo.toml b/tinkernet/Cargo.toml index 74808f36..d6839fc0 100644 --- a/tinkernet/Cargo.toml +++ b/tinkernet/Cargo.toml @@ -76,6 +76,7 @@ orml-tokens2 = { package = "orml-tokens", git = "https://github.com/arrudagates/ # Substrate FRAME Dependencies frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.6.0", default-features = false } frame-executive = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.6.0", default-features = false } +frame-metadata-hash-extension = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.6.0", default-features = false} frame-support = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.6.0", default-features = false } frame-system = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.6.0", default-features = false } frame-system-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.6.0", default-features = false } diff --git a/tinkernet/runtime/Cargo.toml b/tinkernet/runtime/Cargo.toml index 3b81fb1e..31bfb7e5 100644 --- a/tinkernet/runtime/Cargo.toml +++ b/tinkernet/runtime/Cargo.toml @@ -53,6 +53,7 @@ orml-tokens2 = { workspace = true } # Substrate FRAME Dependencies frame-benchmarking = { workspace = true, optional = true } frame-executive = { workspace = true } +frame-metadata-hash-extension = { workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } frame-system-benchmarking = { workspace = true, optional = true } @@ -126,10 +127,14 @@ aura = [] default = ["std", "aura"] manual-seal = [] +metadata-hash = [ + "substrate-wasm-builder/metadata-hash", +] + # A feature that should be enabled when the runtime should be build 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 = ["sp-api/disable-logging", "metadata-hash"] # By default some types have documentation, `no-metadata-docs` allows to reduce the documentation # in the metadata. @@ -149,6 +154,7 @@ std = [ "cumulus-primitives-utility/std", "cumulus-pallet-dmp-queue/std", "frame-executive/std", + "frame-metadata-hash-extension/std", "frame-support/std", "frame-system-rpc-runtime-api/std", "frame-system/std", diff --git a/tinkernet/runtime/build.rs b/tinkernet/runtime/build.rs index e7e696b4..ce297c84 100644 --- a/tinkernet/runtime/build.rs +++ b/tinkernet/runtime/build.rs @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#[cfg(feature = "std")] +#[cfg(all(not(feature = "metadata-hash"), feature = "std"))] fn main() { substrate_wasm_builder::WasmBuilder::new() .with_current_project() @@ -25,6 +25,16 @@ fn main() { .build() } +#[cfg(all(feature = "metadata-hash", feature = "std"))] +fn main() { + substrate_wasm_builder::WasmBuilder::new() + .with_current_project() + .export_heap_base() + .import_memory() + .enable_metadata_hash("TNKR", 12) + .build() +} + /// The wasm builder is deactivated when compiling /// this crate for wasm to speed up the compilation. #[cfg(not(feature = "std"))] diff --git a/tinkernet/runtime/src/lib.rs b/tinkernet/runtime/src/lib.rs index ac4b0015..87520df1 100644 --- a/tinkernet/runtime/src/lib.rs +++ b/tinkernet/runtime/src/lib.rs @@ -157,6 +157,7 @@ pub type SignedExtra = ( frame_system::CheckNonce, frame_system::CheckWeight, pallet_asset_tx_payment::ChargeAssetTxPayment, + frame_metadata_hash_extension::CheckMetadataHash, ); /// Unchecked extrinsic type as expected by this runtime. @@ -213,7 +214,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("tinkernet_node"), impl_name: create_runtime_str!("tinkernet_node"), authoring_version: 1, - spec_version: 23, + spec_version: 24, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1,