Merge branch 'main' into misc/improve-e2e-tests

This commit is contained in:
undercover-cactus 2025-11-03 15:30:22 +01:00 committed by GitHub
commit 98dacdd7ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
51 changed files with 1574 additions and 1130 deletions

View file

@ -0,0 +1,23 @@
name: Check licenses
on:
pull_request:
workflow_dispatch:
jobs:
verify:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v5
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.88.0
override: true
- name: Verify Licenses
working-directory: operator
run: |
cargo install cargo-license@0.7.0
./scripts/verify-licenses.sh

View file

@ -46,7 +46,7 @@ RUN apt-get update && \
find /var/lib/apt/lists/ -type f -not -name lock -delete
# Create datahaven user and directories
RUN useradd -m -u 1000 -U -s /bin/sh -d /datahaven datahaven && \
RUN useradd -m -u 1001 -U -s /bin/sh -d /datahaven datahaven && \
mkdir -p /data /datahaven/.local/share /specs /storage && \
chown -R datahaven:datahaven /data /storage && \
ln -s /data /datahaven/.local/share/datahaven-node

206
operator/Cargo.lock generated
View file

@ -1517,7 +1517,7 @@ dependencies = [
"pallet-message-queue",
"parity-scale-codec",
"scale-info",
"snowbridge-core 0.3.1",
"snowbridge-core 0.4.0",
"sp-core",
"sp-runtime",
"sp-std",
@ -2902,7 +2902,7 @@ dependencies = [
[[package]]
name = "datahaven-mainnet-runtime"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"bridge-hub-common 0.13.1",
"datahaven-runtime-common",
@ -2922,6 +2922,7 @@ dependencies = [
"frame-try-runtime",
"hex",
"hex-literal 0.3.4",
"itoa",
"log",
"num-bigint",
"num_enum",
@ -2982,6 +2983,7 @@ dependencies = [
"pallet-safe-mode",
"pallet-scheduler",
"pallet-session",
"pallet-session-benchmarking",
"pallet-storage-providers",
"pallet-storage-providers-runtime-api",
"pallet-sudo",
@ -3007,8 +3009,8 @@ dependencies = [
"shp-traits",
"shp-treasury-funding",
"smallvec",
"snowbridge-beacon-primitives 0.3.1",
"snowbridge-core 0.3.1",
"snowbridge-beacon-primitives 0.4.0",
"snowbridge-core 0.4.0",
"snowbridge-inbound-queue-primitives",
"snowbridge-merkle-tree",
"snowbridge-outbound-queue-primitives",
@ -3050,7 +3052,7 @@ dependencies = [
[[package]]
name = "datahaven-node"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"async-channel 1.9.0",
"clap",
@ -3160,7 +3162,7 @@ dependencies = [
[[package]]
name = "datahaven-runtime-common"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"fp-account",
"frame-support",
@ -3189,7 +3191,7 @@ dependencies = [
[[package]]
name = "datahaven-stagenet-runtime"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"bridge-hub-common 0.13.1",
"datahaven-runtime-common",
@ -3209,6 +3211,7 @@ dependencies = [
"frame-try-runtime",
"hex",
"hex-literal 0.3.4",
"itoa",
"log",
"num-bigint",
"num_enum",
@ -3269,6 +3272,7 @@ dependencies = [
"pallet-safe-mode",
"pallet-scheduler",
"pallet-session",
"pallet-session-benchmarking",
"pallet-storage-providers",
"pallet-storage-providers-runtime-api",
"pallet-sudo",
@ -3294,8 +3298,8 @@ dependencies = [
"shp-traits",
"shp-treasury-funding",
"smallvec",
"snowbridge-beacon-primitives 0.3.1",
"snowbridge-core 0.3.1",
"snowbridge-beacon-primitives 0.4.0",
"snowbridge-core 0.4.0",
"snowbridge-inbound-queue-primitives",
"snowbridge-merkle-tree",
"snowbridge-outbound-queue-primitives",
@ -3337,7 +3341,7 @@ dependencies = [
[[package]]
name = "datahaven-testnet-runtime"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"bridge-hub-common 0.13.1",
"datahaven-runtime-common",
@ -3357,6 +3361,7 @@ dependencies = [
"frame-try-runtime",
"hex",
"hex-literal 0.3.4",
"itoa",
"log",
"num-bigint",
"num_enum",
@ -3417,6 +3422,7 @@ dependencies = [
"pallet-safe-mode",
"pallet-scheduler",
"pallet-session",
"pallet-session-benchmarking",
"pallet-storage-providers",
"pallet-storage-providers-runtime-api",
"pallet-sudo",
@ -3442,8 +3448,8 @@ dependencies = [
"shp-traits",
"shp-treasury-funding",
"smallvec",
"snowbridge-beacon-primitives 0.3.1",
"snowbridge-core 0.3.1",
"snowbridge-beacon-primitives 0.4.0",
"snowbridge-core 0.4.0",
"snowbridge-inbound-queue-primitives",
"snowbridge-merkle-tree",
"snowbridge-outbound-queue-primitives",
@ -3634,7 +3640,7 @@ dependencies = [
[[package]]
name = "dhp-bridge"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"frame-support",
"frame-system",
@ -3642,7 +3648,7 @@ dependencies = [
"pallet-datahaven-native-transfer",
"pallet-external-validators",
"parity-scale-codec",
"snowbridge-core 0.3.1",
"snowbridge-core 0.4.0",
"snowbridge-inbound-queue-primitives",
"sp-core",
"sp-std",
@ -8982,7 +8988,7 @@ dependencies = [
[[package]]
name = "pallet-bucket-nfts"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"frame-benchmarking",
"frame-support",
@ -9058,7 +9064,7 @@ dependencies = [
[[package]]
name = "pallet-cr-randomness"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"frame-support",
"frame-system",
@ -9077,7 +9083,7 @@ dependencies = [
[[package]]
name = "pallet-datahaven-native-transfer"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"frame-benchmarking",
"frame-support",
@ -9085,7 +9091,7 @@ dependencies = [
"pallet-balances",
"parity-scale-codec",
"scale-info",
"snowbridge-core 0.3.1",
"snowbridge-core 0.4.0",
"snowbridge-outbound-queue-primitives",
"sp-core",
"sp-io",
@ -9189,7 +9195,7 @@ dependencies = [
[[package]]
name = "pallet-evm-precompile-balances-erc20"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"fp-evm",
"frame-support",
@ -9212,7 +9218,7 @@ dependencies = [
[[package]]
name = "pallet-evm-precompile-batch"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"evm",
"fp-evm",
@ -9251,7 +9257,7 @@ dependencies = [
[[package]]
name = "pallet-evm-precompile-call-permit"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"evm",
"fp-evm",
@ -9317,7 +9323,7 @@ dependencies = [
[[package]]
name = "pallet-evm-precompile-file-system"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"fp-account",
"fp-evm",
@ -9385,7 +9391,7 @@ dependencies = [
[[package]]
name = "pallet-evm-precompile-proxy"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"evm",
"fp-evm",
@ -9429,7 +9435,7 @@ dependencies = [
[[package]]
name = "pallet-evm-precompile-registry"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"fp-evm",
"frame-support",
@ -9480,7 +9486,7 @@ dependencies = [
"parity-scale-codec",
"scale-info",
"serde",
"snowbridge-core 0.3.1",
"snowbridge-core 0.4.0",
"snowbridge-outbound-queue-primitives",
"sp-core",
"sp-io",
@ -9490,7 +9496,7 @@ dependencies = [
[[package]]
name = "pallet-external-validators"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"frame-benchmarking",
"frame-support",
@ -9514,7 +9520,7 @@ dependencies = [
[[package]]
name = "pallet-external-validators-rewards"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"cumulus-primitives-core",
"frame-benchmarking",
@ -9529,7 +9535,7 @@ dependencies = [
"polkadot-primitives",
"polkadot-runtime-parachains",
"scale-info",
"snowbridge-core 0.3.1",
"snowbridge-core 0.4.0",
"snowbridge-merkle-tree",
"snowbridge-outbound-queue-primitives",
"sp-core",
@ -9541,7 +9547,7 @@ dependencies = [
[[package]]
name = "pallet-external-validators-rewards-runtime-api"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"parity-scale-codec",
"snowbridge-merkle-tree",
@ -9570,7 +9576,7 @@ dependencies = [
[[package]]
name = "pallet-file-system"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"frame-benchmarking",
"frame-support",
@ -9597,7 +9603,7 @@ dependencies = [
[[package]]
name = "pallet-file-system-runtime-api"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"parity-scale-codec",
"scale-info",
@ -9764,7 +9770,7 @@ dependencies = [
[[package]]
name = "pallet-outbound-commitment-store"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"frame-support",
"frame-system",
@ -9793,7 +9799,7 @@ dependencies = [
[[package]]
name = "pallet-payment-streams"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"frame-benchmarking",
"frame-support",
@ -9813,7 +9819,7 @@ dependencies = [
[[package]]
name = "pallet-payment-streams-runtime-api"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"parity-scale-codec",
"scale-info",
@ -9841,7 +9847,7 @@ dependencies = [
[[package]]
name = "pallet-proofs-dealer"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"frame-benchmarking",
"frame-support",
@ -9863,7 +9869,7 @@ dependencies = [
[[package]]
name = "pallet-proofs-dealer-runtime-api"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"parity-scale-codec",
"scale-info",
@ -9885,8 +9891,9 @@ dependencies = [
[[package]]
name = "pallet-randomness"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"frame-benchmarking",
"frame-support",
"frame-system",
"log",
@ -9975,6 +9982,22 @@ dependencies = [
"sp-trie",
]
[[package]]
name = "pallet-session-benchmarking"
version = "39.1.0"
source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-stable2412-6#bbc435c7667d3283ba280a8fec44676357392753"
dependencies = [
"frame-benchmarking",
"frame-support",
"frame-system",
"pallet-session",
"pallet-staking",
"parity-scale-codec",
"rand 0.8.5",
"sp-runtime",
"sp-session",
]
[[package]]
name = "pallet-staking"
version = "39.1.0"
@ -10009,7 +10032,7 @@ dependencies = [
[[package]]
name = "pallet-storage-providers"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"frame-benchmarking",
"frame-support",
@ -10031,7 +10054,7 @@ dependencies = [
[[package]]
name = "pallet-storage-providers-runtime-api"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"parity-scale-codec",
"scale-info",
@ -15139,7 +15162,7 @@ dependencies = [
[[package]]
name = "shc-actors-derive"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"once_cell",
"proc-macro2",
@ -15152,7 +15175,7 @@ dependencies = [
[[package]]
name = "shc-actors-framework"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"anyhow",
"bincode",
@ -15170,7 +15193,7 @@ dependencies = [
[[package]]
name = "shc-blockchain-service"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"anyhow",
"array-bytes",
@ -15198,6 +15221,7 @@ dependencies = [
"sc-network-types",
"sc-service",
"sc-tracing",
"sc-transaction-pool-api",
"sc-utils",
"serde",
"serde_json",
@ -15221,7 +15245,7 @@ dependencies = [
[[package]]
name = "shc-client"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"anyhow",
"array-bytes",
@ -15287,7 +15311,7 @@ dependencies = [
[[package]]
name = "shc-common"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"anyhow",
"bigdecimal",
@ -15351,7 +15375,7 @@ dependencies = [
[[package]]
name = "shc-file-manager"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"bincode",
"hash-db",
@ -15375,7 +15399,7 @@ dependencies = [
[[package]]
name = "shc-file-transfer-service"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"anyhow",
"array-bytes",
@ -15404,7 +15428,7 @@ dependencies = [
[[package]]
name = "shc-fisherman-service"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"async-trait",
"diesel",
@ -15434,7 +15458,7 @@ dependencies = [
[[package]]
name = "shc-forest-manager"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"async-trait",
"bincode",
@ -15459,7 +15483,7 @@ dependencies = [
[[package]]
name = "shc-indexer-db"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"bigdecimal",
"chrono",
@ -15487,7 +15511,7 @@ dependencies = [
[[package]]
name = "shc-indexer-service"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"anyhow",
"array-bytes",
@ -15538,7 +15562,7 @@ dependencies = [
[[package]]
name = "shc-rpc"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"array-bytes",
"async-trait",
@ -15589,7 +15613,7 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "shp-constants"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"sp-core",
"sp-runtime",
@ -15598,7 +15622,7 @@ dependencies = [
[[package]]
name = "shp-data-price-updater"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"frame-support",
"parity-scale-codec",
@ -15613,7 +15637,7 @@ dependencies = [
[[package]]
name = "shp-file-key-verifier"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"frame-support",
"parity-scale-codec",
@ -15631,7 +15655,7 @@ dependencies = [
[[package]]
name = "shp-file-metadata"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"hex",
"num-bigint",
@ -15647,7 +15671,7 @@ dependencies = [
[[package]]
name = "shp-forest-verifier"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"frame-support",
"parity-scale-codec",
@ -15664,7 +15688,7 @@ dependencies = [
[[package]]
name = "shp-opaque"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"parachains-common",
"sp-runtime",
@ -15673,7 +15697,7 @@ dependencies = [
[[package]]
name = "shp-session-keys"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"async-trait",
"parity-scale-codec",
@ -15688,7 +15712,7 @@ dependencies = [
[[package]]
name = "shp-traits"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"frame-support",
"parity-scale-codec",
@ -15702,7 +15726,7 @@ dependencies = [
[[package]]
name = "shp-treasury-funding"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"log",
"shp-traits",
@ -15713,7 +15737,7 @@ dependencies = [
[[package]]
name = "shp-types"
version = "0.1.0"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.0.6-alpha#05d269a26d11c1ed8a6d917b3e08ff3b5d3d4b22"
source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.1.1#73241088333295db001818864a518b8c25896b5a"
dependencies = [
"sp-core",
"sp-runtime",
@ -16087,7 +16111,7 @@ dependencies = [
[[package]]
name = "snowbridge-beacon-primitives"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"byte-slice-cast",
"frame-support",
@ -16131,7 +16155,7 @@ dependencies = [
[[package]]
name = "snowbridge-core"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"bp-relayers",
"ethabi-decode",
@ -16231,8 +16255,8 @@ dependencies = [
"log",
"parity-scale-codec",
"scale-info",
"snowbridge-beacon-primitives 0.3.1",
"snowbridge-core 0.3.1",
"snowbridge-beacon-primitives 0.4.0",
"snowbridge-core 0.4.0",
"snowbridge-verification-primitives",
"sp-core",
"sp-io",
@ -16245,7 +16269,7 @@ dependencies = [
[[package]]
name = "snowbridge-merkle-tree"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"array-bytes",
"hex",
@ -16286,7 +16310,7 @@ dependencies = [
[[package]]
name = "snowbridge-outbound-queue-primitives"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"alloy-core",
"ethabi-decode",
@ -16298,7 +16322,7 @@ dependencies = [
"parity-scale-codec",
"polkadot-parachain-primitives",
"scale-info",
"snowbridge-core 0.3.1",
"snowbridge-core 0.4.0",
"snowbridge-verification-primitives",
"sp-arithmetic",
"sp-core",
@ -16312,12 +16336,12 @@ dependencies = [
[[package]]
name = "snowbridge-outbound-queue-v2-runtime-api"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"frame-support",
"parity-scale-codec",
"scale-info",
"snowbridge-core 0.3.1",
"snowbridge-core 0.4.0",
"snowbridge-merkle-tree",
"snowbridge-outbound-queue-primitives",
"sp-api",
@ -16327,7 +16351,7 @@ dependencies = [
[[package]]
name = "snowbridge-pallet-ethereum-client"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"frame-benchmarking",
"frame-support",
@ -16340,8 +16364,8 @@ dependencies = [
"scale-info",
"serde",
"serde_json",
"snowbridge-beacon-primitives 0.3.1",
"snowbridge-core 0.3.1",
"snowbridge-beacon-primitives 0.4.0",
"snowbridge-core 0.4.0",
"snowbridge-ethereum 0.3.0",
"snowbridge-inbound-queue-primitives",
"snowbridge-pallet-ethereum-client-fixtures",
@ -16357,8 +16381,8 @@ name = "snowbridge-pallet-ethereum-client-fixtures"
version = "0.9.0"
dependencies = [
"hex-literal 0.3.4",
"snowbridge-beacon-primitives 0.3.1",
"snowbridge-core 0.3.1",
"snowbridge-beacon-primitives 0.4.0",
"snowbridge-core 0.4.0",
"snowbridge-inbound-queue-primitives",
"sp-core",
"sp-std",
@ -16366,7 +16390,7 @@ dependencies = [
[[package]]
name = "snowbridge-pallet-inbound-queue-v2"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"alloy-core",
"bp-relayers",
@ -16380,8 +16404,8 @@ dependencies = [
"parity-scale-codec",
"scale-info",
"serde",
"snowbridge-beacon-primitives 0.3.1",
"snowbridge-core 0.3.1",
"snowbridge-beacon-primitives 0.4.0",
"snowbridge-core 0.4.0",
"snowbridge-inbound-queue-primitives",
"snowbridge-pallet-ethereum-client",
"snowbridge-pallet-inbound-queue-v2-fixtures",
@ -16402,8 +16426,8 @@ name = "snowbridge-pallet-inbound-queue-v2-fixtures"
version = "0.10.0"
dependencies = [
"hex-literal 0.3.4",
"snowbridge-beacon-primitives 0.3.1",
"snowbridge-core 0.3.1",
"snowbridge-beacon-primitives 0.4.0",
"snowbridge-core 0.4.0",
"snowbridge-inbound-queue-primitives",
"sp-core",
"sp-std",
@ -16433,7 +16457,7 @@ dependencies = [
[[package]]
name = "snowbridge-pallet-outbound-queue-v2"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"alloy-core",
"bp-relayers",
@ -16447,8 +16471,8 @@ dependencies = [
"parity-scale-codec",
"scale-info",
"serde",
"snowbridge-beacon-primitives 0.3.1",
"snowbridge-core 0.3.1",
"snowbridge-beacon-primitives 0.4.0",
"snowbridge-core 0.4.0",
"snowbridge-inbound-queue-primitives",
"snowbridge-merkle-tree",
"snowbridge-outbound-queue-primitives",
@ -16479,7 +16503,7 @@ dependencies = [
"parity-scale-codec",
"polkadot-primitives",
"scale-info",
"snowbridge-core 0.3.1",
"snowbridge-core 0.4.0",
"snowbridge-outbound-queue-primitives",
"snowbridge-pallet-outbound-queue",
"sp-core",
@ -16492,7 +16516,7 @@ dependencies = [
[[package]]
name = "snowbridge-pallet-system-v2"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"frame-benchmarking",
"frame-support",
@ -16504,7 +16528,7 @@ dependencies = [
"parity-scale-codec",
"polkadot-primitives",
"scale-info",
"snowbridge-core 0.3.1",
"snowbridge-core 0.4.0",
"snowbridge-outbound-queue-primitives",
"snowbridge-pallet-outbound-queue-v2",
"snowbridge-pallet-system",
@ -16520,10 +16544,10 @@ dependencies = [
[[package]]
name = "snowbridge-system-v2-runtime-api"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"parity-scale-codec",
"snowbridge-core 0.3.1",
"snowbridge-core 0.4.0",
"sp-api",
"sp-std",
"staging-xcm",
@ -16531,7 +16555,7 @@ dependencies = [
[[package]]
name = "snowbridge-test-utils"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"frame-benchmarking",
"frame-support",
@ -16551,12 +16575,12 @@ dependencies = [
[[package]]
name = "snowbridge-verification-primitives"
version = "0.3.1"
version = "0.4.0"
dependencies = [
"frame-support",
"parity-scale-codec",
"scale-info",
"snowbridge-beacon-primitives 0.3.1",
"snowbridge-beacon-primitives 0.4.0",
"sp-core",
"sp-std",
]

View file

@ -1,11 +1,11 @@
[workspace.package]
authors = ["MoonsongLabs <dev@moonsonglabs.com>"]
description = "DataHaven: A decentralized storage network with Ethereum and IPFS integration."
authors = ["Moonsong Labs"]
description = "DataHaven: A decentralized storage network with Ethereum and EigenLayer integration."
edition = "2021"
homepage = "https://datahaven.xyz/"
license = "GPL-3"
repository = "https://github.com/datahavenxyz/datahaven"
version = "0.3.1"
version = "0.4.0"
[workspace]
members = [
@ -27,11 +27,6 @@ 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-external-validators = { path = "./pallets/external-validators", default-features = false }
pallet-external-validators-rewards = { path = "./pallets/external-validators-rewards", default-features = false }
pallet-external-validators-rewards-runtime-api = { path = "./pallets/external-validators-rewards/runtime-api", default-features = false }
pallet-external-validator-slashes = { path = "./pallets/external-validator-slashes", default-features = false }
pallet-outbound-commitment-store = { path = "./pallets/outbound-commitment-store", default-features = false }
pallet-datahaven-native-transfer = { path = "./pallets/datahaven-native-transfer", default-features = false }
pallet-evm-precompile-balances-erc20 = { path = "./precompiles/erc20-balances", default-features = false }
pallet-evm-precompile-batch = { path = "./precompiles/batch", default-features = false }
@ -43,6 +38,11 @@ pallet-evm-precompile-preimage = { path = "./precompiles/preimage", default-feat
pallet-evm-precompile-proxy = { path = "./precompiles/proxy", default-features = false }
pallet-evm-precompile-referenda = { path = "./precompiles/referenda", default-features = false }
pallet-evm-precompile-registry = { path = "./precompiles/precompile-registry", default-features = false }
pallet-external-validator-slashes = { path = "./pallets/external-validator-slashes", default-features = false }
pallet-external-validators = { path = "./pallets/external-validators", default-features = false }
pallet-external-validators-rewards = { path = "./pallets/external-validators-rewards", default-features = false }
pallet-external-validators-rewards-runtime-api = { path = "./pallets/external-validators-rewards/runtime-api", default-features = false }
pallet-outbound-commitment-store = { path = "./pallets/outbound-commitment-store", default-features = false }
# Crates.io (wasm)
alloy-core = { version = "0.8.15", default-features = false }
@ -64,6 +64,7 @@ hex = { version = "0.4.3", default-features = false }
hex-literal = { version = "0.3.4" }
impl-serde = { version = "0.5.0", default-features = false }
impl-trait-for-tuples = { version = "0.2.2" }
itoa = { version = "1.0" }
jsonrpsee = { version = "0.24.3" }
libsecp256k1 = { version = "0.7", default-features = false }
log = { version = "0.4.25" }
@ -137,6 +138,7 @@ pallet-referenda = { git = "https://github.com/paritytech/polkadot-sdk", tag = "
pallet-safe-mode = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false }
pallet-scheduler = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false }
pallet-session = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false }
pallet-session-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false }
pallet-staking = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false }
pallet-sudo = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false }
pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-6", default-features = false }
@ -263,43 +265,43 @@ fc-storage = { git = "https://github.com/polkadot-evm/frontier", branch = "stabl
# StorageHub
## Runtime
pallet-bucket-nfts = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
pallet-cr-randomness = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
pallet-file-system = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
pallet-file-system-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
pallet-payment-streams = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
pallet-payment-streams-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
pallet-proofs-dealer = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
pallet-proofs-dealer-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
pallet-randomness = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
pallet-storage-providers = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
pallet-storage-providers-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
shp-constants = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
shp-data-price-updater = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
shp-file-key-verifier = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
shp-file-metadata = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
shp-forest-verifier = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
shp-traits = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
shp-treasury-funding = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
storage-hub-runtime = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
pallet-bucket-nfts = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
pallet-cr-randomness = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
pallet-file-system = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
pallet-file-system-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
pallet-payment-streams = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
pallet-payment-streams-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
pallet-proofs-dealer = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
pallet-proofs-dealer-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
pallet-randomness = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
pallet-storage-providers = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
pallet-storage-providers-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
shp-constants = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
shp-data-price-updater = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
shp-file-key-verifier = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
shp-file-metadata = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
shp-forest-verifier = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
shp-traits = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
shp-treasury-funding = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
storage-hub-runtime = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
## Client
cumulus-client-service = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2412-6", default-features = false }
shc-actors-derive = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
shc-actors-framework = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
shc-blockchain-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
shc-client = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
shc-common = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
shc-file-manager = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
shc-file-transfer-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
shc-fisherman-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
shc-forest-manager = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
shc-indexer-db = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
shc-indexer-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
shc-rpc = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
shp-opaque = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
shp-types = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
shc-actors-derive = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
shc-actors-framework = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
shc-blockchain-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
shc-client = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
shc-common = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
shc-file-manager = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
shc-file-transfer-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
shc-fisherman-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
shc-forest-manager = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
shc-indexer-db = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
shc-indexer-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
shc-rpc = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
shp-opaque = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
shp-types = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
## Precompiles
pallet-evm-precompile-file-system = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.0.6-alpha", default-features = false }
pallet-evm-precompile-file-system = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.1.1", default-features = false }
# The list of dependencies below (which can be both direct and indirect dependencies) are crates
# that are suspected to be CPU-intensive, and that are unlikely to require debugging (as some of

View file

@ -600,6 +600,19 @@ pub struct FishermanConfigurations {
required_if_eq("fisherman", "true")
)]
pub fisherman_database_url: Option<String>,
/// Maximum number of incomplete storage requests to process after the first block processed coming out of syncing mode.
#[arg(long, value_name = "COUNT", default_value = "10000", value_parser = clap::value_parser!(u32).range(1..))]
pub fisherman_incomplete_sync_max: u32,
/// Page size for incomplete storage request pagination.
/// Must be at least 1.
#[arg(long, value_name = "SIZE", default_value = "256", value_parser = clap::value_parser!(u32).range(1..))]
pub fisherman_incomplete_sync_page_size: u32,
/// The minimum number of blocks between the last processed block and the current best block to consider the fisherman out of sync.
#[arg(long, default_value = "5")]
pub fisherman_sync_mode_min_blocks_behind: u32,
}
impl FishermanConfigurations {
@ -610,6 +623,9 @@ impl FishermanConfigurations {
.fisherman_database_url
.clone()
.expect("Fisherman database URL is required"),
incomplete_sync_max: self.fisherman_incomplete_sync_max,
incomplete_sync_page_size: self.fisherman_incomplete_sync_page_size,
sync_mode_min_blocks_behind: self.fisherman_sync_mode_min_blocks_behind,
maintenance_mode: false, // Skipping maintenance mode for now
})
} else {

View file

@ -1246,7 +1246,9 @@ async fn configure_and_spawn_fisherman<Runtime: StorageEnableRuntime>(
fisherman_builder.with_indexer_db_pool(Some(db_pool.clone()));
// Spawn the fisherman service
fisherman_builder.with_fisherman(client.clone()).await;
fisherman_builder
.with_fisherman(client.clone(), &fisherman_options)
.await;
// All variables below are not needed for the fisherman service to operate but required by the StorageHubHandler
// TODO: Refactor this once we have a proper setup to support role based StorageHubHandler builder

View file

@ -26,7 +26,7 @@ use frame_support::{
use snowbridge_core::TokenId;
use snowbridge_outbound_queue_primitives::v2::{Command, Message as OutboundMessage, SendMessage};
use sp_core::{H160, H256};
use sp_runtime::BoundedVec;
use sp_runtime::{traits::Saturating, BoundedVec};
use sp_std::vec;
pub use pallet::*;
@ -135,6 +135,8 @@ pub mod pallet {
ZeroFee,
/// Native token has not been registered on Ethereum yet
TokenNotRegistered,
/// Insufficient balance in Ethereum sovereign account
InsufficientSovereignBalance,
}
#[pallet::call]
@ -275,13 +277,19 @@ pub mod pallet {
///
/// Transfers tokens from the Ethereum sovereign account back to user
pub fn unlock_tokens(who: &T::AccountId, amount: BalanceOf<T>) -> DispatchResult {
let sovereign = T::EthereumSovereignAccount::get();
let balance = T::Currency::balance(&sovereign);
let minimum_balance = T::Currency::minimum_balance();
let available_balance = balance.saturating_sub(minimum_balance);
// Allow unlocking only from funds that exceed the existential buffer.
ensure!(
available_balance >= amount,
Error::<T>::InsufficientSovereignBalance
);
// Transfer from the Ethereum sovereign account
T::Currency::transfer(
&T::EthereumSovereignAccount::get(),
who,
amount,
Preservation::Preserve,
)?;
T::Currency::transfer(&sovereign, who, amount, Preservation::Preserve)?;
Self::deposit_event(Event::TokensUnlocked {
account: who.clone(),

View file

@ -243,7 +243,10 @@ fn unlock_tokens_works() {
));
assert_eq!(Balances::balance(&BOB), INITIAL_BALANCE + unlock_amount);
assert_eq!(Balances::balance(&ETHEREUM_SOVEREIGN), 1); // Existential deposit remains
assert_eq!(
Balances::balance(&ETHEREUM_SOVEREIGN),
Balances::minimum_balance()
); // Existential deposit remains
// Check event
assert_eq!(
@ -262,7 +265,21 @@ fn unlock_insufficient_sovereign_balance_fails() {
// Try to unlock without any locked tokens
assert_noop!(
DataHavenNativeTransfer::<Test>::unlock_tokens(&BOB, 1000),
DispatchError::Token(sp_runtime::TokenError::FundsUnavailable)
Error::<Test>::InsufficientSovereignBalance
);
});
}
#[test]
fn unlock_fails_if_existential_deposit_would_be_consumed() {
new_test_ext().execute_with(|| {
let amount = 10u128;
assert_ok!(DataHavenNativeTransfer::<Test>::lock_tokens(&ALICE, amount));
// Attempt to withdraw the full sovereign balance, which should leave the account below ED
assert_noop!(
DataHavenNativeTransfer::<Test>::unlock_tokens(&BOB, amount),
Error::<Test>::InsufficientSovereignBalance
);
});
}
@ -283,7 +300,10 @@ fn lock_unlock_different_amounts() {
&CHARLIE, 2999
));
assert_eq!(Balances::balance(&ETHEREUM_SOVEREIGN), 1); // Existential deposit remains
assert_eq!(
Balances::balance(&ETHEREUM_SOVEREIGN),
Balances::minimum_balance()
); // Existential deposit remains
assert_eq!(Balances::balance(&BOB), INITIAL_BALANCE + 2000);
assert_eq!(Balances::balance(&CHARLIE), INITIAL_BALANCE + 2999);
});

View file

@ -159,6 +159,10 @@ pub mod pallet {
/// The weight information of this pallet.
type WeightInfo: WeightInfo;
/// Slashing mode option configuration
#[pallet::constant]
type SlashingMode: Get<SlashingModeOption>;
}
#[pallet::error]
@ -362,6 +366,11 @@ pub mod pallet {
let processed = Self::process_slashes_queue(T::QueuedSlashesProcessedPerBlock::get());
T::WeightInfo::process_slashes_queue(processed)
}
fn on_runtime_upgrade() -> Weight {
SlashingMode::<T>::put(T::SlashingMode::get());
T::DbWeight::get().writes(1)
}
}
}

View file

@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Tanssi. If not, see <http://www.gnu.org/licenses/>
use crate::SlashingModeOption;
use frame_support::traits::OnInitialize;
use pallet_external_validators::traits::ActiveEraInfo;
use pallet_external_validators::traits::EraIndex;
@ -261,6 +262,14 @@ impl external_validator_slashes::Config for Test {
type QueuedSlashesProcessedPerBlock = ConstU32<20>;
type WeightInfo = ();
type SendMessage = MockOkOutboundQueue;
type SlashingMode = SlashingMode;
}
pub struct SlashingMode;
impl Get<SlashingModeOption> for SlashingMode {
fn get() -> SlashingModeOption {
SlashingModeOption::Enabled
}
}
pub struct FullIdentificationOf;

View file

@ -1,6 +1,6 @@
[package]
name = "pallet-evm-precompile-registry"
authors = ["The DataHaven Team"]
authors = { workspace = true }
description = "Registry of active precompiles"
edition = "2021"
version = { workspace = true }

View file

@ -1,4 +1,5 @@
[package]
authors = { workspace = true }
description = "Common code used through the DataHaven network"
edition = { workspace = true }
name = "datahaven-runtime-common"

View file

@ -31,6 +31,7 @@ frame-system-rpc-runtime-api = { workspace = true }
frame-try-runtime = { workspace = true, optional = true }
hex = { workspace = true }
hex-literal = { workspace = true }
itoa = { workspace = true }
log = { workspace = true }
num-bigint = { workspace = true }
num_enum = { workspace = true }
@ -41,6 +42,7 @@ pallet-beefy = { workspace = true }
pallet-beefy-mmr = { workspace = true }
pallet-collective = { workspace = true }
pallet-conviction-voting = { workspace = true }
pallet-datahaven-native-transfer = { workspace = true }
pallet-ethereum = { workspace = true, features = ["forbid-evm-reentrancy"] }
pallet-evm = { workspace = true, features = ["forbid-evm-reentrancy"] }
pallet-evm-chain-id = { workspace = true }
@ -49,10 +51,10 @@ pallet-evm-precompile-bn128 = { workspace = true }
pallet-evm-precompile-modexp = { workspace = true }
pallet-evm-precompile-sha3fips = { workspace = true }
pallet-evm-precompile-simple = { workspace = true }
pallet-external-validator-slashes = { workspace = true }
pallet-external-validators = { workspace = true }
pallet-external-validators-rewards = { workspace = true }
pallet-external-validators-rewards-runtime-api = { workspace = true }
pallet-external-validator-slashes = { workspace = true }
pallet-grandpa = { workspace = true }
pallet-identity = { workspace = true }
pallet-im-online = { workspace = true }
@ -62,20 +64,20 @@ pallet-mmr = { workspace = true }
pallet-multisig = { workspace = true }
pallet-offences = { workspace = true }
pallet-outbound-commitment-store = { workspace = true }
pallet-datahaven-native-transfer = { workspace = true }
pallet-parameters = { workspace = true }
pallet-preimage = { workspace = true }
pallet-safe-mode = { workspace = true }
pallet-tx-pause = { workspace = true }
pallet-proxy = { workspace = true }
pallet-referenda = { workspace = true }
pallet-safe-mode = { workspace = true }
pallet-scheduler = { workspace = true }
pallet-session = { workspace = true }
pallet-session-benchmarking = { workspace = true, optional = true }
pallet-sudo = { workspace = true }
pallet-timestamp = { workspace = true }
pallet-transaction-payment = { workspace = true }
pallet-transaction-payment-rpc-runtime-api = { workspace = true }
pallet-treasury = { workspace = true }
pallet-tx-pause = { workspace = true }
pallet-utility = { workspace = true }
pallet-whitelist = { workspace = true }
polkadot-primitives = { workspace = true }
@ -117,11 +119,11 @@ sp-std = { workspace = true }
sp-storage = { workspace = true }
sp-transaction-pool = { workspace = true }
sp-version = { workspace = true, features = ["serde"] }
strum = { workspace = true }
strum_macros = { workspace = true }
xcm = { workspace = true }
xcm-builder = { workspace = true }
xcm-executor = { workspace = true }
strum = { workspace = true }
strum_macros = { workspace = true }
# DataHaven precompiles
pallet-evm-precompile-balances-erc20 = { workspace = true }
@ -137,10 +139,11 @@ pallet-evm-precompile-registry = { workspace = true }
# StorageHub
pallet-bucket-nfts = { workspace = true }
pallet-nfts = { workspace = true }
pallet-cr-randomness = { workspace = true }
pallet-evm-precompile-file-system = { workspace = true }
pallet-file-system = { workspace = true }
pallet-file-system-runtime-api = { workspace = true }
pallet-nfts = { workspace = true }
pallet-payment-streams = { workspace = true }
pallet-payment-streams-runtime-api = { workspace = true }
pallet-proofs-dealer = { workspace = true }
@ -150,14 +153,13 @@ pallet-storage-providers = { workspace = true }
pallet-storage-providers-runtime-api = { workspace = true }
shc-common = { workspace = true, optional = true }
shp-constants = { workspace = true }
shp-data-price-updater = { workspace = true }
shp-file-key-verifier = { workspace = true }
shp-file-metadata = { workspace = true }
shp-forest-verifier = { workspace = true }
shp-traits = { workspace = true }
shp-treasury-funding = { workspace = true }
shp-forest-verifier = { workspace = true }
shp-file-key-verifier = { workspace = true }
shp-data-price-updater = { workspace = true }
sp-trie = { workspace = true }
pallet-evm-precompile-file-system = { workspace = true }
[build-dependencies]
substrate-wasm-builder = { workspace = true, optional = true, default-features = true }
@ -172,9 +174,9 @@ precompile-utils = { workspace = true, features = ["std", "testing"] }
# Snowbridge testing
snowbridge-core = { workspace = true }
snowbridge-outbound-queue-primitives = { workspace = true }
snowbridge-pallet-system = { workspace = true }
snowbridge-pallet-system-v2 = { workspace = true }
snowbridge-outbound-queue-primitives = { workspace = true }
[features]
default = ["std"]
@ -188,6 +190,7 @@ std = [
"frame-metadata-hash-extension/std",
"frame-support/std",
"frame-system-benchmarking?/std",
"pallet-session-benchmarking?/std",
"frame-system-rpc-runtime-api/std",
"frame-system/std",
"frame-try-runtime?/std",
@ -331,11 +334,13 @@ runtime-benchmarks = [
"pallet-referenda/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
"pallet-session-benchmarking/runtime-benchmarks",
"pallet-sudo/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-treasury/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
"pallet-whitelist/runtime-benchmarks",
"pallet-randomness/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"polkadot-runtime-common/runtime-benchmarks",
"snowbridge-inbound-queue-primitives/runtime-benchmarks",

View file

@ -36,6 +36,9 @@ frame_benchmarking::define_benchmarks!(
// Consensus pallets
[pallet_mmr, Mmr]
[pallet_beefy_mmr, BeefyMmrLeaf]
[pallet_babe, Babe]
[pallet_grandpa, Grandpa]
[pallet_randomness, Randomness]
// Substrate pallets
[pallet_balances, Balances]
@ -69,6 +72,7 @@ frame_benchmarking::define_benchmarks!(
// DataHaven custom pallets
[pallet_external_validators, ExternalValidators]
[pallet_external_validators_rewards, ExternalValidatorsRewards]
[pallet_external_validator_slashes, ExternalValidatorsSlashes]
[pallet_datahaven_native_transfer, DataHavenNativeTransfer]
// Snowbridge pallets

View file

@ -40,6 +40,7 @@ use super::{
MAXIMUM_BLOCK_WEIGHT, NORMAL_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, VERSION,
};
use codec::{Decode, Encode, MaxEncodedLen};
use pallet_external_validator_slashes::SlashingModeOption;
use scale_info::TypeInfo;
use sp_runtime::RuntimeDebug;
@ -236,13 +237,15 @@ impl Contains<RuntimeCall> for NormalCallFilter {
}
/// Calls that can bypass the safe-mode pallet.
/// These calls are essential for emergency governance and system maintenance.
/// These calls are essential for emergency governance, system maintenance, and basic operation.
pub struct SafeModeWhitelistedCalls;
impl Contains<RuntimeCall> for SafeModeWhitelistedCalls {
fn contains(call: &RuntimeCall) -> bool {
match call {
// Core system calls
RuntimeCall::System(_) => true,
RuntimeCall::Timestamp(_) => true,
RuntimeCall::Randomness(_) => true,
// Safe mode management
RuntimeCall::SafeMode(_) => true,
// Transaction pause management
@ -321,7 +324,7 @@ impl pallet_babe::Config for Runtime {
type ExpectedBlockTime = ExpectedBlockTime;
type EpochChangeTrigger = pallet_babe::ExternalTrigger;
type DisabledValidators = Session;
type WeightInfo = ();
type WeightInfo = mainnet_weights::pallet_babe::WeightInfo<Runtime>;
type MaxAuthorities = MaxAuthorities;
type MaxNominators = ConstU32<0>;
@ -405,7 +408,7 @@ impl pallet_session::Config for Runtime {
type SessionManager = pallet_session::historical::NoteHistoricalRoot<Self, ExternalValidators>;
type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type WeightInfo = ();
type WeightInfo = pallet_session::weights::SubstrateWeight<Runtime>;
}
parameter_types! {
@ -434,7 +437,7 @@ parameter_types! {
impl pallet_grandpa::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
type WeightInfo = mainnet_weights::pallet_grandpa::WeightInfo<Runtime>;
type MaxAuthorities = MaxAuthorities;
type MaxNominators = ConstU32<0>;
type MaxSetIdSessionEntries = MaxSetIdSessionEntries;
@ -643,7 +646,7 @@ impl pallet_identity::Config for Runtime {
type PendingUsernameExpiration = PendingUsernameExpiration;
type MaxSuffixLength = MaxSuffixLength;
type MaxUsernameLength = MaxUsernameLength;
type WeightInfo = ();
type WeightInfo = pallet_identity::weights::SubstrateWeight<Runtime>;
type UsernameDeposit = ();
type UsernameGracePeriod = ();
@ -1631,12 +1634,14 @@ impl pallet_external_validator_slashes::Config for Runtime {
type InvulnerablesProvider = ExternalValidators;
type ExternalIndexProvider = ExternalValidators;
type QueuedSlashesProcessedPerBlock = ConstU32<10>;
type WeightInfo = (); // TODO: calculate weights
type WeightInfo = mainnet_weights::pallet_external_validator_slashes::WeightInfo<Runtime>;
type SendMessage = SlashesSendAdapter;
type SlashingMode = SlashingMode;
}
parameter_types! {
pub const SlashDeferDuration: EraIndex = polkadot_runtime_common::prod_or_fast!(0, 0);
pub const SlashingMode: SlashingModeOption = polkadot_runtime_common::prod_or_fast!(SlashingModeOption::Disabled, SlashingModeOption::Disabled);
}
#[cfg(test)]

View file

@ -37,7 +37,7 @@ use sp_runtime::traits::Zero;
use sp_runtime::SaturatedConversion;
use sp_runtime::{traits::BlakeTwo256, Perbill};
use sp_std::convert::{From, Into};
use sp_std::vec;
use sp_std::{vec, vec::Vec};
use sp_trie::{LayoutV1, TrieConfiguration, TrieLayout};
#[cfg(feature = "std")]
@ -105,7 +105,7 @@ impl pallet_randomness::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type BabeDataGetter = BabeDataGetter;
type BabeBlockGetter = BlockNumberGetter;
type WeightInfo = ();
type WeightInfo = crate::weights::pallet_randomness::WeightInfo<Runtime>;
type BabeDataGetterBlockNumber = BlockNumber;
}
@ -450,6 +450,25 @@ parameter_types! {
pub const FileSystemFileDeletionRequestHoldReason: RuntimeHoldReason = RuntimeHoldReason::FileSystem(pallet_file_system::HoldReason::FileDeletionRequestHold);
}
// Converts a given signed message in a EIP-191 compliant message bytes to verify.
/// EIP-191: https://eips.ethereum.org/EIPS/eip-191
/// "\x19Ethereum Signed Message:\n" + len(message) + message"
pub struct Eip191Adapter;
impl shp_traits::MessageAdapter for Eip191Adapter {
fn bytes_to_verify(message: &[u8]) -> Vec<u8> {
const PREFIX: &str = "\x19Ethereum Signed Message:\n";
let len = message.len();
let mut len_string_buffer = itoa::Buffer::new();
let len_string = len_string_buffer.format(len);
let mut eth_message = Vec::with_capacity(PREFIX.len() + len_string.len() + len);
eth_message.extend_from_slice(PREFIX.as_bytes());
eth_message.extend_from_slice(len_string.as_bytes());
eth_message.extend_from_slice(message);
eth_message
}
}
impl pallet_file_system::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = pallet_file_system::weights::SubstrateWeight<Runtime>;
@ -501,6 +520,8 @@ impl pallet_file_system::Config for Runtime {
type TickRangeToMaximumThreshold = runtime_config::TickRangeToMaximumThreshold;
type OffchainSignature = Signature;
type OffchainPublicKey = <Signature as Verify>::Signer;
type MaxFileDeletionsPerExtrinsic = ConstU32<100>;
type IntentionMsgAdapter = Eip191Adapter;
}
impl MostlyStablePriceIndexUpdaterConfig for Runtime {

View file

@ -123,7 +123,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// `spec_version`, and `authoring_version` are the same between Wasm and native.
// This value is set to 200 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
// the compatible custom types.
spec_version: 310,
spec_version: 400,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
@ -1062,40 +1062,13 @@ impl_runtime_apis! {
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 <Runtime as pallet_evm::Config>::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),
};
let weight_limit = <Runtime as pallet_evm::Config>::GasWeightMapping::gas_to_weight(
gas_limit,
without_base_extrinsic_weight
);
<Runtime as pallet_evm::Config>::Runner::call(
from,
@ -1109,8 +1082,8 @@ impl_runtime_apis! {
access_list.unwrap_or_default(),
is_transactional,
validate,
weight_limit,
proof_size_base_cost,
Some(weight_limit),
None,
config.as_ref().unwrap_or(<Runtime as pallet_evm::Config>::config()),
).map_err(|err| err.error.into())
}
@ -1142,7 +1115,11 @@ impl_runtime_apis! {
gas_limit.low_u64()
};
let (weight_limit, proof_size_base_cost) = (None, None);
let without_base_extrinsic_weight = true;
let weight_limit = <Runtime as pallet_evm::Config>::GasWeightMapping::gas_to_weight(
gas_limit,
without_base_extrinsic_weight
);
#[allow(clippy::or_fun_call)]
<Runtime as pallet_evm::Config>::Runner::create(
@ -1156,8 +1133,8 @@ impl_runtime_apis! {
access_list.unwrap_or_default(),
is_transactional,
validate,
weight_limit,
proof_size_base_cost,
Some(weight_limit),
None,
config.as_ref().unwrap_or(<Runtime as pallet_evm::Config>::config()),
).map_err(|err| err.error.into())
}
@ -1268,6 +1245,9 @@ impl_runtime_apis! {
fn query_incomplete_storage_request_metadata(file_key: H256) -> Result<pallet_file_system_runtime_api::IncompleteStorageRequestMetadataResponse<AccountId, BucketId<Runtime>, StorageDataUnit<Runtime>, H256, BackupStorageProviderId<Runtime>>, QueryIncompleteStorageRequestMetadataError> {
FileSystem::query_incomplete_storage_request_metadata(file_key)
}
fn list_incomplete_storage_request_keys(start_after: Option<H256>, limit: u32) -> Vec<H256> {
FileSystem::list_incomplete_storage_request_keys(start_after, limit)
}
}
impl pallet_payment_streams_runtime_api::PaymentStreamsApi<Block, ProviderIdFor<Runtime>, Balance, AccountId> for Runtime {

View file

@ -19,6 +19,7 @@
// DataHaven pallets
pub mod pallet_datahaven_native_transfer;
pub mod pallet_external_validator_slashes;
pub mod pallet_external_validators;
pub mod pallet_external_validators_rewards;
@ -31,9 +32,11 @@ pub mod snowbridge_pallet_system_v2;
// Substrate pallets
pub mod frame_system;
pub mod pallet_babe;
pub mod pallet_balances;
pub mod pallet_beefy_mmr;
pub mod pallet_evm;
pub mod pallet_grandpa;
pub mod pallet_im_online;
pub mod pallet_message_queue;
pub mod pallet_migrations;
@ -42,6 +45,7 @@ pub mod pallet_multisig;
pub mod pallet_parameters;
pub mod pallet_preimage;
pub mod pallet_proxy;
pub mod pallet_randomness;
pub mod pallet_safe_mode;
pub mod pallet_scheduler;
pub mod pallet_sudo;

View file

@ -0,0 +1,50 @@
//! Autogenerated weights for `pallet_babe`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0
//! DATE: 2025-10-30, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
// frame-omni-bencher
// v1
// benchmark
// pallet
// --runtime
// target/production/wbuild/datahaven-mainnet-runtime/datahaven_mainnet_runtime.compact.compressed.wasm
// --pallet
// pallet_babe
// --extrinsic
//
// --template
// benchmarking/frame-weight-template.hbs
// --output
// runtime/mainnet/src/weights/pallet_babe.rs
// --steps
// 50
// --repeat
// 20
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weights for `pallet_babe`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_babe::WeightInfo for WeightInfo<T> {
fn plan_config_change() -> Weight {
// Placeholder constant; re-benchmark to refresh.
Weight::from_parts(5_000_000, 0)
}
fn report_equivocation(_equivocations: u32, _key_owners: u32) -> Weight {
// Based on previous check_equivocation_proof baseline; re-benchmark to refresh.
Weight::from_parts(89_672_355, 0)
}
}

View file

@ -0,0 +1,115 @@
//! Autogenerated weights for `pallet_external_validator_slashes`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0
//! DATE: 2025-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
// frame-omni-bencher
// v1
// benchmark
// pallet
// --runtime
// target/production/wbuild/datahaven-mainnet-runtime/datahaven_mainnet_runtime.compact.compressed.wasm
// --pallet
// pallet_external_validator_slashes
// --extrinsic
//
// --template
// benchmarking/frame-weight-template.hbs
// --output
// runtime/mainnet/src/weights/pallet_external_validator_slashes.rs
// --steps
// 50
// --repeat
// 20
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weights for `pallet_external_validator_slashes`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_external_validator_slashes::weights::WeightInfo for WeightInfo<T> {
/// Storage: `ExternalValidators::ActiveEra` (r:1 w:0)
/// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`)
/// Storage: `ExternalValidatorsSlashes::Slashes` (r:1 w:1)
/// Proof: `ExternalValidatorsSlashes::Slashes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `s` is `[1, 1000]`.
fn cancel_deferred_slash(_s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `38528`
// Estimated: `41993`
// Minimum execution time: 76_582_000 picoseconds.
Weight::from_parts(1_422_088_660, 41993)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: `ExternalValidators::ActiveEra` (r:1 w:0)
/// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`)
/// Storage: `ExternalValidators::ErasStartSessionIndex` (r:1 w:0)
/// Proof: `ExternalValidators::ErasStartSessionIndex` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
/// Storage: `ExternalValidatorsSlashes::NextSlashId` (r:1 w:1)
/// Proof: `ExternalValidatorsSlashes::NextSlashId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `ExternalValidatorsSlashes::ValidatorSlashInEra` (r:1 w:1)
/// Proof: `ExternalValidatorsSlashes::ValidatorSlashInEra` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// Storage: `ExternalValidatorsSlashes::Slashes` (r:1 w:1)
/// Proof: `ExternalValidatorsSlashes::Slashes` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn force_inject_slash() -> Weight {
// Proof Size summary in bytes:
// Measured: `492`
// Estimated: `3957`
// Minimum execution time: 28_199_000 picoseconds.
Weight::from_parts(28_842_000, 3957)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
/// Storage: `ExternalValidators::ActiveEra` (r:1 w:0)
/// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`)
/// Storage: `ExternalValidatorsSlashes::UnreportedSlashesQueue` (r:1 w:1)
/// Proof: `ExternalValidatorsSlashes::UnreportedSlashesQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `Parameters::Parameters` (r:2 w:0)
/// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
/// Storage: `MessageQueue::BookStateFor` (r:1 w:1)
/// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(136), added: 2611, mode: `MaxEncodedLen`)
/// Storage: `MessageQueue::ServiceHead` (r:1 w:1)
/// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`)
/// Storage: `MessageQueue::Pages` (r:0 w:1)
/// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(32845), added: 35320, mode: `MaxEncodedLen`)
/// The range of component `s` is `[1, 200]`.
fn process_slashes_queue(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `541 + s * (38 ±0)`
// Estimated: `6044 + s * (38 ±0)`
// Minimum execution time: 50_142_000 picoseconds.
Weight::from_parts(52_116_022, 6044)
// Standard Error: 857
.saturating_add(Weight::from_parts(45_899, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(6_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
.saturating_add(Weight::from_parts(0, 38).saturating_mul(s.into()))
}
/// Storage: `ExternalValidatorsSlashes::SlashingMode` (r:0 w:1)
/// Proof: `ExternalValidatorsSlashes::SlashingMode` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`)
fn set_slashing_mode() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_864_000 picoseconds.
Weight::from_parts(4_014_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
fn root_test_send_msg_to_eth() -> Weight {
Weight::from_parts(1_015_195_000, 3601)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
}

View file

@ -0,0 +1,56 @@
//! Autogenerated weights for `pallet_grandpa`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0
//! DATE: 2025-10-30, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
// frame-omni-bencher
// v1
// benchmark
// pallet
// --runtime
// target/production/wbuild/datahaven-mainnet-runtime/datahaven_mainnet_runtime.compact.compressed.wasm
// --pallet
// pallet_grandpa
// --extrinsic
//
// --template
// benchmarking/frame-weight-template.hbs
// --output
// runtime/mainnet/src/weights/pallet_grandpa.rs
// --steps
// 50
// --repeat
// 20
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weights for `pallet_grandpa`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_grandpa::WeightInfo for WeightInfo<T> {
/// Storage: `Grandpa::Stalled` (r:0 w:1)
/// Proof: `Grandpa::Stalled` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
fn note_stalled() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_687_000 picoseconds.
Weight::from_parts(3_903_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
fn report_equivocation(_equivocations: u32, _key_owners: u32) -> Weight {
// Based on previous check_equivocation_proof baseline; re-benchmark to refresh.
Weight::from_parts(79_601_142, 0)
}
}

View file

@ -0,0 +1,77 @@
//! Autogenerated weights for `pallet_randomness`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0
//! DATE: 2025-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
// frame-omni-bencher
// v1
// benchmark
// pallet
// --runtime
// target/production/wbuild/datahaven-mainnet-runtime/datahaven_mainnet_runtime.compact.compressed.wasm
// --pallet
// pallet_randomness
// --extrinsic
//
// --template
// benchmarking/frame-weight-template.hbs
// --output
// runtime/mainnet/src/weights/pallet_randomness.rs
// --steps
// 50
// --repeat
// 20
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weights for `pallet_randomness`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_randomness::weights::WeightInfo for WeightInfo<T> {
/// Storage: `Babe::AuthorVrfRandomness` (r:1 w:0)
/// Proof: `Babe::AuthorVrfRandomness` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`)
/// Storage: `Randomness::RelayEpoch` (r:1 w:1)
/// Proof: `Randomness::RelayEpoch` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
/// Storage: `Babe::NextRandomness` (r:1 w:0)
/// Proof: `Babe::NextRandomness` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Babe::EpochStart` (r:1 w:0)
/// Proof: `Babe::EpochStart` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
/// Storage: `Randomness::LastRelayBlockAndParaBlockValidForNextEpoch` (r:1 w:1)
/// Proof: `Randomness::LastRelayBlockAndParaBlockValidForNextEpoch` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
/// Storage: `Randomness::LatestOneEpochAgoRandomness` (r:0 w:1)
/// Proof: `Randomness::LatestOneEpochAgoRandomness` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`)
/// Storage: `Randomness::LatestParentBlockRandomness` (r:0 w:1)
/// Proof: `Randomness::LatestParentBlockRandomness` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`)
/// Storage: `Randomness::InherentIncluded` (r:0 w:1)
/// Proof: `Randomness::InherentIncluded` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`)
fn set_babe_randomness() -> Weight {
// Proof Size summary in bytes:
// Measured: `348`
// Estimated: `1518`
// Minimum execution time: 26_171_000 picoseconds.
Weight::from_parts(27_041_000, 1518)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
/// Storage: `Randomness::InherentIncluded` (r:1 w:1)
/// Proof: `Randomness::InherentIncluded` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`)
fn on_finalize_hook() -> Weight {
// Proof Size summary in bytes:
// Measured: `99`
// Estimated: `1485`
// Minimum execution time: 5_396_000 picoseconds.
Weight::from_parts(5_596_000, 1485)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
}

View file

@ -374,9 +374,10 @@ fn processing_fails_with_insufficient_sovereign_balance() {
setup_sovereign_balance(TRANSFER_AMOUNT / 2); // Insufficient balance
let result =
snowbridge_pallet_inbound_queue_v2::Pallet::<Runtime>::process_message(alice, message);
assert!(result.is_err());
assert_noop!(
snowbridge_pallet_inbound_queue_v2::Pallet::<Runtime>::process_message(alice, message),
pallet_datahaven_native_transfer::Error::<Runtime>::InsufficientSovereignBalance
);
});
}

View file

@ -31,6 +31,7 @@ frame-system-rpc-runtime-api = { workspace = true }
frame-try-runtime = { workspace = true, optional = true }
hex = { workspace = true }
hex-literal = { workspace = true }
itoa = { workspace = true }
log = { workspace = true }
num-bigint = { workspace = true }
num_enum = { workspace = true }
@ -41,6 +42,7 @@ pallet-beefy = { workspace = true }
pallet-beefy-mmr = { workspace = true }
pallet-collective = { workspace = true }
pallet-conviction-voting = { workspace = true }
pallet-datahaven-native-transfer = { workspace = true }
pallet-ethereum = { workspace = true, features = ["forbid-evm-reentrancy"] }
pallet-evm = { workspace = true, features = ["forbid-evm-reentrancy"] }
pallet-evm-chain-id = { workspace = true }
@ -49,10 +51,10 @@ pallet-evm-precompile-bn128 = { workspace = true }
pallet-evm-precompile-modexp = { workspace = true }
pallet-evm-precompile-sha3fips = { workspace = true }
pallet-evm-precompile-simple = { workspace = true }
pallet-external-validator-slashes = { workspace = true }
pallet-external-validators = { workspace = true }
pallet-external-validators-rewards = { workspace = true }
pallet-external-validators-rewards-runtime-api = { workspace = true }
pallet-external-validator-slashes = { workspace = true }
pallet-grandpa = { workspace = true }
pallet-identity = { workspace = true }
pallet-im-online = { workspace = true }
@ -62,20 +64,20 @@ pallet-mmr = { workspace = true }
pallet-multisig = { workspace = true }
pallet-offences = { workspace = true }
pallet-outbound-commitment-store = { workspace = true }
pallet-datahaven-native-transfer = { workspace = true }
pallet-parameters = { workspace = true }
pallet-preimage = { workspace = true }
pallet-safe-mode = { workspace = true }
pallet-tx-pause = { workspace = true }
pallet-proxy = { workspace = true }
pallet-referenda = { workspace = true }
pallet-safe-mode = { workspace = true }
pallet-scheduler = { workspace = true }
pallet-session = { workspace = true }
pallet-session-benchmarking = { workspace = true, optional = true }
pallet-sudo = { workspace = true }
pallet-timestamp = { workspace = true }
pallet-transaction-payment = { workspace = true }
pallet-transaction-payment-rpc-runtime-api = { workspace = true }
pallet-treasury = { workspace = true }
pallet-tx-pause = { workspace = true }
pallet-utility = { workspace = true }
pallet-whitelist = { workspace = true }
polkadot-primitives = { workspace = true }
@ -127,20 +129,21 @@ xcm-executor = { workspace = true }
pallet-evm-precompile-balances-erc20 = { workspace = true }
pallet-evm-precompile-batch = { workspace = true }
pallet-evm-precompile-call-permit = { workspace = true }
pallet-evm-precompile-preimage = { workspace = true }
pallet-evm-precompile-collective = { workspace = true }
pallet-evm-precompile-conviction-voting = { workspace = true }
pallet-evm-precompile-identity = { workspace = true }
pallet-evm-precompile-preimage = { workspace = true }
pallet-evm-precompile-proxy = { workspace = true }
pallet-evm-precompile-referenda = { workspace = true }
pallet-evm-precompile-registry = { workspace = true }
# StorageHub
pallet-bucket-nfts = { workspace = true }
pallet-nfts = { workspace = true }
pallet-cr-randomness = { workspace = true }
pallet-evm-precompile-file-system = { workspace = true }
pallet-file-system = { workspace = true }
pallet-file-system-runtime-api = { workspace = true }
pallet-nfts = { workspace = true }
pallet-payment-streams = { workspace = true }
pallet-payment-streams-runtime-api = { workspace = true }
pallet-proofs-dealer = { workspace = true }
@ -150,14 +153,13 @@ pallet-storage-providers = { workspace = true }
pallet-storage-providers-runtime-api = { workspace = true }
shc-common = { workspace = true, optional = true }
shp-constants = { workspace = true }
shp-data-price-updater = { workspace = true }
shp-file-key-verifier = { workspace = true }
shp-file-metadata = { workspace = true }
shp-forest-verifier = { workspace = true }
shp-traits = { workspace = true }
shp-treasury-funding = { workspace = true }
shp-forest-verifier = { workspace = true }
shp-file-key-verifier = { workspace = true }
shp-data-price-updater = { workspace = true }
sp-trie = { workspace = true }
pallet-evm-precompile-file-system = { workspace = true }
[build-dependencies]
substrate-wasm-builder = { workspace = true, optional = true, default-features = true }
@ -172,9 +174,9 @@ precompile-utils = { workspace = true, features = ["std", "testing"] }
# Snowbridge testing
snowbridge-core = { workspace = true }
snowbridge-outbound-queue-primitives = { workspace = true }
snowbridge-pallet-system = { workspace = true }
snowbridge-pallet-system-v2 = { workspace = true }
snowbridge-outbound-queue-primitives = { workspace = true }
[features]
default = ["std"]
@ -188,6 +190,7 @@ std = [
"frame-metadata-hash-extension/std",
"frame-support/std",
"frame-system-benchmarking?/std",
"pallet-session-benchmarking?/std",
"frame-system-rpc-runtime-api/std",
"frame-system/std",
"frame-try-runtime?/std",
@ -328,9 +331,11 @@ runtime-benchmarks = [
"pallet-preimage/runtime-benchmarks",
"pallet-safe-mode/runtime-benchmarks",
"pallet-tx-pause/runtime-benchmarks",
"pallet-randomness/runtime-benchmarks",
"pallet-referenda/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
"pallet-session-benchmarking/runtime-benchmarks",
"pallet-sudo/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-treasury/runtime-benchmarks",

View file

@ -36,6 +36,9 @@ frame_benchmarking::define_benchmarks!(
// Consensus pallets
[pallet_mmr, Mmr]
[pallet_beefy_mmr, BeefyMmrLeaf]
[pallet_babe, Babe]
[pallet_grandpa, Grandpa]
[pallet_randomness, Randomness]
// Substrate pallets
[pallet_balances, Balances]
@ -69,6 +72,7 @@ frame_benchmarking::define_benchmarks!(
// DataHaven custom pallets
[pallet_external_validators, ExternalValidators]
[pallet_external_validators_rewards, ExternalValidatorsRewards]
[pallet_external_validator_slashes, ExternalValidatorsSlashes]
[pallet_datahaven_native_transfer, DataHavenNativeTransfer]
// Snowbridge pallets

View file

@ -40,6 +40,7 @@ use super::{
MAXIMUM_BLOCK_WEIGHT, NORMAL_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, VERSION,
};
use codec::{Decode, Encode, MaxEncodedLen};
use pallet_external_validator_slashes::SlashingModeOption;
use scale_info::TypeInfo;
use sp_runtime::RuntimeDebug;
@ -236,13 +237,15 @@ impl Contains<RuntimeCall> for NormalCallFilter {
}
/// Calls that can bypass the safe-mode pallet.
/// These calls are essential for emergency governance and system maintenance.
/// These calls are essential for emergency governance, system maintenance, and basic operation.
pub struct SafeModeWhitelistedCalls;
impl Contains<RuntimeCall> for SafeModeWhitelistedCalls {
fn contains(call: &RuntimeCall) -> bool {
match call {
// Core system calls
RuntimeCall::System(_) => true,
RuntimeCall::Timestamp(_) => true,
RuntimeCall::Randomness(_) => true,
// Safe mode management
RuntimeCall::SafeMode(_) => true,
// Transaction pause management
@ -321,7 +324,7 @@ impl pallet_babe::Config for Runtime {
type ExpectedBlockTime = ExpectedBlockTime;
type EpochChangeTrigger = pallet_babe::ExternalTrigger;
type DisabledValidators = Session;
type WeightInfo = ();
type WeightInfo = stagenet_weights::pallet_babe::WeightInfo<Runtime>;
type MaxAuthorities = MaxAuthorities;
type MaxNominators = ConstU32<0>;
@ -404,7 +407,7 @@ impl pallet_session::Config for Runtime {
type SessionManager = pallet_session::historical::NoteHistoricalRoot<Self, ExternalValidators>;
type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type WeightInfo = ();
type WeightInfo = pallet_session::weights::SubstrateWeight<Runtime>;
}
parameter_types! {
@ -433,7 +436,7 @@ parameter_types! {
impl pallet_grandpa::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
type WeightInfo = stagenet_weights::pallet_grandpa::WeightInfo<Runtime>;
type MaxAuthorities = MaxAuthorities;
type MaxNominators = ConstU32<0>;
type MaxSetIdSessionEntries = MaxSetIdSessionEntries;
@ -640,7 +643,7 @@ impl pallet_identity::Config for Runtime {
type PendingUsernameExpiration = PendingUsernameExpiration;
type MaxSuffixLength = MaxSuffixLength;
type MaxUsernameLength = MaxUsernameLength;
type WeightInfo = ();
type WeightInfo = pallet_identity::weights::SubstrateWeight<Runtime>;
type UsernameDeposit = ();
type UsernameGracePeriod = ();
@ -1630,12 +1633,14 @@ impl pallet_external_validator_slashes::Config for Runtime {
type InvulnerablesProvider = ExternalValidators;
type ExternalIndexProvider = ExternalValidators;
type QueuedSlashesProcessedPerBlock = ConstU32<10>;
type WeightInfo = (); // TODO: calculate weights
type WeightInfo = stagenet_weights::pallet_external_validator_slashes::WeightInfo<Runtime>;
type SendMessage = SlashesSendAdapter;
type SlashingMode = SlashingMode;
}
parameter_types! {
pub const SlashDeferDuration: EraIndex = polkadot_runtime_common::prod_or_fast!(0, 0);
pub const SlashingMode: SlashingModeOption = polkadot_runtime_common::prod_or_fast!(SlashingModeOption::LogOnly, SlashingModeOption::LogOnly);
}
#[cfg(test)]

View file

@ -37,7 +37,7 @@ use sp_runtime::traits::Zero;
use sp_runtime::SaturatedConversion;
use sp_runtime::{traits::BlakeTwo256, Perbill};
use sp_std::convert::{From, Into};
use sp_std::vec;
use sp_std::{vec, vec::Vec};
use sp_trie::{LayoutV1, TrieConfiguration, TrieLayout};
#[cfg(feature = "std")]
@ -105,7 +105,7 @@ impl pallet_randomness::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type BabeDataGetter = BabeDataGetter;
type BabeBlockGetter = BlockNumberGetter;
type WeightInfo = ();
type WeightInfo = crate::weights::pallet_randomness::WeightInfo<Runtime>;
type BabeDataGetterBlockNumber = BlockNumber;
}
@ -450,6 +450,25 @@ parameter_types! {
pub const FileSystemFileDeletionRequestHoldReason: RuntimeHoldReason = RuntimeHoldReason::FileSystem(pallet_file_system::HoldReason::FileDeletionRequestHold);
}
// Converts a given signed message in a EIP-191 compliant message bytes to verify.
/// EIP-191: https://eips.ethereum.org/EIPS/eip-191
/// "\x19Ethereum Signed Message:\n" + len(message) + message"
pub struct Eip191Adapter;
impl shp_traits::MessageAdapter for Eip191Adapter {
fn bytes_to_verify(message: &[u8]) -> Vec<u8> {
const PREFIX: &str = "\x19Ethereum Signed Message:\n";
let len = message.len();
let mut len_string_buffer = itoa::Buffer::new();
let len_string = len_string_buffer.format(len);
let mut eth_message = Vec::with_capacity(PREFIX.len() + len_string.len() + len);
eth_message.extend_from_slice(PREFIX.as_bytes());
eth_message.extend_from_slice(len_string.as_bytes());
eth_message.extend_from_slice(message);
eth_message
}
}
impl pallet_file_system::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = pallet_file_system::weights::SubstrateWeight<Runtime>;
@ -501,6 +520,8 @@ impl pallet_file_system::Config for Runtime {
type TickRangeToMaximumThreshold = runtime_config::TickRangeToMaximumThreshold;
type OffchainSignature = Signature;
type OffchainPublicKey = <Signature as Verify>::Signer;
type MaxFileDeletionsPerExtrinsic = ConstU32<100>;
type IntentionMsgAdapter = Eip191Adapter;
}
impl MostlyStablePriceIndexUpdaterConfig for Runtime {

View file

@ -126,7 +126,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// `spec_version`, and `authoring_version` are the same between Wasm and native.
// This value is set to 200 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
// the compatible custom types.
spec_version: 310,
spec_version: 400,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
@ -1064,40 +1064,13 @@ impl_runtime_apis! {
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 <Runtime as pallet_evm::Config>::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),
};
let weight_limit = <Runtime as pallet_evm::Config>::GasWeightMapping::gas_to_weight(
gas_limit,
without_base_extrinsic_weight
);
<Runtime as pallet_evm::Config>::Runner::call(
from,
@ -1111,8 +1084,8 @@ impl_runtime_apis! {
access_list.unwrap_or_default(),
is_transactional,
validate,
weight_limit,
proof_size_base_cost,
Some(weight_limit),
None,
config.as_ref().unwrap_or(<Runtime as pallet_evm::Config>::config()),
).map_err(|err| err.error.into())
}
@ -1144,7 +1117,11 @@ impl_runtime_apis! {
gas_limit.low_u64()
};
let (weight_limit, proof_size_base_cost) = (None, None);
let without_base_extrinsic_weight = true;
let weight_limit = <Runtime as pallet_evm::Config>::GasWeightMapping::gas_to_weight(
gas_limit,
without_base_extrinsic_weight
);
#[allow(clippy::or_fun_call)]
<Runtime as pallet_evm::Config>::Runner::create(
@ -1158,8 +1135,8 @@ impl_runtime_apis! {
access_list.unwrap_or_default(),
is_transactional,
validate,
weight_limit,
proof_size_base_cost,
Some(weight_limit),
None,
config.as_ref().unwrap_or(<Runtime as pallet_evm::Config>::config()),
).map_err(|err| err.error.into())
}
@ -1271,6 +1248,9 @@ impl_runtime_apis! {
fn query_incomplete_storage_request_metadata(file_key: H256) -> Result<pallet_file_system_runtime_api::IncompleteStorageRequestMetadataResponse<AccountId, BucketId<Runtime>, StorageDataUnit<Runtime>, H256, BackupStorageProviderId<Runtime>>, QueryIncompleteStorageRequestMetadataError> {
FileSystem::query_incomplete_storage_request_metadata(file_key)
}
fn list_incomplete_storage_request_keys(start_after: Option<H256>, limit: u32) -> Vec<H256> {
FileSystem::list_incomplete_storage_request_keys(start_after, limit)
}
}
impl pallet_payment_streams_runtime_api::PaymentStreamsApi<Block, ProviderIdFor<Runtime>, Balance, AccountId> for Runtime {

View file

@ -19,6 +19,7 @@
// DataHaven pallets
pub mod pallet_datahaven_native_transfer;
pub mod pallet_external_validator_slashes;
pub mod pallet_external_validators;
pub mod pallet_external_validators_rewards;
@ -31,9 +32,12 @@ pub mod snowbridge_pallet_system_v2;
// Substrate pallets
pub mod frame_system;
pub mod pallet_babe;
pub mod pallet_balances;
pub mod pallet_beefy_mmr;
pub mod pallet_evm;
pub mod pallet_grandpa;
pub mod pallet_randomness;
// pub mod pallet_identity;
pub mod pallet_im_online;
pub mod pallet_message_queue;

View file

@ -0,0 +1,48 @@
//! Autogenerated weights for `pallet_babe`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0
//! DATE: 2025-10-30, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
// frame-omni-bencher
// v1
// benchmark
// pallet
// --runtime
// target/production/wbuild/datahaven-stagenet-runtime/datahaven_stagenet_runtime.compact.compressed.wasm
// --pallet
// pallet_babe
// --extrinsic
//
// --template
// benchmarking/frame-weight-template.hbs
// --output
// runtime/stagenet/src/weights/pallet_babe.rs
// --steps
// 50
// --repeat
// 20
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weights for `pallet_babe`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_babe::WeightInfo for WeightInfo<T> {
fn plan_config_change() -> Weight {
Weight::from_parts(5_000_000, 0)
}
fn report_equivocation(_equivocations: u32, _key_owners: u32) -> Weight {
Weight::from_parts(89_669_734, 0)
}
}

View file

@ -0,0 +1,115 @@
//! Autogenerated weights for `pallet_external_validator_slashes`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0
//! DATE: 2025-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
// frame-omni-bencher
// v1
// benchmark
// pallet
// --runtime
// target/production/wbuild/datahaven-stagenet-runtime/datahaven_stagenet_runtime.compact.compressed.wasm
// --pallet
// pallet_external_validator_slashes
// --extrinsic
//
// --template
// benchmarking/frame-weight-template.hbs
// --output
// runtime/stagenet/src/weights/pallet_external_validator_slashes.rs
// --steps
// 50
// --repeat
// 20
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weights for `pallet_external_validator_slashes`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_external_validator_slashes::WeightInfo for WeightInfo<T> {
/// Storage: `ExternalValidators::ActiveEra` (r:1 w:0)
/// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`)
/// Storage: `ExternalValidatorsSlashes::Slashes` (r:1 w:1)
/// Proof: `ExternalValidatorsSlashes::Slashes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `s` is `[1, 1000]`.
fn cancel_deferred_slash(_s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `38528`
// Estimated: `41993`
// Minimum execution time: 77_237_000 picoseconds.
Weight::from_parts(1_417_731_577, 41993)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: `ExternalValidators::ActiveEra` (r:1 w:0)
/// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`)
/// Storage: `ExternalValidators::ErasStartSessionIndex` (r:1 w:0)
/// Proof: `ExternalValidators::ErasStartSessionIndex` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
/// Storage: `ExternalValidatorsSlashes::NextSlashId` (r:1 w:1)
/// Proof: `ExternalValidatorsSlashes::NextSlashId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `ExternalValidatorsSlashes::ValidatorSlashInEra` (r:1 w:1)
/// Proof: `ExternalValidatorsSlashes::ValidatorSlashInEra` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// Storage: `ExternalValidatorsSlashes::Slashes` (r:1 w:1)
/// Proof: `ExternalValidatorsSlashes::Slashes` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn force_inject_slash() -> Weight {
// Proof Size summary in bytes:
// Measured: `492`
// Estimated: `3957`
// Minimum execution time: 27_206_000 picoseconds.
Weight::from_parts(27_858_000, 3957)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
/// Storage: `ExternalValidators::ActiveEra` (r:1 w:0)
/// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`)
/// Storage: `ExternalValidatorsSlashes::UnreportedSlashesQueue` (r:1 w:1)
/// Proof: `ExternalValidatorsSlashes::UnreportedSlashesQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `Parameters::Parameters` (r:2 w:0)
/// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
/// Storage: `MessageQueue::BookStateFor` (r:1 w:1)
/// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(136), added: 2611, mode: `MaxEncodedLen`)
/// Storage: `MessageQueue::ServiceHead` (r:1 w:1)
/// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`)
/// Storage: `MessageQueue::Pages` (r:0 w:1)
/// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(32845), added: 35320, mode: `MaxEncodedLen`)
/// The range of component `s` is `[1, 200]`.
fn process_slashes_queue(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `541 + s * (38 ±0)`
// Estimated: `6044 + s * (38 ±0)`
// Minimum execution time: 49_346_000 picoseconds.
Weight::from_parts(51_048_900, 6044)
// Standard Error: 836
.saturating_add(Weight::from_parts(47_676, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(6_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
.saturating_add(Weight::from_parts(0, 38).saturating_mul(s.into()))
}
/// Storage: `ExternalValidatorsSlashes::SlashingMode` (r:0 w:1)
/// Proof: `ExternalValidatorsSlashes::SlashingMode` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`)
fn set_slashing_mode() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_654_000 picoseconds.
Weight::from_parts(3_892_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
fn root_test_send_msg_to_eth() -> Weight {
Weight::from_parts(1_015_195_000, 3601)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
}

View file

@ -0,0 +1,55 @@
//! Autogenerated weights for `pallet_grandpa`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0
//! DATE: 2025-10-30, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
// frame-omni-bencher
// v1
// benchmark
// pallet
// --runtime
// target/production/wbuild/datahaven-stagenet-runtime/datahaven_stagenet_runtime.compact.compressed.wasm
// --pallet
// pallet_grandpa
// --extrinsic
//
// --template
// benchmarking/frame-weight-template.hbs
// --output
// runtime/stagenet/src/weights/pallet_grandpa.rs
// --steps
// 50
// --repeat
// 20
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weights for `pallet_grandpa`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_grandpa::WeightInfo for WeightInfo<T> {
/// Storage: `Grandpa::Stalled` (r:0 w:1)
/// Proof: `Grandpa::Stalled` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
fn note_stalled() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_681_000 picoseconds.
Weight::from_parts(3_933_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
fn report_equivocation(_equivocations: u32, _key_owners: u32) -> Weight {
Weight::from_parts(79_233_438, 0)
}
}

View file

@ -0,0 +1,77 @@
//! Autogenerated weights for `pallet_randomness`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0
//! DATE: 2025-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
// frame-omni-bencher
// v1
// benchmark
// pallet
// --runtime
// target/production/wbuild/datahaven-stagenet-runtime/datahaven_stagenet_runtime.compact.compressed.wasm
// --pallet
// pallet_randomness
// --extrinsic
//
// --template
// benchmarking/frame-weight-template.hbs
// --output
// runtime/stagenet/src/weights/pallet_randomness.rs
// --steps
// 50
// --repeat
// 20
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weights for `pallet_randomness`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_randomness::weights::WeightInfo for WeightInfo<T> {
/// Storage: `Babe::AuthorVrfRandomness` (r:1 w:0)
/// Proof: `Babe::AuthorVrfRandomness` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`)
/// Storage: `Randomness::RelayEpoch` (r:1 w:1)
/// Proof: `Randomness::RelayEpoch` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
/// Storage: `Babe::NextRandomness` (r:1 w:0)
/// Proof: `Babe::NextRandomness` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Babe::EpochStart` (r:1 w:0)
/// Proof: `Babe::EpochStart` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
/// Storage: `Randomness::LastRelayBlockAndParaBlockValidForNextEpoch` (r:1 w:1)
/// Proof: `Randomness::LastRelayBlockAndParaBlockValidForNextEpoch` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
/// Storage: `Randomness::LatestOneEpochAgoRandomness` (r:0 w:1)
/// Proof: `Randomness::LatestOneEpochAgoRandomness` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`)
/// Storage: `Randomness::LatestParentBlockRandomness` (r:0 w:1)
/// Proof: `Randomness::LatestParentBlockRandomness` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`)
/// Storage: `Randomness::InherentIncluded` (r:0 w:1)
/// Proof: `Randomness::InherentIncluded` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`)
fn set_babe_randomness() -> Weight {
// Proof Size summary in bytes:
// Measured: `348`
// Estimated: `1518`
// Minimum execution time: 26_032_000 picoseconds.
Weight::from_parts(26_849_000, 1518)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
/// Storage: `Randomness::InherentIncluded` (r:1 w:1)
/// Proof: `Randomness::InherentIncluded` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`)
fn on_finalize_hook() -> Weight {
// Proof Size summary in bytes:
// Measured: `99`
// Estimated: `1485`
// Minimum execution time: 5_285_000 picoseconds.
Weight::from_parts(5_600_000, 1485)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
}

View file

@ -361,9 +361,10 @@ fn processing_fails_with_insufficient_sovereign_balance() {
setup_sovereign_balance(TRANSFER_AMOUNT / 2); // Insufficient balance
let result =
snowbridge_pallet_inbound_queue_v2::Pallet::<Runtime>::process_message(alice, message);
assert!(result.is_err());
assert_noop!(
snowbridge_pallet_inbound_queue_v2::Pallet::<Runtime>::process_message(alice, message),
pallet_datahaven_native_transfer::Error::<Runtime>::InsufficientSovereignBalance
);
});
}

View file

@ -31,6 +31,7 @@ frame-system-rpc-runtime-api = { workspace = true }
frame-try-runtime = { workspace = true, optional = true }
hex = { workspace = true }
hex-literal = { workspace = true }
itoa = { workspace = true }
log = { workspace = true }
num-bigint = { workspace = true }
num_enum = { workspace = true }
@ -51,10 +52,10 @@ pallet-evm-precompile-conviction-voting = { workspace = true }
pallet-evm-precompile-modexp = { workspace = true }
pallet-evm-precompile-sha3fips = { workspace = true }
pallet-evm-precompile-simple = { workspace = true }
pallet-external-validator-slashes = { workspace = true }
pallet-external-validators = { workspace = true }
pallet-external-validators-rewards = { workspace = true }
pallet-external-validators-rewards-runtime-api = { workspace = true }
pallet-external-validator-slashes = { workspace = true }
pallet-grandpa = { workspace = true }
pallet-identity = { workspace = true }
pallet-im-online = { workspace = true }
@ -66,17 +67,18 @@ pallet-offences = { workspace = true }
pallet-outbound-commitment-store = { workspace = true }
pallet-parameters = { workspace = true }
pallet-preimage = { workspace = true }
pallet-safe-mode = { workspace = true }
pallet-tx-pause = { workspace = true }
pallet-proxy = { workspace = true }
pallet-referenda = { workspace = true }
pallet-safe-mode = { workspace = true }
pallet-scheduler = { workspace = true }
pallet-session = { workspace = true }
pallet-session-benchmarking = { workspace = true, optional = true }
pallet-sudo = { workspace = true }
pallet-timestamp = { workspace = true }
pallet-transaction-payment = { workspace = true }
pallet-transaction-payment-rpc-runtime-api = { workspace = true }
pallet-treasury = { workspace = true }
pallet-tx-pause = { workspace = true }
pallet-utility = { workspace = true }
pallet-whitelist = { workspace = true }
polkadot-primitives = { workspace = true }
@ -118,29 +120,30 @@ sp-std = { workspace = true }
sp-storage = { workspace = true }
sp-transaction-pool = { workspace = true }
sp-version = { workspace = true, features = ["serde"] }
strum = { workspace = true }
strum_macros = { workspace = true }
xcm = { workspace = true }
xcm-builder = { workspace = true }
xcm-executor = { workspace = true }
strum = { workspace = true }
strum_macros = { workspace = true }
# DataHaven precompiles
pallet-evm-precompile-balances-erc20 = { workspace = true }
pallet-evm-precompile-batch = { workspace = true }
pallet-evm-precompile-call-permit = { workspace = true }
pallet-evm-precompile-preimage = { workspace = true }
pallet-evm-precompile-collective = { workspace = true }
pallet-evm-precompile-identity = { workspace = true }
pallet-evm-precompile-preimage = { workspace = true }
pallet-evm-precompile-proxy = { workspace = true }
pallet-evm-precompile-referenda = { workspace = true }
pallet-evm-precompile-registry = { workspace = true }
# StorageHub
pallet-bucket-nfts = { workspace = true }
pallet-nfts = { workspace = true }
pallet-cr-randomness = { workspace = true }
pallet-evm-precompile-file-system = { workspace = true }
pallet-file-system = { workspace = true }
pallet-file-system-runtime-api = { workspace = true }
pallet-nfts = { workspace = true }
pallet-payment-streams = { workspace = true }
pallet-payment-streams-runtime-api = { workspace = true }
pallet-proofs-dealer = { workspace = true }
@ -150,14 +153,13 @@ pallet-storage-providers = { workspace = true }
pallet-storage-providers-runtime-api = { workspace = true }
shc-common = { workspace = true, optional = true }
shp-constants = { workspace = true }
shp-data-price-updater = { workspace = true }
shp-file-key-verifier = { workspace = true }
shp-file-metadata = { workspace = true }
shp-forest-verifier = { workspace = true }
shp-traits = { workspace = true }
shp-treasury-funding = { workspace = true }
shp-forest-verifier = { workspace = true }
shp-file-key-verifier = { workspace = true }
shp-data-price-updater = { workspace = true }
sp-trie = { workspace = true }
pallet-evm-precompile-file-system = { workspace = true }
[build-dependencies]
substrate-wasm-builder = { workspace = true, optional = true, default-features = true }
@ -188,6 +190,7 @@ std = [
"frame-metadata-hash-extension/std",
"frame-support/std",
"frame-system-benchmarking?/std",
"pallet-session-benchmarking?/std",
"frame-system-rpc-runtime-api/std",
"frame-system/std",
"frame-try-runtime?/std",
@ -321,12 +324,14 @@ runtime-benchmarks = [
"pallet-multisig/runtime-benchmarks",
"pallet-offences/runtime-benchmarks",
"pallet-parameters/runtime-benchmarks",
"pallet-randomness/runtime-benchmarks",
"pallet-preimage/runtime-benchmarks",
"pallet-safe-mode/runtime-benchmarks",
"pallet-tx-pause/runtime-benchmarks",
"pallet-referenda/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
"pallet-session-benchmarking/runtime-benchmarks",
"pallet-sudo/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-treasury/runtime-benchmarks",

View file

@ -1,800 +0,0 @@
// 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 <http://unlicense.org>
// 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 = <<Runtime as pallet_mmr::Config>::LeafData as LeafDataProvider>::LeafData;
pub type Hashing = <Runtime as pallet_mmr::Config>::Hashing;
pub type Hash = <Hashing as sp_runtime::traits::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<Result<Self::SignedInfo, TransactionValidityError>> {
match self {
RuntimeCall::Ethereum(call) => call.check_self_contained(),
_ => None,
}
}
fn validate_self_contained(
&self,
signed_info: &Self::SignedInfo,
dispatch_info: &DispatchInfoOf<RuntimeCall>,
len: usize,
) -> Option<TransactionValidity> {
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<RuntimeCall>,
len: usize,
) -> Option<Result<(), TransactionValidityError>> {
match self {
RuntimeCall::Ethereum(call) => {
call.pre_dispatch_self_contained(info, dispatch_info, len)
}
_ => None,
}
}
fn apply_self_contained(
self,
info: Self::SignedInfo,
) -> Option<sp_runtime::DispatchResultWithInfo<PostDispatchInfoOf<Self>>> {
match self {
call @ RuntimeCall::Ethereum(pallet_ethereum::Call::transact { .. }) => {
Some(call.dispatch(RuntimeOrigin::from(
pallet_ethereum::RawOrigin::EthereumTransaction(info),
)))
}
_ => None,
}
}
}
impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {
fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {
UncheckedExtrinsic::new_bare(
pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),
)
}
}
impl_runtime_apis! {
impl sp_api::Core<Block> for Runtime {
fn version() -> RuntimeVersion {
VERSION
}
fn execute_block(block: Block) {
Executive::execute_block(block);
}
fn initialize_block(header: &<Block as BlockT>::Header) -> sp_runtime::ExtrinsicInclusionMode {
Executive::initialize_block(header)
}
}
impl sp_api::Metadata<Block> for Runtime {
fn metadata() -> OpaqueMetadata {
OpaqueMetadata::new(Runtime::metadata().into())
}
fn metadata_at_version(version: u32) -> Option<OpaqueMetadata> {
Runtime::metadata_at_version(version)
}
fn metadata_versions() -> Vec<u32> {
Runtime::metadata_versions()
}
}
impl sp_block_builder::BlockBuilder<Block> for Runtime {
fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
Executive::apply_extrinsic(extrinsic)
}
fn finalize_block() -> <Block as BlockT>::Header {
Executive::finalize_block()
}
fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::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<Block> for Runtime {
fn validate_transaction(
source: TransactionSource,
tx: <Block as BlockT>::Extrinsic,
block_hash: <Block as BlockT>::Hash,
) -> TransactionValidity {
Executive::validate_transaction(source, tx, block_hash)
}
}
impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
fn offchain_worker(header: &<Block as BlockT>::Header) {
Executive::offchain_worker(header)
}
}
impl sp_session::SessionKeys<Block> for Runtime {
fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
SessionKeys::generate(seed)
}
fn decode_session_keys(
encoded: Vec<u8>,
) -> Option<Vec<(Vec<u8>, sp_core::crypto::KeyTypeId)>> {
SessionKeys::decode_into_raw_public_keys(&encoded)
}
}
impl sp_consensus_babe::BabeApi<Block> 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<sp_consensus_babe::OpaqueKeyOwnershipProof> {
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<<Block as BlockT>::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<Block> 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<
<Block as BlockT>::Hash,
sp_runtime::traits::NumberFor<Block>,
>,
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<fg_primitives::OpaqueKeyOwnershipProof> {
Historical::prove((fg_primitives::KEY_TYPE, authority_id))
.map(|p| p.encode())
.map(fg_primitives::OpaqueKeyOwnershipProof::new)
}
}
#[api_version(2)]
impl mmr::MmrApi<Block, mmr::Hash, BlockNumber> for Runtime {
fn mmr_root() -> Result<mmr::Hash, mmr::Error> {
Ok(pallet_mmr::RootHash::<Runtime>::get())
}
fn mmr_leaf_count() -> Result<mmr::LeafIndex, mmr::Error> {
Ok(pallet_mmr::NumberOfLeaves::<Runtime>::get())
}
fn generate_proof(
block_numbers: Vec<BlockNumber>,
best_known_block_number: Option<BlockNumber>,
) -> Result<(Vec<mmr::EncodableOpaqueLeaf>, mmr::LeafProof<mmr::Hash>), 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<mmr::EncodableOpaqueLeaf>, proof: mmr::LeafProof<mmr::Hash>)
-> Result<(), mmr::Error>
{
let leaves = leaves.into_iter().map(|leaf|
leaf.into_opaque_leaf()
.try_decode()
.ok_or(mmr::Error::Verify)).collect::<Result<Vec<mmr::Leaf>, mmr::Error>>()?;
Mmr::verify_leaves(leaves, proof)
}
fn verify_proof_stateless(
root: mmr::Hash,
leaves: Vec<mmr::EncodableOpaqueLeaf>,
proof: mmr::LeafProof<mmr::Hash>
) -> Result<(), mmr::Error> {
let nodes = leaves.into_iter().map(|leaf|mmr::DataOrHash::Data(leaf.into_opaque_leaf())).collect();
pallet_mmr::verify_leaves_proof::<mmr::Hashing, _>(root, nodes, proof)
}
}
impl pallet_beefy_mmr::BeefyMmrApi<Block, Hash> for RuntimeApi {
fn authority_set_proof() -> sp_consensus_beefy::mmr::BeefyAuthoritySet<Hash> {
BeefyMmrLeaf::authority_set_proof()
}
fn next_authority_set_proof() -> sp_consensus_beefy::mmr::BeefyNextAuthoritySet<Hash> {
BeefyMmrLeaf::next_authority_set_proof()
}
}
#[api_version(5)]
impl sp_consensus_beefy::BeefyApi<Block, BeefyId> for Runtime {
fn beefy_genesis() -> Option<BlockNumber> {
pallet_beefy::GenesisBlock::<Runtime>::get()
}
fn validator_set() -> Option<sp_consensus_beefy::ValidatorSet<BeefyId>> {
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<
<Block as BlockT>::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<BlockNumber, BeefyId>,
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<sp_consensus_beefy::OpaqueKeyOwnershipProof> {
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<BlockNumber>,
) -> Option<sp_runtime::OpaqueValue> {
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<Block, AccountId, Nonce> for Runtime {
fn account_nonce(account: AccountId) -> Nonce {
System::account_nonce(account)
}
}
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
fn query_info(
uxt: <Block as BlockT>::Extrinsic,
len: u32,
) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo<Balance> {
TransactionPayment::query_info(uxt, len)
}
fn query_fee_details(
uxt: <Block as BlockT>::Extrinsic,
len: u32,
) -> pallet_transaction_payment::FeeDetails<Balance> {
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<Block, Balance, RuntimeCall>
for Runtime
{
fn query_call_info(
call: RuntimeCall,
len: u32,
) -> pallet_transaction_payment::RuntimeDispatchInfo<Balance> {
TransactionPayment::query_call_info(call, len)
}
fn query_call_fee_details(
call: RuntimeCall,
len: u32,
) -> pallet_transaction_payment::FeeDetails<Balance> {
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<Block, Balance> for Runtime {
fn prove_message(leaf_index: u64) -> Option<snowbridge_merkle_tree::MerkleProof> {
snowbridge_pallet_outbound_queue_v2::api::prove_message::<Runtime>(leaf_index)
}
}
impl snowbridge_system_v2_runtime_api::ControlV2Api<Block> for Runtime {
fn agent_id(location: VersionedLocation) -> Option<AgentId> {
snowbridge_pallet_system_v2::api::agent_id::<Runtime>(location)
}
}
#[cfg(feature = "runtime-benchmarks")]
impl frame_benchmarking::Benchmark<Block> for Runtime {
fn benchmark_metadata(extra: bool) -> (
Vec<frame_benchmarking::BenchmarkList>,
Vec<frame_support::traits::StorageInfo>,
) {
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::<BenchmarkList>::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<Vec<frame_benchmarking::BenchmarkBatch>, 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<TrackedStorageKey> = AllPalletsWithSystem::whitelisted_storage_keys();
let mut batches = Vec::<BenchmarkBatch>::new();
let params = (&config, &whitelist);
add_benchmarks!(params, batches);
Ok(batches)
}
}
#[cfg(feature = "try-runtime")]
impl frame_try_runtime::TryRuntime<Block> 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<Block> for Runtime {
fn build_state(config: Vec<u8>) -> sp_genesis_builder::Result {
build_state::<RuntimeGenesisConfig>(config)
}
fn get_preset(id: &Option<sp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
get_preset::<RuntimeGenesisConfig>(id, crate::genesis_config_presets::get_preset)
}
fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
crate::genesis_config_presets::preset_names()
}
}
impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {
fn chain_id() -> u64 {
<Runtime as pallet_evm::Config>::ChainId::get()
}
fn account_basic(address: H160) -> EVMAccount {
let (account, _) = pallet_evm::Pallet::<Runtime>::account_basic(&address);
account
}
fn gas_price() -> U256 {
let (gas_price, _) = <Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price();
gas_price
}
fn account_code_at(address: H160) -> Vec<u8> {
pallet_evm::AccountCodes::<Runtime>::get(address)
}
fn author() -> H160 {
<pallet_evm::Pallet<Runtime>>::find_author()
}
fn storage_at(address: H160, index: U256) -> H256 {
let tmp = index.to_big_endian();
pallet_evm::AccountStorages::<Runtime>::get(address, H256::from_slice(&tmp[..]))
}
fn call(
from: H160,
to: H160,
data: Vec<u8>,
value: U256,
gas_limit: U256,
max_fee_per_gas: Option<U256>,
max_priority_fee_per_gas: Option<U256>,
nonce: Option<U256>,
estimate: bool,
access_list: Option<Vec<(H160, Vec<H256>)>>,
) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {
let config = if estimate {
let mut config = <Runtime as pallet_evm::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 <Runtime as pallet_evm::Config>::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),
};
<Runtime as pallet_evm::Config>::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(<Runtime as pallet_evm::Config>::config()),
).map_err(|err| err.error.into())
}
fn create(
from: H160,
data: Vec<u8>,
value: U256,
gas_limit: U256,
max_fee_per_gas: Option<U256>,
max_priority_fee_per_gas: Option<U256>,
nonce: Option<U256>,
estimate: bool,
access_list: Option<Vec<(H160, Vec<H256>)>>,
) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {
let config = if estimate {
let mut config = <Runtime as pallet_evm::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)]
<Runtime as pallet_evm::Config>::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(<Runtime as pallet_evm::Config>::config()),
).map_err(|err| err.error.into())
}
fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {
pallet_ethereum::CurrentTransactionStatuses::<Runtime>::get()
}
fn current_block() -> Option<pallet_ethereum::Block> {
pallet_ethereum::CurrentBlock::<Runtime>::get()
}
fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {
pallet_ethereum::CurrentReceipts::<Runtime>::get()
}
fn current_all() -> (
Option<pallet_ethereum::Block>,
Option<Vec<pallet_ethereum::Receipt>>,
Option<Vec<TransactionStatus>>,
) {
(
pallet_ethereum::CurrentBlock::<Runtime>::get(),
pallet_ethereum::CurrentReceipts::<Runtime>::get(),
pallet_ethereum::CurrentTransactionStatuses::<Runtime>::get()
)
}
fn extrinsic_filter(
xts: Vec<<Block as BlockT>::Extrinsic>,
) -> Vec<EthereumTransaction> {
xts.into_iter().filter_map(|xt| match xt.0.function {
RuntimeCall::Ethereum(transact { transaction }) => Some(transaction),
_ => None
}).collect::<Vec<EthereumTransaction>>()
}
fn elasticity() -> Option<Permill> {
None
}
fn gas_limit_multiplier_support() {}
fn pending_block(
xts: Vec<<Block as BlockT>::Extrinsic>,
) -> (Option<pallet_ethereum::Block>, Option<Vec<TransactionStatus>>) {
for ext in xts.into_iter() {
let _ = Executive::apply_extrinsic(ext);
}
Ethereum::on_finalize(System::block_number() + 1);
(
pallet_ethereum::CurrentBlock::<Runtime>::get(),
pallet_ethereum::CurrentTransactionStatuses::<Runtime>::get()
)
}
fn initialize_pending_block(header: &<Block as BlockT>::Header) {
Executive::initialize_block(header);
}
}
impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {
fn convert_transaction(transaction: EthereumTransaction) -> <Block as BlockT>::Extrinsic {
UncheckedExtrinsic::new_bare(
pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),
)
}
}
}

View file

@ -28,6 +28,7 @@
use pallet_collective as pallet_collective_treasury_council;
#[allow(unused_imports)]
use pallet_collective as pallet_collective_technical_committee;
use pallet_external_validator_slashes as pallet_external_validators_slashes;
frame_benchmarking::define_benchmarks!(
// System benchmarks
@ -36,6 +37,9 @@ frame_benchmarking::define_benchmarks!(
// Consensus pallets
[pallet_mmr, Mmr]
[pallet_beefy_mmr, BeefyMmrLeaf]
[pallet_babe, Babe]
[pallet_grandpa, Grandpa]
[pallet_randomness, Randomness]
// Substrate pallets
[pallet_balances, Balances]
@ -68,6 +72,7 @@ frame_benchmarking::define_benchmarks!(
// DataHaven custom pallets
[pallet_external_validators, ExternalValidators]
[pallet_external_validators_rewards, ExternalValidatorsRewards]
[pallet_external_validator_slashes, ExternalValidatorsSlashes]
[pallet_datahaven_native_transfer, DataHavenNativeTransfer]
// Snowbridge pallets

View file

@ -40,6 +40,7 @@ use super::{
MAXIMUM_BLOCK_WEIGHT, NORMAL_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, VERSION,
};
use codec::{Decode, Encode, MaxEncodedLen};
use pallet_external_validator_slashes::SlashingModeOption;
use scale_info::TypeInfo;
use sp_runtime::RuntimeDebug;
@ -236,13 +237,15 @@ impl Contains<RuntimeCall> for NormalCallFilter {
}
/// Calls that can bypass the safe-mode pallet.
/// These calls are essential for emergency governance and system maintenance.
/// These calls are essential for emergency governance, system maintenance, and basic operation.
pub struct SafeModeWhitelistedCalls;
impl Contains<RuntimeCall> for SafeModeWhitelistedCalls {
fn contains(call: &RuntimeCall) -> bool {
match call {
// Core system calls
RuntimeCall::System(_) => true,
RuntimeCall::Timestamp(_) => true,
RuntimeCall::Randomness(_) => true,
// Safe mode management
RuntimeCall::SafeMode(_) => true,
// Transaction pause management
@ -321,7 +324,7 @@ impl pallet_babe::Config for Runtime {
type ExpectedBlockTime = ExpectedBlockTime;
type EpochChangeTrigger = pallet_babe::ExternalTrigger;
type DisabledValidators = Session;
type WeightInfo = ();
type WeightInfo = testnet_weights::pallet_babe::WeightInfo<Runtime>;
type MaxAuthorities = MaxAuthorities;
type MaxNominators = ConstU32<0>;
@ -433,7 +436,7 @@ parameter_types! {
impl pallet_grandpa::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
type WeightInfo = testnet_weights::pallet_grandpa::WeightInfo<Runtime>;
type MaxAuthorities = MaxAuthorities;
type MaxNominators = ConstU32<0>;
type MaxSetIdSessionEntries = MaxSetIdSessionEntries;
@ -643,7 +646,7 @@ impl pallet_identity::Config for Runtime {
type PendingUsernameExpiration = PendingUsernameExpiration;
type MaxSuffixLength = MaxSuffixLength;
type MaxUsernameLength = MaxUsernameLength;
type WeightInfo = ();
type WeightInfo = pallet_identity::weights::SubstrateWeight<Runtime>;
type UsernameDeposit = ();
type UsernameGracePeriod = ();
@ -1631,12 +1634,15 @@ impl pallet_external_validator_slashes::Config for Runtime {
type InvulnerablesProvider = ExternalValidators;
type ExternalIndexProvider = ExternalValidators;
type QueuedSlashesProcessedPerBlock = ConstU32<10>;
type WeightInfo = (); // TODO: calculate weights
type WeightInfo = testnet_weights::pallet_external_validator_slashes::WeightInfo<Runtime>;
type SendMessage = SlashesSendAdapter;
type SlashingMode = SlashingMode;
}
parameter_types! {
pub const SlashDeferDuration: EraIndex = polkadot_runtime_common::prod_or_fast!(0, 0);
pub const SlashingMode: SlashingModeOption = polkadot_runtime_common::prod_or_fast!(SlashingModeOption::Disabled, SlashingModeOption::Disabled);
}
#[cfg(test)]

View file

@ -37,7 +37,7 @@ use sp_runtime::traits::Zero;
use sp_runtime::SaturatedConversion;
use sp_runtime::{traits::BlakeTwo256, Perbill};
use sp_std::convert::{From, Into};
use sp_std::vec;
use sp_std::{vec, vec::Vec};
use sp_trie::{LayoutV1, TrieConfiguration, TrieLayout};
#[cfg(feature = "std")]
@ -105,7 +105,7 @@ impl pallet_randomness::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type BabeDataGetter = BabeDataGetter;
type BabeBlockGetter = BlockNumberGetter;
type WeightInfo = ();
type WeightInfo = crate::weights::pallet_randomness::WeightInfo<Runtime>;
type BabeDataGetterBlockNumber = BlockNumber;
}
@ -450,6 +450,25 @@ parameter_types! {
pub const FileSystemFileDeletionRequestHoldReason: RuntimeHoldReason = RuntimeHoldReason::FileSystem(pallet_file_system::HoldReason::FileDeletionRequestHold);
}
// Converts a given signed message in a EIP-191 compliant message bytes to verify.
/// EIP-191: https://eips.ethereum.org/EIPS/eip-191
/// "\x19Ethereum Signed Message:\n" + len(message) + message"
pub struct Eip191Adapter;
impl shp_traits::MessageAdapter for Eip191Adapter {
fn bytes_to_verify(message: &[u8]) -> Vec<u8> {
const PREFIX: &str = "\x19Ethereum Signed Message:\n";
let len = message.len();
let mut len_string_buffer = itoa::Buffer::new();
let len_string = len_string_buffer.format(len);
let mut eth_message = Vec::with_capacity(PREFIX.len() + len_string.len() + len);
eth_message.extend_from_slice(PREFIX.as_bytes());
eth_message.extend_from_slice(len_string.as_bytes());
eth_message.extend_from_slice(message);
eth_message
}
}
impl pallet_file_system::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = pallet_file_system::weights::SubstrateWeight<Runtime>;
@ -501,6 +520,8 @@ impl pallet_file_system::Config for Runtime {
type TickRangeToMaximumThreshold = runtime_config::TickRangeToMaximumThreshold;
type OffchainSignature = Signature;
type OffchainPublicKey = <Signature as Verify>::Signer;
type MaxFileDeletionsPerExtrinsic = ConstU32<100>;
type IntentionMsgAdapter = Eip191Adapter;
}
impl MostlyStablePriceIndexUpdaterConfig for Runtime {

View file

@ -122,7 +122,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// `spec_version`, and `authoring_version` are the same between Wasm and native.
// This value is set to 200 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
// the compatible custom types.
spec_version: 310,
spec_version: 400,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
@ -1061,40 +1061,13 @@ impl_runtime_apis! {
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 <Runtime as pallet_evm::Config>::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),
};
let weight_limit = <Runtime as pallet_evm::Config>::GasWeightMapping::gas_to_weight(
gas_limit,
without_base_extrinsic_weight
);
<Runtime as pallet_evm::Config>::Runner::call(
from,
@ -1108,8 +1081,8 @@ impl_runtime_apis! {
access_list.unwrap_or_default(),
is_transactional,
validate,
weight_limit,
proof_size_base_cost,
Some(weight_limit),
None,
config.as_ref().unwrap_or(<Runtime as pallet_evm::Config>::config()),
).map_err(|err| err.error.into())
}
@ -1141,7 +1114,11 @@ impl_runtime_apis! {
gas_limit.low_u64()
};
let (weight_limit, proof_size_base_cost) = (None, None);
let without_base_extrinsic_weight = true;
let weight_limit = <Runtime as pallet_evm::Config>::GasWeightMapping::gas_to_weight(
gas_limit,
without_base_extrinsic_weight
);
#[allow(clippy::or_fun_call)]
<Runtime as pallet_evm::Config>::Runner::create(
@ -1155,8 +1132,8 @@ impl_runtime_apis! {
access_list.unwrap_or_default(),
is_transactional,
validate,
weight_limit,
proof_size_base_cost,
Some(weight_limit),
None,
config.as_ref().unwrap_or(<Runtime as pallet_evm::Config>::config()),
).map_err(|err| err.error.into())
}
@ -1267,6 +1244,9 @@ impl_runtime_apis! {
fn query_incomplete_storage_request_metadata(file_key: H256) -> Result<pallet_file_system_runtime_api::IncompleteStorageRequestMetadataResponse<AccountId, BucketId<Runtime>, StorageDataUnit<Runtime>, H256, BackupStorageProviderId<Runtime>>, QueryIncompleteStorageRequestMetadataError> {
FileSystem::query_incomplete_storage_request_metadata(file_key)
}
fn list_incomplete_storage_request_keys(start_after: Option<H256>, limit: u32) -> Vec<H256> {
FileSystem::list_incomplete_storage_request_keys(start_after, limit)
}
}
impl pallet_payment_streams_runtime_api::PaymentStreamsApi<Block, ProviderIdFor<Runtime>, Balance, AccountId> for Runtime {

View file

@ -19,6 +19,7 @@
// DataHaven pallets
pub mod pallet_datahaven_native_transfer;
pub mod pallet_external_validator_slashes;
pub mod pallet_external_validators;
pub mod pallet_external_validators_rewards;
@ -31,9 +32,12 @@ pub mod snowbridge_pallet_system_v2;
// Substrate pallets
pub mod frame_system;
pub mod pallet_babe;
pub mod pallet_balances;
pub mod pallet_beefy_mmr;
pub mod pallet_evm;
pub mod pallet_grandpa;
pub mod pallet_randomness;
//pub mod pallet_identity;
pub mod pallet_im_online;
pub mod pallet_message_queue;

View file

@ -0,0 +1,48 @@
//! Autogenerated weights for `pallet_babe`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0
//! DATE: 2025-10-30, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
// frame-omni-bencher
// v1
// benchmark
// pallet
// --runtime
// target/production/wbuild/datahaven-testnet-runtime/datahaven_testnet_runtime.compact.compressed.wasm
// --pallet
// pallet_babe
// --extrinsic
//
// --template
// benchmarking/frame-weight-template.hbs
// --output
// runtime/testnet/src/weights/pallet_babe.rs
// --steps
// 50
// --repeat
// 20
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weights for `pallet_babe`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_babe::WeightInfo for WeightInfo<T> {
fn plan_config_change() -> Weight {
Weight::from_parts(5_000_000, 0)
}
fn report_equivocation(_equivocations: u32, _key_owners: u32) -> Weight {
Weight::from_parts(89_841_267, 0)
}
}

View file

@ -0,0 +1,115 @@
//! Autogenerated weights for `pallet_external_validator_slashes`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0
//! DATE: 2025-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
// frame-omni-bencher
// v1
// benchmark
// pallet
// --runtime
// target/production/wbuild/datahaven-testnet-runtime/datahaven_testnet_runtime.compact.compressed.wasm
// --pallet
// pallet_external_validator_slashes
// --extrinsic
//
// --template
// benchmarking/frame-weight-template.hbs
// --output
// runtime/testnet/src/weights/pallet_external_validator_slashes.rs
// --steps
// 50
// --repeat
// 20
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weights for `pallet_external_validator_slashes`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_external_validator_slashes::weights::WeightInfo for WeightInfo<T> {
/// Storage: `ExternalValidators::ActiveEra` (r:1 w:0)
/// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`)
/// Storage: `ExternalValidatorsSlashes::Slashes` (r:1 w:1)
/// Proof: `ExternalValidatorsSlashes::Slashes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `s` is `[1, 1000]`.
fn cancel_deferred_slash(_s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `38528`
// Estimated: `41993`
// Minimum execution time: 77_069_000 picoseconds.
Weight::from_parts(1_419_406_561, 41993)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: `ExternalValidators::ActiveEra` (r:1 w:0)
/// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`)
/// Storage: `ExternalValidators::ErasStartSessionIndex` (r:1 w:0)
/// Proof: `ExternalValidators::ErasStartSessionIndex` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
/// Storage: `ExternalValidatorsSlashes::NextSlashId` (r:1 w:1)
/// Proof: `ExternalValidatorsSlashes::NextSlashId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `ExternalValidatorsSlashes::ValidatorSlashInEra` (r:1 w:1)
/// Proof: `ExternalValidatorsSlashes::ValidatorSlashInEra` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// Storage: `ExternalValidatorsSlashes::Slashes` (r:1 w:1)
/// Proof: `ExternalValidatorsSlashes::Slashes` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn force_inject_slash() -> Weight {
// Proof Size summary in bytes:
// Measured: `492`
// Estimated: `3957`
// Minimum execution time: 27_830_000 picoseconds.
Weight::from_parts(28_371_000, 3957)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
/// Storage: `ExternalValidators::ActiveEra` (r:1 w:0)
/// Proof: `ExternalValidators::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`)
/// Storage: `ExternalValidatorsSlashes::UnreportedSlashesQueue` (r:1 w:1)
/// Proof: `ExternalValidatorsSlashes::UnreportedSlashesQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `Parameters::Parameters` (r:2 w:0)
/// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
/// Storage: `MessageQueue::BookStateFor` (r:1 w:1)
/// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(136), added: 2611, mode: `MaxEncodedLen`)
/// Storage: `MessageQueue::ServiceHead` (r:1 w:1)
/// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`)
/// Storage: `MessageQueue::Pages` (r:0 w:1)
/// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(32845), added: 35320, mode: `MaxEncodedLen`)
/// The range of component `s` is `[1, 200]`.
fn process_slashes_queue(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `541 + s * (38 ±0)`
// Estimated: `6044 + s * (38 ±0)`
// Minimum execution time: 49_704_000 picoseconds.
Weight::from_parts(51_458_451, 6044)
// Standard Error: 674
.saturating_add(Weight::from_parts(45_427, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(6_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
.saturating_add(Weight::from_parts(0, 38).saturating_mul(s.into()))
}
/// Storage: `ExternalValidatorsSlashes::SlashingMode` (r:0 w:1)
/// Proof: `ExternalValidatorsSlashes::SlashingMode` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`)
fn set_slashing_mode() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_748_000 picoseconds.
Weight::from_parts(3_946_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
fn root_test_send_msg_to_eth() -> Weight {
Weight::from_parts(1_015_195_000, 3601)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
}

View file

@ -0,0 +1,55 @@
//! Autogenerated weights for `pallet_grandpa`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0
//! DATE: 2025-10-30, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
// frame-omni-bencher
// v1
// benchmark
// pallet
// --runtime
// target/production/wbuild/datahaven-testnet-runtime/datahaven_testnet_runtime.compact.compressed.wasm
// --pallet
// pallet_grandpa
// --extrinsic
//
// --template
// benchmarking/frame-weight-template.hbs
// --output
// runtime/testnet/src/weights/pallet_grandpa.rs
// --steps
// 50
// --repeat
// 20
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weights for `pallet_grandpa`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_grandpa::WeightInfo for WeightInfo<T> {
/// Storage: `Grandpa::Stalled` (r:0 w:1)
/// Proof: `Grandpa::Stalled` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
fn note_stalled() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_827_000 picoseconds.
Weight::from_parts(3_954_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
fn report_equivocation(_equivocations: u32, _key_owners: u32) -> Weight {
Weight::from_parts(79_198_467, 0)
}
}

View file

@ -0,0 +1,77 @@
//! Autogenerated weights for `pallet_randomness`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 51.0.0
//! DATE: 2025-10-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
// frame-omni-bencher
// v1
// benchmark
// pallet
// --runtime
// target/production/wbuild/datahaven-testnet-runtime/datahaven_testnet_runtime.compact.compressed.wasm
// --pallet
// pallet_randomness
// --extrinsic
//
// --template
// benchmarking/frame-weight-template.hbs
// --output
// runtime/testnet/src/weights/pallet_randomness.rs
// --steps
// 50
// --repeat
// 20
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weights for `pallet_randomness`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_randomness::weights::WeightInfo for WeightInfo<T> {
/// Storage: `Babe::AuthorVrfRandomness` (r:1 w:0)
/// Proof: `Babe::AuthorVrfRandomness` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`)
/// Storage: `Randomness::RelayEpoch` (r:1 w:1)
/// Proof: `Randomness::RelayEpoch` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
/// Storage: `Babe::NextRandomness` (r:1 w:0)
/// Proof: `Babe::NextRandomness` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Babe::EpochStart` (r:1 w:0)
/// Proof: `Babe::EpochStart` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
/// Storage: `Randomness::LastRelayBlockAndParaBlockValidForNextEpoch` (r:1 w:1)
/// Proof: `Randomness::LastRelayBlockAndParaBlockValidForNextEpoch` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
/// Storage: `Randomness::LatestOneEpochAgoRandomness` (r:0 w:1)
/// Proof: `Randomness::LatestOneEpochAgoRandomness` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`)
/// Storage: `Randomness::LatestParentBlockRandomness` (r:0 w:1)
/// Proof: `Randomness::LatestParentBlockRandomness` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`)
/// Storage: `Randomness::InherentIncluded` (r:0 w:1)
/// Proof: `Randomness::InherentIncluded` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`)
fn set_babe_randomness() -> Weight {
// Proof Size summary in bytes:
// Measured: `348`
// Estimated: `1518`
// Minimum execution time: 25_653_000 picoseconds.
Weight::from_parts(26_835_000, 1518)
.saturating_add(T::DbWeight::get().reads(5_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
/// Storage: `Randomness::InherentIncluded` (r:1 w:1)
/// Proof: `Randomness::InherentIncluded` (`max_values`: Some(1), `max_size`: Some(0), added: 495, mode: `MaxEncodedLen`)
fn on_finalize_hook() -> Weight {
// Proof Size summary in bytes:
// Measured: `99`
// Estimated: `1485`
// Minimum execution time: 5_406_000 picoseconds.
Weight::from_parts(5_749_000, 1485)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
}

View file

@ -361,9 +361,10 @@ fn processing_fails_with_insufficient_sovereign_balance() {
setup_sovereign_balance(TRANSFER_AMOUNT / 2); // Insufficient balance
let result =
snowbridge_pallet_inbound_queue_v2::Pallet::<Runtime>::process_message(alice, message);
assert!(result.is_err());
assert_noop!(
snowbridge_pallet_inbound_queue_v2::Pallet::<Runtime>::process_message(alice, message),
pallet_datahaven_native_transfer::Error::<Runtime>::InsufficientSovereignBalance
);
});
}

View file

@ -0,0 +1,71 @@
#!/bin/bash
cargo license --json > licenses.json
LICENSES=(
"(MIT OR Apache-2.0) AND Unicode-DFS-2016"
"(MIT OR Apache-2.0) AND Unicode-3.0"
"0BSD OR Apache-2.0 OR MIT"
"Apache-2.0 AND ISC"
"Apache-2.0 AND MIT"
"Apache-2.0 OR LGPL-2.1-or-later OR MIT"
"Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT"
"Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR CC0-1.0"
"Apache-2.0 OR BSD-1-Clause OR MIT"
"Apache-2.0 OR BSD-2-Clause OR MIT"
"Apache-2.0 OR BSD-3-Clause OR MIT"
"Apache-2.0 OR BSD-3-Clause"
"Apache-2.0 OR BSL-1.0"
"Apache-2.0 OR BSL-1.0 OR MIT"
"Apache-2.0 OR CC0-1.0 OR MIT-0"
"Apache-2.0 OR CC0-1.0"
"Apache-2.0 OR GPL-3.0"
"Apache-2.0 OR ISC OR MIT"
"Apache-2.0 OR MIT OR Zlib"
"Apache-2.0 OR MIT"
"(Apache-2.0 OR MIT) AND Apache-2.0"
"Apache-2.0 WITH LLVM-exception"
"Apache-2.0"
"BSD-2-Clause"
"BSD-3-Clause OR MIT"
"BSD-3-Clause"
"CC0-1.0"
"CDLA-Permissive-2.0"
"GPL-3.0-only"
"GPL-3.0-or-later WITH Classpath-exception-2.0"
"ISC"
"LGPL-3.0 OR MPL-2.0"
"MIT OR Unlicense"
"MIT"
"MPL-2.0"
"Zlib"
"Unicode-3.0"
"(Apache-2.0 OR MIT) AND Unicode-3.0"
)
AUTHORS=(
"PureStake"
"Parity Technologies <admin@parity.io>"
"Moonsong Labs"
"moonbeam-foundation"
"Frontier developers <legal@bitarray.dev>"
"StorageHub Team"
)
NAMES=(
"ring" # v0.16.20 has null license metadata but contains Apache-2.0 AND ISC LICENSE file
)
licenses_filter=$(printf ' .license != "%s" and' "${LICENSES[@]}")
authors_filter=$(printf ' .authors != "%s" and' "${AUTHORS[@]}")
names_filter=$(printf ' .name != "%s" and' "${NAMES[@]}")
# "true" at the end is necessary to close the "and" conditional
filter="${licenses_filter}${authors_filter}${names_filter} true"
echo -e "checking licenses with filter:\n$filter\n"
RESULT=$(jq "[.[] | select($filter)]" licenses.json)
if [[ "$RESULT" == "[]" ]]; then
echo "OK !!"
exit 0
else
echo -en "$RESULT\n"
echo "FAILURE !!"
exit 1
fi

View file

@ -1,5 +1,5 @@
{
"version": "0.1.0-autogenerated.12568285267841290320",
"version": "0.1.0-autogenerated.40127769317338577",
"name": "@polkadot-api/descriptors",
"files": [
"dist"

Binary file not shown.

View file

@ -0,0 +1,112 @@
import { beforeAll, beforeEach, describeSuite, expect } from "@moonwall/cli";
import type { ApiPromise } from "@polkadot/api";
describeSuite({
id: "D010105",
title: "Safe Mode Block Production",
foundationMethods: "dev",
testCases: ({ context, it }) => {
let api: ApiPromise;
beforeAll(async () => {
api = context.polkadotJs();
});
async function getSubstrateBlockNumber(): Promise<number> {
const blockNumber = await api.query.system.number();
return blockNumber.toNumber();
}
beforeEach(async () => {
// Check if safe mode is already active from genesis
let enteredUntil = (await api.query.safeMode.enteredUntil()) as any;
if (!enteredUntil.isSome) {
const enterSafeModeCall = api.tx.safeMode.forceEnter();
const sudoTx = api.tx.sudo.sudo(enterSafeModeCall);
await context.createBlock(sudoTx);
enteredUntil = (await api.query.safeMode.enteredUntil()) as any;
}
expect(enteredUntil.isSome, "Safe mode should be active").to.be.true;
});
it({
id: "T01",
title: "should produce blocks while in safe mode",
test: async () => {
const startBlock = await getSubstrateBlockNumber();
const blocksToCreate = 5;
for (let i = 0; i < blocksToCreate; i++) {
await context.createBlock();
}
const currentBlock = await getSubstrateBlockNumber();
const blocksProduced = currentBlock - startBlock;
expect(blocksProduced).to.be.greaterThanOrEqual(
blocksToCreate,
"Blocks should continue to be produced in safe mode"
);
const exitBlockBefore = await getSubstrateBlockNumber();
const exitSafeModeCall = api.tx.safeMode.forceExit();
const exitSudoTx = api.tx.sudo.sudo(exitSafeModeCall);
await context.createBlock(exitSudoTx);
// Verify the exit block was created (ensures state is updated)
const exitBlockAfter = await getSubstrateBlockNumber();
expect(exitBlockAfter, "Exit block should have been created").to.be.greaterThan(
exitBlockBefore
);
const enteredUntilAfterExit = (await api.query.safeMode.enteredUntil()) as any;
expect(!enteredUntilAfterExit.isSome, "Safe mode should be deactivated").to.be.true;
await context.createBlock();
const finalBlock = await getSubstrateBlockNumber();
expect(finalBlock).to.be.greaterThan(currentBlock);
}
});
it({
id: "T02",
title: "should allow timestamp calls in safe mode",
test: async () => {
const startBlock = await getSubstrateBlockNumber();
// Create a block - this implicitly includes timestamp extrinsic
// The fact that this succeeds proves Timestamp is whitelisted
await context.createBlock();
// Verify the block was created (contains valid timestamp)
const block = await context.viem().getBlock({ blockTag: "latest" });
expect(Number(block.timestamp)).to.be.greaterThan(0);
// Verify block number increased
const currentBlock = await getSubstrateBlockNumber();
expect(currentBlock).to.be.greaterThan(startBlock);
// Exit safe mode
const exitBlockBefore = await getSubstrateBlockNumber();
const exitSafeModeCall = api.tx.safeMode.forceExit();
const exitSudoTx = api.tx.sudo.sudo(exitSafeModeCall);
await context.createBlock(exitSudoTx);
// Verify the exit block was created (ensures state is updated)
const exitBlockAfter = await getSubstrateBlockNumber();
expect(exitBlockAfter, "Exit block should have been created").to.be.greaterThan(
exitBlockBefore
);
// Verify we exited safe mode
const enteredUntilAfterExit = (await api.query.safeMode.enteredUntil()) as any;
expect(!enteredUntilAfterExit.isSome, "Safe mode should be deactivated").to.be.true;
}
});
}
});

View file

@ -36,8 +36,7 @@ describeSuite({
const callCode = (await context.viem().call({ data: compiled.bytecode })).data;
await context.createBlock();
const { contractAddress } = await deployCreateCompiledContract(context, "MultiplyBy7", {
txnType: txnType as any,
gas: 5_000_000n
txnType: txnType as any
});
const deployedCode = await context.viem().getCode({ address: contractAddress! });
expect(callCode).to.be.eq(deployedCode);
@ -49,8 +48,7 @@ describeSuite({
title: `should not contain ${txnType} contract at genesis`,
test: async () => {
const { contractAddress } = await deployCreateCompiledContract(context, "MultiplyBy7", {
type: txnType as any,
gas: 5_000_000n
type: txnType as any
});
expect(
await context.viem().getCode({ address: contractAddress!, blockNumber: 0n })
@ -78,8 +76,7 @@ describeSuite({
await context.viem().sendTransaction({
data: callData,
nonce,
txnType: txnType as any,
gas: 5_000_000n
txnType: txnType as any
});
const contractAddress = ("0x" +