diff --git a/.github/workflows/task-rust-tests.yml b/.github/workflows/task-rust-tests.yml index 3fd4e57c..ba95772e 100644 --- a/.github/workflows/task-rust-tests.yml +++ b/.github/workflows/task-rust-tests.yml @@ -33,6 +33,14 @@ jobs: - uses: ./.github/workflows/actions/setup-env with: cache-key: "TEST" + - name: Free up disk space + # Remove some pre-installed tooling that we don't use to free space + run: | + echo "Disk space before cleanup:" + df -h / + sudo rm -rf /usr/share/dotnet /opt/ghc /opt/hostedtoolcache/CodeQL + echo "Disk space after cleanup:" + df -h / - name: Install nextest uses: taiki-e/install-action@nextest - name: Build and archive tests diff --git a/operator/Cargo.lock b/operator/Cargo.lock index 28aae80d..bc2336c4 100644 --- a/operator/Cargo.lock +++ b/operator/Cargo.lock @@ -916,7 +916,7 @@ dependencies = [ [[package]] name = "binary-merkle-tree" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "hash-db", "log", @@ -1158,7 +1158,7 @@ dependencies = [ [[package]] name = "bp-header-chain" version = "0.19.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "bp-runtime", "finality-grandpa", @@ -1175,7 +1175,7 @@ dependencies = [ [[package]] name = "bp-messages" version = "0.19.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "bp-header-chain", "bp-runtime", @@ -1191,7 +1191,7 @@ dependencies = [ [[package]] name = "bp-parachains" version = "0.19.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "bp-header-chain", "bp-polkadot-core", @@ -1208,7 +1208,7 @@ dependencies = [ [[package]] name = "bp-polkadot-core" version = "0.19.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "bp-messages", "bp-runtime", @@ -1225,7 +1225,7 @@ dependencies = [ [[package]] name = "bp-relayers" version = "0.19.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "bp-header-chain", "bp-messages", @@ -1243,7 +1243,7 @@ dependencies = [ [[package]] name = "bp-runtime" version = "0.19.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-support", "frame-system", @@ -1266,14 +1266,14 @@ dependencies = [ [[package]] name = "bridge-hub-common" version = "0.12.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "cumulus-primitives-core", "frame-support", "pallet-message-queue", "parity-scale-codec", "scale-info", - "snowbridge-core 0.12.1", + "snowbridge-core 0.12.2", "sp-core", "sp-runtime", "sp-std", @@ -2030,7 +2030,7 @@ dependencies = [ [[package]] name = "cumulus-client-parachain-inherent" version = "0.15.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2052,7 +2052,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.17.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -2068,7 +2068,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.17.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2082,7 +2082,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-proof-size-hostfunction" version = "0.11.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "sp-externalities", "sp-runtime-interface", @@ -2092,7 +2092,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.21.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2111,7 +2111,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.17.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -2317,80 +2317,7 @@ dependencies = [ ] [[package]] -name = "datahaven-node" -version = "0.1.0" -dependencies = [ - "clap", - "datahaven-runtime", - "fc-api", - "fc-cli", - "fc-consensus", - "fc-db", - "fc-mapping-sync", - "fc-rpc", - "fc-rpc-core", - "fc-storage", - "flume 0.10.14", - "fp-account", - "fp-evm", - "fp-rpc", - "frame-benchmarking-cli", - "frame-metadata-hash-extension", - "frame-system", - "frame-system-rpc-runtime-api", - "futures", - "hex-literal 0.3.4", - "jsonrpsee 0.24.9", - "log", - "mmr-rpc", - "pallet-ethereum", - "pallet-im-online", - "pallet-transaction-payment", - "pallet-transaction-payment-rpc", - "pallet-transaction-payment-rpc-runtime-api", - "parity-scale-codec", - "sc-basic-authorship", - "sc-cli", - "sc-client-api", - "sc-consensus", - "sc-consensus-babe", - "sc-consensus-beefy", - "sc-consensus-beefy-rpc", - "sc-consensus-grandpa", - "sc-consensus-manual-seal", - "sc-executor", - "sc-network", - "sc-network-sync", - "sc-offchain", - "sc-rpc", - "sc-service", - "sc-telemetry", - "sc-transaction-pool", - "sc-transaction-pool-api", - "serde_json", - "sp-api", - "sp-block-builder", - "sp-blockchain", - "sp-consensus-babe", - "sp-consensus-beefy", - "sp-consensus-grandpa", - "sp-core", - "sp-genesis-builder", - "sp-inherents", - "sp-io", - "sp-keyring", - "sp-offchain", - "sp-runtime", - "sp-session", - "sp-timestamp", - "sp-transaction-pool", - "substrate-build-script-utils", - "substrate-frame-rpc-system", - "url", -] - -[[package]] -name = "datahaven-runtime" +name = "datahaven-mainnet-runtime" version = "0.1.0" dependencies = [ "bridge-hub-common 0.13.1", @@ -2477,16 +2404,273 @@ dependencies = [ "substrate-wasm-builder", ] +[[package]] +name = "datahaven-node" +version = "0.1.0" +dependencies = [ + "clap", + "datahaven-mainnet-runtime", + "datahaven-runtime-common", + "datahaven-stagenet-runtime", + "datahaven-testnet-runtime", + "fc-api", + "fc-cli", + "fc-consensus", + "fc-db", + "fc-mapping-sync", + "fc-rpc", + "fc-rpc-core", + "fc-storage", + "flume 0.10.14", + "fp-account", + "fp-evm", + "fp-rpc", + "frame-benchmarking-cli", + "frame-metadata-hash-extension", + "frame-system", + "frame-system-rpc-runtime-api", + "futures", + "hex-literal 0.3.4", + "jsonrpsee 0.24.9", + "log", + "mmr-rpc", + "pallet-beefy-mmr", + "pallet-ethereum", + "pallet-im-online", + "pallet-mmr", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc", + "pallet-transaction-payment-rpc-runtime-api", + "parity-scale-codec", + "sc-basic-authorship", + "sc-cli", + "sc-client-api", + "sc-consensus", + "sc-consensus-babe", + "sc-consensus-beefy", + "sc-consensus-beefy-rpc", + "sc-consensus-grandpa", + "sc-consensus-manual-seal", + "sc-executor", + "sc-network", + "sc-network-sync", + "sc-offchain", + "sc-rpc", + "sc-service", + "sc-telemetry", + "sc-transaction-pool", + "sc-transaction-pool-api", + "serde_json", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-consensus-babe", + "sp-consensus-beefy", + "sp-consensus-grandpa", + "sp-core", + "sp-genesis-builder", + "sp-inherents", + "sp-io", + "sp-keyring", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-timestamp", + "sp-transaction-pool", + "substrate-build-script-utils", + "substrate-frame-rpc-system", + "url", +] + [[package]] name = "datahaven-runtime-common" version = "0.1.0" dependencies = [ + "fp-account", "frame-support", "polkadot-primitives", "polkadot-runtime-common", + "sp-core", + "sp-runtime", "staging-xcm", ] +[[package]] +name = "datahaven-stagenet-runtime" +version = "0.1.0" +dependencies = [ + "bridge-hub-common 0.13.1", + "datahaven-runtime-common", + "dhp-bridge", + "fp-account", + "fp-evm", + "fp-rpc", + "fp-self-contained", + "frame-benchmarking", + "frame-executive", + "frame-metadata-hash-extension", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "hex", + "hex-literal 0.3.4", + "pallet-authorship", + "pallet-babe", + "pallet-balances", + "pallet-beefy", + "pallet-beefy-mmr", + "pallet-ethereum", + "pallet-evm", + "pallet-evm-chain-id", + "pallet-grandpa", + "pallet-identity", + "pallet-im-online", + "pallet-message-queue", + "pallet-mmr", + "pallet-multisig", + "pallet-offences", + "pallet-outbound-commitment-store", + "pallet-parameters", + "pallet-preimage", + "pallet-scheduler", + "pallet-session", + "pallet-sudo", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-utility", + "pallet-validator-set", + "parity-scale-codec", + "polkadot-primitives", + "polkadot-runtime-common", + "scale-info", + "serde_json", + "snowbridge-beacon-primitives 0.2.0", + "snowbridge-core 0.2.0", + "snowbridge-inbound-queue-primitives", + "snowbridge-merkle-tree", + "snowbridge-outbound-queue-primitives", + "snowbridge-outbound-queue-v2-runtime-api", + "snowbridge-pallet-ethereum-client", + "snowbridge-pallet-inbound-queue-v2", + "snowbridge-pallet-outbound-queue-v2", + "snowbridge-pallet-system", + "snowbridge-pallet-system-v2", + "snowbridge-system-v2-runtime-api", + "snowbridge-verification-primitives", + "sp-api", + "sp-block-builder", + "sp-consensus-babe", + "sp-consensus-beefy", + "sp-consensus-grandpa", + "sp-core", + "sp-genesis-builder", + "sp-inherents", + "sp-keyring", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-staking", + "sp-std", + "sp-storage", + "sp-transaction-pool", + "sp-version", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "substrate-wasm-builder", +] + +[[package]] +name = "datahaven-testnet-runtime" +version = "0.1.0" +dependencies = [ + "bridge-hub-common 0.13.1", + "datahaven-runtime-common", + "dhp-bridge", + "fp-account", + "fp-evm", + "fp-rpc", + "fp-self-contained", + "frame-benchmarking", + "frame-executive", + "frame-metadata-hash-extension", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "hex", + "hex-literal 0.3.4", + "pallet-authorship", + "pallet-babe", + "pallet-balances", + "pallet-beefy", + "pallet-beefy-mmr", + "pallet-ethereum", + "pallet-evm", + "pallet-evm-chain-id", + "pallet-grandpa", + "pallet-identity", + "pallet-im-online", + "pallet-message-queue", + "pallet-mmr", + "pallet-multisig", + "pallet-offences", + "pallet-outbound-commitment-store", + "pallet-parameters", + "pallet-preimage", + "pallet-scheduler", + "pallet-session", + "pallet-sudo", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-utility", + "pallet-validator-set", + "parity-scale-codec", + "polkadot-primitives", + "polkadot-runtime-common", + "scale-info", + "serde_json", + "snowbridge-beacon-primitives 0.2.0", + "snowbridge-core 0.2.0", + "snowbridge-inbound-queue-primitives", + "snowbridge-merkle-tree", + "snowbridge-outbound-queue-primitives", + "snowbridge-outbound-queue-v2-runtime-api", + "snowbridge-pallet-ethereum-client", + "snowbridge-pallet-inbound-queue-v2", + "snowbridge-pallet-outbound-queue-v2", + "snowbridge-pallet-system", + "snowbridge-pallet-system-v2", + "snowbridge-system-v2-runtime-api", + "snowbridge-verification-primitives", + "sp-api", + "sp-block-builder", + "sp-consensus-babe", + "sp-consensus-beefy", + "sp-consensus-grandpa", + "sp-core", + "sp-genesis-builder", + "sp-inherents", + "sp-keyring", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-staking", + "sp-std", + "sp-storage", + "sp-transaction-pool", + "sp-version", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "substrate-wasm-builder", +] + [[package]] name = "der" version = "0.7.10" @@ -3577,7 +3761,7 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "fork-tree" version = "13.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "parity-scale-codec", ] @@ -3705,7 +3889,7 @@ checksum = "28dd6caf6059519a65843af8fe2a3ae298b14b80179855aeb4adc2c1934ee619" [[package]] name = "frame-benchmarking" version = "39.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-support", "frame-support-procedural", @@ -3729,7 +3913,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "46.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "Inflector", "array-bytes", @@ -3791,7 +3975,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "14.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "proc-macro-crate 3.3.0", "proc-macro2", @@ -3802,7 +3986,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "39.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -3818,7 +4002,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "39.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "aquamarine", "frame-support", @@ -3871,7 +4055,7 @@ dependencies = [ [[package]] name = "frame-metadata-hash-extension" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "array-bytes", "const-hex", @@ -3887,7 +4071,7 @@ dependencies = [ [[package]] name = "frame-support" version = "39.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "aquamarine", "array-bytes", @@ -3930,7 +4114,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "31.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "Inflector", "cfg-expr", @@ -3950,7 +4134,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "13.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate 3.3.0", @@ -3962,7 +4146,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "12.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "proc-macro2", "quote", @@ -3972,7 +4156,7 @@ dependencies = [ [[package]] name = "frame-system" version = "39.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "cfg-if", "docify", @@ -3992,7 +4176,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "39.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-benchmarking", "frame-support", @@ -4006,7 +4190,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "35.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "docify", "parity-scale-codec", @@ -4016,7 +4200,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.45.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-support", "parity-scale-codec", @@ -6600,7 +6784,7 @@ dependencies = [ [[package]] name = "mmr-rpc" version = "39.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "jsonrpsee 0.24.9", "parity-scale-codec", @@ -7245,7 +7429,7 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "pallet-asset-conversion" version = "21.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-benchmarking", "frame-support", @@ -7263,7 +7447,7 @@ dependencies = [ [[package]] name = "pallet-asset-rate" version = "18.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-benchmarking", "frame-support", @@ -7277,7 +7461,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "39.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-support", "frame-system", @@ -7292,7 +7476,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "39.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-support", "frame-system", @@ -7305,7 +7489,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "39.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-benchmarking", "frame-support", @@ -7328,7 +7512,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "40.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "docify", "frame-benchmarking", @@ -7343,7 +7527,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "40.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-support", "frame-system", @@ -7362,7 +7546,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "40.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "array-bytes", "binary-merkle-tree", @@ -7387,7 +7571,7 @@ dependencies = [ [[package]] name = "pallet-broker" version = "0.18.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "bitvec", "frame-benchmarking", @@ -7405,7 +7589,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "38.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7427,7 +7611,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "38.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7497,7 +7681,7 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "38.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "docify", "frame-benchmarking", @@ -7515,7 +7699,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "39.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-benchmarking", "frame-support", @@ -7537,7 +7721,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "39.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "enumflags2", "frame-benchmarking", @@ -7553,7 +7737,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "38.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-benchmarking", "frame-support", @@ -7572,7 +7756,7 @@ dependencies = [ [[package]] name = "pallet-message-queue" version = "42.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "environmental", "frame-benchmarking", @@ -7591,7 +7775,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "39.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-benchmarking", "frame-support", @@ -7607,8 +7791,8 @@ dependencies = [ [[package]] name = "pallet-multisig" -version = "39.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +version = "39.1.1" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "log", "parity-scale-codec", @@ -7619,7 +7803,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "38.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-support", "frame-system", @@ -7646,7 +7830,7 @@ dependencies = [ [[package]] name = "pallet-parameters" version = "0.10.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "docify", "frame-benchmarking", @@ -7663,7 +7847,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "39.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-benchmarking", "frame-support", @@ -7679,7 +7863,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "40.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "docify", "frame-benchmarking", @@ -7696,7 +7880,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "39.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-support", "frame-system", @@ -7717,7 +7901,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "39.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7739,7 +7923,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "22.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "log", "sp-arithmetic", @@ -7748,7 +7932,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "39.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "docify", "frame-benchmarking", @@ -7763,7 +7947,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "38.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "docify", "frame-benchmarking", @@ -7782,7 +7966,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "39.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-benchmarking", "frame-support", @@ -7798,7 +7982,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "42.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "jsonrpsee 0.24.9", "pallet-transaction-payment-rpc-runtime-api", @@ -7814,7 +7998,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "39.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -7826,7 +8010,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "38.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "docify", "frame-benchmarking", @@ -7845,7 +8029,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "39.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-benchmarking", "frame-support", @@ -7877,7 +8061,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "39.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-benchmarking", "frame-support", @@ -7891,7 +8075,7 @@ dependencies = [ [[package]] name = "pallet-xcm" version = "18.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "bounded-collections", "frame-benchmarking", @@ -8231,7 +8415,7 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "parity-scale-codec", "scale-info", @@ -8242,7 +8426,7 @@ dependencies = [ [[package]] name = "polkadot-node-metrics" version = "21.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "bs58", "futures", @@ -8261,7 +8445,7 @@ dependencies = [ [[package]] name = "polkadot-node-network-protocol" version = "21.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "async-channel 1.9.0", "async-trait", @@ -8286,7 +8470,7 @@ dependencies = [ [[package]] name = "polkadot-node-primitives" version = "17.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "bitvec", "bounded-vec", @@ -8312,7 +8496,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-types" version = "21.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "async-trait", "bitvec", @@ -8341,7 +8525,7 @@ dependencies = [ [[package]] name = "polkadot-overseer" version = "21.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "async-trait", "futures", @@ -8363,7 +8547,7 @@ dependencies = [ [[package]] name = "polkadot-parachain-primitives" version = "15.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "bounded-collections", "derive_more 0.99.20", @@ -8379,7 +8563,7 @@ dependencies = [ [[package]] name = "polkadot-primitives" version = "17.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "bitvec", "hex-literal 0.4.1", @@ -8407,7 +8591,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" version = "18.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "bitvec", "frame-benchmarking", @@ -8458,7 +8642,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-metrics" version = "18.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "bs58", "frame-benchmarking", @@ -8470,7 +8654,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-parachains" version = "18.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "bitflags 1.3.2", "bitvec", @@ -8519,7 +8703,7 @@ dependencies = [ [[package]] name = "polkadot-sdk-frame" version = "0.8.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "docify", "frame-benchmarking", @@ -8553,7 +8737,7 @@ dependencies = [ [[package]] name = "polkadot-statement-table" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -9922,7 +10106,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "30.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "log", "sp-core", @@ -9933,7 +10117,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.48.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "async-trait", "futures", @@ -9963,7 +10147,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.48.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "futures", "futures-timer", @@ -9985,7 +10169,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.43.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "parity-scale-codec", "sp-api", @@ -10000,7 +10184,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "41.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "array-bytes", "docify", @@ -10027,7 +10211,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "12.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "proc-macro-crate 3.3.0", "proc-macro2", @@ -10038,7 +10222,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.50.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "array-bytes", "chrono", @@ -10080,7 +10264,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "38.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "fnv", "futures", @@ -10107,7 +10291,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.45.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "hash-db", "kvdb", @@ -10133,7 +10317,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.47.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "async-trait", "futures", @@ -10157,7 +10341,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.48.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#823a912ab188db40f9b66ee1f8e011c0238dff55" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "async-trait", "futures", @@ -10186,7 +10370,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.48.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "async-trait", "fork-tree", @@ -10222,7 +10406,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "array-bytes", "async-channel 1.9.0", @@ -10258,7 +10442,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy-rpc" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "futures", "jsonrpsee 0.24.9", @@ -10278,7 +10462,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.47.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "fork-tree", "parity-scale-codec", @@ -10291,7 +10475,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa" version = "0.33.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "ahash", "array-bytes", @@ -10335,7 +10519,7 @@ dependencies = [ [[package]] name = "sc-consensus-manual-seal" version = "0.49.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#823a912ab188db40f9b66ee1f8e011c0238dff55" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "assert_matches", "async-trait", @@ -10370,7 +10554,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.47.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "async-trait", "futures", @@ -10393,7 +10577,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.41.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "parity-scale-codec", "parking_lot 0.12.3", @@ -10416,7 +10600,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.36.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "polkavm", "sc-allocator", @@ -10429,7 +10613,7 @@ dependencies = [ [[package]] name = "sc-executor-polkavm" version = "0.33.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "log", "polkavm", @@ -10440,7 +10624,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.36.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "anyhow", "cfg-if", @@ -10458,7 +10642,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.47.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "console", "futures", @@ -10475,7 +10659,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "34.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "array-bytes", "parking_lot 0.12.3", @@ -10489,7 +10673,7 @@ dependencies = [ [[package]] name = "sc-mixnet" version = "0.18.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "array-bytes", "arrayvec 0.7.6", @@ -10518,7 +10702,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.48.3" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "array-bytes", "async-channel 1.9.0", @@ -10569,7 +10753,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.47.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "async-trait", "bitflags 1.3.2", @@ -10587,7 +10771,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.48.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "ahash", "futures", @@ -10606,7 +10790,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.47.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "array-bytes", "async-channel 1.9.0", @@ -10627,7 +10811,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.47.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "array-bytes", "async-channel 1.9.0", @@ -10663,7 +10847,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.47.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "array-bytes", "futures", @@ -10682,7 +10866,7 @@ dependencies = [ [[package]] name = "sc-network-types" version = "0.15.2" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "bs58", "ed25519-dalek", @@ -10699,7 +10883,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "43.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "array-bytes", "bytes", @@ -10736,7 +10920,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.18.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -10745,7 +10929,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "43.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "futures", "jsonrpsee 0.24.9", @@ -10777,7 +10961,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.47.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "jsonrpsee 0.24.9", "parity-scale-codec", @@ -10797,7 +10981,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "20.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "dyn-clone", "forwarded-header-value", @@ -10821,7 +11005,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.48.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "array-bytes", "futures", @@ -10853,7 +11037,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.49.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "async-trait", "directories", @@ -10917,7 +11101,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.37.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "log", "parity-scale-codec", @@ -10928,7 +11112,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "41.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "derive_more 0.99.20", "futures", @@ -10949,7 +11133,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "chrono", "futures", @@ -10969,7 +11153,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "38.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "chrono", "console", @@ -10997,7 +11181,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "proc-macro-crate 3.3.0", "proc-macro2", @@ -11008,7 +11192,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "38.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "async-trait", "futures", @@ -11039,7 +11223,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "38.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "async-trait", "futures", @@ -11055,7 +11239,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "18.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "async-channel 1.9.0", "futures", @@ -11638,7 +11822,7 @@ checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" [[package]] name = "slot-range-helper" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "enumn", "parity-scale-codec", @@ -11818,7 +12002,7 @@ dependencies = [ [[package]] name = "snowbridge-beacon-primitives" version = "0.12.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "byte-slice-cast", "frame-support", @@ -11864,8 +12048,8 @@ dependencies = [ [[package]] name = "snowbridge-core" -version = "0.12.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +version = "0.12.2" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "ethabi-decode", "frame-support", @@ -11909,7 +12093,7 @@ dependencies = [ [[package]] name = "snowbridge-ethereum" version = "0.11.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "ethabi-decode", "ethbloom", @@ -11984,7 +12168,7 @@ dependencies = [ [[package]] name = "snowbridge-outbound-queue-merkle-tree" version = "0.10.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "parity-scale-codec", "scale-info", @@ -12120,7 +12304,7 @@ dependencies = [ [[package]] name = "snowbridge-pallet-outbound-queue" version = "0.12.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "bridge-hub-common 0.12.0", "ethabi-decode", @@ -12130,7 +12314,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "snowbridge-core 0.12.1", + "snowbridge-core 0.12.2", "snowbridge-outbound-queue-merkle-tree", "sp-arithmetic", "sp-core", @@ -12321,7 +12505,7 @@ dependencies = [ [[package]] name = "sp-api" version = "35.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "docify", "hash-db", @@ -12343,7 +12527,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "21.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "Inflector", "blake2 0.10.6", @@ -12357,7 +12541,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "39.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "parity-scale-codec", "scale-info", @@ -12369,7 +12553,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "docify", "integer-sqrt", @@ -12383,7 +12567,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "35.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "parity-scale-codec", "scale-info", @@ -12395,7 +12579,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "35.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "sp-api", "sp-inherents", @@ -12405,7 +12589,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "38.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "futures", "parity-scale-codec", @@ -12424,7 +12608,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.41.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "async-trait", "futures", @@ -12439,7 +12623,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.41.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "async-trait", "parity-scale-codec", @@ -12455,7 +12639,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.41.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "async-trait", "parity-scale-codec", @@ -12473,7 +12657,7 @@ dependencies = [ [[package]] name = "sp-consensus-beefy" version = "23.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "parity-scale-codec", "scale-info", @@ -12493,7 +12677,7 @@ dependencies = [ [[package]] name = "sp-consensus-grandpa" version = "22.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "finality-grandpa", "log", @@ -12510,7 +12694,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.41.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "parity-scale-codec", "scale-info", @@ -12521,7 +12705,7 @@ dependencies = [ [[package]] name = "sp-core" version = "35.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "array-bytes", "bitflags 1.3.2", @@ -12581,7 +12765,7 @@ dependencies = [ [[package]] name = "sp-crypto-hashing" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "blake2b_simd", "byteorder", @@ -12594,7 +12778,7 @@ dependencies = [ [[package]] name = "sp-crypto-hashing-proc-macro" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "quote", "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?branch=stable2412)", @@ -12604,7 +12788,7 @@ dependencies = [ [[package]] name = "sp-database" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "kvdb", "parking_lot 0.12.3", @@ -12613,7 +12797,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "proc-macro2", "quote", @@ -12623,7 +12807,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.30.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "environmental", "parity-scale-codec", @@ -12633,7 +12817,7 @@ dependencies = [ [[package]] name = "sp-genesis-builder" version = "0.16.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "parity-scale-codec", "scale-info", @@ -12645,7 +12829,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "35.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -12657,8 +12841,8 @@ dependencies = [ [[package]] name = "sp-io" -version = "39.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +version = "39.0.1" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "bytes", "docify", @@ -12684,7 +12868,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "40.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "sp-core", "sp-runtime", @@ -12694,7 +12878,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.41.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "parity-scale-codec", "parking_lot 0.12.3", @@ -12705,7 +12889,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "thiserror 1.0.69", "zstd 0.12.4", @@ -12714,7 +12898,7 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.8.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-metadata 18.0.0", "parity-scale-codec", @@ -12724,7 +12908,7 @@ dependencies = [ [[package]] name = "sp-mixnet" version = "0.13.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "parity-scale-codec", "scale-info", @@ -12735,7 +12919,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "35.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "log", "parity-scale-codec", @@ -12752,7 +12936,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "35.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "parity-scale-codec", "scale-info", @@ -12765,7 +12949,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "35.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "sp-api", "sp-core", @@ -12775,7 +12959,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "13.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "backtrace", "regex", @@ -12784,7 +12968,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "33.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "rustc-hash 1.1.0", "serde", @@ -12794,7 +12978,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "40.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "binary-merkle-tree", "docify", @@ -12823,7 +13007,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -12842,7 +13026,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "18.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "Inflector", "expander", @@ -12855,7 +13039,7 @@ dependencies = [ [[package]] name = "sp-session" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "parity-scale-codec", "scale-info", @@ -12869,7 +13053,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -12882,7 +13066,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.44.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "hash-db", "log", @@ -12902,7 +13086,7 @@ dependencies = [ [[package]] name = "sp-statement-store" version = "19.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "aes-gcm", "curve25519-dalek", @@ -12926,12 +13110,12 @@ dependencies = [ [[package]] name = "sp-std" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" [[package]] name = "sp-storage" version = "22.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "impl-serde 0.5.0", "parity-scale-codec", @@ -12943,7 +13127,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "35.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "async-trait", "parity-scale-codec", @@ -12955,7 +13139,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "17.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "parity-scale-codec", "tracing", @@ -12966,7 +13150,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "35.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "sp-api", "sp-runtime", @@ -12975,7 +13159,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "35.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "async-trait", "parity-scale-codec", @@ -12989,7 +13173,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "38.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "ahash", "hash-db", @@ -13011,7 +13195,7 @@ dependencies = [ [[package]] name = "sp-version" version = "38.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "impl-serde 0.5.0", "parity-scale-codec", @@ -13028,7 +13212,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "15.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "parity-scale-codec", "proc-macro-warning 1.84.1", @@ -13040,7 +13224,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "21.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -13052,7 +13236,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "31.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "bounded-collections", "parity-scale-codec", @@ -13264,7 +13448,7 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "staging-xcm" version = "15.0.3" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "array-bytes", "bounded-collections", @@ -13284,8 +13468,8 @@ dependencies = [ [[package]] name = "staging-xcm-builder" -version = "18.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +version = "18.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-support", "frame-system", @@ -13307,7 +13491,7 @@ dependencies = [ [[package]] name = "staging-xcm-executor" version = "18.0.2" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "environmental", "frame-benchmarking", @@ -13414,7 +13598,7 @@ dependencies = [ [[package]] name = "substrate-bip39" version = "0.6.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "hmac 0.12.1", "pbkdf2", @@ -13426,12 +13610,12 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" [[package]] name = "substrate-frame-rpc-system" version = "42.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "docify", "frame-system-rpc-runtime-api", @@ -13451,7 +13635,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.17.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "http-body-util", "hyper 1.6.0", @@ -13464,8 +13648,8 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" -version = "25.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +version = "25.0.1" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "array-bytes", "build-helper", @@ -14170,7 +14354,7 @@ dependencies = [ [[package]] name = "tracing-gum" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "coarsetime", "polkadot-primitives", @@ -14181,7 +14365,7 @@ dependencies = [ [[package]] name = "tracing-gum-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "expander", "proc-macro-crate 3.3.0", @@ -15506,7 +15690,7 @@ dependencies = [ [[package]] name = "xcm-procedural" version = "11.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "Inflector", "proc-macro2", @@ -15517,7 +15701,7 @@ dependencies = [ [[package]] name = "xcm-runtime-apis" version = "0.5.2" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#02fe4655b2426d9ed0573ba5eadd3c9bb2b2ee63" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2412#d77b878daef34cf840eb34657d48f644ed9ca197" dependencies = [ "frame-support", "parity-scale-codec", diff --git a/operator/Cargo.toml b/operator/Cargo.toml index cd915465..271b61cd 100644 --- a/operator/Cargo.toml +++ b/operator/Cargo.toml @@ -9,15 +9,9 @@ edition = "2021" members = [ "node", "pallets/outbound-commitment-store", - "pallets/ethereum-client", - "pallets/inbound-queue-v2", - "pallets/outbound-queue-v2", - "pallets/system", - "pallets/system-v2", - "pallets/validator-set", + "pallets/*", "primitives/bridge", - "runtime", - "runtime/common", + "runtime/*", ] resolver = "2" @@ -25,8 +19,10 @@ resolver = "2" [workspace.dependencies] # Local -datahaven-runtime = { path = "./runtime", default-features = false } +datahaven-mainnet-runtime = { path = "./runtime/mainnet", default-features = false } datahaven-runtime-common = { path = "./runtime/common", default-features = false } +datahaven-stagenet-runtime = { path = "./runtime/stagenet", default-features = false } +datahaven-testnet-runtime = { path = "./runtime/testnet", default-features = false } dhp-bridge = { path = "./primitives/bridge", default-features = false } pallet-outbound-commitment-store = { path = "./pallets/outbound-commitment-store", default-features = false } pallet-validator-set = { path = "./pallets/validator-set", default-features = false } @@ -135,12 +131,14 @@ sp-consensus = { git = "https://github.com/paritytech/polkadot-sdk", branch = "s sp-consensus-babe = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false } sp-consensus-beefy = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false } sp-consensus-grandpa = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false } +sp-consensus-slots = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false } sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false } sp-crypto-hashing = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false } sp-genesis-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false } sp-inherents = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false } sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false } sp-keyring = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false } +sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false } sp-offchain = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false } sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false } sp-runtime-interface = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2412", default-features = false } diff --git a/operator/node/Cargo.toml b/operator/node/Cargo.toml index 818b075e..66b275a1 100644 --- a/operator/node/Cargo.toml +++ b/operator/node/Cargo.toml @@ -16,7 +16,10 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] # Local -datahaven-runtime = { workspace = true } +datahaven-mainnet-runtime = { workspace = true } +datahaven-runtime-common = { workspace = true } +datahaven-stagenet-runtime = { workspace = true } +datahaven-testnet-runtime = { workspace = true } # Crates.io clap = { features = ["derive"], workspace = true } @@ -29,12 +32,16 @@ log = { workspace = true } serde_json = { workspace = true, default-features = true } url = { workspace = true } +#MMR +mmr-rpc = { workspace = true, default-features = true } +pallet-beefy-mmr = { workspace = true, default-features = true } +pallet-mmr = { workspace = true, default-features = true } + # Polkadot SDK frame-benchmarking-cli = { workspace = true, default-features = true } frame-metadata-hash-extension = { workspace = true, default-features = true } frame-system = { workspace = true, default-features = true } frame-system-rpc-runtime-api = { workspace = true } -mmr-rpc = { workspace = true, default-features = true } pallet-im-online = { workspace = true } pallet-transaction-payment = { workspace = true, default-features = true } pallet-transaction-payment-rpc = { workspace = true, default-features = true } @@ -68,11 +75,11 @@ sp-genesis-builder = { workspace = true, default-features = true } sp-inherents = { workspace = true, default-features = true } sp-io = { workspace = true, default-features = true } sp-keyring = { workspace = true, default-features = true } -sp-offchain = { workspace = true, features = ["default"] } +sp-offchain = { workspace = true, default-features = true } sp-runtime = { workspace = true, default-features = true } -sp-session = { workspace = true, features = ["default"] } +sp-session = { workspace = true, default-features = true } sp-timestamp = { workspace = true, default-features = true } -sp-transaction-pool = { workspace = true, features = ["default"] } +sp-transaction-pool = { workspace = true, default-features = true } substrate-frame-rpc-system = { workspace = true, default-features = true } # Frontier @@ -95,22 +102,30 @@ substrate-build-script-utils = { workspace = true, default-features = true } [features] default = ["std"] std = [ - "datahaven-runtime/std", + "datahaven-runtime-common/std", + "datahaven-stagenet-runtime/std", + "datahaven-mainnet-runtime/std", + "datahaven-testnet-runtime/std", ] # Dependencies that are only required if runtime benchmarking should be build. runtime-benchmarks = [ - "datahaven-runtime/runtime-benchmarks", - "frame-benchmarking-cli/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "sc-service/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", + "frame-benchmarking-cli/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "sc-service/runtime-benchmarks", + "datahaven-runtime-common/runtime-benchmarks", + "datahaven-stagenet-runtime/runtime-benchmarks", + "datahaven-mainnet-runtime/runtime-benchmarks", + "datahaven-testnet-runtime/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", ] # Enable features that allow the runtime to be tried and debugged. Name might be subject to change # in the near future. try-runtime = [ - "datahaven-runtime/try-runtime", - "frame-system/try-runtime", - "pallet-transaction-payment/try-runtime", - "sp-runtime/try-runtime", + "frame-system/try-runtime", + "pallet-transaction-payment/try-runtime", + "datahaven-stagenet-runtime/try-runtime", + "datahaven-mainnet-runtime/try-runtime", + "datahaven-testnet-runtime/try-runtime", + "sp-runtime/try-runtime", ] diff --git a/operator/node/src/benchmarking.rs b/operator/node/src/benchmarking.rs index da68a3b7..89b50d55 100644 --- a/operator/node/src/benchmarking.rs +++ b/operator/node/src/benchmarking.rs @@ -4,7 +4,7 @@ use crate::service::FullClient; -use datahaven_runtime as runtime; +use datahaven_mainnet_runtime as runtime; use fp_account::EthereumSignature; use runtime::{AccountId, Balance, BalancesCall, SystemCall}; use sc_cli::Result; @@ -18,18 +18,18 @@ use std::{sync::Arc, time::Duration}; /// Generates extrinsics for the `benchmark overhead` command. /// /// Note: Should only be used for benchmarking. -pub struct RemarkBuilder { - client: Arc, +pub struct RemarkBuilder { + client: Arc>, } -impl RemarkBuilder { +impl RemarkBuilder { /// Creates a new [`Self`] from the given client. - pub fn new(client: Arc) -> Self { + pub fn new(client: Arc>) -> Self { Self { client } } } -impl frame_benchmarking_cli::ExtrinsicBuilder for RemarkBuilder { +impl frame_benchmarking_cli::ExtrinsicBuilder for RemarkBuilder { fn pallet(&self) -> &str { "system" } @@ -54,15 +54,15 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for RemarkBuilder { /// Generates `Balances::TransferKeepAlive` extrinsics for the benchmarks. /// /// Note: Should only be used for benchmarking. -pub struct TransferKeepAliveBuilder { - client: Arc, +pub struct TransferKeepAliveBuilder { + client: Arc>, dest: AccountId, value: Balance, } -impl TransferKeepAliveBuilder { +impl TransferKeepAliveBuilder { /// Creates a new [`Self`] from the given client. - pub fn new(client: Arc, dest: AccountId, value: Balance) -> Self { + pub fn new(client: Arc>, dest: AccountId, value: Balance) -> Self { Self { client, dest, @@ -71,7 +71,7 @@ impl TransferKeepAliveBuilder { } } -impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder { +impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder { fn pallet(&self) -> &str { "balances" } @@ -100,8 +100,8 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder { /// Create a transaction using the given `call`. /// /// Note: Should only be used for benchmarking. -pub fn create_benchmark_extrinsic( - client: &FullClient, +pub fn create_benchmark_extrinsic( + client: &FullClient, sender: ecdsa::Pair, call: runtime::RuntimeCall, nonce: u32, diff --git a/operator/node/src/chain_spec.rs b/operator/node/src/chain_spec/mainnet.rs similarity index 84% rename from operator/node/src/chain_spec.rs rename to operator/node/src/chain_spec/mainnet.rs index a2c0ac99..9e1949fd 100644 --- a/operator/node/src/chain_spec.rs +++ b/operator/node/src/chain_spec/mainnet.rs @@ -1,14 +1,13 @@ -use datahaven_runtime::WASM_BINARY; +use datahaven_mainnet_runtime::WASM_BINARY; use sc_service::ChainType; +use super::ChainSpec; + const EVM_CHAIN_ID: u64 = 1289; const SS58_FORMAT: u16 = EVM_CHAIN_ID as u16; const TOKEN_DECIMALS: u8 = 18; const TOKEN_SYMBOL: &str = "HAVE"; -/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type. -pub type ChainSpec = sc_service::GenericChainSpec; - pub fn development_chain_spec() -> Result { // Give the token a unit name and decimal places let mut properties = sc_service::Properties::new(); @@ -21,8 +20,8 @@ pub fn development_chain_spec() -> Result { WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?, None, ) - .with_name("Development") - .with_id("dev") + .with_name("DataHaven Mainnet Dev") + .with_id("datahaven_mainnet_dev") .with_chain_type(ChainType::Development) .with_genesis_config_preset_name(sp_genesis_builder::DEV_RUNTIME_PRESET) .with_properties(properties) @@ -40,8 +39,8 @@ pub fn local_chain_spec() -> Result { WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?, None, ) - .with_name("Local Testnet") - .with_id("local") + .with_name("DataHaven Mainnet Local") + .with_id("datahaven_mainnet_local") .with_chain_type(ChainType::Local) .with_genesis_config_preset_name(sp_genesis_builder::LOCAL_TESTNET_RUNTIME_PRESET) .with_properties(properties) diff --git a/operator/node/src/chain_spec/mod.rs b/operator/node/src/chain_spec/mod.rs new file mode 100644 index 00000000..e039845d --- /dev/null +++ b/operator/node/src/chain_spec/mod.rs @@ -0,0 +1,40 @@ +pub mod mainnet; +pub mod stagenet; +pub mod testnet; + +/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type. +pub type ChainSpec = sc_service::GenericChainSpec; + +/// Can be called for a chain spec `Configuration` to determine the network type. +#[allow(unused)] +pub trait NetworkType { + /// Returns `true` if this is a configuration for the `Stagenet` network. + fn is_stagenet(&self) -> bool; + + /// Returns `true` if this is a configuration for the `Testnet` network. + fn is_testnet(&self) -> bool; + + /// Returns `true` if this is a configuration for the `Mainnet` network. + fn is_mainnet(&self) -> bool; + + /// Returns `true` if this is a configuration for a dev network. + fn is_dev(&self) -> bool; +} + +impl NetworkType for Box { + fn is_dev(&self) -> bool { + self.chain_type() == sc_service::ChainType::Development + } + + fn is_stagenet(&self) -> bool { + self.id().starts_with("datahaven_stagenet") + } + + fn is_testnet(&self) -> bool { + self.id().starts_with("datahaven_testnet") + } + + fn is_mainnet(&self) -> bool { + self.id().starts_with("datahaven_mainnet") + } +} diff --git a/operator/node/src/chain_spec/stagenet.rs b/operator/node/src/chain_spec/stagenet.rs new file mode 100644 index 00000000..87ae6b0e --- /dev/null +++ b/operator/node/src/chain_spec/stagenet.rs @@ -0,0 +1,48 @@ +use datahaven_stagenet_runtime::WASM_BINARY; +use sc_service::ChainType; + +use super::ChainSpec; + +const EVM_CHAIN_ID: u64 = 1283; +const SS58_FORMAT: u16 = EVM_CHAIN_ID as u16; +const TOKEN_DECIMALS: u8 = 18; +const TOKEN_SYMBOL: &str = "HAVE"; + +pub fn development_chain_spec() -> Result { + // Give the token a unit name and decimal places + let mut properties = sc_service::Properties::new(); + properties.insert("tokenSymbol".into(), TOKEN_SYMBOL.into()); + properties.insert("tokenDecimals".into(), TOKEN_DECIMALS.into()); + properties.insert("ss58Format".into(), SS58_FORMAT.into()); + properties.insert("isEthereum".into(), true.into()); + + Ok(ChainSpec::builder( + WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?, + None, + ) + .with_name("DataHaven Stagenet Dev") + .with_id("datahaven_stagenet_dev") + .with_chain_type(ChainType::Development) + .with_genesis_config_preset_name(sp_genesis_builder::DEV_RUNTIME_PRESET) + .with_properties(properties) + .build()) +} + +pub fn local_chain_spec() -> Result { + let mut properties = sc_service::Properties::new(); + properties.insert("tokenSymbol".into(), TOKEN_SYMBOL.into()); + properties.insert("tokenDecimals".into(), TOKEN_DECIMALS.into()); + properties.insert("ss58Format".into(), SS58_FORMAT.into()); + properties.insert("isEthereum".into(), true.into()); + + Ok(ChainSpec::builder( + WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?, + None, + ) + .with_name("DataHaven Stagenet Local") + .with_id("datahaven_stagenet_local") + .with_chain_type(ChainType::Local) + .with_genesis_config_preset_name(sp_genesis_builder::LOCAL_TESTNET_RUNTIME_PRESET) + .with_properties(properties) + .build()) +} diff --git a/operator/node/src/chain_spec/testnet.rs b/operator/node/src/chain_spec/testnet.rs new file mode 100644 index 00000000..92c371dc --- /dev/null +++ b/operator/node/src/chain_spec/testnet.rs @@ -0,0 +1,48 @@ +use datahaven_testnet_runtime::WASM_BINARY; +use sc_service::ChainType; + +use super::ChainSpec; + +const EVM_CHAIN_ID: u64 = 1288; +const SS58_FORMAT: u16 = EVM_CHAIN_ID as u16; +const TOKEN_DECIMALS: u8 = 18; +const TOKEN_SYMBOL: &str = "HAVE"; + +pub fn development_chain_spec() -> Result { + // Give the token a unit name and decimal places + let mut properties = sc_service::Properties::new(); + properties.insert("tokenSymbol".into(), TOKEN_SYMBOL.into()); + properties.insert("tokenDecimals".into(), TOKEN_DECIMALS.into()); + properties.insert("ss58Format".into(), SS58_FORMAT.into()); + properties.insert("isEthereum".into(), true.into()); + + Ok(ChainSpec::builder( + WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?, + None, + ) + .with_name("DataHaven Testnet Dev") + .with_id("datahaven_testnet_dev") + .with_chain_type(ChainType::Development) + .with_genesis_config_preset_name(sp_genesis_builder::DEV_RUNTIME_PRESET) + .with_properties(properties) + .build()) +} + +pub fn local_chain_spec() -> Result { + let mut properties = sc_service::Properties::new(); + properties.insert("tokenSymbol".into(), TOKEN_SYMBOL.into()); + properties.insert("tokenDecimals".into(), TOKEN_DECIMALS.into()); + properties.insert("ss58Format".into(), SS58_FORMAT.into()); + properties.insert("isEthereum".into(), true.into()); + + Ok(ChainSpec::builder( + WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?, + None, + ) + .with_name("DataHaven Testnet Local") + .with_id("datahaven_testnet_local") + .with_chain_type(ChainType::Local) + .with_genesis_config_preset_name(sp_genesis_builder::LOCAL_TESTNET_RUNTIME_PRESET) + .with_properties(properties) + .build()) +} diff --git a/operator/node/src/client.rs b/operator/node/src/client.rs index 6617c1b6..06183a5f 100644 --- a/operator/node/src/client.rs +++ b/operator/node/src/client.rs @@ -1,7 +1,7 @@ use crate::eth::EthCompatRuntimeApiCollection; use codec::Codec; // Substrate -use datahaven_runtime::{AccountId, Nonce}; +use datahaven_runtime_common::{AccountId, Nonce}; use sc_executor::WasmExecutor; use sp_runtime::traits::{Block as BlockT, MaybeDisplay}; diff --git a/operator/node/src/command.rs b/operator/node/src/command.rs index d3349a74..e9ea9bc7 100644 --- a/operator/node/src/command.rs +++ b/operator/node/src/command.rs @@ -3,14 +3,14 @@ use std::sync::Arc; use crate::service::frontier_database_dir; use crate::{ benchmarking::{inherent_benchmark_data, RemarkBuilder, TransferKeepAliveBuilder}, - chain_spec, + chain_spec::{self, NetworkType}, cli::{Cli, Subcommand}, service, }; -use datahaven_runtime::{genesis_config_presets::alith, Block, EXISTENTIAL_DEPOSIT}; +use datahaven_runtime_common::Block; use frame_benchmarking_cli::{BenchmarkCmd, ExtrinsicFactory, SUBSTRATE_REFERENCE_HARDWARE}; use sc_cli::SubstrateCli; -use sc_service::{DatabaseSource, PartialComponents}; +use sc_service::DatabaseSource; impl SubstrateCli for Cli { fn impl_name() -> String { @@ -39,8 +39,12 @@ impl SubstrateCli for Cli { fn load_spec(&self, id: &str) -> Result, String> { Ok(match id { - "dev" => Box::new(chain_spec::development_chain_spec()?), - "" | "local" => Box::new(chain_spec::local_chain_spec()?), + "dev" | "stagenet-dev" => Box::new(chain_spec::stagenet::development_chain_spec()?), + "" | "local" | "stagenet-local" => Box::new(chain_spec::stagenet::local_chain_spec()?), + "testnet-dev" => Box::new(chain_spec::testnet::development_chain_spec()?), + "testnet-local" => Box::new(chain_spec::testnet::local_chain_spec()?), + "mainnet-dev" => Box::new(chain_spec::mainnet::development_chain_spec()?), + "mainnet-local" => Box::new(chain_spec::mainnet::local_chain_spec()?), path => Box::new(chain_spec::ChainSpec::from_json_file( std::path::PathBuf::from(path), )?), @@ -48,6 +52,66 @@ impl SubstrateCli for Cli { } } +macro_rules! construct_async_run { + (|$components:ident, $cli:ident, $cmd:ident, $config:ident| $( $code:tt )* ) => {{ + let runner = $cli.create_runner($cmd)?; + match runner.config().chain_spec { + ref spec if spec.is_mainnet() => { + runner.async_run(|$config| { + let $components = service::new_partial::( + &$config, + &mut $cli.eth.clone() + )?; + let task_manager = $components.task_manager; + { $( $code )* }.map(|v| (v, task_manager)) + }) + } + ref spec if spec.is_testnet() => { + runner.async_run(|$config| { + let $components = service::new_partial::( + &$config, + &mut $cli.eth.clone() + )?; + let task_manager = $components.task_manager; + { $( $code )* }.map(|v| (v, task_manager)) + }) + } + _ => { + runner.async_run(|$config| { + let $components = service::new_partial::( + &$config, + &mut $cli.eth.clone() + )?; + let task_manager = $components.task_manager; + { $( $code )* }.map(|v| (v, task_manager)) + }) + } + } + }} +} + +macro_rules! construct_benchmark_partials { + ($cli:expr, $config:expr, |$partials:ident| $code:expr) => { + match $config.chain_spec { + ref spec if spec.is_mainnet() => { + let $partials = + service::new_partial::(&$config, &mut $cli.eth.clone())?; + $code + } + ref spec if spec.is_testnet() => { + let $partials = + service::new_partial::(&$config, &mut $cli.eth.clone())?; + $code + } + _ => { + let $partials = + service::new_partial::(&$config, &mut $cli.eth.clone())?; + $code + } + } + }; +} + /// Parse and run command line arguments pub fn run() -> sc_cli::Result<()> { let cli = Cli::from_args(); @@ -59,49 +123,23 @@ pub fn run() -> sc_cli::Result<()> { runner.sync_run(|config| cmd.run(config.chain_spec, config.network)) } Some(Subcommand::CheckBlock(cmd)) => { - let runner = cli.create_runner(cmd)?; - runner.async_run(|config| { - let PartialComponents { - client, - task_manager, - import_queue, - .. - } = service::new_partial(&config, &mut cli.eth.clone())?; - Ok((cmd.run(client, import_queue), task_manager)) + construct_async_run!(|components, cli, cmd, config| { + Ok(cmd.run(components.client, components.import_queue)) }) } Some(Subcommand::ExportBlocks(cmd)) => { - let runner = cli.create_runner(cmd)?; - runner.async_run(|config| { - let PartialComponents { - client, - task_manager, - .. - } = service::new_partial(&config, &mut cli.eth.clone())?; - Ok((cmd.run(client, config.database), task_manager)) + construct_async_run!(|components, cli, cmd, config| { + Ok(cmd.run(components.client, config.database)) }) } Some(Subcommand::ExportState(cmd)) => { - let runner = cli.create_runner(cmd)?; - runner.async_run(|config| { - let PartialComponents { - client, - task_manager, - .. - } = service::new_partial(&config, &mut cli.eth.clone())?; - Ok((cmd.run(client, config.chain_spec), task_manager)) + construct_async_run!(|components, cli, cmd, config| { + Ok(cmd.run(components.client, config.chain_spec)) }) } Some(Subcommand::ImportBlocks(cmd)) => { - let runner = cli.create_runner(cmd)?; - runner.async_run(|config| { - let PartialComponents { - client, - task_manager, - import_queue, - .. - } = service::new_partial(&config, &mut cli.eth.clone())?; - Ok((cmd.run(client, import_queue), task_manager)) + construct_async_run!(|components, cli, cmd, config| { + Ok(cmd.run(components.client, components.import_queue)) }) } Some(Subcommand::PurgeChain(cmd)) => { @@ -124,20 +162,14 @@ pub fn run() -> sc_cli::Result<()> { }) } Some(Subcommand::Revert(cmd)) => { - let runner = cli.create_runner(cmd)?; - runner.async_run(|config| { - let PartialComponents { - client, - task_manager, - backend, - .. - } = service::new_partial(&config, &mut cli.eth.clone())?; - let aux_revert = Box::new(|client: Arc, backend, blocks| { - sc_consensus_babe::revert(client.clone(), backend, blocks)?; - sc_consensus_grandpa::revert(client, blocks)?; - Ok(()) - }); - Ok((cmd.run(client, backend, Some(aux_revert)), task_manager)) + construct_async_run!(|components, cli, cmd, config| { + let aux_revert = + Box::new(|client: Arc>, backend, blocks| { + sc_consensus_babe::revert(client.clone(), backend, blocks)?; + sc_consensus_grandpa::revert(client, blocks)?; + Ok(()) + }); + Ok(cmd.run(components.client, components.backend, Some(aux_revert))) }) } Some(Subcommand::Benchmark(cmd)) => { @@ -151,7 +183,7 @@ pub fn run() -> sc_cli::Result<()> { if !cfg!(feature = "runtime-benchmarks") { return Err( "Runtime benchmarking wasn't enabled when building the node. \ - You can enable it with `--features runtime-benchmarks`." + You can enable it with `--features runtime-benchmarks`." .into(), ); } @@ -161,9 +193,8 @@ pub fn run() -> sc_cli::Result<()> { )) } BenchmarkCmd::Block(cmd) => { - let PartialComponents { client, .. } = - service::new_partial(&config, &mut cli.eth.clone())?; - cmd.run(client) + construct_benchmark_partials!(cli, config, |partials| cmd + .run(partials.client)) } #[cfg(not(feature = "runtime-benchmarks"))] BenchmarkCmd::Storage(_) => Err( @@ -172,42 +203,46 @@ pub fn run() -> sc_cli::Result<()> { ), #[cfg(feature = "runtime-benchmarks")] BenchmarkCmd::Storage(cmd) => { - let PartialComponents { - client, backend, .. - } = service::new_partial(&config, &mut cli.eth.clone())?; - let db = backend.expose_db(); - let storage = backend.expose_storage(); + construct_benchmark_partials!(cli, config, |partials| { + let db = partials.backend.expose_db(); + let storage = partials.backend.expose_storage(); - cmd.run(config, client, db, storage) + cmd.run(config, partials.client.clone(), db, storage) + }) } BenchmarkCmd::Overhead(cmd) => { - let PartialComponents { client, .. } = - service::new_partial(&config, &mut cli.eth.clone())?; - let ext_builder = RemarkBuilder::new(client.clone()); - - cmd.run( - config.chain_spec.name().to_string(), - client, - inherent_benchmark_data()?, - Vec::new(), - &ext_builder, - false, - ) + construct_benchmark_partials!(cli, config, |partials| { + let ext_builder = RemarkBuilder::new(partials.client.clone()); + cmd.run( + config.chain_spec.name().to_string(), + partials.client, + inherent_benchmark_data()?, + Vec::new(), + &ext_builder, + false, + ) + }) } BenchmarkCmd::Extrinsic(cmd) => { - let PartialComponents { client, .. } = - service::new_partial(&config, &mut cli.eth.clone())?; - // Register the *Remark* and *TKA* builders. - let ext_factory = ExtrinsicFactory(vec![ - Box::new(RemarkBuilder::new(client.clone())), - Box::new(TransferKeepAliveBuilder::new( - client.clone(), - alith(), - EXISTENTIAL_DEPOSIT, - )), - ]); + construct_benchmark_partials!(cli, config, |partials| { + // Register the *Remark* and *TKA* builders. + let ext_factory = ExtrinsicFactory(vec![ + Box::new(RemarkBuilder::new(partials.client.clone())), + Box::new(TransferKeepAliveBuilder::new( + partials.client.clone(), + datahaven_stagenet_runtime::genesis_config_presets::alith(), + // Assume the existential deposit is the same for all runtimes + datahaven_stagenet_runtime::EXISTENTIAL_DEPOSIT, + )), + ]); - cmd.run(client, inherent_benchmark_data()?, Vec::new(), &ext_factory) + cmd.run( + partials.client, + inherent_benchmark_data()?, + Vec::new(), + &ext_factory, + ) + }) } BenchmarkCmd::Machine(cmd) => { cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone()) @@ -223,22 +258,54 @@ pub fn run() -> sc_cli::Result<()> { let runner = cli.create_runner(&cli.run)?; runner.run_node_until_exit(|config| async move { match config.network.network_backend.unwrap_or_default() { - sc_network::config::NetworkBackendType::Libp2p => service::new_full::< - sc_network::NetworkWorker< - datahaven_runtime::opaque::Block, - ::Hash, - >, - >( - config, cli.eth - ) - .await - .map_err(sc_cli::Error::Service), - - sc_network::config::NetworkBackendType::Litep2p => { - service::new_full::(config, cli.eth) + sc_network::config::NetworkBackendType::Libp2p => match config.chain_spec { + ref spec if spec.is_mainnet() => { + service::new_full::< + datahaven_mainnet_runtime::apis::RuntimeApi, + sc_network::NetworkWorker<_, _>, + >(config, cli.eth) .await - .map_err(sc_cli::Error::Service) + } + ref spec if spec.is_testnet() => { + service::new_full::< + datahaven_testnet_runtime::apis::RuntimeApi, + sc_network::NetworkWorker<_, _>, + >(config, cli.eth) + .await + } + _ => { + service::new_full::< + datahaven_stagenet_runtime::apis::RuntimeApi, + sc_network::NetworkWorker<_, _>, + >(config, cli.eth) + .await + } } + .map_err(sc_cli::Error::Service), + sc_network::config::NetworkBackendType::Litep2p => match config.chain_spec { + ref spec if spec.is_mainnet() => { + service::new_full::< + datahaven_mainnet_runtime::apis::RuntimeApi, + sc_network::Litep2pNetworkBackend, + >(config, cli.eth) + .await + } + ref spec if spec.is_testnet() => { + service::new_full::< + datahaven_testnet_runtime::apis::RuntimeApi, + sc_network::Litep2pNetworkBackend, + >(config, cli.eth) + .await + } + _ => { + service::new_full::< + datahaven_stagenet_runtime::apis::RuntimeApi, + sc_network::Litep2pNetworkBackend, + >(config, cli.eth) + .await + } + } + .map_err(sc_cli::Error::Service), } }) } diff --git a/operator/node/src/eth.rs b/operator/node/src/eth.rs index 1406cc44..dae254f0 100644 --- a/operator/node/src/eth.rs +++ b/operator/node/src/eth.rs @@ -1,6 +1,6 @@ // Substrate use crate::client::{FullBackend, FullClient}; -use datahaven_runtime::opaque::Block; +use datahaven_runtime_common::Block; pub use fc_db::Backend as FrontierBackend; use fc_rpc::EthTask; pub use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool}; diff --git a/operator/node/src/rpc.rs b/operator/node/src/rpc.rs index 46a233de..1218bcd5 100644 --- a/operator/node/src/rpc.rs +++ b/operator/node/src/rpc.rs @@ -7,8 +7,8 @@ use crate::consensus::BabeConsensusDataProvider; use crate::eth::DefaultEthConfig; -use datahaven_runtime::{ - opaque::Block, AccountId, Balance, BlockNumber, Hash, Nonce, SLOT_DURATION, +use datahaven_runtime_common::{ + time::SLOT_DURATION, AccountId, Balance, Block, BlockNumber, Hash, Nonce, }; use fc_rpc::TxPool; use fc_rpc::{Eth, EthBlockDataCacheTask, EthFilter, Net, Web3}; @@ -241,6 +241,8 @@ where let tx_pool = TxPool::new(client.clone(), graph.clone()); module.merge(tx_pool.into_rpc())?; + // module.merge(FrontierFinality::new(client.clone(), frontier_backend.clone()).into_rpc())?; + // Extend this RPC with a custom API by using the following syntax. // `YourRpcStruct` should have a reference to a client, which is needed // to call into the runtime. diff --git a/operator/node/src/service.rs b/operator/node/src/service.rs index 897265a4..072f7ff7 100644 --- a/operator/node/src/service.rs +++ b/operator/node/src/service.rs @@ -6,7 +6,7 @@ use crate::eth::{ }; use crate::eth::{EthConfiguration, StorageOverrideHandler}; use crate::rpc::BeefyDeps; -use datahaven_runtime::{self, apis::RuntimeApi, opaque::Block}; +use datahaven_runtime_common::{AccountId, Balance, Block, BlockNumber, Hash, Nonce}; use fc_consensus::FrontierBlockImport; use fc_db::DatabaseSource; use fc_storage::StorageOverride; @@ -15,42 +15,115 @@ use sc_client_api::{AuxStore, Backend, BlockBackend, StateBackend, StorageProvid use sc_consensus_babe::ImportQueueParams; use sc_consensus_grandpa::SharedVoterState; use sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY}; -use sc_network_sync::WarpSyncConfig; -use sc_service::{error::Error as ServiceError, Configuration, TFullClient, TaskManager}; +use sc_service::{error::Error as ServiceError, Configuration, TaskManager, WarpSyncConfig}; use sc_telemetry::{Telemetry, TelemetryWorker}; use sc_transaction_pool::{BasicPool, FullChainApi}; use sc_transaction_pool_api::OffchainTransactionPoolFactory; use sp_api::ProvideRuntimeApi; use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; -use sp_consensus_beefy::ecdsa_crypto; +use sp_consensus_beefy::ecdsa_crypto::AuthorityId as BeefyId; use sp_runtime::traits::BlakeTwo256; -use std::default::Default; -use std::time::Duration; -use std::{path::Path, sync::Arc}; +use std::{default::Default, path::Path, sync::Arc, time::Duration}; -pub type HostFunctions = sp_io::SubstrateHostFunctions; - -pub(crate) type FullClient = TFullClient>; +pub(crate) type FullClient = sc_service::TFullClient< + Block, + RuntimeApi, + sc_executor::WasmExecutor, +>; type FullBackend = sc_service::TFullBackend; type FullSelectChain = sc_consensus::LongestChain; -type FullGrandpaBlockImport = - sc_consensus_grandpa::GrandpaBlockImport; -type FullBeefyBlockImport = +type FullGrandpaBlockImport = sc_consensus_grandpa::GrandpaBlockImport< + FullBackend, + Block, + FullClient, + FullSelectChain, +>; +type FullBeefyBlockImport = sc_consensus_beefy::import::BeefyBlockImport< Block, FullBackend, - FullClient, + FullClient, InnerBlockImport, AuthorityId, >; -type SingleStatePool = BasicPool, Block>; +type SingleStatePool = BasicPool, Block>, Block>; /// The minimum period of blocks on which justifications will be /// imported and generated. const GRANDPA_JUSTIFICATION_PERIOD: u32 = 512; +pub(crate) trait FullRuntimeApi: + sp_transaction_pool::runtime_api::TaggedTransactionQueue + + sp_api::Metadata + + crate::eth::EthCompatRuntimeApiCollection + + frame_system_rpc_runtime_api::AccountNonceApi + + sp_session::SessionKeys + + sp_api::ApiExt + + pallet_mmr::primitives::MmrApi + + pallet_beefy_mmr::BeefyMmrApi + + sp_consensus_beefy::BeefyApi + + pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi + + sp_offchain::OffchainWorkerApi + + sp_block_builder::BlockBuilder + + sp_consensus_babe::BabeApi + + sp_consensus_grandpa::GrandpaApi + + fp_rpc::ConvertTransactionRuntimeApi + + fp_rpc::EthereumRuntimeRPCApi +{ +} + +impl FullRuntimeApi for T where + T: sp_transaction_pool::runtime_api::TaggedTransactionQueue + + sp_api::Metadata + + crate::eth::EthCompatRuntimeApiCollection + + frame_system_rpc_runtime_api::AccountNonceApi + + sp_session::SessionKeys + + sp_api::ApiExt + + pallet_mmr::primitives::MmrApi + + pallet_beefy_mmr::BeefyMmrApi + + sp_consensus_beefy::BeefyApi + + pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi + + sp_offchain::OffchainWorkerApi + + sp_block_builder::BlockBuilder + + sp_consensus_babe::BabeApi + + sp_consensus_grandpa::GrandpaApi + + fp_rpc::ConvertTransactionRuntimeApi + + fp_rpc::EthereumRuntimeRPCApi +{ +} + +pub type Service = sc_service::PartialComponents< + FullClient, + FullBackend, + FullSelectChain, + sc_consensus::DefaultImportQueue, + SingleStatePool, + ( + sc_consensus_babe::BabeBlockImport< + Block, + FullClient, + FullBeefyBlockImport< + FrontierBlockImport< + Block, + FullGrandpaBlockImport, + FullClient, + >, + BeefyId, + RuntimeApi, + >, + >, + sc_consensus_grandpa::LinkHalf, FullSelectChain>, + sc_consensus_babe::BabeLink, + sc_consensus_beefy::BeefyVoterLinks, + sc_consensus_beefy::BeefyRPCLinks, + Arc>>, + Arc>, + Option, + ), +>; + pub fn frontier_database_dir(config: &Configuration, path: &str) -> std::path::PathBuf { config .base_path @@ -58,6 +131,7 @@ pub fn frontier_database_dir(config: &Configuration, path: &str) -> std::path::P .join("frontier") .join(path) } + pub fn open_frontier_backend( client: Arc, config: &Configuration, @@ -124,35 +198,15 @@ where Ok(frontier_backend) } -pub type Service = sc_service::PartialComponents< - FullClient, - FullBackend, - FullSelectChain, - sc_consensus::DefaultImportQueue, - SingleStatePool, - ( - sc_consensus_babe::BabeBlockImport< - Block, - FullClient, - FullBeefyBlockImport< - FrontierBlockImport, - ecdsa_crypto::AuthorityId, - >, - >, - sc_consensus_grandpa::LinkHalf, - sc_consensus_babe::BabeLink, - sc_consensus_beefy::BeefyVoterLinks, - sc_consensus_beefy::BeefyRPCLinks, - Arc>, - Arc>, - Option, - ), ->; -pub fn new_partial( +pub fn new_partial( config: &Configuration, eth_config: &mut EthConfiguration, -) -> Result { +) -> Result, ServiceError> +where + RuntimeApi: sp_api::ConstructRuntimeApi> + Send + Sync + 'static, + RuntimeApi::RuntimeApi: FullRuntimeApi, +{ let telemetry = config .telemetry_endpoints .clone() @@ -182,7 +236,7 @@ pub fn new_partial( let executor = wasm_builder.build(); let (client, backend, keystore_container, task_manager) = - sc_service::new_full_parts::( + sc_service::new_full_parts::( config, telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()), executor, @@ -285,13 +339,18 @@ pub fn new_partial( }) } -// Builds a new service for a full client. +/// Builds a new service for a full client. pub async fn new_full< + RuntimeApi, N: sc_network::NetworkBackend::Hash>, >( config: Configuration, mut eth_config: EthConfiguration, -) -> Result { +) -> Result +where + RuntimeApi: sp_api::ConstructRuntimeApi> + Send + Sync + 'static, + RuntimeApi::RuntimeApi: FullRuntimeApi, +{ let sc_service::PartialComponents { client, backend, @@ -311,7 +370,7 @@ pub async fn new_full< storage_override, mut telemetry, ), - } = new_partial(&config, &mut eth_config)?; + } = new_partial::(&config, &mut eth_config)?; let FrontierPartialComponents { filter_pool, @@ -472,7 +531,7 @@ pub async fn new_full< client: client.clone(), pool: pool.clone(), graph: pool.pool().clone(), - beefy: BeefyDeps:: { + beefy: BeefyDeps:: { beefy_finality_proof_stream: beefy_rpc_links.from_voter_justif_stream.clone(), beefy_best_block_stream: beefy_rpc_links.from_voter_best_beefy_stream.clone(), subscription_executor, @@ -638,16 +697,8 @@ pub async fn new_full< is_authority: role.is_authority(), }; - let gadget = sc_consensus_beefy::start_beefy_gadget::< - _, - _, - _, - _, - _, - _, - _, - ecdsa_crypto::AuthorityId, - >(beefy_params); + let gadget = + sc_consensus_beefy::start_beefy_gadget::<_, _, _, _, _, _, _, BeefyId>(beefy_params); // BEEFY is part of consensus, if it fails we'll bring the node down with it to make sure it // is noticed. diff --git a/operator/pallets/system-v2/Cargo.toml b/operator/pallets/system-v2/Cargo.toml index 2e342327..6030d938 100644 --- a/operator/pallets/system-v2/Cargo.toml +++ b/operator/pallets/system-v2/Cargo.toml @@ -3,8 +3,8 @@ name = "snowbridge-pallet-system-v2" description = "Snowbridge System Pallet V2" version = "0.2.0" authors = ["Snowfork "] -edition.workspace = true -repository.workspace = true +edition = { workspace = true } +repository = { workspace = true } license = "Apache-2.0" categories = ["cryptography::cryptocurrencies"] @@ -15,30 +15,30 @@ targets = ["x86_64-unknown-linux-gnu"] exclude-from-umbrella = true [dependencies] -codec = { features = ["derive"], workspace = true } -frame-benchmarking = { optional = true, workspace = true } -frame-support.workspace = true -frame-system.workspace = true +codec = { workspace = true, features = ["derive"] } +frame-benchmarking = { workspace = true, optional = true } +frame-support = { workspace = true } +frame-system = { workspace = true } log = { workspace = true } -pallet-xcm.workspace = true -scale-info = { features = ["derive"], workspace = true } -snowbridge-core.workspace = true -snowbridge-outbound-queue-primitives.workspace = true -snowbridge-pallet-system.workspace = true -sp-core.workspace = true -sp-io.workspace = true -sp-runtime.workspace = true -sp-std.workspace = true -xcm-executor.workspace = true -xcm.workspace = true +pallet-xcm = { workspace = true } +scale-info = { workspace = true, features = ["derive"] } +snowbridge-core = { workspace = true } +snowbridge-outbound-queue-primitives = { workspace = true } +snowbridge-pallet-system = { workspace = true } +sp-core = { workspace = true } +sp-io = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } +xcm = { workspace = true } +xcm-executor = { workspace = true } [dev-dependencies] hex-literal = { workspace = true, default-features = true } -pallet-balances = { default-features = true, workspace = true } -polkadot-primitives = { default-features = true, workspace = true } -snowbridge-pallet-outbound-queue-v2 = { default-features = true, workspace = true } +pallet-balances = { workspace = true, default-features = true } +polkadot-primitives = { workspace = true, default-features = true } +snowbridge-pallet-outbound-queue-v2 = { workspace = true, default-features = true } snowbridge-test-utils = { workspace = true } -sp-keyring = { default-features = true, workspace = true } +sp-keyring = { workspace = true, default-features = true } [features] default = ["std"] diff --git a/operator/pallets/validator-set/Cargo.toml b/operator/pallets/validator-set/Cargo.toml index e7bf5618..d1b479dc 100644 --- a/operator/pallets/validator-set/Cargo.toml +++ b/operator/pallets/validator-set/Cargo.toml @@ -6,19 +6,17 @@ edition = '2021' license = 'Apache-2.0' [dependencies] -codec = { features = [ "derive" ], workspace = true } -frame-benchmarking.optional = true -frame-benchmarking.workspace = true -frame-support.workspace = true -frame-system.workspace = true -log.workspace = true -scale-info = { features = [ "derive", "serde" ], workspace = true } -sp-core.workspace = true -sp-io.workspace = true -sp-runtime.workspace = true -sp-staking.workspace = true - +codec = { workspace = true, features = ["derive"] } +frame-benchmarking = { workspace = true, optional = true } +frame-support = { workspace = true } +frame-system = { workspace = true } +log = { workspace = true } pallet-session = { workspace = true, features = ['historical'] } +scale-info = { workspace = true, features = ["derive", "serde"] } +sp-core = { workspace = true } +sp-io = { workspace = true } +sp-runtime = { workspace = true } +sp-staking = { workspace = true } [features] default = ['std'] diff --git a/operator/runtime/common/Cargo.toml b/operator/runtime/common/Cargo.toml index 0647ee89..3a87268e 100644 --- a/operator/runtime/common/Cargo.toml +++ b/operator/runtime/common/Cargo.toml @@ -2,26 +2,33 @@ name = "datahaven-runtime-common" description = "Common code used through the Datahaven network" version = "0.1.0" -edition.workspace = true +edition = { workspace = true } [dependencies] -frame-support.workspace = true -polkadot-primitives.workspace = true -polkadot-runtime-common.workspace = true +fp-account = { workspace = true } +frame-support = { workspace = true } +polkadot-primitives = { workspace = true } +polkadot-runtime-common = { workspace = true } +sp-core = { workspace = true, features = ["serde"] } +sp-runtime = { workspace = true, features = ["serde"] } xcm = { workspace = true } + [features] default = ["std"] std = [ "frame-support/std", "polkadot-primitives/std", "polkadot-runtime-common/std", - "xcm/std" + "xcm/std", + "sp-core/std", + "sp-runtime/std", ] runtime-benchmarks = [ "frame-support/runtime-benchmarks", "polkadot-primitives/runtime-benchmarks", "polkadot-runtime-common/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", ] # Set timing constants (e.g. session period) to faster versions to speed up testing. diff --git a/operator/runtime/common/src/lib.rs b/operator/runtime/common/src/lib.rs index 41a2d7e9..9d1e563f 100644 --- a/operator/runtime/common/src/lib.rs +++ b/operator/runtime/common/src/lib.rs @@ -19,3 +19,43 @@ pub mod constants; pub use constants::*; pub mod impl_on_charge_evm_transaction; +use fp_account::EthereumSignature; +pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic; +use sp_runtime::{ + generic, + traits::{BlakeTwo256, IdentifyAccount, Verify}, +}; + +/// Alias to 512-bit hash when used in the context of a transaction signature on the chain. +pub type Signature = EthereumSignature; + +/// Some way of identifying an account on the chain. We intentionally make it equivalent +/// to the public key of our transaction signing scheme. +pub type AccountId = <::Signer as IdentifyAccount>::AccountId; + +/// Balance of an account. +pub type Balance = u128; + +/// Index of a transaction in the chain. +pub type Nonce = u32; + +/// A hash of some data used by the chain. +pub type Hash = sp_core::H256; + +/// An index to a block. +pub type BlockNumber = u32; + +/// The address format for describing accounts. +pub type Address = AccountId; + +/// Block header type as expected by this runtime. +pub type Header = generic::Header; + +/// Block type as expected by this runtime. +pub type Block = generic::Block; + +/// A Block signed with a Justification +pub type SignedBlock = generic::SignedBlock; + +/// BlockId type as expected by this runtime. +pub type BlockId = generic::BlockId; diff --git a/operator/runtime/Cargo.toml b/operator/runtime/mainnet/Cargo.toml similarity index 91% rename from operator/runtime/Cargo.toml rename to operator/runtime/mainnet/Cargo.toml index e303d21f..21824713 100644 --- a/operator/runtime/Cargo.toml +++ b/operator/runtime/mainnet/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "datahaven-runtime" -description = "datahaven runtime template built with polkadot-sdk." +name = "datahaven-mainnet-runtime" +description = "DataHaven Mainnet runtime" version = "0.1.0" license = "Unlicense" authors = { workspace = true } @@ -14,21 +14,21 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] bridge-hub-common = { workspace = true, optional = true } -codec = { features = ["derive"], workspace = true } +codec = { workspace = true, features = ["derive"] } datahaven-runtime-common = { workspace = true } dhp-bridge = { workspace = true } fp-account = { workspace = true, features = ["serde"] } fp-evm = { workspace = true, features = ["serde"] } fp-rpc = { workspace = true } fp-self-contained = { workspace = true, features = ["serde", "try-runtime"] } -frame-benchmarking = { optional = true, workspace = true } +frame-benchmarking = { workspace = true, optional = true } frame-executive = { workspace = true } frame-metadata-hash-extension = { workspace = true } -frame-support = { features = ["experimental"], workspace = true } +frame-support = { workspace = true, features = ["experimental"] } frame-system = { workspace = true } -frame-system-benchmarking = { optional = true, workspace = true } +frame-system-benchmarking = { workspace = true, optional = true } frame-system-rpc-runtime-api = { workspace = true } -frame-try-runtime = { optional = true, workspace = true } +frame-try-runtime = { workspace = true, optional = true } hex = { workspace = true } hex-literal = { workspace = true } pallet-authorship = { workspace = true } @@ -59,7 +59,7 @@ pallet-utility = { workspace = true } pallet-validator-set = { workspace = true } polkadot-primitives = { workspace = true } polkadot-runtime-common = { workspace = true } -scale-info = { features = ["derive", "serde"], workspace = true } +scale-info = { workspace = true, features = ["derive", "serde"] } serde_json = { workspace = true, default-features = false, features = ["alloc"] } snowbridge-beacon-primitives = { workspace = true } snowbridge-core = { workspace = true } @@ -76,27 +76,27 @@ snowbridge-system-v2-runtime-api = { workspace = true } snowbridge-verification-primitives = { workspace = true } sp-api = { workspace = true } sp-block-builder = { workspace = true } -sp-consensus-babe = { features = ["serde"], workspace = true } -sp-consensus-beefy = { features = ["serde"], workspace = true } -sp-consensus-grandpa = { features = ["serde"], workspace = true } -sp-core = { features = ["serde"], workspace = true } +sp-consensus-babe = { workspace = true, features = ["serde"] } +sp-consensus-beefy = { workspace = true, features = ["serde"] } +sp-consensus-grandpa = { workspace = true, features = ["serde"] } +sp-core = { workspace = true, features = ["serde"] } sp-genesis-builder = { workspace = true } sp-inherents = { workspace = true } sp-keyring = { workspace = true } sp-offchain = { workspace = true } -sp-runtime = { features = ["serde"], workspace = true } +sp-runtime = { workspace = true, features = ["serde"] } sp-session = { workspace = true } sp-staking = { workspace = true } sp-std = { workspace = true } sp-storage = { workspace = true } sp-transaction-pool = { workspace = true } -sp-version = { features = ["serde"], workspace = true } +sp-version = { workspace = true, features = ["serde"] } xcm = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } [build-dependencies] -substrate-wasm-builder = { optional = true, workspace = true, default-features = true } +substrate-wasm-builder = { workspace = true, optional = true, default-features = true } [features] default = ["std"] diff --git a/operator/runtime/build.rs b/operator/runtime/mainnet/build.rs similarity index 100% rename from operator/runtime/build.rs rename to operator/runtime/mainnet/build.rs diff --git a/operator/runtime/src/apis.rs b/operator/runtime/mainnet/src/apis.rs similarity index 100% rename from operator/runtime/src/apis.rs rename to operator/runtime/mainnet/src/apis.rs diff --git a/operator/runtime/src/benchmarks.rs b/operator/runtime/mainnet/src/benchmarks.rs similarity index 100% rename from operator/runtime/src/benchmarks.rs rename to operator/runtime/mainnet/src/benchmarks.rs diff --git a/operator/runtime/src/configs/mod.rs b/operator/runtime/mainnet/src/configs/mod.rs similarity index 100% rename from operator/runtime/src/configs/mod.rs rename to operator/runtime/mainnet/src/configs/mod.rs diff --git a/operator/runtime/src/configs/runtime_params.rs b/operator/runtime/mainnet/src/configs/runtime_params.rs similarity index 100% rename from operator/runtime/src/configs/runtime_params.rs rename to operator/runtime/mainnet/src/configs/runtime_params.rs diff --git a/operator/runtime/mainnet/src/genesis_config_presets.rs b/operator/runtime/mainnet/src/genesis_config_presets.rs new file mode 100644 index 00000000..c25b3604 --- /dev/null +++ b/operator/runtime/mainnet/src/genesis_config_presets.rs @@ -0,0 +1,220 @@ +use crate::{ + configs::BABE_GENESIS_EPOCH_CONFIG, AccountId, BalancesConfig, RuntimeGenesisConfig, + SessionKeys, Signature, SudoConfig, +}; +use alloc::{format, vec, vec::Vec}; +use hex_literal::hex; +use pallet_im_online::sr25519::AuthorityId as ImOnlineId; +use serde_json::Value; +use sp_consensus_babe::AuthorityId as BabeId; +use sp_consensus_beefy::ecdsa_crypto::AuthorityId as BeefyId; +use sp_consensus_grandpa::AuthorityId as GrandpaId; +use sp_core::{ecdsa, Pair, Public}; +use sp_genesis_builder::{self, PresetId}; +use sp_runtime::traits::{IdentifyAccount, Verify}; + +const MAINNET_EVM_CHAIN_ID: u64 = 1289; + +// Returns the genesis config presets populated with given parameters. +fn testnet_genesis( + initial_authorities: Vec<(AccountId, BabeId, GrandpaId, ImOnlineId, BeefyId)>, + root_key: AccountId, + endowed_accounts: Vec, + evm_chain_id: u64, +) -> Value { + let config = RuntimeGenesisConfig { + balances: BalancesConfig { + balances: endowed_accounts + .iter() + .cloned() + .map(|k| (k, 1u128 << 110)) + .collect::>(), + }, + babe: pallet_babe::GenesisConfig { + epoch_config: BABE_GENESIS_EPOCH_CONFIG, + ..Default::default() + }, + evm_chain_id: pallet_evm_chain_id::GenesisConfig { + chain_id: evm_chain_id, + ..Default::default() + }, + session: pallet_session::GenesisConfig { + keys: initial_authorities + .iter() + .map(|(account, babe, grandpa, im_online, beefy)| { + ( + *account, + *account, + session_keys( + babe.clone(), + grandpa.clone(), + im_online.clone(), + beefy.clone(), + ), + ) + }) + .collect::>(), + ..Default::default() + }, + sudo: SudoConfig { + key: Some(root_key), + }, + validator_set: pallet_validator_set::GenesisConfig { + initial_validators: initial_authorities + .iter() + .map(|(account, ..)| *account) + .collect::>() + .try_into() + .expect("Too many initial authorities"), + }, + ..Default::default() + }; + + serde_json::to_value(config).expect("Could not build genesis config.") +} + +/// Return the development genesis config. +pub fn development_config_genesis() -> Value { + let mut endowed_accounts = pre_funded_accounts(); + endowed_accounts.sort(); + + testnet_genesis( + vec![authority_keys_from_seed("Alice")], + alith(), + endowed_accounts, + MAINNET_EVM_CHAIN_ID, + ) +} + +/// Return the local genesis config preset. +pub fn local_config_genesis() -> Value { + let mut endowed_accounts = pre_funded_accounts(); + endowed_accounts.sort(); + + testnet_genesis( + vec![ + authority_keys_from_seed("Alice"), + authority_keys_from_seed("Bob"), + authority_keys_from_seed("Charlie"), + authority_keys_from_seed("Dave"), + authority_keys_from_seed("Eve"), + authority_keys_from_seed("Ferdie"), + ], + alith(), + endowed_accounts, + MAINNET_EVM_CHAIN_ID, + ) +} + +/// Provides the JSON representation of predefined genesis config for given `id`. +pub fn get_preset(id: &PresetId) -> Option> { + let patch = match id.as_str() { + sp_genesis_builder::DEV_RUNTIME_PRESET => development_config_genesis(), + sp_genesis_builder::LOCAL_TESTNET_RUNTIME_PRESET => local_config_genesis(), + _ => return None, + }; + Some( + serde_json::to_string(&patch) + .expect("serialization to json is expected to work. qed.") + .into_bytes(), + ) +} + +/// List of supported presets. +pub fn preset_names() -> Vec { + vec![ + PresetId::from(sp_genesis_builder::DEV_RUNTIME_PRESET), + PresetId::from(sp_genesis_builder::LOCAL_TESTNET_RUNTIME_PRESET), + ] +} + +/// Generate a crypto pair from seed. +pub fn get_from_seed(seed: &str) -> ::Public { + TPublic::Pair::from_string(&format!("//{}", seed), None) + .expect("static values are valid; qed") + .public() +} + +fn session_keys( + babe: BabeId, + grandpa: GrandpaId, + im_online: ImOnlineId, + beefy: BeefyId, +) -> SessionKeys { + SessionKeys { + babe, + grandpa, + im_online, + beefy, + } +} + +type AccountPublic = ::Signer; + +/// Generate an account ID from seed. +pub fn get_account_id_from_seed(seed: &str) -> AccountId +where + AccountPublic: From<::Public>, +{ + AccountPublic::from(get_from_seed::(seed)).into_account() +} + +/// Generate a Babe authority key. +pub fn authority_keys_from_seed(s: &str) -> (AccountId, BabeId, GrandpaId, ImOnlineId, BeefyId) { + ( + get_account_id_from_seed::(s), + get_from_seed::(s), + get_from_seed::(s), + get_from_seed::(s), + get_from_seed::(s), + ) +} + +pub fn alith() -> AccountId { + AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")) +} + +pub fn baltathar() -> AccountId { + AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")) +} + +pub fn charleth() -> AccountId { + AccountId::from(hex!("798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc")) +} + +pub fn dorothy() -> AccountId { + AccountId::from(hex!("773539d4Ac0e786233D90A233654ccEE26a613D9")) +} + +pub fn ethan() -> AccountId { + AccountId::from(hex!("Ff64d3F6efE2317EE2807d2235B1ac2AA69d9E87")) +} + +pub fn frank() -> AccountId { + AccountId::from(hex!("C0F0f4ab324C46e55D02D0033343B4Be8A55532d")) +} + +pub fn beacon_relayer() -> AccountId { + AccountId::from(hex!("c46e141b5083721ad5f5056ba1cded69dce4a65f")) +} + +/// Get pre-funded accounts +pub fn pre_funded_accounts() -> Vec { + // These addresses are derived from Substrate's canonical mnemonic: + // bottom drive obey lake curtain smoke basket hold race lonely fit walk + vec![ + get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Charlie"), + get_account_id_from_seed::("Dave"), + get_account_id_from_seed::("Eve"), + get_account_id_from_seed::("Ferdie"), + alith(), + baltathar(), + charleth(), + dorothy(), + ethan(), + frank(), + beacon_relayer(), + ] +} diff --git a/operator/runtime/mainnet/src/lib.rs b/operator/runtime/mainnet/src/lib.rs new file mode 100644 index 00000000..e72b2a58 --- /dev/null +++ b/operator/runtime/mainnet/src/lib.rs @@ -0,0 +1,322 @@ +#![cfg_attr(not(feature = "std"), no_std)] +// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. +#![recursion_limit = "256"] + +extern crate alloc; +#[cfg(feature = "std")] +include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); + +pub mod apis; +#[cfg(feature = "runtime-benchmarks")] +mod benchmarks; +pub mod configs; + +use alloc::{borrow::Cow, vec::Vec}; +use sp_runtime::{generic, impl_opaque_keys}; +#[cfg(feature = "std")] +use sp_version::NativeVersion; +use sp_version::RuntimeVersion; + +pub use frame_system::Call as SystemCall; +pub use pallet_balances::Call as BalancesCall; +pub use pallet_timestamp::Call as TimestampCall; +use sp_core::H160; +#[cfg(any(feature = "std", test))] +pub use sp_runtime::BuildStorage; + +pub use datahaven_runtime_common::{ + AccountId, Address, Balance, BlockNumber, Hash, Header, Nonce, Signature, +}; + +pub mod genesis_config_presets; + +/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know +/// the specifics of the runtime. They can then be made to be agnostic over specific formats +/// of data like extrinsics, allowing for them to continue syncing the network through upgrades +/// to even the core data structures. +pub mod opaque { + use super::*; + use sp_runtime::{ + generic, + traits::{BlakeTwo256, Hash as HashT}, + }; + + pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic; + + /// Opaque block header type. + pub type Header = generic::Header; + /// Opaque block type. + pub type Block = generic::Block; + /// Opaque block identifier type. + pub type BlockId = generic::BlockId; + /// Opaque block hash type. + pub type Hash = ::Output; +} + +impl_opaque_keys! { + pub struct SessionKeys { + pub babe: Babe, + pub grandpa: Grandpa, + pub im_online: ImOnline, + pub beefy: Beefy, + } +} + +// To learn more about runtime versioning, see: +// https://docs.substrate.io/main-docs/build/upgrade#runtime-versioning +#[sp_version::runtime_version] +pub const VERSION: RuntimeVersion = RuntimeVersion { + spec_name: Cow::Borrowed("datahaven-mainnet"), + impl_name: Cow::Borrowed("datahaven-mainnet"), + authoring_version: 1, + // The version of the runtime specification. A full node will not attempt to use its native + // runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, + // `spec_version`, and `authoring_version` are the same between Wasm and native. + // This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use + // the compatible custom types. + spec_version: 100, + impl_version: 1, + apis: apis::RUNTIME_API_VERSIONS, + transaction_version: 1, + system_version: 1, +}; + +mod block_times { + /// This determines the average expected block time that we are targeting. Blocks will be + /// produced at a minimum duration defined by `SLOT_DURATION`. `SLOT_DURATION` is picked up by + /// `pallet_timestamp` which is in turn picked up by `pallet_babe` to implement `fn + /// slot_duration()`. + /// + /// Change this to adjust the block time. + pub const MILLI_SECS_PER_BLOCK: u64 = 6000; + + // NOTE: Currently it is not possible to change the slot duration after the chain has started. + // Attempting to do so will brick block production. + pub const SLOT_DURATION: u64 = MILLI_SECS_PER_BLOCK; +} +pub use block_times::*; + +// Time is measured by number of blocks. +pub const MINUTES: BlockNumber = 60_000 / (MILLI_SECS_PER_BLOCK as BlockNumber); +pub const HOURS: BlockNumber = MINUTES * 60; +pub const DAYS: BlockNumber = HOURS * 24; + +pub const BLOCK_HASH_COUNT: BlockNumber = 2400; + +// Provide a common factor between runtimes based on a supply of 10_000_000 tokens. +pub const SUPPLY_FACTOR: Balance = 1; + +// Unit = the base number of indivisible units for balances +pub const UNIT: Balance = 1_000_000_000_000; +pub const MILLI_UNIT: Balance = 1_000_000_000; +pub const MICRO_UNIT: Balance = 1_000_000; + +pub const STORAGE_BYTE_FEE: Balance = 100 * MICRO_UNIT * SUPPLY_FACTOR; + +/// Existential deposit. +pub const EXISTENTIAL_DEPOSIT: Balance = MILLI_UNIT; + +pub const fn deposit(items: u32, bytes: u32) -> Balance { + items as Balance * UNIT * SUPPLY_FACTOR + (bytes as Balance) * STORAGE_BYTE_FEE +} + +/// The version information used to identify this runtime when compiled natively. +#[cfg(feature = "std")] +pub fn native_version() -> NativeVersion { + NativeVersion { + runtime_version: VERSION, + can_author_with: Default::default(), + } +} + +/// Block type as expected by this runtime. +pub type Block = generic::Block; + +/// The SignedExtension to the basic transaction logic. +pub type SignedExtra = ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + frame_system::CheckWeight, + pallet_transaction_payment::ChargeTransactionPayment, + frame_metadata_hash_extension::CheckMetadataHash, +); + +/// Unchecked extrinsic type as expected by this runtime. +pub type UncheckedExtrinsic = + fp_self_contained::UncheckedExtrinsic; + +pub type CheckedExtrinsic = + fp_self_contained::CheckedExtrinsic; + +/// The payload being signed in transactions. +pub type SignedPayload = generic::SignedPayload; + +/// All migrations of the runtime, aside from the ones declared in the pallets. +/// +/// This can be a tuple of types, each implementing `OnRuntimeUpgrade`. +#[allow(unused_parens)] +type Migrations = (); + +/// Executive: handles dispatch to the various modules. +pub type Executive = frame_executive::Executive< + Runtime, + Block, + frame_system::ChainContext, + Runtime, + AllPalletsWithSystem, + Migrations, +>; + +impl frame_system::offchain::CreateTransactionBase for Runtime +where + RuntimeCall: From, +{ + type Extrinsic = UncheckedExtrinsic; + type RuntimeCall = RuntimeCall; +} + +impl frame_system::offchain::CreateInherent for Runtime +where + RuntimeCall: From, +{ + fn create_inherent(call: RuntimeCall) -> UncheckedExtrinsic { + UncheckedExtrinsic::new_bare(call) + } +} + +// Create the runtime by composing the FRAME pallets that were previously configured. +#[frame_support::runtime] +mod runtime { + #[runtime::runtime] + #[runtime::derive( + RuntimeCall, + RuntimeEvent, + RuntimeError, + RuntimeOrigin, + RuntimeFreezeReason, + RuntimeHoldReason, + RuntimeSlashReason, + RuntimeLockId, + RuntimeTask + )] + pub struct Runtime; + + // ╔══════════════════ System and Consensus Pallets ═════════════════╗ + #[runtime::pallet_index(0)] + pub type System = frame_system; + + // Babe must be before session. + #[runtime::pallet_index(1)] + pub type Babe = pallet_babe; + + #[runtime::pallet_index(2)] + pub type Timestamp = pallet_timestamp; + + #[runtime::pallet_index(3)] + pub type Balances = pallet_balances; + + // Consensus support. + // Authorship must be before session in order to note author in the correct session and era. + #[runtime::pallet_index(4)] + pub type Authorship = pallet_authorship; + + #[runtime::pallet_index(5)] + pub type Offences = pallet_offences; + + #[runtime::pallet_index(6)] + pub type Historical = pallet_session::historical; + + // Validator set must be before Session. + #[runtime::pallet_index(7)] + pub type ValidatorSet = pallet_validator_set; + + #[runtime::pallet_index(8)] + pub type Session = pallet_session; + + #[runtime::pallet_index(9)] + pub type ImOnline = pallet_im_online; + + #[runtime::pallet_index(10)] + pub type Grandpa = pallet_grandpa; + + #[runtime::pallet_index(11)] + pub type TransactionPayment = pallet_transaction_payment; + + #[runtime::pallet_index(12)] + pub type Beefy = pallet_beefy; + + #[runtime::pallet_index(13)] + pub type Mmr = pallet_mmr; + + #[runtime::pallet_index(14)] + pub type BeefyMmrLeaf = pallet_beefy_mmr; + // ╚═════════════════ System and Consensus Pallets ══════════════════╝ + + // ╔═════════════════ Polkadot SDK Utility Pallets ══════════════════╗ + #[runtime::pallet_index(30)] + pub type Utility = pallet_utility; + + #[runtime::pallet_index(31)] + pub type Scheduler = pallet_scheduler; + + #[runtime::pallet_index(32)] + pub type Preimage = pallet_preimage; + + #[runtime::pallet_index(33)] + pub type Identity = pallet_identity; + + #[runtime::pallet_index(34)] + pub type Multisig = pallet_multisig; + + #[runtime::pallet_index(35)] + pub type Parameters = pallet_parameters; + + #[runtime::pallet_index(36)] + pub type Sudo = pallet_sudo; + + #[runtime::pallet_index(37)] + pub type MessageQueue = pallet_message_queue; + // ╚═════════════════ Polkadot SDK Utility Pallets ══════════════════╝ + + // ╔════════════════════ Frontier (EVM) Pallets ═════════════════════╗ + #[runtime::pallet_index(50)] + pub type Ethereum = pallet_ethereum; + + #[runtime::pallet_index(51)] + pub type Evm = pallet_evm; + + #[runtime::pallet_index(52)] + pub type EvmChainId = pallet_evm_chain_id; + // ╚════════════════════ Frontier (EVM) Pallets ═════════════════════╝ + + // ╔══════════════════════ Snowbridge Pallets ═══════════════════════╗ + #[runtime::pallet_index(60)] + pub type EthereumBeaconClient = snowbridge_pallet_ethereum_client; + + #[runtime::pallet_index(61)] + pub type InboundQueueV2 = snowbridge_pallet_inbound_queue_v2; + + #[runtime::pallet_index(62)] + pub type OutboundQueueV2 = snowbridge_pallet_outbound_queue_v2; + + #[runtime::pallet_index(63)] + pub type SnowbridgeSystem = snowbridge_pallet_system; + + #[runtime::pallet_index(64)] + pub type SnowbridgeSystemV2 = snowbridge_pallet_system_v2; + // ╚══════════════════════ Snowbridge Pallets ═══════════════════════╝ + + // ╔══════════════════════ StorageHub Pallets ═══════════════════════╗ + // Start with index 70 + // ╚══════════════════════ StorageHub Pallets ═══════════════════════╝ + + // ╔═══════════════════ DataHaven-specific Pallets ══════════════════╗ + // Start with index 100 + #[runtime::pallet_index(100)] + pub type OutboundCommitmentStore = pallet_outbound_commitment_store; + // ╚═══════════════════ DataHaven-specific Pallets ══════════════════╝ +} diff --git a/operator/runtime/stagenet/Cargo.toml b/operator/runtime/stagenet/Cargo.toml new file mode 100644 index 00000000..4117d191 --- /dev/null +++ b/operator/runtime/stagenet/Cargo.toml @@ -0,0 +1,267 @@ +[package] +name = "datahaven-stagenet-runtime" +description = "DataHaven Stagenet runtime" +version = "0.1.0" +license = "Unlicense" +authors = { workspace = true } +homepage = { workspace = true } +repository = { workspace = true } +edition = { workspace = true } +publish = false + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +bridge-hub-common = { workspace = true, optional = true } +codec = { workspace = true, features = ["derive"] } +datahaven-runtime-common = { workspace = true } +dhp-bridge = { workspace = true } +fp-account = { workspace = true, features = ["serde"] } +fp-evm = { workspace = true, features = ["serde"] } +fp-rpc = { workspace = true } +fp-self-contained = { workspace = true, features = ["serde", "try-runtime"] } +frame-benchmarking = { workspace = true, optional = true } +frame-executive = { workspace = true } +frame-metadata-hash-extension = { workspace = true } +frame-support = { workspace = true, features = ["experimental"] } +frame-system = { workspace = true } +frame-system-benchmarking = { workspace = true, optional = true } +frame-system-rpc-runtime-api = { workspace = true } +frame-try-runtime = { workspace = true, optional = true } +hex = { workspace = true } +hex-literal = { workspace = true } +pallet-authorship = { workspace = true } +pallet-babe = { workspace = true } +pallet-balances = { workspace = true } +pallet-beefy = { workspace = true } +pallet-beefy-mmr = { workspace = true } +pallet-ethereum = { workspace = true } +pallet-evm = { workspace = true } +pallet-evm-chain-id = { workspace = true } +pallet-grandpa = { workspace = true } +pallet-identity = { workspace = true } +pallet-im-online = { workspace = true } +pallet-message-queue = { workspace = true } +pallet-mmr = { workspace = true } +pallet-multisig = { workspace = true } +pallet-offences = { workspace = true } +pallet-outbound-commitment-store = { workspace = true } +pallet-parameters = { workspace = true } +pallet-preimage = { workspace = true } +pallet-scheduler = { workspace = true } +pallet-session = { workspace = true } +pallet-sudo = { workspace = true } +pallet-timestamp = { workspace = true } +pallet-transaction-payment = { workspace = true } +pallet-transaction-payment-rpc-runtime-api = { workspace = true } +pallet-utility = { workspace = true } +pallet-validator-set = { workspace = true } +polkadot-primitives = { workspace = true } +polkadot-runtime-common = { workspace = true } +scale-info = { workspace = true, features = ["derive", "serde"] } +serde_json = { workspace = true, default-features = false, features = ["alloc"] } +snowbridge-beacon-primitives = { workspace = true } +snowbridge-core = { workspace = true } +snowbridge-inbound-queue-primitives = { workspace = true } +snowbridge-merkle-tree = { workspace = true } +snowbridge-outbound-queue-primitives = { workspace = true } +snowbridge-outbound-queue-v2-runtime-api = { workspace = true } +snowbridge-pallet-ethereum-client = { workspace = true } +snowbridge-pallet-inbound-queue-v2 = { workspace = true } +snowbridge-pallet-outbound-queue-v2 = { workspace = true } +snowbridge-pallet-system = { workspace = true } +snowbridge-pallet-system-v2 = { workspace = true } +snowbridge-system-v2-runtime-api = { workspace = true } +snowbridge-verification-primitives = { workspace = true } +sp-api = { workspace = true } +sp-block-builder = { workspace = true } +sp-consensus-babe = { workspace = true, features = ["serde"] } +sp-consensus-beefy = { workspace = true, features = ["serde"] } +sp-consensus-grandpa = { workspace = true, features = ["serde"] } +sp-core = { workspace = true, features = ["serde"] } +sp-genesis-builder = { workspace = true } +sp-inherents = { workspace = true } +sp-keyring = { workspace = true } +sp-offchain = { workspace = true } +sp-runtime = { workspace = true, features = ["serde"] } +sp-session = { workspace = true } +sp-staking = { workspace = true } +sp-std = { workspace = true } +sp-storage = { workspace = true } +sp-transaction-pool = { workspace = true } +sp-version = { workspace = true, features = ["serde"] } +xcm = { workspace = true } +xcm-builder = { workspace = true } +xcm-executor = { workspace = true } + +[build-dependencies] +substrate-wasm-builder = { workspace = true, optional = true, default-features = true } + +[features] +default = ["std"] +std = [ + "codec/std", + "datahaven-runtime-common/std", + "fp-account/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", + "frame-system/std", + "frame-try-runtime?/std", + "pallet-authorship/std", + "pallet-babe/std", + "pallet-balances/std", + "pallet-beefy-mmr/std", + "pallet-beefy/std", + "pallet-ethereum/std", + "pallet-evm-chain-id/std", + "pallet-evm/std", + "pallet-grandpa/std", + "pallet-identity/std", + "pallet-im-online/std", + "pallet-message-queue/std", + "pallet-mmr/std", + "pallet-multisig/std", + "pallet-offences/std", + "pallet-parameters/std", + "pallet-preimage/std", + "pallet-scheduler/std", + "pallet-session/std", + "pallet-sudo/std", + "pallet-timestamp/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-transaction-payment/std", + "pallet-utility/std", + "pallet-validator-set/std", + "polkadot-primitives/std", + "polkadot-runtime-common/std", + "scale-info/std", + "serde_json/std", + "snowbridge-beacon-primitives/std", + "snowbridge-inbound-queue-primitives/std", + "snowbridge-outbound-queue-primitives/std", + "snowbridge-pallet-ethereum-client/std", + "snowbridge-pallet-inbound-queue-v2/std", + "snowbridge-pallet-outbound-queue-v2/std", + "snowbridge-merkle-tree/std", + "snowbridge-outbound-queue-v2-runtime-api/std", + "snowbridge-pallet-system/std", + "snowbridge-pallet-system-v2/std", + "snowbridge-system-v2-runtime-api/std", + "dhp-bridge/std", + "snowbridge-verification-primitives/std", + "sp-api/std", + "sp-block-builder/std", + "sp-consensus-babe/std", + "sp-consensus-beefy/std", + "sp-consensus-grandpa/std", + "sp-core/std", + "sp-genesis-builder/std", + "sp-inherents/std", + "sp-keyring/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-session/std", + "sp-staking/std", + "sp-std/std", + "sp-storage/std", + "sp-transaction-pool/std", + "sp-version/std", + "substrate-wasm-builder", + "pallet-outbound-commitment-store/std", +] + +runtime-benchmarks = [ + "bridge-hub-common", + "datahaven-runtime-common/runtime-benchmarks", + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-beefy-mmr/runtime-benchmarks", + "pallet-ethereum/runtime-benchmarks", + "pallet-evm/runtime-benchmarks", + "pallet-grandpa/runtime-benchmarks", + "pallet-identity/runtime-benchmarks", + "pallet-im-online/runtime-benchmarks", + "pallet-message-queue/runtime-benchmarks", + "pallet-mmr/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-offences/runtime-benchmarks", + "pallet-parameters/runtime-benchmarks", + "pallet-preimage/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "pallet-sudo/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "polkadot-primitives/runtime-benchmarks", + "polkadot-runtime-common/runtime-benchmarks", + "snowbridge-inbound-queue-primitives/runtime-benchmarks", + "snowbridge-pallet-ethereum-client/runtime-benchmarks", + "snowbridge-pallet-inbound-queue-v2/runtime-benchmarks", + "snowbridge-pallet-system-v2/runtime-benchmarks", + "snowbridge-pallet-outbound-queue-v2/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "snowbridge-pallet-system/runtime-benchmarks", + "pallet-outbound-commitment-store/runtime-benchmarks", +] + +try-runtime = [ + "fp-self-contained/try-runtime", + "frame-executive/try-runtime", + "frame-support/try-runtime", + "frame-system/try-runtime", + "frame-try-runtime/try-runtime", + "pallet-authorship/try-runtime", + "pallet-babe/try-runtime", + "pallet-balances/try-runtime", + "pallet-beefy-mmr/try-runtime", + "pallet-beefy/try-runtime", + "pallet-ethereum/try-runtime", + "pallet-evm/try-runtime", + "pallet-grandpa/try-runtime", + "pallet-identity/try-runtime", + "pallet-im-online/try-runtime", + "pallet-message-queue/try-runtime", + "pallet-mmr/try-runtime", + "pallet-multisig/try-runtime", + "pallet-offences/try-runtime", + "pallet-parameters/try-runtime", + "pallet-preimage/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-session/try-runtime", + "pallet-sudo/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-transaction-payment/try-runtime", + "pallet-utility/try-runtime", + "polkadot-runtime-common/try-runtime", + "snowbridge-pallet-ethereum-client/try-runtime", + "snowbridge-pallet-inbound-queue-v2/try-runtime", + "snowbridge-pallet-system-v2/try-runtime", + "snowbridge-pallet-outbound-queue-v2/try-runtime", + "sp-runtime/try-runtime", + "snowbridge-pallet-system/try-runtime", + "pallet-outbound-commitment-store/try-runtime", +] + +fast-runtime = [ + "datahaven-runtime-common/fast-runtime", +] + +# Enable the metadata hash generation. +# +# This is hidden behind a feature because it increases the compile time. +# The wasm binary needs to be compiled twice, once to fetch the metadata, +# generate the metadata hash and then a second time with the +# `RUNTIME_METADATA_HASH` environment variable set for the `CheckMetadataHash` +# extension. +metadata-hash = ["substrate-wasm-builder/metadata-hash"] + +# A convenience feature for enabling things when doing a build +# for an on-chain release. +on-chain-release-build = ["metadata-hash", "sp-api/disable-logging"] diff --git a/operator/runtime/stagenet/build.rs b/operator/runtime/stagenet/build.rs new file mode 100644 index 00000000..138ae658 --- /dev/null +++ b/operator/runtime/stagenet/build.rs @@ -0,0 +1,16 @@ +#[cfg(all(feature = "std", feature = "metadata-hash"))] +fn main() { + substrate_wasm_builder::WasmBuilder::init_with_defaults() + .enable_metadata_hash("UNIT", 12) + .build(); +} + +#[cfg(all(feature = "std", not(feature = "metadata-hash")))] +fn main() { + substrate_wasm_builder::WasmBuilder::build_using_defaults(); +} + +/// The wasm builder is deactivated when compiling +/// this crate for wasm to speed up the compilation. +#[cfg(not(feature = "std"))] +fn main() {} diff --git a/operator/runtime/stagenet/src/apis.rs b/operator/runtime/stagenet/src/apis.rs new file mode 100644 index 00000000..4487857b --- /dev/null +++ b/operator/runtime/stagenet/src/apis.rs @@ -0,0 +1,800 @@ +// This is free and unencumbered software released into the public domain. +// +// Anyone is free to copy, modify, publish, use, compile, sell, or +// distribute this software, either in source code form or as a compiled +// binary, for any purpose, commercial or non-commercial, and by any +// means. +// +// In jurisdictions that recognize copyright laws, the author or authors +// of this software dedicate any and all copyright interest in the +// software to the public domain. We make this dedication for the benefit +// of the public at large and to the detriment of our heirs and +// successors. We intend this dedication to be an overt act of +// relinquishment in perpetuity of all present and future rights to this +// software under copyright law. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +// For more information, please refer to + +// Local module imports +use super::{ + AccountId, Babe, Balance, Beefy, BeefyMmrLeaf, Block, BlockNumber, Ethereum, Executive, + Grandpa, Historical, InherentDataExt, Mmr, Nonce, Runtime, RuntimeCall, RuntimeGenesisConfig, + RuntimeOrigin, SessionKeys, System, TransactionPayment, UncheckedExtrinsic, VERSION, +}; +// External crates imports +use crate::configs::BABE_GENESIS_EPOCH_CONFIG; +use alloc::vec::Vec; +use codec::Encode; +use datahaven_runtime_common::time::EpochDurationInBlocks; +use fp_rpc::TransactionStatus; +use frame_support::traits::OnFinalize; +use pallet_ethereum::Transaction as EthereumTransaction; +use pallet_evm::GasWeightMapping; + +use frame_support::traits::KeyOwnerProofSystem; +use frame_support::{ + genesis_builder_helper::{build_state, get_preset}, + weights::Weight, +}; +use pallet_ethereum::Call::transact; +use pallet_evm::Account as EVMAccount; +use pallet_evm::FeeCalculator; +use pallet_evm::Runner; +use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId}; +use polkadot_primitives::Hash; +use snowbridge_core::AgentId; +use sp_api::impl_runtime_apis; +use sp_consensus_beefy::{ + ecdsa_crypto::{AuthorityId as BeefyId, Signature as BeefySignature}, + AncestryHelper, +}; +use sp_core::{Get, H256, U256}; +use sp_core::{OpaqueMetadata, H160}; +use sp_runtime::traits::{DispatchInfoOf, Dispatchable, PostDispatchInfoOf}; +use sp_runtime::transaction_validity::TransactionValidityError; +use sp_runtime::{ + traits::Block as BlockT, + transaction_validity::{TransactionSource, TransactionValidity}, + ApplyExtrinsicResult, Permill, +}; +use sp_version::RuntimeVersion; +use xcm::VersionedLocation; +/// MMR helper types. +mod mmr { + use super::Runtime; + pub use pallet_mmr::primitives::*; + + pub type Leaf = <::LeafData as LeafDataProvider>::LeafData; + pub type Hashing = ::Hashing; + pub type Hash = ::Output; +} + +#[derive(Clone)] +pub struct TransactionConverter; + +impl fp_self_contained::SelfContainedCall for RuntimeCall { + type SignedInfo = H160; + + fn is_self_contained(&self) -> bool { + match self { + RuntimeCall::Ethereum(call) => call.is_self_contained(), + _ => false, + } + } + + fn check_self_contained(&self) -> Option> { + match self { + RuntimeCall::Ethereum(call) => call.check_self_contained(), + _ => None, + } + } + + fn validate_self_contained( + &self, + signed_info: &Self::SignedInfo, + dispatch_info: &DispatchInfoOf, + len: usize, + ) -> Option { + match self { + RuntimeCall::Ethereum(call) => { + call.validate_self_contained(signed_info, dispatch_info, len) + } + _ => None, + } + } + + fn pre_dispatch_self_contained( + &self, + info: &Self::SignedInfo, + dispatch_info: &DispatchInfoOf, + len: usize, + ) -> Option> { + match self { + RuntimeCall::Ethereum(call) => { + call.pre_dispatch_self_contained(info, dispatch_info, len) + } + _ => None, + } + } + + fn apply_self_contained( + self, + info: Self::SignedInfo, + ) -> Option>> { + match self { + call @ RuntimeCall::Ethereum(pallet_ethereum::Call::transact { .. }) => { + Some(call.dispatch(RuntimeOrigin::from( + pallet_ethereum::RawOrigin::EthereumTransaction(info), + ))) + } + _ => None, + } + } +} + +impl fp_rpc::ConvertTransaction for TransactionConverter { + fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic { + UncheckedExtrinsic::new_bare( + pallet_ethereum::Call::::transact { transaction }.into(), + ) + } +} + +impl_runtime_apis! { + impl sp_api::Core for Runtime { + fn version() -> RuntimeVersion { + VERSION + } + + fn execute_block(block: Block) { + Executive::execute_block(block); + } + + fn initialize_block(header: &::Header) -> sp_runtime::ExtrinsicInclusionMode { + Executive::initialize_block(header) + } + } + + impl sp_api::Metadata for Runtime { + fn metadata() -> OpaqueMetadata { + OpaqueMetadata::new(Runtime::metadata().into()) + } + + fn metadata_at_version(version: u32) -> Option { + Runtime::metadata_at_version(version) + } + + fn metadata_versions() -> Vec { + Runtime::metadata_versions() + } + } + + impl sp_block_builder::BlockBuilder for Runtime { + fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyExtrinsicResult { + Executive::apply_extrinsic(extrinsic) + } + + fn finalize_block() -> ::Header { + Executive::finalize_block() + } + + fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<::Extrinsic> { + data.create_extrinsics() + } + + fn check_inherents( + block: Block, + data: sp_inherents::InherentData, + ) -> sp_inherents::CheckInherentsResult { + data.check_extrinsics(&block) + } + } + + impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime { + fn validate_transaction( + source: TransactionSource, + tx: ::Extrinsic, + block_hash: ::Hash, + ) -> TransactionValidity { + Executive::validate_transaction(source, tx, block_hash) + } + } + + impl sp_offchain::OffchainWorkerApi for Runtime { + fn offchain_worker(header: &::Header) { + Executive::offchain_worker(header) + } + } + + impl sp_session::SessionKeys for Runtime { + fn generate_session_keys(seed: Option>) -> Vec { + SessionKeys::generate(seed) + } + + fn decode_session_keys( + encoded: Vec, + ) -> Option, sp_core::crypto::KeyTypeId)>> { + SessionKeys::decode_into_raw_public_keys(&encoded) + } + } + + impl sp_consensus_babe::BabeApi for Runtime { + fn configuration() -> sp_consensus_babe::BabeConfiguration { + let epoch_config = Babe::epoch_config().unwrap_or(BABE_GENESIS_EPOCH_CONFIG); + sp_consensus_babe::BabeConfiguration { + slot_duration: Babe::slot_duration(), + epoch_length: EpochDurationInBlocks::get().into(), + c: epoch_config.c, + authorities: Babe::authorities().to_vec(), + randomness: Babe::randomness(), + allowed_slots: epoch_config.allowed_slots, + } + } + + fn current_epoch_start() -> sp_consensus_babe::Slot { + Babe::current_epoch_start() + } + + fn current_epoch() -> sp_consensus_babe::Epoch { + Babe::current_epoch() + } + + fn next_epoch() -> sp_consensus_babe::Epoch { + Babe::next_epoch() + } + + fn generate_key_ownership_proof( + _slot: sp_consensus_babe::Slot, + authority_id: sp_consensus_babe::AuthorityId, + ) -> Option { + use codec::Encode; + + Historical::prove((sp_consensus_babe::KEY_TYPE, authority_id)) + .map(|p| p.encode()) + .map(sp_consensus_babe::OpaqueKeyOwnershipProof::new) + } + + fn submit_report_equivocation_unsigned_extrinsic( + equivocation_proof: sp_consensus_babe::EquivocationProof<::Header>, + key_owner_proof: sp_consensus_babe::OpaqueKeyOwnershipProof, + ) -> Option<()> { + let key_owner_proof = key_owner_proof.decode()?; + + Babe::submit_unsigned_equivocation_report( + equivocation_proof, + key_owner_proof, + ) + } + } + + impl sp_consensus_grandpa::GrandpaApi for Runtime { + fn grandpa_authorities() -> Vec<(GrandpaId, u64)> { + Grandpa::grandpa_authorities() + } + + fn current_set_id() -> fg_primitives::SetId { + Grandpa::current_set_id() + } + + fn submit_report_equivocation_unsigned_extrinsic( + equivocation_proof: fg_primitives::EquivocationProof< + ::Hash, + sp_runtime::traits::NumberFor, + >, + key_owner_proof: fg_primitives::OpaqueKeyOwnershipProof, + ) -> Option<()> { + let key_owner_proof = key_owner_proof.decode()?; + + Grandpa::submit_unsigned_equivocation_report( + equivocation_proof, + key_owner_proof, + ) + } + + fn generate_key_ownership_proof( + _set_id: fg_primitives::SetId, + authority_id: fg_primitives::AuthorityId, + ) -> Option { + + Historical::prove((fg_primitives::KEY_TYPE, authority_id)) + .map(|p| p.encode()) + .map(fg_primitives::OpaqueKeyOwnershipProof::new) + } + } + + #[api_version(2)] + impl mmr::MmrApi for Runtime { + fn mmr_root() -> Result { + Ok(pallet_mmr::RootHash::::get()) + } + + fn mmr_leaf_count() -> Result { + Ok(pallet_mmr::NumberOfLeaves::::get()) + } + + fn generate_proof( + block_numbers: Vec, + best_known_block_number: Option, + ) -> Result<(Vec, mmr::LeafProof), mmr::Error> { + Mmr::generate_proof(block_numbers, best_known_block_number).map( + |(leaves, proof)| { + ( + leaves + .into_iter() + .map(|leaf| mmr::EncodableOpaqueLeaf::from_leaf(&leaf)) + .collect(), + proof, + ) + }, + ) + } + + fn verify_proof(leaves: Vec, proof: mmr::LeafProof) + -> Result<(), mmr::Error> + { + let leaves = leaves.into_iter().map(|leaf| + leaf.into_opaque_leaf() + .try_decode() + .ok_or(mmr::Error::Verify)).collect::, mmr::Error>>()?; + Mmr::verify_leaves(leaves, proof) + } + + fn verify_proof_stateless( + root: mmr::Hash, + leaves: Vec, + proof: mmr::LeafProof + ) -> Result<(), mmr::Error> { + let nodes = leaves.into_iter().map(|leaf|mmr::DataOrHash::Data(leaf.into_opaque_leaf())).collect(); + pallet_mmr::verify_leaves_proof::(root, nodes, proof) + } + } + + impl pallet_beefy_mmr::BeefyMmrApi for RuntimeApi { + fn authority_set_proof() -> sp_consensus_beefy::mmr::BeefyAuthoritySet { + BeefyMmrLeaf::authority_set_proof() + } + + fn next_authority_set_proof() -> sp_consensus_beefy::mmr::BeefyNextAuthoritySet { + BeefyMmrLeaf::next_authority_set_proof() + } + } + + #[api_version(5)] + impl sp_consensus_beefy::BeefyApi for Runtime { + fn beefy_genesis() -> Option { + pallet_beefy::GenesisBlock::::get() + } + + fn validator_set() -> Option> { + Beefy::validator_set() + } + + fn submit_report_double_voting_unsigned_extrinsic( + equivocation_proof: sp_consensus_beefy::DoubleVotingProof< + BlockNumber, + BeefyId, + BeefySignature, + >, + key_owner_proof: sp_consensus_beefy::OpaqueKeyOwnershipProof, + ) -> Option<()> { + let key_owner_proof = key_owner_proof.decode()?; + + Beefy::submit_unsigned_double_voting_report( + equivocation_proof, + key_owner_proof, + ) + } + + fn submit_report_fork_voting_unsigned_extrinsic( + equivocation_proof: + sp_consensus_beefy::ForkVotingProof< + ::Header, + BeefyId, + sp_runtime::OpaqueValue + >, + key_owner_proof: sp_consensus_beefy::OpaqueKeyOwnershipProof, + ) -> Option<()> { + Beefy::submit_unsigned_fork_voting_report( + equivocation_proof.try_into()?, + key_owner_proof.decode()?, + ) + } + + fn submit_report_future_block_voting_unsigned_extrinsic( + equivocation_proof: sp_consensus_beefy::FutureBlockVotingProof, + key_owner_proof: sp_consensus_beefy::OpaqueKeyOwnershipProof, + ) -> Option<()> { + Beefy::submit_unsigned_future_block_voting_report( + equivocation_proof, + key_owner_proof.decode()?, + ) + } + + fn generate_key_ownership_proof( + _set_id: sp_consensus_beefy::ValidatorSetId, + authority_id: BeefyId, + ) -> Option { + Historical::prove((sp_consensus_beefy::KEY_TYPE, authority_id)) + .map(|p| p.encode()) + .map(sp_consensus_beefy::OpaqueKeyOwnershipProof::new) + } + + fn generate_ancestry_proof( + prev_block_number: BlockNumber, + best_known_block_number: Option, + ) -> Option { + use codec::Encode; + + BeefyMmrLeaf::generate_proof(prev_block_number, best_known_block_number) + .map(|p| p.encode()) + .map(sp_runtime::OpaqueValue::new) + } + } + + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { + System::account_nonce(account) + } + } + + impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi for Runtime { + fn query_info( + uxt: ::Extrinsic, + len: u32, + ) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo { + TransactionPayment::query_info(uxt, len) + } + fn query_fee_details( + uxt: ::Extrinsic, + len: u32, + ) -> pallet_transaction_payment::FeeDetails { + TransactionPayment::query_fee_details(uxt, len) + } + fn query_weight_to_fee(weight: Weight) -> Balance { + TransactionPayment::weight_to_fee(weight) + } + fn query_length_to_fee(length: u32) -> Balance { + TransactionPayment::length_to_fee(length) + } + } + + impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi + for Runtime + { + fn query_call_info( + call: RuntimeCall, + len: u32, + ) -> pallet_transaction_payment::RuntimeDispatchInfo { + TransactionPayment::query_call_info(call, len) + } + fn query_call_fee_details( + call: RuntimeCall, + len: u32, + ) -> pallet_transaction_payment::FeeDetails { + TransactionPayment::query_call_fee_details(call, len) + } + fn query_weight_to_fee(weight: Weight) -> Balance { + TransactionPayment::weight_to_fee(weight) + } + fn query_length_to_fee(length: u32) -> Balance { + TransactionPayment::length_to_fee(length) + } + } + + impl snowbridge_outbound_queue_v2_runtime_api::OutboundQueueV2Api for Runtime { + fn prove_message(leaf_index: u64) -> Option { + snowbridge_pallet_outbound_queue_v2::api::prove_message::(leaf_index) + } + } + + impl snowbridge_system_v2_runtime_api::ControlV2Api for Runtime { + fn agent_id(location: VersionedLocation) -> Option { + snowbridge_pallet_system_v2::api::agent_id::(location) + } + } + + #[cfg(feature = "runtime-benchmarks")] + impl frame_benchmarking::Benchmark for Runtime { + fn benchmark_metadata(extra: bool) -> ( + Vec, + Vec, + ) { + use frame_benchmarking::{baseline, Benchmarking, BenchmarkList}; + use frame_support::traits::StorageInfoTrait; + use frame_system_benchmarking::Pallet as SystemBench; + use baseline::Pallet as BaselineBench; + use super::*; + + let mut list = Vec::::new(); + list_benchmarks!(list, extra); + + let storage_info = AllPalletsWithSystem::storage_info(); + + (list, storage_info) + } + + #[expect(non_local_definitions)] + fn dispatch_benchmark( + config: frame_benchmarking::BenchmarkConfig + ) -> Result, alloc::string::String> { + use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch}; + use sp_storage::TrackedStorageKey; + use frame_system_benchmarking::Pallet as SystemBench; + use baseline::Pallet as BaselineBench; + use super::*; + + impl frame_system_benchmarking::Config for Runtime {} + impl baseline::Config for Runtime {} + + use frame_support::traits::WhitelistedStorageKeys; + let whitelist: Vec = AllPalletsWithSystem::whitelisted_storage_keys(); + + let mut batches = Vec::::new(); + let params = (&config, &whitelist); + add_benchmarks!(params, batches); + + Ok(batches) + } + } + + #[cfg(feature = "try-runtime")] + impl frame_try_runtime::TryRuntime for Runtime { + fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) { + // NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to + // have a backtrace here. If any of the pre/post migration checks fail, we shall stop + // right here and right now. + let weight = Executive::try_runtime_upgrade(checks).unwrap(); + (weight, super::configs::RuntimeBlockWeights::get().max_block) + } + + fn execute_block( + block: Block, + state_root_check: bool, + signature_check: bool, + select: frame_try_runtime::TryStateSelect + ) -> Weight { + // NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to + // have a backtrace here. + Executive::try_execute_block(block, state_root_check, signature_check, select).expect("execute-block failed") + } + } + + impl sp_genesis_builder::GenesisBuilder for Runtime { + fn build_state(config: Vec) -> sp_genesis_builder::Result { + build_state::(config) + } + + fn get_preset(id: &Option) -> Option> { + get_preset::(id, crate::genesis_config_presets::get_preset) + } + + fn preset_names() -> Vec { + crate::genesis_config_presets::preset_names() + } + } + + impl fp_rpc::EthereumRuntimeRPCApi for Runtime { + fn chain_id() -> u64 { + ::ChainId::get() + } + + fn account_basic(address: H160) -> EVMAccount { + let (account, _) = pallet_evm::Pallet::::account_basic(&address); + account + } + + fn gas_price() -> U256 { + let (gas_price, _) = ::FeeCalculator::min_gas_price(); + gas_price + } + + fn account_code_at(address: H160) -> Vec { + pallet_evm::AccountCodes::::get(address) + } + + fn author() -> H160 { + >::find_author() + } + + fn storage_at(address: H160, index: U256) -> H256 { + let tmp = index.to_big_endian(); + pallet_evm::AccountStorages::::get(address, H256::from_slice(&tmp[..])) + } + + fn call( + from: H160, + to: H160, + data: Vec, + value: U256, + gas_limit: U256, + max_fee_per_gas: Option, + max_priority_fee_per_gas: Option, + nonce: Option, + estimate: bool, + access_list: Option)>>, + ) -> Result { + let config = if estimate { + let mut config = ::config().clone(); + config.estimate = true; + Some(config) + } else { + None + }; + let is_transactional = false; + let validate = true; + + // Estimated encoded transaction size must be based on the heaviest transaction + // type (EIP1559Transaction) to be compatible with all transaction types. + let mut estimated_transaction_len = data.len() + + // pallet ethereum index: 1 + // transact call index: 1 + // Transaction enum variant: 1 + // chain_id 8 bytes + // nonce: 32 + // max_priority_fee_per_gas: 32 + // max_fee_per_gas: 32 + // gas_limit: 32 + // action: 21 (enum varianrt + call address) + // value: 32 + // access_list: 1 (empty vec size) + // 65 bytes signature + 258; + + if access_list.is_some() { + estimated_transaction_len += access_list.encoded_size(); + } + + let gas_limit = gas_limit.min(u64::MAX.into()).low_u64(); + let without_base_extrinsic_weight = true; + + let (weight_limit, proof_size_base_cost) = + match ::GasWeightMapping::gas_to_weight( + gas_limit, + without_base_extrinsic_weight + ) { + weight_limit if weight_limit.proof_size() > 0 => { + (Some(weight_limit), Some(estimated_transaction_len as u64)) + } + _ => (None, None), + }; + + ::Runner::call( + from, + to, + data, + value, + gas_limit, + max_fee_per_gas, + max_priority_fee_per_gas, + nonce, + access_list.unwrap_or_default(), + is_transactional, + validate, + weight_limit, + proof_size_base_cost, + config.as_ref().unwrap_or(::config()), + ).map_err(|err| err.error.into()) + } + + fn create( + from: H160, + data: Vec, + value: U256, + gas_limit: U256, + max_fee_per_gas: Option, + max_priority_fee_per_gas: Option, + nonce: Option, + estimate: bool, + access_list: Option)>>, + ) -> Result { + let config = if estimate { + let mut config = ::config().clone(); + config.estimate = true; + Some(config) + } else { + None + }; + let is_transactional = false; + let validate = true; + + let gas_limit = if gas_limit > U256::from(u64::MAX) { + u64::MAX + } else { + gas_limit.low_u64() + }; + + let (weight_limit, proof_size_base_cost) = (None, None); + + #[allow(clippy::or_fun_call)] + ::Runner::create( + from, + data, + value, + gas_limit, + max_fee_per_gas, + max_priority_fee_per_gas, + nonce, + access_list.unwrap_or_default(), + is_transactional, + validate, + weight_limit, + proof_size_base_cost, + config.as_ref().unwrap_or(::config()), + ).map_err(|err| err.error.into()) + } + + fn current_transaction_statuses() -> Option> { + pallet_ethereum::CurrentTransactionStatuses::::get() + } + + fn current_block() -> Option { + pallet_ethereum::CurrentBlock::::get() + } + + fn current_receipts() -> Option> { + pallet_ethereum::CurrentReceipts::::get() + } + + fn current_all() -> ( + Option, + Option>, + Option>, + ) { + ( + pallet_ethereum::CurrentBlock::::get(), + pallet_ethereum::CurrentReceipts::::get(), + pallet_ethereum::CurrentTransactionStatuses::::get() + ) + } + + fn extrinsic_filter( + xts: Vec<::Extrinsic>, + ) -> Vec { + xts.into_iter().filter_map(|xt| match xt.0.function { + RuntimeCall::Ethereum(transact { transaction }) => Some(transaction), + _ => None + }).collect::>() + } + + fn elasticity() -> Option { + None + } + + fn gas_limit_multiplier_support() {} + + fn pending_block( + xts: Vec<::Extrinsic>, + ) -> (Option, Option>) { + for ext in xts.into_iter() { + let _ = Executive::apply_extrinsic(ext); + } + + Ethereum::on_finalize(System::block_number() + 1); + + ( + pallet_ethereum::CurrentBlock::::get(), + pallet_ethereum::CurrentTransactionStatuses::::get() + ) + } + + fn initialize_pending_block(header: &::Header) { + Executive::initialize_block(header); + } + } + + impl fp_rpc::ConvertTransactionRuntimeApi for Runtime { + fn convert_transaction(transaction: EthereumTransaction) -> ::Extrinsic { + UncheckedExtrinsic::new_bare( + pallet_ethereum::Call::::transact { transaction }.into(), + ) + } + } +} diff --git a/operator/runtime/stagenet/src/benchmarks.rs b/operator/runtime/stagenet/src/benchmarks.rs new file mode 100644 index 00000000..1803158c --- /dev/null +++ b/operator/runtime/stagenet/src/benchmarks.rs @@ -0,0 +1,38 @@ +// This is free and unencumbered software released into the public domain. +// +// Anyone is free to copy, modify, publish, use, compile, sell, or +// distribute this software, either in source code form or as a compiled +// binary, for any purpose, commercial or non-commercial, and by any +// means. +// +// In jurisdictions that recognize copyright laws, the author or authors +// of this software dedicate any and all copyright interest in the +// software to the public domain. We make this dedication for the benefit +// of the public at large and to the detriment of our heirs and +// successors. We intend this dedication to be an overt act of +// relinquishment in perpetuity of all present and future rights to this +// software under copyright law. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +// For more information, please refer to + +frame_benchmarking::define_benchmarks!( + [frame_benchmarking, BaselineBench::] + [frame_system, SystemBench::] + [pallet_balances, Balances] + [pallet_identity, Identity] + [pallet_im_online, ImOnline] + [pallet_multisig, Multisig] + [pallet_preimage, Preimage] + [pallet_scheduler, Scheduler] + [pallet_timestamp, Timestamp] + [pallet_utility, Utility] + [pallet_sudo, Sudo] +); diff --git a/operator/runtime/stagenet/src/configs/mod.rs b/operator/runtime/stagenet/src/configs/mod.rs new file mode 100644 index 00000000..e685d8bd --- /dev/null +++ b/operator/runtime/stagenet/src/configs/mod.rs @@ -0,0 +1,874 @@ +// This is free and unencumbered software released into the public domain. +// +// Anyone is free to copy, modify, publish, use, compile, sell, or +// distribute this software, either in source code form or as a compiled +// binary, for any purpose, commercial or non-commercial, and by any +// means. +// +// In jurisdictions that recognize copyright laws, the author or authors +// of this software dedicate any and all copyright interest in the +// software to the public domain. We make this dedication for the benefit +// of the public at large and to the detriment of our heirs and +// successors. We intend this dedication to be an overt act of +// relinquishment in perpetuity of all present and future rights to this +// software under copyright law. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +// For more information, please refer to + +mod runtime_params; + +use super::{ + deposit, AccountId, Babe, Balance, Balances, BeefyMmrLeaf, Block, BlockNumber, + EthereumBeaconClient, EvmChainId, Hash, Historical, ImOnline, MessageQueue, Nonce, Offences, + OriginCaller, OutboundCommitmentStore, OutboundQueueV2, PalletInfo, Preimage, Runtime, + RuntimeCall, RuntimeEvent, RuntimeFreezeReason, RuntimeHoldReason, RuntimeOrigin, RuntimeTask, + Session, SessionKeys, Signature, System, Timestamp, ValidatorSet, EXISTENTIAL_DEPOSIT, + SLOT_DURATION, STORAGE_BYTE_FEE, SUPPLY_FACTOR, UNIT, VERSION, +}; +use codec::{Decode, Encode}; +use datahaven_runtime_common::{ + gas::WEIGHT_PER_GAS, + time::{EpochDurationInBlocks, DAYS, MILLISECS_PER_BLOCK, MINUTES}, +}; +use dhp_bridge::EigenLayerMessageProcessor; +use frame_support::{ + derive_impl, + pallet_prelude::TransactionPriority, + parameter_types, + traits::{ + fungible::{Balanced, Credit, HoldConsideration, Inspect}, + ConstU128, ConstU32, ConstU64, ConstU8, EqualPrivilegeOnly, FindAuthor, + KeyOwnerProofSystem, LinearStoragePrice, OnUnbalanced, VariantCountOf, + }, + weights::{ + constants::{RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND}, + IdentityFee, RuntimeDbWeight, Weight, + }, +}; +use frame_system::{ + limits::{BlockLength, BlockWeights}, + EnsureRoot, EnsureRootWithSuccess, +}; +use pallet_ethereum::PostLogContent; +use pallet_evm::{ + EVMFungibleAdapter, EnsureAddressNever, EnsureAddressRoot, FeeCalculator, + FrameSystemAccountProvider, IdentityAddressMapping, + OnChargeEVMTransaction as OnChargeEVMTransactionT, +}; +use pallet_grandpa::AuthorityId as GrandpaId; +use pallet_im_online::sr25519::AuthorityId as ImOnlineId; +use pallet_transaction_payment::{ + ConstFeeMultiplier, FungibleAdapter, Multiplier, Pallet as TransactionPayment, +}; +use polkadot_primitives::Moment; +use runtime_params::RuntimeParameters; +use snowbridge_beacon_primitives::{Fork, ForkVersions}; +use snowbridge_core::{gwei, meth, AgentIdOf, PricingParameters, Rewards}; +use snowbridge_inbound_queue_primitives::RewardLedger; +use snowbridge_outbound_queue_primitives::{ + v1::{Fee, Message, SendMessage}, + v2::ConstantGasMeter, + SendError, SendMessageFeeProvider, +}; +use snowbridge_pallet_outbound_queue_v2::OnNewCommitment; +use snowbridge_pallet_system::BalanceOf; +use sp_consensus_beefy::{ + ecdsa_crypto::AuthorityId as BeefyId, + mmr::{BeefyDataProvider, MmrLeafVersion}, +}; +use sp_core::{crypto::KeyTypeId, Get, H160, H256, U256}; +use sp_runtime::FixedU128; +use sp_runtime::{ + traits::{ConvertInto, IdentityLookup, Keccak256, One, OpaqueKeys, UniqueSaturatedInto}, + FixedPointNumber, Perbill, +}; +use sp_staking::{EraIndex, SessionIndex}; +use sp_std::{ + convert::{From, Into}, + prelude::*, +}; +use sp_version::RuntimeVersion; +use xcm::latest::NetworkId; +use xcm::prelude::*; + +#[cfg(feature = "runtime-benchmarks")] +use bridge_hub_common::AggregateMessageOrigin; + +const EVM_CHAIN_ID: u64 = 1283; +const SS58_FORMAT: u16 = EVM_CHAIN_ID as u16; + +// TODO: We need to define what do we want here as max PoV size +pub const MAX_POV_SIZE: u64 = 5 * 1024 * 1024; + +// Todo: import all currency constants from moonbeam +pub const WEIGHT_FEE: Balance = 50_000 / 4; + +pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND, u64::MAX) + .saturating_mul(2) + .set_proof_size(MAX_POV_SIZE); + +const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); + +//╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗ +//║ COMMON PARAMETERS ║ +//╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝ + +parameter_types! { + pub const MaxAuthorities: u32 = 32; + pub const BondingDuration: EraIndex = polkadot_runtime_common::prod_or_fast!(28, 3); + pub const SessionsPerEra: SessionIndex = polkadot_runtime_common::prod_or_fast!(6, 1); +} + +//╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗ +//║ SYSTEM AND CONSENSUS PALLETS ║ +//╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝ + +parameter_types! { + pub const BlockHashCount: BlockNumber = 2400; + pub const Version: RuntimeVersion = VERSION; + + /// We allow for 2 seconds of compute with a 6 second average block time. + pub RuntimeBlockWeights: BlockWeights = BlockWeights::with_sensible_defaults( + Weight::from_parts(2u64 * WEIGHT_REF_TIME_PER_SECOND, u64::MAX), + NORMAL_DISPATCH_RATIO, + ); + pub RuntimeBlockLength: BlockLength = BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO); + pub const SS58Prefix: u16 = SS58_FORMAT; +} + +/// The default types are being injected by [`derive_impl`](`frame_support::derive_impl`) from +/// [`SoloChainDefaultConfig`](`struct@frame_system::config_preludes::SolochainDefaultConfig`), +/// but overridden as needed. +#[derive_impl(frame_system::config_preludes::SolochainDefaultConfig)] +impl frame_system::Config for Runtime { + /// The block type for the runtime. + type Block = Block; + /// Block & extrinsics weights: base values and limits. + type BlockWeights = RuntimeBlockWeights; + /// The maximum length of a block (in bytes). + type BlockLength = RuntimeBlockLength; + /// The identifier used to distinguish between accounts. + type AccountId = AccountId; + /// The lookup mechanism to get account ID from whatever is passed in dispatchers. + type Lookup = IdentityLookup; + /// The type for storing how many extrinsics an account has signed. + type Nonce = Nonce; + /// The type for hashing blocks and tries. + type Hash = Hash; + /// Maximum number of block number to block hash mappings to keep (oldest pruned first). + type BlockHashCount = BlockHashCount; + /// The weight of database operations that the runtime can invoke. + type DbWeight = RocksDbWeight; + /// Version of the runtime. + type Version = Version; + /// The data to be stored in an account. + type AccountData = pallet_balances::AccountData; + /// This is used as an identifier of the chain. 42 is the generic substrate prefix. + type SS58Prefix = SS58Prefix; + type MaxConsumers = frame_support::traits::ConstU32<16>; +} + +// 1 in 4 blocks (on average, not counting collisions) will be primary babe blocks. +pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4); +/// The BABE epoch configuration at genesis. +pub const BABE_GENESIS_EPOCH_CONFIG: sp_consensus_babe::BabeEpochConfiguration = + sp_consensus_babe::BabeEpochConfiguration { + c: PRIMARY_PROBABILITY, + allowed_slots: sp_consensus_babe::AllowedSlots::PrimaryAndSecondaryVRFSlots, + }; + +parameter_types! { + pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK; + pub ReportLongevity: u64 = + BondingDuration::get() as u64 * SessionsPerEra::get() as u64 * (EpochDurationInBlocks::get() as u64); +} + +impl pallet_babe::Config for Runtime { + type EpochDuration = EpochDurationInBlocks; + type ExpectedBlockTime = ExpectedBlockTime; + type EpochChangeTrigger = pallet_babe::ExternalTrigger; + type DisabledValidators = Session; + type WeightInfo = (); + type MaxAuthorities = MaxAuthorities; + type MaxNominators = ConstU32<0>; + + type KeyOwnerProof = + >::Proof; + + type EquivocationReportSystem = + pallet_babe::EquivocationReportSystem; +} + +impl pallet_timestamp::Config for Runtime { + /// A timestamp: milliseconds since the unix epoch. + type Moment = u64; + type OnTimestampSet = Babe; + type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; + type WeightInfo = (); +} + +impl pallet_balances::Config for Runtime { + type MaxLocks = ConstU32<50>; + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + /// The type for recording an account's balance. + type Balance = Balance; + /// The ubiquitous event type. + type RuntimeEvent = RuntimeEvent; + type DustRemoval = (); + type ExistentialDeposit = ConstU128; + type AccountStore = System; + type WeightInfo = pallet_balances::weights::SubstrateWeight; + type FreezeIdentifier = RuntimeFreezeReason; + type MaxFreezes = VariantCountOf; + type RuntimeHoldReason = RuntimeHoldReason; + type RuntimeFreezeReason = RuntimeFreezeReason; + type DoneSlashHandler = (); +} + +impl pallet_authorship::Config for Runtime { + type FindAuthor = pallet_session::FindAccountFromAuthorIndex; + type EventHandler = ImOnline; +} + +impl pallet_offences::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type IdentificationTuple = pallet_session::historical::IdentificationTuple; + type OnOffenceHandler = ValidatorSet; +} + +impl pallet_session::historical::Config for Runtime { + type FullIdentification = Self::ValidatorId; + type FullIdentificationOf = Self::ValidatorIdOf; +} + +impl pallet_session::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type ValidatorId = AccountId; + type ValidatorIdOf = ConvertInto; + type ShouldEndSession = Babe; + type NextSessionRotation = Babe; + type SessionManager = pallet_session::historical::NoteHistoricalRoot; + type SessionHandler = ::KeyTypeIdProviders; + type Keys = SessionKeys; + type WeightInfo = pallet_session::weights::SubstrateWeight; +} + +parameter_types! { + pub const SetKeysCooldownBlocks: BlockNumber = 5 * MINUTES; +} + +impl pallet_validator_set::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type AddRemoveOrigin = EnsureRoot; + type MaxAuthorities = MaxAuthorities; + type SetKeysCooldownBlocks = SetKeysCooldownBlocks; + type WeightInfo = pallet_validator_set::weights::SubstrateWeight; +} + +parameter_types! { + pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::MAX; +} + +impl pallet_im_online::Config for Runtime { + type AuthorityId = ImOnlineId; + type MaxKeys = MaxAuthorities; + type MaxPeerInHeartbeats = ConstU32<0>; // Not used any more + type RuntimeEvent = RuntimeEvent; + type ValidatorSet = Historical; + type NextSessionRotation = Babe; + type ReportUnresponsiveness = Offences; + type UnsignedPriority = ImOnlineUnsignedPriority; + type WeightInfo = (); +} + +parameter_types! { + pub const EquivocationReportPeriodInEpochs: u64 = 168; + pub const EquivocationReportPeriodInBlocks: u64 = + EquivocationReportPeriodInEpochs::get() * (EpochDurationInBlocks::get() as u64); + pub const MaxSetIdSessionEntries: u32 = BondingDuration::get() * SessionsPerEra::get(); +} + +impl pallet_grandpa::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + + type WeightInfo = (); + type MaxAuthorities = MaxAuthorities; + type MaxNominators = ConstU32<0>; + type MaxSetIdSessionEntries = MaxSetIdSessionEntries; + + type KeyOwnerProof = >::Proof; + type EquivocationReportSystem = pallet_grandpa::EquivocationReportSystem< + Self, + Offences, + Historical, + EquivocationReportPeriodInBlocks, + >; +} + +parameter_types! { + pub FeeMultiplier: Multiplier = Multiplier::one(); +} + +impl pallet_transaction_payment::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type OnChargeTransaction = FungibleAdapter; + type OperationalFeeMultiplier = ConstU8<5>; + type WeightToFee = IdentityFee; + type LengthToFee = IdentityFee; + type FeeMultiplierUpdate = ConstFeeMultiplier; + type WeightInfo = (); +} + +parameter_types! { + pub const BeefySetIdSessionEntries: u32 = BondingDuration::get() * SessionsPerEra::get(); +} + +impl pallet_beefy::Config for Runtime { + type BeefyId = BeefyId; + type MaxAuthorities = ConstU32<32>; + type MaxNominators = ConstU32<0>; + type MaxSetIdSessionEntries = BeefySetIdSessionEntries; + type OnNewValidatorSet = BeefyMmrLeaf; + type AncestryHelper = BeefyMmrLeaf; + type WeightInfo = (); + type KeyOwnerProof = >::Proof; + type EquivocationReportSystem = (); +} + +parameter_types! { + pub LeafVersion: MmrLeafVersion = MmrLeafVersion::new(0, 0); +} + +#[derive(Debug, PartialEq, Eq, Clone, Encode, Decode)] +pub struct LeafExtraData { + extra: H256, +} + +pub struct LeafExtraDataProvider; +impl BeefyDataProvider for LeafExtraDataProvider { + fn extra_data() -> LeafExtraData { + LeafExtraData { + extra: OutboundCommitmentStore::get_latest_commitment().unwrap_or_default(), + } + } +} + +impl pallet_mmr::Config for Runtime { + const INDEXING_PREFIX: &'static [u8] = pallet_mmr::primitives::INDEXING_PREFIX; + type Hashing = Keccak256; + type LeafData = pallet_beefy_mmr::Pallet; + type OnNewRoot = pallet_beefy_mmr::DepositBeefyDigest; + type WeightInfo = (); + type BlockHashProvider = pallet_mmr::DefaultBlockHashProvider; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); +} + +impl pallet_beefy_mmr::Config for Runtime { + type LeafVersion = LeafVersion; + type BeefyAuthorityToMerkleLeaf = pallet_beefy_mmr::BeefyEcdsaToEthereum; + type LeafExtra = LeafExtraData; + type BeefyDataProvider = LeafExtraDataProvider; + type WeightInfo = (); +} + +//╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗ +//║ POLKADOT SDK UTILITY PALLETS ║ +//╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝ + +impl pallet_utility::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type PalletsOrigin = OriginCaller; + type WeightInfo = (); +} + +parameter_types! { + pub MaximumSchedulerWeight: Weight = NORMAL_DISPATCH_RATIO * RuntimeBlockWeights::get().max_block; + pub const NoPreimagePostponement: Option = Some(10); +} + +impl pallet_scheduler::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type PalletsOrigin = OriginCaller; + type RuntimeCall = RuntimeCall; + type MaximumWeight = MaximumSchedulerWeight; + type ScheduleOrigin = EnsureRoot; + type MaxScheduledPerBlock = ConstU32<50>; + type OriginPrivilegeCmp = EqualPrivilegeOnly; + type Preimages = Preimage; + type WeightInfo = (); +} + +parameter_types! { + pub const PreimageBaseDeposit: Balance = 5 * UNIT * SUPPLY_FACTOR ; + pub const PreimageByteDeposit: Balance = STORAGE_BYTE_FEE; + pub const PreimageHoldReason: RuntimeHoldReason = + RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage); +} + +impl pallet_preimage::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type ManagerOrigin = EnsureRoot; + type Consideration = HoldConsideration< + AccountId, + Balances, + PreimageHoldReason, + LinearStoragePrice, + >; + type WeightInfo = (); +} + +parameter_types! { + pub const MaxSubAccounts: u32 = 100; + pub const MaxAdditionalFields: u32 = 100; + pub const MaxRegistrars: u32 = 20; + pub const PendingUsernameExpiration: u32 = 7 * DAYS; + pub const MaxSuffixLength: u32 = 7; + pub const MaxUsernameLength: u32 = 32; +} + +type IdentityForceOrigin = EnsureRoot; +type IdentityRegistrarOrigin = EnsureRoot; +// TODO: Add governance origin when available +// type IdentityForceOrigin = +// EitherOfDiverse, governance::custom_origins::GeneralAdmin>; +// type IdentityRegistrarOrigin = +// EitherOfDiverse, governance::custom_origins::GeneralAdmin>; + +impl pallet_identity::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + // Add one item in storage and take 258 bytes + type BasicDeposit = ConstU128<{ deposit(1, 258) }>; + // Does not add any item to the storage but takes 1 bytes + type ByteDeposit = ConstU128<{ deposit(0, 1) }>; + // Add one item in storage and take 53 bytes + type SubAccountDeposit = ConstU128<{ deposit(1, 53) }>; + type MaxSubAccounts = MaxSubAccounts; + type IdentityInformation = pallet_identity::legacy::IdentityInfo; + type MaxRegistrars = MaxRegistrars; + type Slashed = (); + // TODO: Slashed funds should be sent to the treasury (when added to the runtime) + // type Slashed = Treasury; + type ForceOrigin = IdentityForceOrigin; + type RegistrarOrigin = IdentityRegistrarOrigin; + type OffchainSignature = Signature; + type SigningPublicKey = ::Signer; + type UsernameAuthorityOrigin = EnsureRoot; + type PendingUsernameExpiration = PendingUsernameExpiration; + type MaxSuffixLength = MaxSuffixLength; + type MaxUsernameLength = MaxUsernameLength; + type WeightInfo = (); + type UsernameDeposit = (); + type UsernameGracePeriod = (); +} + +parameter_types! { + // One storage item; key size is 32 + 20; value is size 4+4+16+20 bytes = 44 bytes. + pub const DepositBase: Balance = deposit(1, 96); + // Additional storage item size of 20 bytes. + pub const DepositFactor: Balance = deposit(0, 20); + pub const MaxSignatories: u32 = 100; +} + +impl pallet_multisig::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type Currency = Balances; + type DepositBase = DepositBase; + type DepositFactor = DepositFactor; + type MaxSignatories = MaxSignatories; + type WeightInfo = (); +} + +impl pallet_parameters::Config for Runtime { + type AdminOrigin = EnsureRoot; + type RuntimeEvent = RuntimeEvent; + type RuntimeParameters = RuntimeParameters; + type WeightInfo = (); +} + +impl pallet_sudo::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type WeightInfo = pallet_sudo::weights::SubstrateWeight; +} + +parameter_types! { + /// Amount of weight that can be spent per block to service messages. + /// + /// # WARNING + /// + /// This is not a good value for para-chains since the `Scheduler` already uses up to 80% block weight. + pub MessageQueueServiceWeight: Weight = Perbill::from_percent(20) * RuntimeBlockWeights::get().max_block; + pub const MessageQueueHeapSize: u32 = 32 * 1024; + pub const MessageQueueMaxStale: u32 = 96; +} + +impl pallet_message_queue::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + #[cfg(not(feature = "runtime-benchmarks"))] + type MessageProcessor = OutboundQueueV2; + #[cfg(feature = "runtime-benchmarks")] + type MessageProcessor = + pallet_message_queue::mock_helpers::NoopMessageProcessor; + type Size = u32; + type QueueChangeHandler = (); + type QueuePausedQuery = (); + type HeapSize = MessageQueueHeapSize; + type MaxStale = MessageQueueMaxStale; + type ServiceWeight = MessageQueueServiceWeight; + type IdleMaxServiceWeight = MessageQueueServiceWeight; + type WeightInfo = (); +} + +//╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗ +//║ FRONTIER (EVM) PALLETS ║ +//╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝ + +parameter_types! { + pub const PostBlockAndTxnHashes: PostLogContent = PostLogContent::BlockAndTxnHashes; +} + +impl pallet_ethereum::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type StateRoot = pallet_ethereum::IntermediateStateRoot; + type PostLogContent = PostBlockAndTxnHashes; + type ExtraDataLength = ConstU32<30>; +} + +// Ported from Moonbeam, please check for reference: https://github.com/moonbeam-foundation/moonbeam/pull/1765 +pub struct TransactionPaymentAsGasPrice; +impl FeeCalculator for TransactionPaymentAsGasPrice { + fn min_gas_price() -> (U256, Weight) { + // note: transaction-payment differs from EIP-1559 in that its tip and length fees are not + // scaled by the multiplier, which means its multiplier will be overstated when + // applied to an ethereum transaction + // note: transaction-payment uses both a congestion modifier (next_fee_multiplier, which is + // updated once per block in on_finalize) and a 'WeightToFee' implementation. Our + // runtime implements this as a 'ConstantModifier', so we can get away with a simple + // multiplication here. + let min_gas_price: u128 = TransactionPayment::::next_fee_multiplier() + .saturating_mul_int((WEIGHT_FEE).saturating_mul(WEIGHT_PER_GAS as u128)); + ( + min_gas_price.into(), + <::DbWeight as Get>::get().reads(1), + ) + } +} + +pub struct FindAuthorAdapter(core::marker::PhantomData); +impl FindAuthor for FindAuthorAdapter +where + T: frame_system::Config + pallet_session::Config, + ::ValidatorId: Into, +{ + fn find_author<'a, I>(digests: I) -> Option + where + I: 'a + IntoIterator, + { + pallet_session::FindAccountFromAuthorIndex::::find_author(digests) + .map(|author| author.into()) + } +} + +datahaven_runtime_common::impl_on_charge_evm_transaction!(); + +parameter_types! { + pub BlockGasLimit: U256 + = U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); + // pub PrecompilesValue: TemplatePrecompiles = TemplatePrecompiles::<_>::new(); + pub WeightPerGas: Weight = Weight::from_parts(WEIGHT_PER_GAS, 0); + pub SuicideQuickClearLimit: u32 = 0; + pub GasLimitPovSizeRatio: u32 = 16; + pub GasLimitStorageGrowthRatio: u64 = 366; +} + +impl pallet_evm::Config for Runtime { + type AccountProvider = FrameSystemAccountProvider; + type FeeCalculator = TransactionPaymentAsGasPrice; + type GasWeightMapping = pallet_evm::FixedGasWeightMapping; + type WeightPerGas = WeightPerGas; + type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping; + type CallOrigin = EnsureAddressRoot; + type WithdrawOrigin = EnsureAddressNever; + type AddressMapping = IdentityAddressMapping; + type Currency = Balances; + type RuntimeEvent = RuntimeEvent; + type PrecompilesType = (); + type PrecompilesValue = (); + type ChainId = EvmChainId; + type BlockGasLimit = BlockGasLimit; + type Runner = pallet_evm::runner::stack::Runner; + type OnChargeTransaction = OnChargeEVMTransaction<()>; + type OnCreate = (); + type FindAuthor = FindAuthorAdapter; + type GasLimitPovSizeRatio = GasLimitPovSizeRatio; + type GasLimitStorageGrowthRatio = (); + type Timestamp = Timestamp; + type WeightInfo = (); +} + +impl pallet_evm_chain_id::Config for Runtime {} + +//╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗ +//║ SNOWBRIDGE PALLETS ║ +//╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝ + +// --- Snowbridge Config Constants & Parameter Types --- +parameter_types! { + pub UniversalLocation: InteriorLocation = Here.into(); + pub InboundDeliveryCost: BalanceOf = 0; + pub RootLocation: Location = Location::here(); + pub Parameters: PricingParameters = PricingParameters { + exchange_rate: FixedU128::from_rational(1, 400), + fee_per_gas: gwei(20), + rewards: Rewards { local: 1 * UNIT, remote: meth(1) }, + multiplier: FixedU128::from_rational(1, 1), + }; + pub EthereumLocation: Location = Location::new(1, EthereumNetwork::get()); + pub TreasuryAccountId: AccountId = AccountId::from([0u8; 20]); +} + +pub struct DoNothingOutboundQueue; +impl SendMessage for DoNothingOutboundQueue { + type Ticket = (); + + fn validate( + _: &Message, + ) -> Result<(Self::Ticket, Fee<::Balance>), SendError> { + Ok(((), Fee::from((0, 0)))) + } + + fn deliver(_: Self::Ticket) -> Result { + Ok(H256::zero()) + } +} + +impl SendMessageFeeProvider for DoNothingOutboundQueue { + type Balance = u128; + + fn local_fee() -> Self::Balance { + 1 + } +} + +// Implement the Snowbridge System V1 config trait +impl snowbridge_pallet_system::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type OutboundQueue = DoNothingOutboundQueue; + type SiblingOrigin = EnsureRootWithSuccess; + type AgentIdOf = AgentIdOf; + type Token = Balances; + type TreasuryAccount = TreasuryAccountId; + type DefaultPricingParameters = Parameters; + type InboundDeliveryCost = InboundDeliveryCost; + type WeightInfo = (); + type UniversalLocation = UniversalLocation; + type EthereumLocation = EthereumLocation; + #[cfg(feature = "runtime-benchmarks")] + type Helper = (); +} + +// Implement the Snowbridge System v2 config trait +impl snowbridge_pallet_system_v2::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type OutboundQueue = OutboundQueueV2; + type FrontendOrigin = EnsureRootWithSuccess; + type GovernanceOrigin = EnsureRootWithSuccess; + type WeightInfo = (); + #[cfg(feature = "runtime-benchmarks")] + type Helper = (); +} + +// For tests, benchmarks and fast-runtime configurations we use the mocked fork versions +#[cfg(any( + feature = "std", + feature = "fast-runtime", + feature = "runtime-benchmarks", + test +))] +parameter_types! { + pub const ChainForkVersions: ForkVersions = ForkVersions { + genesis: Fork { + version: [0, 0, 0, 0], // 0x00000000 + epoch: 0, + }, + altair: Fork { + version: [1, 0, 0, 0], // 0x01000000 + epoch: 0, + }, + bellatrix: Fork { + version: [2, 0, 0, 0], // 0x02000000 + epoch: 0, + }, + capella: Fork { + version: [3, 0, 0, 0], // 0x03000000 + epoch: 0, + }, + deneb: Fork { + version: [4, 0, 0, 0], // 0x04000000 + epoch: 0, + }, + electra: Fork { + version: [5, 0, 0, 0], // 0x05000000 + epoch: 0, + }, + }; +} + +// Holesky: https://github.com/eth-clients/holesky +// Fork versions: https://github.com/eth-clients/holesky/blob/main/metadata/config.yaml +#[cfg(not(any( + feature = "std", + feature = "fast-runtime", + feature = "runtime-benchmarks", + test +)))] +parameter_types! { + pub const ChainForkVersions: ForkVersions = ForkVersions { + genesis: Fork { + version: hex_literal::hex!("01017000"), // 0x01017000 + epoch: 0, + }, + altair: Fork { + version: hex_literal::hex!("02017000"), // 0x02017000 + epoch: 0, + }, + bellatrix: Fork { + version: hex_literal::hex!("03017000"), // 0x03017000 + epoch: 0, + }, + capella: Fork { + version: hex_literal::hex!("04017000"), // 0x04017000 + epoch: 256, + }, + deneb: Fork { + version: hex_literal::hex!("05017000"), // 0x05017000 + epoch: 29696, + }, + electra: Fork { + version: hex_literal::hex!("06017000"), // 0x06017000 + epoch: 115968, + }, + }; +} + +impl snowbridge_pallet_ethereum_client::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type ForkVersions = ChainForkVersions; + type FreeHeadersInterval = (); + type WeightInfo = (); +} + +parameter_types! { + pub DefaultRewardKind: () = (); +} + +// Dummy RewardPayment implementation +pub struct DummyRewardPayment; +impl RewardLedger for DummyRewardPayment { + fn register_reward(_who: &AccountId, _reward: (), _amount: u128) { + // Empty implementation for dummy struct + } +} + +impl snowbridge_pallet_inbound_queue_v2::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Verifier = EthereumBeaconClient; + type GatewayAddress = runtime_params::dynamic_params::runtime_config::EthereumGatewayAddress; + type MessageProcessor = EigenLayerMessageProcessor; + type RewardKind = (); + type DefaultRewardKind = DefaultRewardKind; + type RewardPayment = DummyRewardPayment; + type WeightInfo = (); + #[cfg(feature = "runtime-benchmarks")] + type Helper = Runtime; +} + +parameter_types! { + /// Network and location for the Ethereum chain. + /// Using the Sepolia Ethereum testnet, with chain ID 11155111. + /// + /// + pub EthereumNetwork: NetworkId = NetworkId::Ethereum { chain_id: 11155111 }; +} + +pub struct CommitmentHandler; +impl OnNewCommitment for CommitmentHandler { + fn on_new_commitment(commitment: H256) { + OutboundCommitmentStore::store_commitment(commitment); + } +} + +impl snowbridge_pallet_outbound_queue_v2::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Hashing = Keccak256; + type MessageQueue = MessageQueue; + type GasMeter = ConstantGasMeter; + type Balance = Balance; + type MaxMessagePayloadSize = ConstU32<2048>; + type MaxMessagesPerBlock = ConstU32<32>; + type OnNewCommitment = CommitmentHandler; + type WeightToFee = IdentityFee; + type WeightInfo = (); + type Verifier = EthereumBeaconClient; + type GatewayAddress = runtime_params::dynamic_params::runtime_config::EthereumGatewayAddress; + type RewardKind = (); + type DefaultRewardKind = DefaultRewardKind; + type RewardPayment = DummyRewardPayment; + type EthereumNetwork = EthereumNetwork; + type ConvertAssetId = (); +} + +//╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗ +//║ STORAGEHUB PALLETS ║ +//╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝ + +//╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗ +//║ DATAHAVEN-SPECIFIC PALLETS ║ +//╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝ + +#[cfg(feature = "runtime-benchmarks")] +pub mod benchmark_helpers { + use crate::RuntimeOrigin; + use crate::{EthereumBeaconClient, Runtime}; + use snowbridge_beacon_primitives::BeaconHeader; + use snowbridge_pallet_inbound_queue_v2::BenchmarkHelper as InboundQueueBenchmarkHelperV2; + use sp_core::H256; + use xcm::opaque::latest::Location; + + impl InboundQueueBenchmarkHelperV2 for Runtime { + fn initialize_storage(beacon_header: BeaconHeader, block_roots_root: H256) { + EthereumBeaconClient::store_finalized_header(beacon_header, block_roots_root).unwrap(); + } + } + + impl snowbridge_pallet_system::BenchmarkHelper for () { + fn make_xcm_origin(_location: Location) -> RuntimeOrigin { + RuntimeOrigin::root() + } + } + + impl snowbridge_pallet_system_v2::BenchmarkHelper for () { + fn make_xcm_origin(_location: Location) -> RuntimeOrigin { + RuntimeOrigin::root() + } + } +} + +impl pallet_outbound_commitment_store::Config for Runtime { + type RuntimeEvent = RuntimeEvent; +} diff --git a/operator/runtime/stagenet/src/configs/runtime_params.rs b/operator/runtime/stagenet/src/configs/runtime_params.rs new file mode 100644 index 00000000..a8b7ace8 --- /dev/null +++ b/operator/runtime/stagenet/src/configs/runtime_params.rs @@ -0,0 +1,34 @@ +use frame_support::dynamic_params::{dynamic_pallet_params, dynamic_params}; +use sp_core::H160; + +use crate::Runtime; + +#[dynamic_params(RuntimeParameters, pallet_parameters::Parameters::)] +pub mod dynamic_params { + use super::*; + #[dynamic_pallet_params] + #[codec(index = 0)] + pub mod runtime_config { + + use super::*; + + #[codec(index = 0)] + #[allow(non_upper_case_globals)] + /// Set the initial address of the Snowbridge Gateway contract on Ethereum. + /// The fact that this is a parameter means that we can set it initially to the zero address, + /// and then change it later via governance, to the actual address of the deployed contract. + pub static EthereumGatewayAddress: H160 = H160::repeat_byte(0x0); + } +} + +#[cfg(feature = "runtime-benchmarks")] +impl Default for RuntimeParameters { + fn default() -> Self { + RuntimeParameters::RuntimeConfig( + dynamic_params::runtime_config::Parameters::EthereumGatewayAddress( + dynamic_params::runtime_config::EthereumGatewayAddress, + Some(H160::repeat_byte(0x0)), + ), + ) + } +} diff --git a/operator/runtime/stagenet/src/genesis_config_presets.rs b/operator/runtime/stagenet/src/genesis_config_presets.rs new file mode 100644 index 00000000..ca29db3a --- /dev/null +++ b/operator/runtime/stagenet/src/genesis_config_presets.rs @@ -0,0 +1,220 @@ +use crate::{ + configs::BABE_GENESIS_EPOCH_CONFIG, AccountId, BalancesConfig, RuntimeGenesisConfig, + SessionKeys, Signature, SudoConfig, +}; +use alloc::{format, vec, vec::Vec}; +use hex_literal::hex; +use pallet_im_online::sr25519::AuthorityId as ImOnlineId; +use serde_json::Value; +use sp_consensus_babe::AuthorityId as BabeId; +use sp_consensus_beefy::ecdsa_crypto::AuthorityId as BeefyId; +use sp_consensus_grandpa::AuthorityId as GrandpaId; +use sp_core::{ecdsa, Pair, Public}; +use sp_genesis_builder::{self, PresetId}; +use sp_runtime::traits::{IdentifyAccount, Verify}; + +const STAGENET_EVM_CHAIN_ID: u64 = 1283; + +// Returns the genesis config presets populated with given parameters. +fn testnet_genesis( + initial_authorities: Vec<(AccountId, BabeId, GrandpaId, ImOnlineId, BeefyId)>, + root_key: AccountId, + endowed_accounts: Vec, + evm_chain_id: u64, +) -> Value { + let config = RuntimeGenesisConfig { + balances: BalancesConfig { + balances: endowed_accounts + .iter() + .cloned() + .map(|k| (k, 1u128 << 110)) + .collect::>(), + }, + babe: pallet_babe::GenesisConfig { + epoch_config: BABE_GENESIS_EPOCH_CONFIG, + ..Default::default() + }, + evm_chain_id: pallet_evm_chain_id::GenesisConfig { + chain_id: evm_chain_id, + ..Default::default() + }, + session: pallet_session::GenesisConfig { + keys: initial_authorities + .iter() + .map(|(account, babe, grandpa, im_online, beefy)| { + ( + *account, + *account, + session_keys( + babe.clone(), + grandpa.clone(), + im_online.clone(), + beefy.clone(), + ), + ) + }) + .collect::>(), + ..Default::default() + }, + sudo: SudoConfig { + key: Some(root_key), + }, + validator_set: pallet_validator_set::GenesisConfig { + initial_validators: initial_authorities + .iter() + .map(|(account, ..)| *account) + .collect::>() + .try_into() + .expect("Too many initial authorities"), + }, + ..Default::default() + }; + + serde_json::to_value(config).expect("Could not build genesis config.") +} + +/// Return the development genesis config. +pub fn development_config_genesis() -> Value { + let mut endowed_accounts = pre_funded_accounts(); + endowed_accounts.sort(); + + testnet_genesis( + vec![authority_keys_from_seed("Alice")], + alith(), + endowed_accounts, + STAGENET_EVM_CHAIN_ID, + ) +} + +/// Return the local genesis config preset. +pub fn local_config_genesis() -> Value { + let mut endowed_accounts = pre_funded_accounts(); + endowed_accounts.sort(); + + testnet_genesis( + vec![ + authority_keys_from_seed("Alice"), + authority_keys_from_seed("Bob"), + authority_keys_from_seed("Charlie"), + authority_keys_from_seed("Dave"), + authority_keys_from_seed("Eve"), + authority_keys_from_seed("Ferdie"), + ], + alith(), + endowed_accounts, + STAGENET_EVM_CHAIN_ID, + ) +} + +/// Provides the JSON representation of predefined genesis config for given `id`. +pub fn get_preset(id: &PresetId) -> Option> { + let patch = match id.as_str() { + sp_genesis_builder::DEV_RUNTIME_PRESET => development_config_genesis(), + sp_genesis_builder::LOCAL_TESTNET_RUNTIME_PRESET => local_config_genesis(), + _ => return None, + }; + Some( + serde_json::to_string(&patch) + .expect("serialization to json is expected to work. qed.") + .into_bytes(), + ) +} + +/// List of supported presets. +pub fn preset_names() -> Vec { + vec![ + PresetId::from(sp_genesis_builder::DEV_RUNTIME_PRESET), + PresetId::from(sp_genesis_builder::LOCAL_TESTNET_RUNTIME_PRESET), + ] +} + +/// Generate a crypto pair from seed. +pub fn get_from_seed(seed: &str) -> ::Public { + TPublic::Pair::from_string(&format!("//{}", seed), None) + .expect("static values are valid; qed") + .public() +} + +fn session_keys( + babe: BabeId, + grandpa: GrandpaId, + im_online: ImOnlineId, + beefy: BeefyId, +) -> SessionKeys { + SessionKeys { + babe, + grandpa, + im_online, + beefy, + } +} + +type AccountPublic = ::Signer; + +/// Generate an account ID from seed. +pub fn get_account_id_from_seed(seed: &str) -> AccountId +where + AccountPublic: From<::Public>, +{ + AccountPublic::from(get_from_seed::(seed)).into_account() +} + +/// Generate a Babe authority key. +pub fn authority_keys_from_seed(s: &str) -> (AccountId, BabeId, GrandpaId, ImOnlineId, BeefyId) { + ( + get_account_id_from_seed::(s), + get_from_seed::(s), + get_from_seed::(s), + get_from_seed::(s), + get_from_seed::(s), + ) +} + +pub fn alith() -> AccountId { + AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")) +} + +pub fn baltathar() -> AccountId { + AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")) +} + +pub fn charleth() -> AccountId { + AccountId::from(hex!("798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc")) +} + +pub fn dorothy() -> AccountId { + AccountId::from(hex!("773539d4Ac0e786233D90A233654ccEE26a613D9")) +} + +pub fn ethan() -> AccountId { + AccountId::from(hex!("Ff64d3F6efE2317EE2807d2235B1ac2AA69d9E87")) +} + +pub fn frank() -> AccountId { + AccountId::from(hex!("C0F0f4ab324C46e55D02D0033343B4Be8A55532d")) +} + +pub fn beacon_relayer() -> AccountId { + AccountId::from(hex!("c46e141b5083721ad5f5056ba1cded69dce4a65f")) +} + +/// Get pre-funded accounts +pub fn pre_funded_accounts() -> Vec { + // These addresses are derived from Substrate's canonical mnemonic: + // bottom drive obey lake curtain smoke basket hold race lonely fit walk + vec![ + get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Charlie"), + get_account_id_from_seed::("Dave"), + get_account_id_from_seed::("Eve"), + get_account_id_from_seed::("Ferdie"), + alith(), + baltathar(), + charleth(), + dorothy(), + ethan(), + frank(), + beacon_relayer(), + ] +} diff --git a/operator/runtime/src/lib.rs b/operator/runtime/stagenet/src/lib.rs similarity index 91% rename from operator/runtime/src/lib.rs rename to operator/runtime/stagenet/src/lib.rs index a91b41fe..d96ab3e7 100644 --- a/operator/runtime/src/lib.rs +++ b/operator/runtime/stagenet/src/lib.rs @@ -12,15 +12,11 @@ mod benchmarks; pub mod configs; use alloc::{borrow::Cow, vec::Vec}; -use sp_runtime::{ - generic, impl_opaque_keys, - traits::{BlakeTwo256, IdentifyAccount, Verify}, -}; +use sp_runtime::{generic, impl_opaque_keys}; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; -use fp_account::EthereumSignature; pub use frame_system::Call as SystemCall; pub use pallet_balances::Call as BalancesCall; pub use pallet_timestamp::Call as TimestampCall; @@ -28,6 +24,10 @@ use sp_core::H160; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; +pub use datahaven_runtime_common::{ + AccountId, Address, Balance, BlockNumber, Hash, Header, Nonce, Signature, +}; + pub mod genesis_config_presets; /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know @@ -129,40 +129,9 @@ pub fn native_version() -> NativeVersion { } } -/// Alias to 512-bit hash when used in the context of a transaction signature on the chain. -pub type Signature = EthereumSignature; - -/// Some way of identifying an account on the chain. We intentionally make it equivalent -/// to the public key of our transaction signing scheme. -pub type AccountId = <::Signer as IdentifyAccount>::AccountId; - -/// Balance of an account. -pub type Balance = u128; - -/// Index of a transaction in the chain. -pub type Nonce = u32; - -/// A hash of some data used by the chain. -pub type Hash = sp_core::H256; - -/// An index to a block. -pub type BlockNumber = u32; - -/// The address format for describing accounts. -pub type Address = AccountId; - -/// Block header type as expected by this runtime. -pub type Header = generic::Header; - /// Block type as expected by this runtime. pub type Block = generic::Block; -/// A Block signed with a Justification -pub type SignedBlock = generic::SignedBlock; - -/// BlockId type as expected by this runtime. -pub type BlockId = generic::BlockId; - /// The SignedExtension to the basic transaction logic. pub type SignedExtra = ( frame_system::CheckNonZeroSender, diff --git a/operator/runtime/testnet/Cargo.toml b/operator/runtime/testnet/Cargo.toml new file mode 100644 index 00000000..deb002a8 --- /dev/null +++ b/operator/runtime/testnet/Cargo.toml @@ -0,0 +1,267 @@ +[package] +name = "datahaven-testnet-runtime" +description = "DataHaven Testnet runtime" +version = "0.1.0" +license = "Unlicense" +authors = { workspace = true } +homepage = { workspace = true } +repository = { workspace = true } +edition = { workspace = true } +publish = false + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +bridge-hub-common = { workspace = true, optional = true } +codec = { workspace = true, features = ["derive"] } +datahaven-runtime-common = { workspace = true } +dhp-bridge = { workspace = true } +fp-account = { workspace = true, features = ["serde"] } +fp-evm = { workspace = true, features = ["serde"] } +fp-rpc = { workspace = true } +fp-self-contained = { workspace = true, features = ["serde", "try-runtime"] } +frame-benchmarking = { workspace = true, optional = true } +frame-executive = { workspace = true } +frame-metadata-hash-extension = { workspace = true } +frame-support = { workspace = true, features = ["experimental"] } +frame-system = { workspace = true } +frame-system-benchmarking = { workspace = true, optional = true } +frame-system-rpc-runtime-api = { workspace = true } +frame-try-runtime = { workspace = true, optional = true } +hex = { workspace = true } +hex-literal = { workspace = true } +pallet-authorship = { workspace = true } +pallet-babe = { workspace = true } +pallet-balances = { workspace = true } +pallet-beefy = { workspace = true } +pallet-beefy-mmr = { workspace = true } +pallet-ethereum = { workspace = true } +pallet-evm = { workspace = true } +pallet-evm-chain-id = { workspace = true } +pallet-grandpa = { workspace = true } +pallet-identity = { workspace = true } +pallet-im-online = { workspace = true } +pallet-message-queue = { workspace = true } +pallet-mmr = { workspace = true } +pallet-multisig = { workspace = true } +pallet-offences = { workspace = true } +pallet-outbound-commitment-store = { workspace = true } +pallet-parameters = { workspace = true } +pallet-preimage = { workspace = true } +pallet-scheduler = { workspace = true } +pallet-session = { workspace = true } +pallet-sudo = { workspace = true } +pallet-timestamp = { workspace = true } +pallet-transaction-payment = { workspace = true } +pallet-transaction-payment-rpc-runtime-api = { workspace = true } +pallet-utility = { workspace = true } +pallet-validator-set = { workspace = true } +polkadot-primitives = { workspace = true } +polkadot-runtime-common = { workspace = true } +scale-info = { workspace = true, features = ["derive", "serde"] } +serde_json = { workspace = true, default-features = false, features = ["alloc"] } +snowbridge-beacon-primitives = { workspace = true } +snowbridge-core = { workspace = true } +snowbridge-inbound-queue-primitives = { workspace = true } +snowbridge-merkle-tree = { workspace = true } +snowbridge-outbound-queue-primitives = { workspace = true } +snowbridge-outbound-queue-v2-runtime-api = { workspace = true } +snowbridge-pallet-ethereum-client = { workspace = true } +snowbridge-pallet-inbound-queue-v2 = { workspace = true } +snowbridge-pallet-outbound-queue-v2 = { workspace = true } +snowbridge-pallet-system = { workspace = true } +snowbridge-pallet-system-v2 = { workspace = true } +snowbridge-system-v2-runtime-api = { workspace = true } +snowbridge-verification-primitives = { workspace = true } +sp-api = { workspace = true } +sp-block-builder = { workspace = true } +sp-consensus-babe = { workspace = true, features = ["serde"] } +sp-consensus-beefy = { workspace = true, features = ["serde"] } +sp-consensus-grandpa = { workspace = true, features = ["serde"] } +sp-core = { workspace = true, features = ["serde"] } +sp-genesis-builder = { workspace = true } +sp-inherents = { workspace = true } +sp-keyring = { workspace = true } +sp-offchain = { workspace = true } +sp-runtime = { workspace = true, features = ["serde"] } +sp-session = { workspace = true } +sp-staking = { workspace = true } +sp-std = { workspace = true } +sp-storage = { workspace = true } +sp-transaction-pool = { workspace = true } +sp-version = { workspace = true, features = ["serde"] } +xcm = { workspace = true } +xcm-builder = { workspace = true } +xcm-executor = { workspace = true } + +[build-dependencies] +substrate-wasm-builder = { workspace = true, optional = true, default-features = true } + +[features] +default = ["std"] +std = [ + "codec/std", + "datahaven-runtime-common/std", + "fp-account/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", + "frame-system/std", + "frame-try-runtime?/std", + "pallet-authorship/std", + "pallet-babe/std", + "pallet-balances/std", + "pallet-beefy-mmr/std", + "pallet-beefy/std", + "pallet-ethereum/std", + "pallet-evm-chain-id/std", + "pallet-evm/std", + "pallet-grandpa/std", + "pallet-identity/std", + "pallet-im-online/std", + "pallet-message-queue/std", + "pallet-mmr/std", + "pallet-multisig/std", + "pallet-offences/std", + "pallet-parameters/std", + "pallet-preimage/std", + "pallet-scheduler/std", + "pallet-session/std", + "pallet-sudo/std", + "pallet-timestamp/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-transaction-payment/std", + "pallet-utility/std", + "pallet-validator-set/std", + "polkadot-primitives/std", + "polkadot-runtime-common/std", + "scale-info/std", + "serde_json/std", + "snowbridge-beacon-primitives/std", + "snowbridge-inbound-queue-primitives/std", + "snowbridge-outbound-queue-primitives/std", + "snowbridge-pallet-ethereum-client/std", + "snowbridge-pallet-inbound-queue-v2/std", + "snowbridge-pallet-outbound-queue-v2/std", + "snowbridge-merkle-tree/std", + "snowbridge-outbound-queue-v2-runtime-api/std", + "snowbridge-pallet-system/std", + "snowbridge-pallet-system-v2/std", + "snowbridge-system-v2-runtime-api/std", + "dhp-bridge/std", + "snowbridge-verification-primitives/std", + "sp-api/std", + "sp-block-builder/std", + "sp-consensus-babe/std", + "sp-consensus-beefy/std", + "sp-consensus-grandpa/std", + "sp-core/std", + "sp-genesis-builder/std", + "sp-inherents/std", + "sp-keyring/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-session/std", + "sp-staking/std", + "sp-std/std", + "sp-storage/std", + "sp-transaction-pool/std", + "sp-version/std", + "substrate-wasm-builder", + "pallet-outbound-commitment-store/std", +] + +runtime-benchmarks = [ + "bridge-hub-common", + "datahaven-runtime-common/runtime-benchmarks", + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-beefy-mmr/runtime-benchmarks", + "pallet-ethereum/runtime-benchmarks", + "pallet-evm/runtime-benchmarks", + "pallet-grandpa/runtime-benchmarks", + "pallet-identity/runtime-benchmarks", + "pallet-im-online/runtime-benchmarks", + "pallet-message-queue/runtime-benchmarks", + "pallet-mmr/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-offences/runtime-benchmarks", + "pallet-parameters/runtime-benchmarks", + "pallet-preimage/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "pallet-sudo/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "polkadot-primitives/runtime-benchmarks", + "polkadot-runtime-common/runtime-benchmarks", + "snowbridge-inbound-queue-primitives/runtime-benchmarks", + "snowbridge-pallet-ethereum-client/runtime-benchmarks", + "snowbridge-pallet-inbound-queue-v2/runtime-benchmarks", + "snowbridge-pallet-system-v2/runtime-benchmarks", + "snowbridge-pallet-outbound-queue-v2/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "snowbridge-pallet-system/runtime-benchmarks", + "pallet-outbound-commitment-store/runtime-benchmarks", +] + +try-runtime = [ + "fp-self-contained/try-runtime", + "frame-executive/try-runtime", + "frame-support/try-runtime", + "frame-system/try-runtime", + "frame-try-runtime/try-runtime", + "pallet-authorship/try-runtime", + "pallet-babe/try-runtime", + "pallet-balances/try-runtime", + "pallet-beefy-mmr/try-runtime", + "pallet-beefy/try-runtime", + "pallet-ethereum/try-runtime", + "pallet-evm/try-runtime", + "pallet-grandpa/try-runtime", + "pallet-identity/try-runtime", + "pallet-im-online/try-runtime", + "pallet-message-queue/try-runtime", + "pallet-mmr/try-runtime", + "pallet-multisig/try-runtime", + "pallet-offences/try-runtime", + "pallet-parameters/try-runtime", + "pallet-preimage/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-session/try-runtime", + "pallet-sudo/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-transaction-payment/try-runtime", + "pallet-utility/try-runtime", + "polkadot-runtime-common/try-runtime", + "snowbridge-pallet-ethereum-client/try-runtime", + "snowbridge-pallet-inbound-queue-v2/try-runtime", + "snowbridge-pallet-system-v2/try-runtime", + "snowbridge-pallet-outbound-queue-v2/try-runtime", + "sp-runtime/try-runtime", + "snowbridge-pallet-system/try-runtime", + "pallet-outbound-commitment-store/try-runtime", +] + +fast-runtime = [ + "datahaven-runtime-common/fast-runtime", +] + +# Enable the metadata hash generation. +# +# This is hidden behind a feature because it increases the compile time. +# The wasm binary needs to be compiled twice, once to fetch the metadata, +# generate the metadata hash and then a second time with the +# `RUNTIME_METADATA_HASH` environment variable set for the `CheckMetadataHash` +# extension. +metadata-hash = ["substrate-wasm-builder/metadata-hash"] + +# A convenience feature for enabling things when doing a build +# for an on-chain release. +on-chain-release-build = ["metadata-hash", "sp-api/disable-logging"] diff --git a/operator/runtime/testnet/build.rs b/operator/runtime/testnet/build.rs new file mode 100644 index 00000000..138ae658 --- /dev/null +++ b/operator/runtime/testnet/build.rs @@ -0,0 +1,16 @@ +#[cfg(all(feature = "std", feature = "metadata-hash"))] +fn main() { + substrate_wasm_builder::WasmBuilder::init_with_defaults() + .enable_metadata_hash("UNIT", 12) + .build(); +} + +#[cfg(all(feature = "std", not(feature = "metadata-hash")))] +fn main() { + substrate_wasm_builder::WasmBuilder::build_using_defaults(); +} + +/// The wasm builder is deactivated when compiling +/// this crate for wasm to speed up the compilation. +#[cfg(not(feature = "std"))] +fn main() {} diff --git a/operator/runtime/testnet/src/apis.rs b/operator/runtime/testnet/src/apis.rs new file mode 100644 index 00000000..4487857b --- /dev/null +++ b/operator/runtime/testnet/src/apis.rs @@ -0,0 +1,800 @@ +// This is free and unencumbered software released into the public domain. +// +// Anyone is free to copy, modify, publish, use, compile, sell, or +// distribute this software, either in source code form or as a compiled +// binary, for any purpose, commercial or non-commercial, and by any +// means. +// +// In jurisdictions that recognize copyright laws, the author or authors +// of this software dedicate any and all copyright interest in the +// software to the public domain. We make this dedication for the benefit +// of the public at large and to the detriment of our heirs and +// successors. We intend this dedication to be an overt act of +// relinquishment in perpetuity of all present and future rights to this +// software under copyright law. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +// For more information, please refer to + +// Local module imports +use super::{ + AccountId, Babe, Balance, Beefy, BeefyMmrLeaf, Block, BlockNumber, Ethereum, Executive, + Grandpa, Historical, InherentDataExt, Mmr, Nonce, Runtime, RuntimeCall, RuntimeGenesisConfig, + RuntimeOrigin, SessionKeys, System, TransactionPayment, UncheckedExtrinsic, VERSION, +}; +// External crates imports +use crate::configs::BABE_GENESIS_EPOCH_CONFIG; +use alloc::vec::Vec; +use codec::Encode; +use datahaven_runtime_common::time::EpochDurationInBlocks; +use fp_rpc::TransactionStatus; +use frame_support::traits::OnFinalize; +use pallet_ethereum::Transaction as EthereumTransaction; +use pallet_evm::GasWeightMapping; + +use frame_support::traits::KeyOwnerProofSystem; +use frame_support::{ + genesis_builder_helper::{build_state, get_preset}, + weights::Weight, +}; +use pallet_ethereum::Call::transact; +use pallet_evm::Account as EVMAccount; +use pallet_evm::FeeCalculator; +use pallet_evm::Runner; +use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId}; +use polkadot_primitives::Hash; +use snowbridge_core::AgentId; +use sp_api::impl_runtime_apis; +use sp_consensus_beefy::{ + ecdsa_crypto::{AuthorityId as BeefyId, Signature as BeefySignature}, + AncestryHelper, +}; +use sp_core::{Get, H256, U256}; +use sp_core::{OpaqueMetadata, H160}; +use sp_runtime::traits::{DispatchInfoOf, Dispatchable, PostDispatchInfoOf}; +use sp_runtime::transaction_validity::TransactionValidityError; +use sp_runtime::{ + traits::Block as BlockT, + transaction_validity::{TransactionSource, TransactionValidity}, + ApplyExtrinsicResult, Permill, +}; +use sp_version::RuntimeVersion; +use xcm::VersionedLocation; +/// MMR helper types. +mod mmr { + use super::Runtime; + pub use pallet_mmr::primitives::*; + + pub type Leaf = <::LeafData as LeafDataProvider>::LeafData; + pub type Hashing = ::Hashing; + pub type Hash = ::Output; +} + +#[derive(Clone)] +pub struct TransactionConverter; + +impl fp_self_contained::SelfContainedCall for RuntimeCall { + type SignedInfo = H160; + + fn is_self_contained(&self) -> bool { + match self { + RuntimeCall::Ethereum(call) => call.is_self_contained(), + _ => false, + } + } + + fn check_self_contained(&self) -> Option> { + match self { + RuntimeCall::Ethereum(call) => call.check_self_contained(), + _ => None, + } + } + + fn validate_self_contained( + &self, + signed_info: &Self::SignedInfo, + dispatch_info: &DispatchInfoOf, + len: usize, + ) -> Option { + match self { + RuntimeCall::Ethereum(call) => { + call.validate_self_contained(signed_info, dispatch_info, len) + } + _ => None, + } + } + + fn pre_dispatch_self_contained( + &self, + info: &Self::SignedInfo, + dispatch_info: &DispatchInfoOf, + len: usize, + ) -> Option> { + match self { + RuntimeCall::Ethereum(call) => { + call.pre_dispatch_self_contained(info, dispatch_info, len) + } + _ => None, + } + } + + fn apply_self_contained( + self, + info: Self::SignedInfo, + ) -> Option>> { + match self { + call @ RuntimeCall::Ethereum(pallet_ethereum::Call::transact { .. }) => { + Some(call.dispatch(RuntimeOrigin::from( + pallet_ethereum::RawOrigin::EthereumTransaction(info), + ))) + } + _ => None, + } + } +} + +impl fp_rpc::ConvertTransaction for TransactionConverter { + fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic { + UncheckedExtrinsic::new_bare( + pallet_ethereum::Call::::transact { transaction }.into(), + ) + } +} + +impl_runtime_apis! { + impl sp_api::Core for Runtime { + fn version() -> RuntimeVersion { + VERSION + } + + fn execute_block(block: Block) { + Executive::execute_block(block); + } + + fn initialize_block(header: &::Header) -> sp_runtime::ExtrinsicInclusionMode { + Executive::initialize_block(header) + } + } + + impl sp_api::Metadata for Runtime { + fn metadata() -> OpaqueMetadata { + OpaqueMetadata::new(Runtime::metadata().into()) + } + + fn metadata_at_version(version: u32) -> Option { + Runtime::metadata_at_version(version) + } + + fn metadata_versions() -> Vec { + Runtime::metadata_versions() + } + } + + impl sp_block_builder::BlockBuilder for Runtime { + fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyExtrinsicResult { + Executive::apply_extrinsic(extrinsic) + } + + fn finalize_block() -> ::Header { + Executive::finalize_block() + } + + fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<::Extrinsic> { + data.create_extrinsics() + } + + fn check_inherents( + block: Block, + data: sp_inherents::InherentData, + ) -> sp_inherents::CheckInherentsResult { + data.check_extrinsics(&block) + } + } + + impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime { + fn validate_transaction( + source: TransactionSource, + tx: ::Extrinsic, + block_hash: ::Hash, + ) -> TransactionValidity { + Executive::validate_transaction(source, tx, block_hash) + } + } + + impl sp_offchain::OffchainWorkerApi for Runtime { + fn offchain_worker(header: &::Header) { + Executive::offchain_worker(header) + } + } + + impl sp_session::SessionKeys for Runtime { + fn generate_session_keys(seed: Option>) -> Vec { + SessionKeys::generate(seed) + } + + fn decode_session_keys( + encoded: Vec, + ) -> Option, sp_core::crypto::KeyTypeId)>> { + SessionKeys::decode_into_raw_public_keys(&encoded) + } + } + + impl sp_consensus_babe::BabeApi for Runtime { + fn configuration() -> sp_consensus_babe::BabeConfiguration { + let epoch_config = Babe::epoch_config().unwrap_or(BABE_GENESIS_EPOCH_CONFIG); + sp_consensus_babe::BabeConfiguration { + slot_duration: Babe::slot_duration(), + epoch_length: EpochDurationInBlocks::get().into(), + c: epoch_config.c, + authorities: Babe::authorities().to_vec(), + randomness: Babe::randomness(), + allowed_slots: epoch_config.allowed_slots, + } + } + + fn current_epoch_start() -> sp_consensus_babe::Slot { + Babe::current_epoch_start() + } + + fn current_epoch() -> sp_consensus_babe::Epoch { + Babe::current_epoch() + } + + fn next_epoch() -> sp_consensus_babe::Epoch { + Babe::next_epoch() + } + + fn generate_key_ownership_proof( + _slot: sp_consensus_babe::Slot, + authority_id: sp_consensus_babe::AuthorityId, + ) -> Option { + use codec::Encode; + + Historical::prove((sp_consensus_babe::KEY_TYPE, authority_id)) + .map(|p| p.encode()) + .map(sp_consensus_babe::OpaqueKeyOwnershipProof::new) + } + + fn submit_report_equivocation_unsigned_extrinsic( + equivocation_proof: sp_consensus_babe::EquivocationProof<::Header>, + key_owner_proof: sp_consensus_babe::OpaqueKeyOwnershipProof, + ) -> Option<()> { + let key_owner_proof = key_owner_proof.decode()?; + + Babe::submit_unsigned_equivocation_report( + equivocation_proof, + key_owner_proof, + ) + } + } + + impl sp_consensus_grandpa::GrandpaApi for Runtime { + fn grandpa_authorities() -> Vec<(GrandpaId, u64)> { + Grandpa::grandpa_authorities() + } + + fn current_set_id() -> fg_primitives::SetId { + Grandpa::current_set_id() + } + + fn submit_report_equivocation_unsigned_extrinsic( + equivocation_proof: fg_primitives::EquivocationProof< + ::Hash, + sp_runtime::traits::NumberFor, + >, + key_owner_proof: fg_primitives::OpaqueKeyOwnershipProof, + ) -> Option<()> { + let key_owner_proof = key_owner_proof.decode()?; + + Grandpa::submit_unsigned_equivocation_report( + equivocation_proof, + key_owner_proof, + ) + } + + fn generate_key_ownership_proof( + _set_id: fg_primitives::SetId, + authority_id: fg_primitives::AuthorityId, + ) -> Option { + + Historical::prove((fg_primitives::KEY_TYPE, authority_id)) + .map(|p| p.encode()) + .map(fg_primitives::OpaqueKeyOwnershipProof::new) + } + } + + #[api_version(2)] + impl mmr::MmrApi for Runtime { + fn mmr_root() -> Result { + Ok(pallet_mmr::RootHash::::get()) + } + + fn mmr_leaf_count() -> Result { + Ok(pallet_mmr::NumberOfLeaves::::get()) + } + + fn generate_proof( + block_numbers: Vec, + best_known_block_number: Option, + ) -> Result<(Vec, mmr::LeafProof), mmr::Error> { + Mmr::generate_proof(block_numbers, best_known_block_number).map( + |(leaves, proof)| { + ( + leaves + .into_iter() + .map(|leaf| mmr::EncodableOpaqueLeaf::from_leaf(&leaf)) + .collect(), + proof, + ) + }, + ) + } + + fn verify_proof(leaves: Vec, proof: mmr::LeafProof) + -> Result<(), mmr::Error> + { + let leaves = leaves.into_iter().map(|leaf| + leaf.into_opaque_leaf() + .try_decode() + .ok_or(mmr::Error::Verify)).collect::, mmr::Error>>()?; + Mmr::verify_leaves(leaves, proof) + } + + fn verify_proof_stateless( + root: mmr::Hash, + leaves: Vec, + proof: mmr::LeafProof + ) -> Result<(), mmr::Error> { + let nodes = leaves.into_iter().map(|leaf|mmr::DataOrHash::Data(leaf.into_opaque_leaf())).collect(); + pallet_mmr::verify_leaves_proof::(root, nodes, proof) + } + } + + impl pallet_beefy_mmr::BeefyMmrApi for RuntimeApi { + fn authority_set_proof() -> sp_consensus_beefy::mmr::BeefyAuthoritySet { + BeefyMmrLeaf::authority_set_proof() + } + + fn next_authority_set_proof() -> sp_consensus_beefy::mmr::BeefyNextAuthoritySet { + BeefyMmrLeaf::next_authority_set_proof() + } + } + + #[api_version(5)] + impl sp_consensus_beefy::BeefyApi for Runtime { + fn beefy_genesis() -> Option { + pallet_beefy::GenesisBlock::::get() + } + + fn validator_set() -> Option> { + Beefy::validator_set() + } + + fn submit_report_double_voting_unsigned_extrinsic( + equivocation_proof: sp_consensus_beefy::DoubleVotingProof< + BlockNumber, + BeefyId, + BeefySignature, + >, + key_owner_proof: sp_consensus_beefy::OpaqueKeyOwnershipProof, + ) -> Option<()> { + let key_owner_proof = key_owner_proof.decode()?; + + Beefy::submit_unsigned_double_voting_report( + equivocation_proof, + key_owner_proof, + ) + } + + fn submit_report_fork_voting_unsigned_extrinsic( + equivocation_proof: + sp_consensus_beefy::ForkVotingProof< + ::Header, + BeefyId, + sp_runtime::OpaqueValue + >, + key_owner_proof: sp_consensus_beefy::OpaqueKeyOwnershipProof, + ) -> Option<()> { + Beefy::submit_unsigned_fork_voting_report( + equivocation_proof.try_into()?, + key_owner_proof.decode()?, + ) + } + + fn submit_report_future_block_voting_unsigned_extrinsic( + equivocation_proof: sp_consensus_beefy::FutureBlockVotingProof, + key_owner_proof: sp_consensus_beefy::OpaqueKeyOwnershipProof, + ) -> Option<()> { + Beefy::submit_unsigned_future_block_voting_report( + equivocation_proof, + key_owner_proof.decode()?, + ) + } + + fn generate_key_ownership_proof( + _set_id: sp_consensus_beefy::ValidatorSetId, + authority_id: BeefyId, + ) -> Option { + Historical::prove((sp_consensus_beefy::KEY_TYPE, authority_id)) + .map(|p| p.encode()) + .map(sp_consensus_beefy::OpaqueKeyOwnershipProof::new) + } + + fn generate_ancestry_proof( + prev_block_number: BlockNumber, + best_known_block_number: Option, + ) -> Option { + use codec::Encode; + + BeefyMmrLeaf::generate_proof(prev_block_number, best_known_block_number) + .map(|p| p.encode()) + .map(sp_runtime::OpaqueValue::new) + } + } + + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { + System::account_nonce(account) + } + } + + impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi for Runtime { + fn query_info( + uxt: ::Extrinsic, + len: u32, + ) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo { + TransactionPayment::query_info(uxt, len) + } + fn query_fee_details( + uxt: ::Extrinsic, + len: u32, + ) -> pallet_transaction_payment::FeeDetails { + TransactionPayment::query_fee_details(uxt, len) + } + fn query_weight_to_fee(weight: Weight) -> Balance { + TransactionPayment::weight_to_fee(weight) + } + fn query_length_to_fee(length: u32) -> Balance { + TransactionPayment::length_to_fee(length) + } + } + + impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi + for Runtime + { + fn query_call_info( + call: RuntimeCall, + len: u32, + ) -> pallet_transaction_payment::RuntimeDispatchInfo { + TransactionPayment::query_call_info(call, len) + } + fn query_call_fee_details( + call: RuntimeCall, + len: u32, + ) -> pallet_transaction_payment::FeeDetails { + TransactionPayment::query_call_fee_details(call, len) + } + fn query_weight_to_fee(weight: Weight) -> Balance { + TransactionPayment::weight_to_fee(weight) + } + fn query_length_to_fee(length: u32) -> Balance { + TransactionPayment::length_to_fee(length) + } + } + + impl snowbridge_outbound_queue_v2_runtime_api::OutboundQueueV2Api for Runtime { + fn prove_message(leaf_index: u64) -> Option { + snowbridge_pallet_outbound_queue_v2::api::prove_message::(leaf_index) + } + } + + impl snowbridge_system_v2_runtime_api::ControlV2Api for Runtime { + fn agent_id(location: VersionedLocation) -> Option { + snowbridge_pallet_system_v2::api::agent_id::(location) + } + } + + #[cfg(feature = "runtime-benchmarks")] + impl frame_benchmarking::Benchmark for Runtime { + fn benchmark_metadata(extra: bool) -> ( + Vec, + Vec, + ) { + use frame_benchmarking::{baseline, Benchmarking, BenchmarkList}; + use frame_support::traits::StorageInfoTrait; + use frame_system_benchmarking::Pallet as SystemBench; + use baseline::Pallet as BaselineBench; + use super::*; + + let mut list = Vec::::new(); + list_benchmarks!(list, extra); + + let storage_info = AllPalletsWithSystem::storage_info(); + + (list, storage_info) + } + + #[expect(non_local_definitions)] + fn dispatch_benchmark( + config: frame_benchmarking::BenchmarkConfig + ) -> Result, alloc::string::String> { + use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch}; + use sp_storage::TrackedStorageKey; + use frame_system_benchmarking::Pallet as SystemBench; + use baseline::Pallet as BaselineBench; + use super::*; + + impl frame_system_benchmarking::Config for Runtime {} + impl baseline::Config for Runtime {} + + use frame_support::traits::WhitelistedStorageKeys; + let whitelist: Vec = AllPalletsWithSystem::whitelisted_storage_keys(); + + let mut batches = Vec::::new(); + let params = (&config, &whitelist); + add_benchmarks!(params, batches); + + Ok(batches) + } + } + + #[cfg(feature = "try-runtime")] + impl frame_try_runtime::TryRuntime for Runtime { + fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) { + // NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to + // have a backtrace here. If any of the pre/post migration checks fail, we shall stop + // right here and right now. + let weight = Executive::try_runtime_upgrade(checks).unwrap(); + (weight, super::configs::RuntimeBlockWeights::get().max_block) + } + + fn execute_block( + block: Block, + state_root_check: bool, + signature_check: bool, + select: frame_try_runtime::TryStateSelect + ) -> Weight { + // NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to + // have a backtrace here. + Executive::try_execute_block(block, state_root_check, signature_check, select).expect("execute-block failed") + } + } + + impl sp_genesis_builder::GenesisBuilder for Runtime { + fn build_state(config: Vec) -> sp_genesis_builder::Result { + build_state::(config) + } + + fn get_preset(id: &Option) -> Option> { + get_preset::(id, crate::genesis_config_presets::get_preset) + } + + fn preset_names() -> Vec { + crate::genesis_config_presets::preset_names() + } + } + + impl fp_rpc::EthereumRuntimeRPCApi for Runtime { + fn chain_id() -> u64 { + ::ChainId::get() + } + + fn account_basic(address: H160) -> EVMAccount { + let (account, _) = pallet_evm::Pallet::::account_basic(&address); + account + } + + fn gas_price() -> U256 { + let (gas_price, _) = ::FeeCalculator::min_gas_price(); + gas_price + } + + fn account_code_at(address: H160) -> Vec { + pallet_evm::AccountCodes::::get(address) + } + + fn author() -> H160 { + >::find_author() + } + + fn storage_at(address: H160, index: U256) -> H256 { + let tmp = index.to_big_endian(); + pallet_evm::AccountStorages::::get(address, H256::from_slice(&tmp[..])) + } + + fn call( + from: H160, + to: H160, + data: Vec, + value: U256, + gas_limit: U256, + max_fee_per_gas: Option, + max_priority_fee_per_gas: Option, + nonce: Option, + estimate: bool, + access_list: Option)>>, + ) -> Result { + let config = if estimate { + let mut config = ::config().clone(); + config.estimate = true; + Some(config) + } else { + None + }; + let is_transactional = false; + let validate = true; + + // Estimated encoded transaction size must be based on the heaviest transaction + // type (EIP1559Transaction) to be compatible with all transaction types. + let mut estimated_transaction_len = data.len() + + // pallet ethereum index: 1 + // transact call index: 1 + // Transaction enum variant: 1 + // chain_id 8 bytes + // nonce: 32 + // max_priority_fee_per_gas: 32 + // max_fee_per_gas: 32 + // gas_limit: 32 + // action: 21 (enum varianrt + call address) + // value: 32 + // access_list: 1 (empty vec size) + // 65 bytes signature + 258; + + if access_list.is_some() { + estimated_transaction_len += access_list.encoded_size(); + } + + let gas_limit = gas_limit.min(u64::MAX.into()).low_u64(); + let without_base_extrinsic_weight = true; + + let (weight_limit, proof_size_base_cost) = + match ::GasWeightMapping::gas_to_weight( + gas_limit, + without_base_extrinsic_weight + ) { + weight_limit if weight_limit.proof_size() > 0 => { + (Some(weight_limit), Some(estimated_transaction_len as u64)) + } + _ => (None, None), + }; + + ::Runner::call( + from, + to, + data, + value, + gas_limit, + max_fee_per_gas, + max_priority_fee_per_gas, + nonce, + access_list.unwrap_or_default(), + is_transactional, + validate, + weight_limit, + proof_size_base_cost, + config.as_ref().unwrap_or(::config()), + ).map_err(|err| err.error.into()) + } + + fn create( + from: H160, + data: Vec, + value: U256, + gas_limit: U256, + max_fee_per_gas: Option, + max_priority_fee_per_gas: Option, + nonce: Option, + estimate: bool, + access_list: Option)>>, + ) -> Result { + let config = if estimate { + let mut config = ::config().clone(); + config.estimate = true; + Some(config) + } else { + None + }; + let is_transactional = false; + let validate = true; + + let gas_limit = if gas_limit > U256::from(u64::MAX) { + u64::MAX + } else { + gas_limit.low_u64() + }; + + let (weight_limit, proof_size_base_cost) = (None, None); + + #[allow(clippy::or_fun_call)] + ::Runner::create( + from, + data, + value, + gas_limit, + max_fee_per_gas, + max_priority_fee_per_gas, + nonce, + access_list.unwrap_or_default(), + is_transactional, + validate, + weight_limit, + proof_size_base_cost, + config.as_ref().unwrap_or(::config()), + ).map_err(|err| err.error.into()) + } + + fn current_transaction_statuses() -> Option> { + pallet_ethereum::CurrentTransactionStatuses::::get() + } + + fn current_block() -> Option { + pallet_ethereum::CurrentBlock::::get() + } + + fn current_receipts() -> Option> { + pallet_ethereum::CurrentReceipts::::get() + } + + fn current_all() -> ( + Option, + Option>, + Option>, + ) { + ( + pallet_ethereum::CurrentBlock::::get(), + pallet_ethereum::CurrentReceipts::::get(), + pallet_ethereum::CurrentTransactionStatuses::::get() + ) + } + + fn extrinsic_filter( + xts: Vec<::Extrinsic>, + ) -> Vec { + xts.into_iter().filter_map(|xt| match xt.0.function { + RuntimeCall::Ethereum(transact { transaction }) => Some(transaction), + _ => None + }).collect::>() + } + + fn elasticity() -> Option { + None + } + + fn gas_limit_multiplier_support() {} + + fn pending_block( + xts: Vec<::Extrinsic>, + ) -> (Option, Option>) { + for ext in xts.into_iter() { + let _ = Executive::apply_extrinsic(ext); + } + + Ethereum::on_finalize(System::block_number() + 1); + + ( + pallet_ethereum::CurrentBlock::::get(), + pallet_ethereum::CurrentTransactionStatuses::::get() + ) + } + + fn initialize_pending_block(header: &::Header) { + Executive::initialize_block(header); + } + } + + impl fp_rpc::ConvertTransactionRuntimeApi for Runtime { + fn convert_transaction(transaction: EthereumTransaction) -> ::Extrinsic { + UncheckedExtrinsic::new_bare( + pallet_ethereum::Call::::transact { transaction }.into(), + ) + } + } +} diff --git a/operator/runtime/testnet/src/benchmarks.rs b/operator/runtime/testnet/src/benchmarks.rs new file mode 100644 index 00000000..1803158c --- /dev/null +++ b/operator/runtime/testnet/src/benchmarks.rs @@ -0,0 +1,38 @@ +// This is free and unencumbered software released into the public domain. +// +// Anyone is free to copy, modify, publish, use, compile, sell, or +// distribute this software, either in source code form or as a compiled +// binary, for any purpose, commercial or non-commercial, and by any +// means. +// +// In jurisdictions that recognize copyright laws, the author or authors +// of this software dedicate any and all copyright interest in the +// software to the public domain. We make this dedication for the benefit +// of the public at large and to the detriment of our heirs and +// successors. We intend this dedication to be an overt act of +// relinquishment in perpetuity of all present and future rights to this +// software under copyright law. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +// For more information, please refer to + +frame_benchmarking::define_benchmarks!( + [frame_benchmarking, BaselineBench::] + [frame_system, SystemBench::] + [pallet_balances, Balances] + [pallet_identity, Identity] + [pallet_im_online, ImOnline] + [pallet_multisig, Multisig] + [pallet_preimage, Preimage] + [pallet_scheduler, Scheduler] + [pallet_timestamp, Timestamp] + [pallet_utility, Utility] + [pallet_sudo, Sudo] +); diff --git a/operator/runtime/testnet/src/configs/mod.rs b/operator/runtime/testnet/src/configs/mod.rs new file mode 100644 index 00000000..d24780e4 --- /dev/null +++ b/operator/runtime/testnet/src/configs/mod.rs @@ -0,0 +1,874 @@ +// This is free and unencumbered software released into the public domain. +// +// Anyone is free to copy, modify, publish, use, compile, sell, or +// distribute this software, either in source code form or as a compiled +// binary, for any purpose, commercial or non-commercial, and by any +// means. +// +// In jurisdictions that recognize copyright laws, the author or authors +// of this software dedicate any and all copyright interest in the +// software to the public domain. We make this dedication for the benefit +// of the public at large and to the detriment of our heirs and +// successors. We intend this dedication to be an overt act of +// relinquishment in perpetuity of all present and future rights to this +// software under copyright law. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +// For more information, please refer to + +mod runtime_params; + +use super::{ + deposit, AccountId, Babe, Balance, Balances, BeefyMmrLeaf, Block, BlockNumber, + EthereumBeaconClient, EvmChainId, Hash, Historical, ImOnline, MessageQueue, Nonce, Offences, + OriginCaller, OutboundCommitmentStore, OutboundQueueV2, PalletInfo, Preimage, Runtime, + RuntimeCall, RuntimeEvent, RuntimeFreezeReason, RuntimeHoldReason, RuntimeOrigin, RuntimeTask, + Session, SessionKeys, Signature, System, Timestamp, ValidatorSet, EXISTENTIAL_DEPOSIT, + SLOT_DURATION, STORAGE_BYTE_FEE, SUPPLY_FACTOR, UNIT, VERSION, +}; +use codec::{Decode, Encode}; +use datahaven_runtime_common::{ + gas::WEIGHT_PER_GAS, + time::{EpochDurationInBlocks, DAYS, MILLISECS_PER_BLOCK, MINUTES}, +}; +use dhp_bridge::EigenLayerMessageProcessor; +use frame_support::{ + derive_impl, + pallet_prelude::TransactionPriority, + parameter_types, + traits::{ + fungible::{Balanced, Credit, HoldConsideration, Inspect}, + ConstU128, ConstU32, ConstU64, ConstU8, EqualPrivilegeOnly, FindAuthor, + KeyOwnerProofSystem, LinearStoragePrice, OnUnbalanced, VariantCountOf, + }, + weights::{ + constants::{RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND}, + IdentityFee, RuntimeDbWeight, Weight, + }, +}; +use frame_system::{ + limits::{BlockLength, BlockWeights}, + EnsureRoot, EnsureRootWithSuccess, +}; +use pallet_ethereum::PostLogContent; +use pallet_evm::{ + EVMFungibleAdapter, EnsureAddressNever, EnsureAddressRoot, FeeCalculator, + FrameSystemAccountProvider, IdentityAddressMapping, + OnChargeEVMTransaction as OnChargeEVMTransactionT, +}; +use pallet_grandpa::AuthorityId as GrandpaId; +use pallet_im_online::sr25519::AuthorityId as ImOnlineId; +use pallet_transaction_payment::{ + ConstFeeMultiplier, FungibleAdapter, Multiplier, Pallet as TransactionPayment, +}; +use polkadot_primitives::Moment; +use runtime_params::RuntimeParameters; +use snowbridge_beacon_primitives::{Fork, ForkVersions}; +use snowbridge_core::{gwei, meth, AgentIdOf, PricingParameters, Rewards}; +use snowbridge_inbound_queue_primitives::RewardLedger; +use snowbridge_outbound_queue_primitives::{ + v1::{Fee, Message, SendMessage}, + v2::ConstantGasMeter, + SendError, SendMessageFeeProvider, +}; +use snowbridge_pallet_outbound_queue_v2::OnNewCommitment; +use snowbridge_pallet_system::BalanceOf; +use sp_consensus_beefy::{ + ecdsa_crypto::AuthorityId as BeefyId, + mmr::{BeefyDataProvider, MmrLeafVersion}, +}; +use sp_core::{crypto::KeyTypeId, Get, H160, H256, U256}; +use sp_runtime::FixedU128; +use sp_runtime::{ + traits::{ConvertInto, IdentityLookup, Keccak256, One, OpaqueKeys, UniqueSaturatedInto}, + FixedPointNumber, Perbill, +}; +use sp_staking::{EraIndex, SessionIndex}; +use sp_std::{ + convert::{From, Into}, + prelude::*, +}; +use sp_version::RuntimeVersion; +use xcm::latest::NetworkId; +use xcm::prelude::*; + +#[cfg(feature = "runtime-benchmarks")] +use bridge_hub_common::AggregateMessageOrigin; + +const EVM_CHAIN_ID: u64 = 1288; +const SS58_FORMAT: u16 = EVM_CHAIN_ID as u16; + +// TODO: We need to define what do we want here as max PoV size +pub const MAX_POV_SIZE: u64 = 5 * 1024 * 1024; + +// Todo: import all currency constants from moonbeam +pub const WEIGHT_FEE: Balance = 50_000 / 4; + +pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND, u64::MAX) + .saturating_mul(2) + .set_proof_size(MAX_POV_SIZE); + +const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); + +//╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗ +//║ COMMON PARAMETERS ║ +//╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝ + +parameter_types! { + pub const MaxAuthorities: u32 = 32; + pub const BondingDuration: EraIndex = polkadot_runtime_common::prod_or_fast!(28, 3); + pub const SessionsPerEra: SessionIndex = polkadot_runtime_common::prod_or_fast!(6, 1); +} + +//╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗ +//║ SYSTEM AND CONSENSUS PALLETS ║ +//╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝ + +parameter_types! { + pub const BlockHashCount: BlockNumber = 2400; + pub const Version: RuntimeVersion = VERSION; + + /// We allow for 2 seconds of compute with a 6 second average block time. + pub RuntimeBlockWeights: BlockWeights = BlockWeights::with_sensible_defaults( + Weight::from_parts(2u64 * WEIGHT_REF_TIME_PER_SECOND, u64::MAX), + NORMAL_DISPATCH_RATIO, + ); + pub RuntimeBlockLength: BlockLength = BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO); + pub const SS58Prefix: u16 = SS58_FORMAT; +} + +/// The default types are being injected by [`derive_impl`](`frame_support::derive_impl`) from +/// [`SoloChainDefaultConfig`](`struct@frame_system::config_preludes::SolochainDefaultConfig`), +/// but overridden as needed. +#[derive_impl(frame_system::config_preludes::SolochainDefaultConfig)] +impl frame_system::Config for Runtime { + /// The block type for the runtime. + type Block = Block; + /// Block & extrinsics weights: base values and limits. + type BlockWeights = RuntimeBlockWeights; + /// The maximum length of a block (in bytes). + type BlockLength = RuntimeBlockLength; + /// The identifier used to distinguish between accounts. + type AccountId = AccountId; + /// The lookup mechanism to get account ID from whatever is passed in dispatchers. + type Lookup = IdentityLookup; + /// The type for storing how many extrinsics an account has signed. + type Nonce = Nonce; + /// The type for hashing blocks and tries. + type Hash = Hash; + /// Maximum number of block number to block hash mappings to keep (oldest pruned first). + type BlockHashCount = BlockHashCount; + /// The weight of database operations that the runtime can invoke. + type DbWeight = RocksDbWeight; + /// Version of the runtime. + type Version = Version; + /// The data to be stored in an account. + type AccountData = pallet_balances::AccountData; + /// This is used as an identifier of the chain. 42 is the generic substrate prefix. + type SS58Prefix = SS58Prefix; + type MaxConsumers = frame_support::traits::ConstU32<16>; +} + +// 1 in 4 blocks (on average, not counting collisions) will be primary babe blocks. +pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4); +/// The BABE epoch configuration at genesis. +pub const BABE_GENESIS_EPOCH_CONFIG: sp_consensus_babe::BabeEpochConfiguration = + sp_consensus_babe::BabeEpochConfiguration { + c: PRIMARY_PROBABILITY, + allowed_slots: sp_consensus_babe::AllowedSlots::PrimaryAndSecondaryVRFSlots, + }; + +parameter_types! { + pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK; + pub ReportLongevity: u64 = + BondingDuration::get() as u64 * SessionsPerEra::get() as u64 * (EpochDurationInBlocks::get() as u64); +} + +impl pallet_babe::Config for Runtime { + type EpochDuration = EpochDurationInBlocks; + type ExpectedBlockTime = ExpectedBlockTime; + type EpochChangeTrigger = pallet_babe::ExternalTrigger; + type DisabledValidators = Session; + type WeightInfo = (); + type MaxAuthorities = MaxAuthorities; + type MaxNominators = ConstU32<0>; + + type KeyOwnerProof = + >::Proof; + + type EquivocationReportSystem = + pallet_babe::EquivocationReportSystem; +} + +impl pallet_timestamp::Config for Runtime { + /// A timestamp: milliseconds since the unix epoch. + type Moment = u64; + type OnTimestampSet = Babe; + type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>; + type WeightInfo = (); +} + +impl pallet_balances::Config for Runtime { + type MaxLocks = ConstU32<50>; + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + /// The type for recording an account's balance. + type Balance = Balance; + /// The ubiquitous event type. + type RuntimeEvent = RuntimeEvent; + type DustRemoval = (); + type ExistentialDeposit = ConstU128; + type AccountStore = System; + type WeightInfo = pallet_balances::weights::SubstrateWeight; + type FreezeIdentifier = RuntimeFreezeReason; + type MaxFreezes = VariantCountOf; + type RuntimeHoldReason = RuntimeHoldReason; + type RuntimeFreezeReason = RuntimeFreezeReason; + type DoneSlashHandler = (); +} + +impl pallet_authorship::Config for Runtime { + type FindAuthor = pallet_session::FindAccountFromAuthorIndex; + type EventHandler = ImOnline; +} + +impl pallet_offences::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type IdentificationTuple = pallet_session::historical::IdentificationTuple; + type OnOffenceHandler = ValidatorSet; +} + +impl pallet_session::historical::Config for Runtime { + type FullIdentification = Self::ValidatorId; + type FullIdentificationOf = Self::ValidatorIdOf; +} + +impl pallet_session::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type ValidatorId = AccountId; + type ValidatorIdOf = ConvertInto; + type ShouldEndSession = Babe; + type NextSessionRotation = Babe; + type SessionManager = pallet_session::historical::NoteHistoricalRoot; + type SessionHandler = ::KeyTypeIdProviders; + type Keys = SessionKeys; + type WeightInfo = pallet_session::weights::SubstrateWeight; +} + +parameter_types! { + pub const SetKeysCooldownBlocks: BlockNumber = 5 * MINUTES; +} + +impl pallet_validator_set::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type AddRemoveOrigin = EnsureRoot; + type MaxAuthorities = MaxAuthorities; + type SetKeysCooldownBlocks = SetKeysCooldownBlocks; + type WeightInfo = pallet_validator_set::weights::SubstrateWeight; +} + +parameter_types! { + pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::MAX; +} + +impl pallet_im_online::Config for Runtime { + type AuthorityId = ImOnlineId; + type MaxKeys = MaxAuthorities; + type MaxPeerInHeartbeats = ConstU32<0>; // Not used any more + type RuntimeEvent = RuntimeEvent; + type ValidatorSet = Historical; + type NextSessionRotation = Babe; + type ReportUnresponsiveness = Offences; + type UnsignedPriority = ImOnlineUnsignedPriority; + type WeightInfo = (); +} + +parameter_types! { + pub const EquivocationReportPeriodInEpochs: u64 = 168; + pub const EquivocationReportPeriodInBlocks: u64 = + EquivocationReportPeriodInEpochs::get() * (EpochDurationInBlocks::get() as u64); + pub const MaxSetIdSessionEntries: u32 = BondingDuration::get() * SessionsPerEra::get(); +} + +impl pallet_grandpa::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + + type WeightInfo = (); + type MaxAuthorities = MaxAuthorities; + type MaxNominators = ConstU32<0>; + type MaxSetIdSessionEntries = MaxSetIdSessionEntries; + + type KeyOwnerProof = >::Proof; + type EquivocationReportSystem = pallet_grandpa::EquivocationReportSystem< + Self, + Offences, + Historical, + EquivocationReportPeriodInBlocks, + >; +} + +parameter_types! { + pub FeeMultiplier: Multiplier = Multiplier::one(); +} + +impl pallet_transaction_payment::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type OnChargeTransaction = FungibleAdapter; + type OperationalFeeMultiplier = ConstU8<5>; + type WeightToFee = IdentityFee; + type LengthToFee = IdentityFee; + type FeeMultiplierUpdate = ConstFeeMultiplier; + type WeightInfo = (); +} + +parameter_types! { + pub const BeefySetIdSessionEntries: u32 = BondingDuration::get() * SessionsPerEra::get(); +} + +impl pallet_beefy::Config for Runtime { + type BeefyId = BeefyId; + type MaxAuthorities = ConstU32<32>; + type MaxNominators = ConstU32<0>; + type MaxSetIdSessionEntries = BeefySetIdSessionEntries; + type OnNewValidatorSet = BeefyMmrLeaf; + type AncestryHelper = BeefyMmrLeaf; + type WeightInfo = (); + type KeyOwnerProof = >::Proof; + type EquivocationReportSystem = (); +} + +parameter_types! { + pub LeafVersion: MmrLeafVersion = MmrLeafVersion::new(0, 0); +} + +#[derive(Debug, PartialEq, Eq, Clone, Encode, Decode)] +pub struct LeafExtraData { + extra: H256, +} + +pub struct LeafExtraDataProvider; +impl BeefyDataProvider for LeafExtraDataProvider { + fn extra_data() -> LeafExtraData { + LeafExtraData { + extra: OutboundCommitmentStore::get_latest_commitment().unwrap_or_default(), + } + } +} + +impl pallet_mmr::Config for Runtime { + const INDEXING_PREFIX: &'static [u8] = pallet_mmr::primitives::INDEXING_PREFIX; + type Hashing = Keccak256; + type LeafData = pallet_beefy_mmr::Pallet; + type OnNewRoot = pallet_beefy_mmr::DepositBeefyDigest; + type WeightInfo = (); + type BlockHashProvider = pallet_mmr::DefaultBlockHashProvider; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); +} + +impl pallet_beefy_mmr::Config for Runtime { + type LeafVersion = LeafVersion; + type BeefyAuthorityToMerkleLeaf = pallet_beefy_mmr::BeefyEcdsaToEthereum; + type LeafExtra = LeafExtraData; + type BeefyDataProvider = LeafExtraDataProvider; + type WeightInfo = (); +} + +//╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗ +//║ POLKADOT SDK UTILITY PALLETS ║ +//╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝ + +impl pallet_utility::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type PalletsOrigin = OriginCaller; + type WeightInfo = (); +} + +parameter_types! { + pub MaximumSchedulerWeight: Weight = NORMAL_DISPATCH_RATIO * RuntimeBlockWeights::get().max_block; + pub const NoPreimagePostponement: Option = Some(10); +} + +impl pallet_scheduler::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type PalletsOrigin = OriginCaller; + type RuntimeCall = RuntimeCall; + type MaximumWeight = MaximumSchedulerWeight; + type ScheduleOrigin = EnsureRoot; + type MaxScheduledPerBlock = ConstU32<50>; + type OriginPrivilegeCmp = EqualPrivilegeOnly; + type Preimages = Preimage; + type WeightInfo = (); +} + +parameter_types! { + pub const PreimageBaseDeposit: Balance = 5 * UNIT * SUPPLY_FACTOR ; + pub const PreimageByteDeposit: Balance = STORAGE_BYTE_FEE; + pub const PreimageHoldReason: RuntimeHoldReason = + RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage); +} + +impl pallet_preimage::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type ManagerOrigin = EnsureRoot; + type Consideration = HoldConsideration< + AccountId, + Balances, + PreimageHoldReason, + LinearStoragePrice, + >; + type WeightInfo = (); +} + +parameter_types! { + pub const MaxSubAccounts: u32 = 100; + pub const MaxAdditionalFields: u32 = 100; + pub const MaxRegistrars: u32 = 20; + pub const PendingUsernameExpiration: u32 = 7 * DAYS; + pub const MaxSuffixLength: u32 = 7; + pub const MaxUsernameLength: u32 = 32; +} + +type IdentityForceOrigin = EnsureRoot; +type IdentityRegistrarOrigin = EnsureRoot; +// TODO: Add governance origin when available +// type IdentityForceOrigin = +// EitherOfDiverse, governance::custom_origins::GeneralAdmin>; +// type IdentityRegistrarOrigin = +// EitherOfDiverse, governance::custom_origins::GeneralAdmin>; + +impl pallet_identity::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + // Add one item in storage and take 258 bytes + type BasicDeposit = ConstU128<{ deposit(1, 258) }>; + // Does not add any item to the storage but takes 1 bytes + type ByteDeposit = ConstU128<{ deposit(0, 1) }>; + // Add one item in storage and take 53 bytes + type SubAccountDeposit = ConstU128<{ deposit(1, 53) }>; + type MaxSubAccounts = MaxSubAccounts; + type IdentityInformation = pallet_identity::legacy::IdentityInfo; + type MaxRegistrars = MaxRegistrars; + type Slashed = (); + // TODO: Slashed funds should be sent to the treasury (when added to the runtime) + // type Slashed = Treasury; + type ForceOrigin = IdentityForceOrigin; + type RegistrarOrigin = IdentityRegistrarOrigin; + type OffchainSignature = Signature; + type SigningPublicKey = ::Signer; + type UsernameAuthorityOrigin = EnsureRoot; + type PendingUsernameExpiration = PendingUsernameExpiration; + type MaxSuffixLength = MaxSuffixLength; + type MaxUsernameLength = MaxUsernameLength; + type WeightInfo = (); + type UsernameDeposit = (); + type UsernameGracePeriod = (); +} + +parameter_types! { + // One storage item; key size is 32 + 20; value is size 4+4+16+20 bytes = 44 bytes. + pub const DepositBase: Balance = deposit(1, 96); + // Additional storage item size of 20 bytes. + pub const DepositFactor: Balance = deposit(0, 20); + pub const MaxSignatories: u32 = 100; +} + +impl pallet_multisig::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type Currency = Balances; + type DepositBase = DepositBase; + type DepositFactor = DepositFactor; + type MaxSignatories = MaxSignatories; + type WeightInfo = (); +} + +impl pallet_parameters::Config for Runtime { + type AdminOrigin = EnsureRoot; + type RuntimeEvent = RuntimeEvent; + type RuntimeParameters = RuntimeParameters; + type WeightInfo = (); +} + +impl pallet_sudo::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type WeightInfo = pallet_sudo::weights::SubstrateWeight; +} + +parameter_types! { + /// Amount of weight that can be spent per block to service messages. + /// + /// # WARNING + /// + /// This is not a good value for para-chains since the `Scheduler` already uses up to 80% block weight. + pub MessageQueueServiceWeight: Weight = Perbill::from_percent(20) * RuntimeBlockWeights::get().max_block; + pub const MessageQueueHeapSize: u32 = 32 * 1024; + pub const MessageQueueMaxStale: u32 = 96; +} + +impl pallet_message_queue::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + #[cfg(not(feature = "runtime-benchmarks"))] + type MessageProcessor = OutboundQueueV2; + #[cfg(feature = "runtime-benchmarks")] + type MessageProcessor = + pallet_message_queue::mock_helpers::NoopMessageProcessor; + type Size = u32; + type QueueChangeHandler = (); + type QueuePausedQuery = (); + type HeapSize = MessageQueueHeapSize; + type MaxStale = MessageQueueMaxStale; + type ServiceWeight = MessageQueueServiceWeight; + type IdleMaxServiceWeight = MessageQueueServiceWeight; + type WeightInfo = (); +} + +//╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗ +//║ FRONTIER (EVM) PALLETS ║ +//╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝ + +parameter_types! { + pub const PostBlockAndTxnHashes: PostLogContent = PostLogContent::BlockAndTxnHashes; +} + +impl pallet_ethereum::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type StateRoot = pallet_ethereum::IntermediateStateRoot; + type PostLogContent = PostBlockAndTxnHashes; + type ExtraDataLength = ConstU32<30>; +} + +// Ported from Moonbeam, please check for reference: https://github.com/moonbeam-foundation/moonbeam/pull/1765 +pub struct TransactionPaymentAsGasPrice; +impl FeeCalculator for TransactionPaymentAsGasPrice { + fn min_gas_price() -> (U256, Weight) { + // note: transaction-payment differs from EIP-1559 in that its tip and length fees are not + // scaled by the multiplier, which means its multiplier will be overstated when + // applied to an ethereum transaction + // note: transaction-payment uses both a congestion modifier (next_fee_multiplier, which is + // updated once per block in on_finalize) and a 'WeightToFee' implementation. Our + // runtime implements this as a 'ConstantModifier', so we can get away with a simple + // multiplication here. + let min_gas_price: u128 = TransactionPayment::::next_fee_multiplier() + .saturating_mul_int((WEIGHT_FEE).saturating_mul(WEIGHT_PER_GAS as u128)); + ( + min_gas_price.into(), + <::DbWeight as Get>::get().reads(1), + ) + } +} + +pub struct FindAuthorAdapter(core::marker::PhantomData); +impl FindAuthor for FindAuthorAdapter +where + T: frame_system::Config + pallet_session::Config, + ::ValidatorId: Into, +{ + fn find_author<'a, I>(digests: I) -> Option + where + I: 'a + IntoIterator, + { + pallet_session::FindAccountFromAuthorIndex::::find_author(digests) + .map(|author| author.into()) + } +} + +datahaven_runtime_common::impl_on_charge_evm_transaction!(); + +parameter_types! { + pub BlockGasLimit: U256 + = U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS); + // pub PrecompilesValue: TemplatePrecompiles = TemplatePrecompiles::<_>::new(); + pub WeightPerGas: Weight = Weight::from_parts(WEIGHT_PER_GAS, 0); + pub SuicideQuickClearLimit: u32 = 0; + pub GasLimitPovSizeRatio: u32 = 16; + pub GasLimitStorageGrowthRatio: u64 = 366; +} + +impl pallet_evm::Config for Runtime { + type AccountProvider = FrameSystemAccountProvider; + type FeeCalculator = TransactionPaymentAsGasPrice; + type GasWeightMapping = pallet_evm::FixedGasWeightMapping; + type WeightPerGas = WeightPerGas; + type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping; + type CallOrigin = EnsureAddressRoot; + type WithdrawOrigin = EnsureAddressNever; + type AddressMapping = IdentityAddressMapping; + type Currency = Balances; + type RuntimeEvent = RuntimeEvent; + type PrecompilesType = (); + type PrecompilesValue = (); + type ChainId = EvmChainId; + type BlockGasLimit = BlockGasLimit; + type Runner = pallet_evm::runner::stack::Runner; + type OnChargeTransaction = OnChargeEVMTransaction<()>; + type OnCreate = (); + type FindAuthor = FindAuthorAdapter; + type GasLimitPovSizeRatio = GasLimitPovSizeRatio; + type GasLimitStorageGrowthRatio = (); + type Timestamp = Timestamp; + type WeightInfo = (); +} + +impl pallet_evm_chain_id::Config for Runtime {} + +//╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗ +//║ SNOWBRIDGE PALLETS ║ +//╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝ + +// --- Snowbridge Config Constants & Parameter Types --- +parameter_types! { + pub UniversalLocation: InteriorLocation = Here.into(); + pub InboundDeliveryCost: BalanceOf = 0; + pub RootLocation: Location = Location::here(); + pub Parameters: PricingParameters = PricingParameters { + exchange_rate: FixedU128::from_rational(1, 400), + fee_per_gas: gwei(20), + rewards: Rewards { local: 1 * UNIT, remote: meth(1) }, + multiplier: FixedU128::from_rational(1, 1), + }; + pub EthereumLocation: Location = Location::new(1, EthereumNetwork::get()); + pub TreasuryAccountId: AccountId = AccountId::from([0u8; 20]); +} + +pub struct DoNothingOutboundQueue; +impl SendMessage for DoNothingOutboundQueue { + type Ticket = (); + + fn validate( + _: &Message, + ) -> Result<(Self::Ticket, Fee<::Balance>), SendError> { + Ok(((), Fee::from((0, 0)))) + } + + fn deliver(_: Self::Ticket) -> Result { + Ok(H256::zero()) + } +} + +impl SendMessageFeeProvider for DoNothingOutboundQueue { + type Balance = u128; + + fn local_fee() -> Self::Balance { + 1 + } +} + +// Implement the Snowbridge System V1 config trait +impl snowbridge_pallet_system::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type OutboundQueue = DoNothingOutboundQueue; + type SiblingOrigin = EnsureRootWithSuccess; + type AgentIdOf = AgentIdOf; + type Token = Balances; + type TreasuryAccount = TreasuryAccountId; + type DefaultPricingParameters = Parameters; + type InboundDeliveryCost = InboundDeliveryCost; + type WeightInfo = (); + type UniversalLocation = UniversalLocation; + type EthereumLocation = EthereumLocation; + #[cfg(feature = "runtime-benchmarks")] + type Helper = (); +} + +// Implement the Snowbridge System v2 config trait +impl snowbridge_pallet_system_v2::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type OutboundQueue = OutboundQueueV2; + type FrontendOrigin = EnsureRootWithSuccess; + type GovernanceOrigin = EnsureRootWithSuccess; + type WeightInfo = (); + #[cfg(feature = "runtime-benchmarks")] + type Helper = (); +} + +// For tests, benchmarks and fast-runtime configurations we use the mocked fork versions +#[cfg(any( + feature = "std", + feature = "fast-runtime", + feature = "runtime-benchmarks", + test +))] +parameter_types! { + pub const ChainForkVersions: ForkVersions = ForkVersions { + genesis: Fork { + version: [0, 0, 0, 0], // 0x00000000 + epoch: 0, + }, + altair: Fork { + version: [1, 0, 0, 0], // 0x01000000 + epoch: 0, + }, + bellatrix: Fork { + version: [2, 0, 0, 0], // 0x02000000 + epoch: 0, + }, + capella: Fork { + version: [3, 0, 0, 0], // 0x03000000 + epoch: 0, + }, + deneb: Fork { + version: [4, 0, 0, 0], // 0x04000000 + epoch: 0, + }, + electra: Fork { + version: [5, 0, 0, 0], // 0x05000000 + epoch: 0, + }, + }; +} + +// Holesky: https://github.com/eth-clients/holesky +// Fork versions: https://github.com/eth-clients/holesky/blob/main/metadata/config.yaml +#[cfg(not(any( + feature = "std", + feature = "fast-runtime", + feature = "runtime-benchmarks", + test +)))] +parameter_types! { + pub const ChainForkVersions: ForkVersions = ForkVersions { + genesis: Fork { + version: hex_literal::hex!("01017000"), // 0x01017000 + epoch: 0, + }, + altair: Fork { + version: hex_literal::hex!("02017000"), // 0x02017000 + epoch: 0, + }, + bellatrix: Fork { + version: hex_literal::hex!("03017000"), // 0x03017000 + epoch: 0, + }, + capella: Fork { + version: hex_literal::hex!("04017000"), // 0x04017000 + epoch: 256, + }, + deneb: Fork { + version: hex_literal::hex!("05017000"), // 0x05017000 + epoch: 29696, + }, + electra: Fork { + version: hex_literal::hex!("06017000"), // 0x06017000 + epoch: 115968, + }, + }; +} + +impl snowbridge_pallet_ethereum_client::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type ForkVersions = ChainForkVersions; + type FreeHeadersInterval = (); + type WeightInfo = (); +} + +parameter_types! { + pub DefaultRewardKind: () = (); +} + +// Dummy RewardPayment implementation +pub struct DummyRewardPayment; +impl RewardLedger for DummyRewardPayment { + fn register_reward(_who: &AccountId, _reward: (), _amount: u128) { + // Empty implementation for dummy struct + } +} + +impl snowbridge_pallet_inbound_queue_v2::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Verifier = EthereumBeaconClient; + type GatewayAddress = runtime_params::dynamic_params::runtime_config::EthereumGatewayAddress; + type MessageProcessor = EigenLayerMessageProcessor; + type RewardKind = (); + type DefaultRewardKind = DefaultRewardKind; + type RewardPayment = DummyRewardPayment; + type WeightInfo = (); + #[cfg(feature = "runtime-benchmarks")] + type Helper = Runtime; +} + +parameter_types! { + /// Network and location for the Ethereum chain. + /// Using the Sepolia Ethereum testnet, with chain ID 11155111. + /// + /// + pub EthereumNetwork: NetworkId = NetworkId::Ethereum { chain_id: 11155111 }; +} + +pub struct CommitmentHandler; +impl OnNewCommitment for CommitmentHandler { + fn on_new_commitment(commitment: H256) { + OutboundCommitmentStore::store_commitment(commitment); + } +} + +impl snowbridge_pallet_outbound_queue_v2::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Hashing = Keccak256; + type MessageQueue = MessageQueue; + type GasMeter = ConstantGasMeter; + type Balance = Balance; + type MaxMessagePayloadSize = ConstU32<2048>; + type MaxMessagesPerBlock = ConstU32<32>; + type OnNewCommitment = CommitmentHandler; + type WeightToFee = IdentityFee; + type WeightInfo = (); + type Verifier = EthereumBeaconClient; + type GatewayAddress = runtime_params::dynamic_params::runtime_config::EthereumGatewayAddress; + type RewardKind = (); + type DefaultRewardKind = DefaultRewardKind; + type RewardPayment = DummyRewardPayment; + type EthereumNetwork = EthereumNetwork; + type ConvertAssetId = (); +} + +//╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗ +//║ STORAGEHUB PALLETS ║ +//╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝ + +//╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗ +//║ DATAHAVEN-SPECIFIC PALLETS ║ +//╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝ + +#[cfg(feature = "runtime-benchmarks")] +pub mod benchmark_helpers { + use crate::RuntimeOrigin; + use crate::{EthereumBeaconClient, Runtime}; + use snowbridge_beacon_primitives::BeaconHeader; + use snowbridge_pallet_inbound_queue_v2::BenchmarkHelper as InboundQueueBenchmarkHelperV2; + use sp_core::H256; + use xcm::opaque::latest::Location; + + impl InboundQueueBenchmarkHelperV2 for Runtime { + fn initialize_storage(beacon_header: BeaconHeader, block_roots_root: H256) { + EthereumBeaconClient::store_finalized_header(beacon_header, block_roots_root).unwrap(); + } + } + + impl snowbridge_pallet_system::BenchmarkHelper for () { + fn make_xcm_origin(_location: Location) -> RuntimeOrigin { + RuntimeOrigin::root() + } + } + + impl snowbridge_pallet_system_v2::BenchmarkHelper for () { + fn make_xcm_origin(_location: Location) -> RuntimeOrigin { + RuntimeOrigin::root() + } + } +} + +impl pallet_outbound_commitment_store::Config for Runtime { + type RuntimeEvent = RuntimeEvent; +} diff --git a/operator/runtime/testnet/src/configs/runtime_params.rs b/operator/runtime/testnet/src/configs/runtime_params.rs new file mode 100644 index 00000000..a8b7ace8 --- /dev/null +++ b/operator/runtime/testnet/src/configs/runtime_params.rs @@ -0,0 +1,34 @@ +use frame_support::dynamic_params::{dynamic_pallet_params, dynamic_params}; +use sp_core::H160; + +use crate::Runtime; + +#[dynamic_params(RuntimeParameters, pallet_parameters::Parameters::)] +pub mod dynamic_params { + use super::*; + #[dynamic_pallet_params] + #[codec(index = 0)] + pub mod runtime_config { + + use super::*; + + #[codec(index = 0)] + #[allow(non_upper_case_globals)] + /// Set the initial address of the Snowbridge Gateway contract on Ethereum. + /// The fact that this is a parameter means that we can set it initially to the zero address, + /// and then change it later via governance, to the actual address of the deployed contract. + pub static EthereumGatewayAddress: H160 = H160::repeat_byte(0x0); + } +} + +#[cfg(feature = "runtime-benchmarks")] +impl Default for RuntimeParameters { + fn default() -> Self { + RuntimeParameters::RuntimeConfig( + dynamic_params::runtime_config::Parameters::EthereumGatewayAddress( + dynamic_params::runtime_config::EthereumGatewayAddress, + Some(H160::repeat_byte(0x0)), + ), + ) + } +} diff --git a/operator/runtime/src/genesis_config_presets.rs b/operator/runtime/testnet/src/genesis_config_presets.rs similarity index 99% rename from operator/runtime/src/genesis_config_presets.rs rename to operator/runtime/testnet/src/genesis_config_presets.rs index 3e0a2f6d..1fdfa42a 100644 --- a/operator/runtime/src/genesis_config_presets.rs +++ b/operator/runtime/testnet/src/genesis_config_presets.rs @@ -13,7 +13,7 @@ use sp_core::{ecdsa, Pair, Public}; use sp_genesis_builder::{self, PresetId}; use sp_runtime::traits::{IdentifyAccount, Verify}; -const TESTNET_EVM_CHAIN_ID: u64 = 1283; +const TESTNET_EVM_CHAIN_ID: u64 = 1288; // Returns the genesis config presets populated with given parameters. fn testnet_genesis( diff --git a/operator/runtime/testnet/src/lib.rs b/operator/runtime/testnet/src/lib.rs new file mode 100644 index 00000000..1a416d1d --- /dev/null +++ b/operator/runtime/testnet/src/lib.rs @@ -0,0 +1,322 @@ +#![cfg_attr(not(feature = "std"), no_std)] +// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. +#![recursion_limit = "256"] + +extern crate alloc; +#[cfg(feature = "std")] +include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); + +pub mod apis; +#[cfg(feature = "runtime-benchmarks")] +mod benchmarks; +pub mod configs; + +use alloc::{borrow::Cow, vec::Vec}; +use sp_runtime::{generic, impl_opaque_keys}; +#[cfg(feature = "std")] +use sp_version::NativeVersion; +use sp_version::RuntimeVersion; + +pub use frame_system::Call as SystemCall; +pub use pallet_balances::Call as BalancesCall; +pub use pallet_timestamp::Call as TimestampCall; +use sp_core::H160; +#[cfg(any(feature = "std", test))] +pub use sp_runtime::BuildStorage; + +pub use datahaven_runtime_common::{ + AccountId, Address, Balance, BlockNumber, Hash, Header, Nonce, Signature, +}; + +pub mod genesis_config_presets; + +/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know +/// the specifics of the runtime. They can then be made to be agnostic over specific formats +/// of data like extrinsics, allowing for them to continue syncing the network through upgrades +/// to even the core data structures. +pub mod opaque { + use super::*; + use sp_runtime::{ + generic, + traits::{BlakeTwo256, Hash as HashT}, + }; + + pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic; + + /// Opaque block header type. + pub type Header = generic::Header; + /// Opaque block type. + pub type Block = generic::Block; + /// Opaque block identifier type. + pub type BlockId = generic::BlockId; + /// Opaque block hash type. + pub type Hash = ::Output; +} + +impl_opaque_keys! { + pub struct SessionKeys { + pub babe: Babe, + pub grandpa: Grandpa, + pub im_online: ImOnline, + pub beefy: Beefy, + } +} + +// To learn more about runtime versioning, see: +// https://docs.substrate.io/main-docs/build/upgrade#runtime-versioning +#[sp_version::runtime_version] +pub const VERSION: RuntimeVersion = RuntimeVersion { + spec_name: Cow::Borrowed("datahaven-testnet"), + impl_name: Cow::Borrowed("datahaven-testnet"), + authoring_version: 1, + // The version of the runtime specification. A full node will not attempt to use its native + // runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, + // `spec_version`, and `authoring_version` are the same between Wasm and native. + // This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use + // the compatible custom types. + spec_version: 100, + impl_version: 1, + apis: apis::RUNTIME_API_VERSIONS, + transaction_version: 1, + system_version: 1, +}; + +mod block_times { + /// This determines the average expected block time that we are targeting. Blocks will be + /// produced at a minimum duration defined by `SLOT_DURATION`. `SLOT_DURATION` is picked up by + /// `pallet_timestamp` which is in turn picked up by `pallet_babe` to implement `fn + /// slot_duration()`. + /// + /// Change this to adjust the block time. + pub const MILLI_SECS_PER_BLOCK: u64 = 6000; + + // NOTE: Currently it is not possible to change the slot duration after the chain has started. + // Attempting to do so will brick block production. + pub const SLOT_DURATION: u64 = MILLI_SECS_PER_BLOCK; +} +pub use block_times::*; + +// Time is measured by number of blocks. +pub const MINUTES: BlockNumber = 60_000 / (MILLI_SECS_PER_BLOCK as BlockNumber); +pub const HOURS: BlockNumber = MINUTES * 60; +pub const DAYS: BlockNumber = HOURS * 24; + +pub const BLOCK_HASH_COUNT: BlockNumber = 2400; + +// Provide a common factor between runtimes based on a supply of 10_000_000 tokens. +pub const SUPPLY_FACTOR: Balance = 1; + +// Unit = the base number of indivisible units for balances +pub const UNIT: Balance = 1_000_000_000_000; +pub const MILLI_UNIT: Balance = 1_000_000_000; +pub const MICRO_UNIT: Balance = 1_000_000; + +pub const STORAGE_BYTE_FEE: Balance = 100 * MICRO_UNIT * SUPPLY_FACTOR; + +/// Existential deposit. +pub const EXISTENTIAL_DEPOSIT: Balance = MILLI_UNIT; + +pub const fn deposit(items: u32, bytes: u32) -> Balance { + items as Balance * UNIT * SUPPLY_FACTOR + (bytes as Balance) * STORAGE_BYTE_FEE +} + +/// The version information used to identify this runtime when compiled natively. +#[cfg(feature = "std")] +pub fn native_version() -> NativeVersion { + NativeVersion { + runtime_version: VERSION, + can_author_with: Default::default(), + } +} + +/// Block type as expected by this runtime. +pub type Block = generic::Block; + +/// The SignedExtension to the basic transaction logic. +pub type SignedExtra = ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + frame_system::CheckWeight, + pallet_transaction_payment::ChargeTransactionPayment, + frame_metadata_hash_extension::CheckMetadataHash, +); + +/// Unchecked extrinsic type as expected by this runtime. +pub type UncheckedExtrinsic = + fp_self_contained::UncheckedExtrinsic; + +pub type CheckedExtrinsic = + fp_self_contained::CheckedExtrinsic; + +/// The payload being signed in transactions. +pub type SignedPayload = generic::SignedPayload; + +/// All migrations of the runtime, aside from the ones declared in the pallets. +/// +/// This can be a tuple of types, each implementing `OnRuntimeUpgrade`. +#[allow(unused_parens)] +type Migrations = (); + +/// Executive: handles dispatch to the various modules. +pub type Executive = frame_executive::Executive< + Runtime, + Block, + frame_system::ChainContext, + Runtime, + AllPalletsWithSystem, + Migrations, +>; + +impl frame_system::offchain::CreateTransactionBase for Runtime +where + RuntimeCall: From, +{ + type Extrinsic = UncheckedExtrinsic; + type RuntimeCall = RuntimeCall; +} + +impl frame_system::offchain::CreateInherent for Runtime +where + RuntimeCall: From, +{ + fn create_inherent(call: RuntimeCall) -> UncheckedExtrinsic { + UncheckedExtrinsic::new_bare(call) + } +} + +// Create the runtime by composing the FRAME pallets that were previously configured. +#[frame_support::runtime] +mod runtime { + #[runtime::runtime] + #[runtime::derive( + RuntimeCall, + RuntimeEvent, + RuntimeError, + RuntimeOrigin, + RuntimeFreezeReason, + RuntimeHoldReason, + RuntimeSlashReason, + RuntimeLockId, + RuntimeTask + )] + pub struct Runtime; + + // ╔══════════════════ System and Consensus Pallets ═════════════════╗ + #[runtime::pallet_index(0)] + pub type System = frame_system; + + // Babe must be before session. + #[runtime::pallet_index(1)] + pub type Babe = pallet_babe; + + #[runtime::pallet_index(2)] + pub type Timestamp = pallet_timestamp; + + #[runtime::pallet_index(3)] + pub type Balances = pallet_balances; + + // Consensus support. + // Authorship must be before session in order to note author in the correct session and era. + #[runtime::pallet_index(4)] + pub type Authorship = pallet_authorship; + + #[runtime::pallet_index(5)] + pub type Offences = pallet_offences; + + #[runtime::pallet_index(6)] + pub type Historical = pallet_session::historical; + + // Validator set must be before Session. + #[runtime::pallet_index(7)] + pub type ValidatorSet = pallet_validator_set; + + #[runtime::pallet_index(8)] + pub type Session = pallet_session; + + #[runtime::pallet_index(9)] + pub type ImOnline = pallet_im_online; + + #[runtime::pallet_index(10)] + pub type Grandpa = pallet_grandpa; + + #[runtime::pallet_index(11)] + pub type TransactionPayment = pallet_transaction_payment; + + #[runtime::pallet_index(12)] + pub type Beefy = pallet_beefy; + + #[runtime::pallet_index(13)] + pub type Mmr = pallet_mmr; + + #[runtime::pallet_index(14)] + pub type BeefyMmrLeaf = pallet_beefy_mmr; + // ╚═════════════════ System and Consensus Pallets ══════════════════╝ + + // ╔═════════════════ Polkadot SDK Utility Pallets ══════════════════╗ + #[runtime::pallet_index(30)] + pub type Utility = pallet_utility; + + #[runtime::pallet_index(31)] + pub type Scheduler = pallet_scheduler; + + #[runtime::pallet_index(32)] + pub type Preimage = pallet_preimage; + + #[runtime::pallet_index(33)] + pub type Identity = pallet_identity; + + #[runtime::pallet_index(34)] + pub type Multisig = pallet_multisig; + + #[runtime::pallet_index(35)] + pub type Parameters = pallet_parameters; + + #[runtime::pallet_index(36)] + pub type Sudo = pallet_sudo; + + #[runtime::pallet_index(37)] + pub type MessageQueue = pallet_message_queue; + // ╚═════════════════ Polkadot SDK Utility Pallets ══════════════════╝ + + // ╔════════════════════ Frontier (EVM) Pallets ═════════════════════╗ + #[runtime::pallet_index(50)] + pub type Ethereum = pallet_ethereum; + + #[runtime::pallet_index(51)] + pub type Evm = pallet_evm; + + #[runtime::pallet_index(52)] + pub type EvmChainId = pallet_evm_chain_id; + // ╚════════════════════ Frontier (EVM) Pallets ═════════════════════╝ + + // ╔══════════════════════ Snowbridge Pallets ═══════════════════════╗ + #[runtime::pallet_index(60)] + pub type EthereumBeaconClient = snowbridge_pallet_ethereum_client; + + #[runtime::pallet_index(61)] + pub type InboundQueueV2 = snowbridge_pallet_inbound_queue_v2; + + #[runtime::pallet_index(62)] + pub type OutboundQueueV2 = snowbridge_pallet_outbound_queue_v2; + + #[runtime::pallet_index(63)] + pub type SnowbridgeSystem = snowbridge_pallet_system; + + #[runtime::pallet_index(64)] + pub type SnowbridgeSystemV2 = snowbridge_pallet_system_v2; + // ╚══════════════════════ Snowbridge Pallets ═══════════════════════╝ + + // ╔══════════════════════ StorageHub Pallets ═══════════════════════╗ + // Start with index 70 + // ╚══════════════════════ StorageHub Pallets ═══════════════════════╝ + + // ╔═══════════════════ DataHaven-specific Pallets ══════════════════╗ + // Start with index 100 + #[runtime::pallet_index(100)] + pub type OutboundCommitmentStore = pallet_outbound_commitment_store; + // ╚═══════════════════ DataHaven-specific Pallets ══════════════════╝ +}