diff --git a/Cargo.lock b/Cargo.lock index 35ecdef1364c3..29d73db2e8d6b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8302,6 +8302,20 @@ dependencies = [ ] [[package]] +<<<<<<< HEAD +======= +name = "memory-db" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e300c54e3239a86f9c61cc63ab0f03862eb40b1c6e065dc6fd6ceaeff6da93d" +dependencies = [ + "foldhash", + "hash-db", + "hashbrown 0.15.3", +] + +[[package]] +>>>>>>> 7058819a (add block hashes to the randomness used by hashmaps and friends in validation context (#9127)) name = "merkleized-metadata" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -20426,9 +20440,15 @@ dependencies = [ "ahash 0.8.8", "array-bytes", "criterion", + "foldhash", "hash-db", +<<<<<<< HEAD "lazy_static", "memory-db", +======= + "hashbrown 0.15.3", + "memory-db 0.34.0", +>>>>>>> 7058819a (add block hashes to the randomness used by hashmaps and friends in validation context (#9127)) "nohash-hasher", "parity-scale-codec", "parking_lot 0.12.1", @@ -22177,14 +22197,24 @@ dependencies = [ [[package]] name = "trie-bench" +<<<<<<< HEAD version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3092f400e9f7e3ce8c1756016a8b6287163ab7a11dd47d82169260cb4cc2d680" +======= +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "972be214c558b1a5550d34c8c7e55a284f6439cefc51226d6ffbfc152de5cc58" +>>>>>>> 7058819a (add block hashes to the randomness used by hashmaps and friends in validation context (#9127)) dependencies = [ "criterion", "hash-db", "keccak-hasher", +<<<<<<< HEAD "memory-db", +======= + "memory-db 0.34.0", +>>>>>>> 7058819a (add block hashes to the randomness used by hashmaps and friends in validation context (#9127)) "parity-scale-codec", "trie-db", "trie-root", diff --git a/Cargo.toml b/Cargo.toml index 2b2a1cdc17d5c..d46a28f734476 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -564,12 +564,663 @@ extra-unused-type-parameters = { level = "allow", priority = 2 } # stylistic default_constructed_unit_structs = { level = "allow", priority = 2 } # stylistic [workspace.dependencies] +<<<<<<< HEAD polkavm = "0.9.3" polkavm-linker = "0.9.2" polkavm-derive = "0.9.1" log = { version = "0.4.21", default-features = false } quote = { version = "1.0.33" } serde = { version = "1.0.197", default-features = false } +======= +Inflector = { version = "0.11.4" } +aes-gcm = { version = "0.10" } +ahash = { version = "0.8.2" } +alloy-core = { version = "1.1.0", default-features = false } +always-assert = { version = "0.1" } +anyhow = { version = "1.0.81", default-features = false } +approx = { version = "0.5.1" } +aquamarine = { version = "0.5.0" } +arbitrary = { version = "1.3.2" } +ark-bls12-377 = { version = "0.4.0", default-features = false } +ark-bls12-377-ext = { version = "0.4.1", default-features = false } +ark-bls12-381 = { version = "0.4.0", default-features = false } +ark-bls12-381-ext = { version = "0.4.1", default-features = false } +ark-bw6-761 = { version = "0.4.0", default-features = false } +ark-bw6-761-ext = { version = "0.4.1", default-features = false } +ark-ec = { version = "0.4.2", default-features = false } +ark-ed-on-bls12-377 = { version = "0.4.0", default-features = false } +ark-ed-on-bls12-377-ext = { version = "0.4.1", default-features = false } +ark-ed-on-bls12-381-bandersnatch = { version = "0.4.0", default-features = false } +ark-ed-on-bls12-381-bandersnatch-ext = { version = "0.4.1", default-features = false } +ark-scale = { version = "0.0.12", default-features = false } +ark-vrf = { version = "0.1.0", default-features = false } +array-bytes = { version = "6.2.2", default-features = false } +arrayvec = { version = "0.7.4" } +assert_cmd = { version = "2.0.14" } +assert_matches = { version = "1.5.0" } +asset-hub-rococo-emulated-chain = { path = "cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-rococo" } +asset-hub-rococo-runtime = { path = "cumulus/parachains/runtimes/assets/asset-hub-rococo", default-features = false } +asset-hub-westend-emulated-chain = { path = "cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-westend" } +asset-hub-westend-runtime = { path = "cumulus/parachains/runtimes/assets/asset-hub-westend" } +asset-test-utils = { path = "cumulus/parachains/runtimes/assets/test-utils", default-features = false } +assets-common = { path = "cumulus/parachains/runtimes/assets/common", default-features = false } +async-channel = { version = "1.8.0" } +async-std = { version = "1.9.0" } +async-trait = { version = "0.1.88" } +asynchronous-codec = { version = "0.6" } +backoff = { version = "0.4" } +backtrace = { version = "0.3.71" } +binary-merkle-tree = { path = "substrate/utils/binary-merkle-tree", default-features = false } +bincode = { version = "1.3.3" } +ethereum-standards = { path = "substrate/primitives/ethereum-standards" } +pallet-ah-ops = { path = "cumulus/pallets/ah-ops", default-features = false } +# personal fork here as workaround for: https://github.com/rust-bitcoin/rust-bip39/pull/64 +bip39 = { package = "parity-bip39", version = "2.0.1", default-features = false } +bitflags = { version = "1.3.2" } +bitvec = { version = "1.0.1", default-features = false } +blake2 = { version = "0.10.4", default-features = false } +blake2b_simd = { version = "1.0.2", default-features = false } +blake3 = { version = "1.5" } +bn = { package = "substrate-bn", version = "0.6", default-features = false } +bounded-collections = { version = "0.3.2", default-features = false } +bounded-vec = { version = "0.7" } +bp-asset-hub-rococo = { path = "cumulus/parachains/runtimes/assets/asset-hub-rococo/bridge-primitives", default-features = false } +bp-asset-hub-westend = { path = "cumulus/parachains/runtimes/assets/asset-hub-westend/bridge-primitives", default-features = false } +bp-beefy = { path = "bridges/primitives/beefy", default-features = false } +bp-bridge-hub-cumulus = { path = "bridges/chains/chain-cumulus", default-features = false } +bp-bridge-hub-rococo = { path = "cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/bridge-primitives", default-features = false } +bp-bridge-hub-westend = { path = "cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/bridge-primitives", default-features = false } +bp-header-chain = { path = "bridges/primitives/header-chain", default-features = false } +bp-messages = { path = "bridges/primitives/messages", default-features = false } +bp-parachains = { path = "bridges/primitives/parachains", default-features = false } +bp-polkadot-bulletin = { path = "bridges/chains/chain-polkadot-bulletin", default-features = false } +bp-polkadot-core = { path = "bridges/primitives/polkadot-core", default-features = false } +bp-relayers = { path = "bridges/primitives/relayers", default-features = false } +bp-rococo = { path = "polkadot/runtime/rococo/bridge-primitives", default-features = false } +bp-runtime = { path = "bridges/primitives/runtime", default-features = false } +bp-test-utils = { path = "bridges/primitives/test-utils", default-features = false } +bp-westend = { path = "polkadot/runtime/westend/bridge-primitives", default-features = false } +bp-xcm-bridge-hub = { path = "bridges/primitives/xcm-bridge-hub", default-features = false } +bp-xcm-bridge-hub-router = { path = "bridges/primitives/xcm-bridge-hub-router", default-features = false } +bridge-hub-common = { path = "cumulus/parachains/runtimes/bridge-hubs/common", default-features = false } +bridge-hub-rococo-emulated-chain = { path = "cumulus/parachains/integration-tests/emulated/chains/parachains/bridges/bridge-hub-rococo" } +bridge-hub-rococo-runtime = { path = "cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo", default-features = false } +bridge-hub-test-utils = { path = "cumulus/parachains/runtimes/bridge-hubs/test-utils", default-features = false } +bridge-hub-westend-emulated-chain = { path = "cumulus/parachains/integration-tests/emulated/chains/parachains/bridges/bridge-hub-westend" } +bridge-hub-westend-runtime = { path = "cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend" } +bridge-runtime-common = { path = "bridges/bin/runtime-common", default-features = false } +bs58 = { version = "0.5.1", default-features = false } +build-helper = { version = "0.1.1" } +byte-slice-cast = { version = "1.2.1", default-features = false } +byteorder = { version = "1.3.2", default-features = false } +bytes = { version = "1.4.0", default-features = false } +cargo_metadata = { version = "0.15.4" } +cfg-expr = { version = "0.15.5" } +cfg-if = { version = "1.0" } +chain-spec-builder = { path = "substrate/bin/utils/chain-spec-builder", default-features = false, package = "staging-chain-spec-builder" } +chain-spec-guide-runtime = { path = "docs/sdk/src/reference_docs/chain_spec_runtime" } +chrono = { version = "0.4.31" } +cid = { version = "0.9.0" } +clap = { version = "4.5.13" } +clap_complete = { version = "4.5.13" } +cmd_lib = { version = "1.9.5" } +coarsetime = { version = "0.1.22" } +codec = { version = "3.7.5", default-features = false, package = "parity-scale-codec" } +collectives-westend-emulated-chain = { path = "cumulus/parachains/integration-tests/emulated/chains/parachains/collectives/collectives-westend" } +collectives-westend-runtime = { path = "cumulus/parachains/runtimes/collectives/collectives-westend" } +color-eyre = { version = "0.6.3", default-features = false } +color-print = { version = "0.3.4" } +colored = { version = "2.0.4" } +comfy-table = { version = "7.1.4", default-features = false } +console = { version = "0.15.8" } +const-hex = { version = "1.10.0", default-features = false } +coretime-rococo-emulated-chain = { path = "cumulus/parachains/integration-tests/emulated/chains/parachains/coretime/coretime-rococo" } +coretime-rococo-runtime = { path = "cumulus/parachains/runtimes/coretime/coretime-rococo" } +coretime-westend-emulated-chain = { path = "cumulus/parachains/integration-tests/emulated/chains/parachains/coretime/coretime-westend" } +coretime-westend-runtime = { path = "cumulus/parachains/runtimes/coretime/coretime-westend" } +cpu-time = { version = "1.0.0" } +criterion = { version = "0.5.1", default-features = false } +cumulus-client-bootnodes = { path = "cumulus/client/bootnodes", default-features = false } +cumulus-client-cli = { path = "cumulus/client/cli", default-features = false } +cumulus-client-collator = { path = "cumulus/client/collator", default-features = false } +cumulus-client-consensus-aura = { path = "cumulus/client/consensus/aura", default-features = false } +cumulus-client-consensus-common = { path = "cumulus/client/consensus/common", default-features = false } +cumulus-client-consensus-proposer = { path = "cumulus/client/consensus/proposer", default-features = false } +cumulus-client-consensus-relay-chain = { path = "cumulus/client/consensus/relay-chain", default-features = false } +cumulus-client-network = { path = "cumulus/client/network", default-features = false } +cumulus-client-parachain-inherent = { path = "cumulus/client/parachain-inherent", default-features = false } +cumulus-client-pov-recovery = { path = "cumulus/client/pov-recovery", default-features = false } +cumulus-client-service = { path = "cumulus/client/service", default-features = false } +cumulus-pallet-aura-ext = { path = "cumulus/pallets/aura-ext", default-features = false } +cumulus-pallet-dmp-queue = { default-features = false, path = "cumulus/pallets/dmp-queue" } +cumulus-pallet-parachain-system = { path = "cumulus/pallets/parachain-system", default-features = false } +cumulus-pallet-parachain-system-proc-macro = { path = "cumulus/pallets/parachain-system/proc-macro", default-features = false } +cumulus-pallet-session-benchmarking = { path = "cumulus/pallets/session-benchmarking", default-features = false } +cumulus-pallet-solo-to-para = { path = "cumulus/pallets/solo-to-para", default-features = false } +cumulus-pallet-weight-reclaim = { path = "cumulus/pallets/weight-reclaim", default-features = false } +cumulus-pallet-xcm = { path = "cumulus/pallets/xcm", default-features = false } +cumulus-pallet-xcmp-queue = { path = "cumulus/pallets/xcmp-queue", default-features = false } +cumulus-ping = { path = "cumulus/parachains/pallets/ping", default-features = false } +cumulus-primitives-aura = { path = "cumulus/primitives/aura", default-features = false } +cumulus-primitives-core = { path = "cumulus/primitives/core", default-features = false } +cumulus-primitives-parachain-inherent = { path = "cumulus/primitives/parachain-inherent", default-features = false } +cumulus-primitives-proof-size-hostfunction = { path = "cumulus/primitives/proof-size-hostfunction", default-features = false } +cumulus-primitives-storage-weight-reclaim = { path = "cumulus/primitives/storage-weight-reclaim", default-features = false } +cumulus-primitives-timestamp = { path = "cumulus/primitives/timestamp", default-features = false } +cumulus-primitives-utility = { path = "cumulus/primitives/utility", default-features = false } +cumulus-relay-chain-inprocess-interface = { path = "cumulus/client/relay-chain-inprocess-interface", default-features = false } +cumulus-relay-chain-interface = { path = "cumulus/client/relay-chain-interface", default-features = false } +cumulus-relay-chain-minimal-node = { path = "cumulus/client/relay-chain-minimal-node", default-features = false } +cumulus-relay-chain-rpc-interface = { path = "cumulus/client/relay-chain-rpc-interface", default-features = false } +cumulus-relay-chain-streams = { path = "cumulus/client/relay-chain-streams", default-features = false } +cumulus-test-client = { path = "cumulus/test/client" } +cumulus-test-relay-sproof-builder = { path = "cumulus/test/relay-sproof-builder", default-features = false } +cumulus-test-runtime = { path = "cumulus/test/runtime" } +cumulus-test-service = { path = "cumulus/test/service" } +cumulus-zombienet-sdk-helpers = { path = "cumulus/zombienet/zombienet-sdk-helpers", default-features = false } +curve25519-dalek = { version = "4.1.3" } +derive-syn-parse = { version = "0.2.0" } +derive-where = { version = "1.2.7" } +derive_more = { version = "0.99.17", default-features = false } +digest = { version = "0.10.3", default-features = false } +directories = { version = "5.0.1" } +dlmalloc = { version = "0.2.4" } +docify = { version = "0.2.9" } +dyn-clonable = { version = "0.9.0" } +dyn-clone = { version = "1.0.16" } +ed25519-dalek = { version = "2.1", default-features = false } +ed25519-zebra = { version = "4.0.3", default-features = false } +either = { version = "1.8.1", default-features = false } +emulated-integration-tests-common = { path = "cumulus/parachains/integration-tests/emulated/common", default-features = false } +enumflags2 = { version = "0.7.11" } +enumn = { version = "0.1.13" } +env_logger = { version = "0.11.2" } +environmental = { version = "1.1.4", default-features = false } +equivocation-detector = { path = "bridges/relays/equivocation" } +ethabi = { version = "2.0.0", default-features = false, package = "ethabi-decode" } +ethbloom = { version = "0.14.1", default-features = false } +ethereum-types = { version = "0.15.1", default-features = false } +exit-future = { version = "0.2.0" } +expander = { version = "2.0.0" } +fatality = { version = "0.1.1" } +fdlimit = { version = "0.3.0" } +femme = { version = "2.2.1" } +filetime = { version = "0.2.16" } +finality-grandpa = { version = "0.16.3", default-features = false } +finality-relay = { path = "bridges/relays/finality" } +first-pallet = { package = "polkadot-sdk-docs-first-pallet", path = "docs/sdk/packages/guides/first-pallet", default-features = false } +first-runtime = { package = "polkadot-sdk-docs-first-runtime", path = "docs/sdk/packages/guides/first-runtime", default-features = false } +flate2 = { version = "1.0" } +fnv = { version = "1.0.6" } +foldhash = { version = "0.1.5", default-features = false } +fork-tree = { path = "substrate/utils/fork-tree", default-features = false } +forwarded-header-value = { version = "0.1.1" } +fraction = { version = "0.13.1" } +frame = { path = "substrate/frame", default-features = false, package = "polkadot-sdk-frame" } +frame-benchmarking = { path = "substrate/frame/benchmarking", default-features = false } +frame-benchmarking-cli = { path = "substrate/utils/frame/benchmarking-cli", default-features = false } +frame-benchmarking-pallet-pov = { default-features = false, path = "substrate/frame/benchmarking/pov" } +frame-election-provider-solution-type = { path = "substrate/frame/election-provider-support/solution-type", default-features = false } +frame-election-provider-support = { path = "substrate/frame/election-provider-support", default-features = false } +frame-executive = { path = "substrate/frame/executive", default-features = false } +frame-metadata = { version = "23.0.0", default-features = false } +frame-metadata-hash-extension = { path = "substrate/frame/metadata-hash-extension", default-features = false } +frame-storage-access-test-runtime = { path = "substrate/utils/frame/storage-access-test-runtime", default-features = false } +frame-support = { path = "substrate/frame/support", default-features = false } +frame-support-procedural = { path = "substrate/frame/support/procedural", default-features = false } +frame-support-procedural-tools = { path = "substrate/frame/support/procedural/tools", default-features = false } +frame-support-procedural-tools-derive = { path = "substrate/frame/support/procedural/tools/derive", default-features = false } +frame-support-test = { path = "substrate/frame/support/test" } +frame-system = { path = "substrate/frame/system", default-features = false } +frame-system-benchmarking = { path = "substrate/frame/system/benchmarking", default-features = false } +frame-system-rpc-runtime-api = { path = "substrate/frame/system/rpc/runtime-api", default-features = false } +frame-try-runtime = { path = "substrate/frame/try-runtime", default-features = false } +fs4 = { version = "0.7.0" } +fs_extra = { version = "1.3.0" } +futures = { version = "0.3.31" } +futures-timer = { version = "3.0.2" } +futures-util = { version = "0.3.30", default-features = false } +generate-bags = { path = "substrate/utils/frame/generate-bags", default-features = false } +gethostname = { version = "0.2.3" } +git2 = { version = "0.20.0", default-features = false } +glob = { version = "0.3" } +glutton-westend-runtime = { path = "cumulus/parachains/runtimes/glutton/glutton-westend" } +governor = { version = "0.6.0" } +gum = { path = "polkadot/node/gum", default-features = false, package = "tracing-gum" } +gum-proc-macro = { path = "polkadot/node/gum/proc-macro", default-features = false, package = "tracing-gum-proc-macro" } +handlebars = { version = "5.1.0" } +hash-db = { version = "0.16.0", default-features = false } +hash256-std-hasher = { version = "0.15.2", default-features = false } +hashbrown = "0.15.3" +hex = { version = "0.4.3", default-features = false } +hex-literal = { version = "0.4.1", default-features = false } +hkdf = { version = "0.12.0" } +hmac = { version = "0.12.1" } +honggfuzz = { version = "0.5.55" } +http = { version = "1.1" } +http-body = { version = "1", default-features = false } +http-body-util = { version = "0.1.2", default-features = false } +humantime-serde = { version = "1.1" } +hyper = { version = "1.3.1", default-features = false } +hyper-rustls = { version = "0.27.3", default-features = false, features = [ + "http1", + "http2", + "logging", + "ring", + "rustls-native-certs", + "tls12", +] } +hyper-util = { version = "0.1.5", default-features = false } +impl-serde = { version = "0.5.0", default-features = false } +impl-trait-for-tuples = { version = "0.2.2" } +indexmap = { version = "2.7.1" } +indicatif = { version = "0.17.7" } +integer-sqrt = { version = "0.1.2" } +ip_network = { version = "0.4.1" } +is-terminal = { version = "0.4.9" } +is_executable = { version = "1.0.1" } +isahc = { version = "1.2" } +itertools = { version = "0.11" } +jobserver = { version = "0.1.26" } +jsonpath_lib = { version = "0.3" } +jsonrpsee = { version = "0.24.3" } +jsonrpsee-core = { version = "0.24.3" } +k256 = { version = "0.13.4", default-features = false } +kitchensink-runtime = { path = "substrate/bin/node/runtime" } +kvdb = { version = "0.13.0" } +kvdb-memorydb = { version = "0.13.0" } +kvdb-rocksdb = { version = "0.19.0" } +kvdb-shared-tests = { version = "0.11.0" } +landlock = { version = "0.3.0" } +libc = { version = "0.2.155" } +libfuzzer-sys = { version = "0.4" } +libp2p = { version = "0.54.1" } +libp2p-identity = { version = "0.2.9" } +libp2p-kad = { version = "0.46.2", default-features = false } +libsecp256k1 = { version = "0.7.0", default-features = false } +linked-hash-map = { version = "0.5.4" } +linked_hash_set = { version = "0.1.4" } +linregress = { version = "0.5.1" } +lite-json = { version = "0.2.0", default-features = false } +litep2p = { version = "0.9.5", features = ["websocket"] } +log = { version = "0.4.22", default-features = false } +macro_magic = { version = "0.5.1" } +maplit = { version = "1.0.2" } +memmap2 = { version = "0.9.3" } +memory-db = { version = "0.34.0", default-features = false } +merkleized-metadata = { version = "0.5.0" } +merlin = { version = "3.0", default-features = false } +messages-relay = { path = "bridges/relays/messages" } +metered = { version = "0.6.1", default-features = false, package = "prioritized-metered-channel" } +milagro-bls = { version = "1.5.4", default-features = false, package = "snowbridge-milagro-bls" } +minimal-template-node = { path = "templates/minimal/node" } +minimal-template-runtime = { path = "templates/minimal/runtime" } +mixnet = { version = "0.7.0" } +mmr-gadget = { path = "substrate/client/merkle-mountain-range", default-features = false } +mmr-lib = { version = "0.8.1", package = "polkadot-ckb-merkle-mountain-range", default-features = false } +mmr-rpc = { path = "substrate/client/merkle-mountain-range/rpc", default-features = false } +mockall = { version = "0.13.1" } +multiaddr = { version = "0.18.1" } +multihash = { version = "0.19.1", default-features = false } +multistream-select = { version = "0.13.0" } +names = { version = "0.14.0", default-features = false } +nix = { version = "0.29.0" } +node-cli = { path = "substrate/bin/node/cli", package = "staging-node-cli" } +node-inspect = { path = "substrate/bin/node/inspect", default-features = false, package = "staging-node-inspect" } +node-primitives = { path = "substrate/bin/node/primitives", default-features = false } +node-rpc = { path = "substrate/bin/node/rpc" } +node-testing = { path = "substrate/bin/node/testing" } +nohash-hasher = { version = "0.2.0" } +novelpoly = { version = "2.0.0", package = "reed-solomon-novelpoly" } +num-bigint = { version = "0.4.3", default-features = false } +num-format = { version = "0.4.3" } +num-integer = { version = "0.1.46", default-features = false } +num-rational = { version = "0.4.1" } +num-traits = { version = "0.2.17", default-features = false } +num_cpus = { version = "1.13.1" } +once_cell = { version = "1.21.3" } +orchestra = { version = "0.4.0", default-features = false } +pallet-alliance = { path = "substrate/frame/alliance", default-features = false } +pallet-asset-conversion = { path = "substrate/frame/asset-conversion", default-features = false } +pallet-asset-conversion-ops = { path = "substrate/frame/asset-conversion/ops", default-features = false } +pallet-asset-conversion-tx-payment = { path = "substrate/frame/transaction-payment/asset-conversion-tx-payment", default-features = false } +pallet-asset-rate = { path = "substrate/frame/asset-rate", default-features = false } +pallet-asset-rewards = { path = "substrate/frame/asset-rewards", default-features = false } +pallet-asset-tx-payment = { path = "substrate/frame/transaction-payment/asset-tx-payment", default-features = false } +pallet-assets = { path = "substrate/frame/assets", default-features = false } +pallet-assets-freezer = { path = "substrate/frame/assets-freezer", default-features = false } +pallet-assets-holder = { path = "substrate/frame/assets-holder", default-features = false } +pallet-atomic-swap = { default-features = false, path = "substrate/frame/atomic-swap" } +pallet-aura = { path = "substrate/frame/aura", default-features = false } +pallet-authority-discovery = { path = "substrate/frame/authority-discovery", default-features = false } +pallet-authorship = { path = "substrate/frame/authorship", default-features = false } +pallet-babe = { path = "substrate/frame/babe", default-features = false } +pallet-bags-list = { path = "substrate/frame/bags-list", default-features = false } +pallet-bags-list-remote-tests = { path = "substrate/frame/bags-list/remote-tests" } +pallet-balances = { path = "substrate/frame/balances", default-features = false } +pallet-beefy = { path = "substrate/frame/beefy", default-features = false } +pallet-beefy-mmr = { path = "substrate/frame/beefy-mmr", default-features = false } +pallet-bounties = { path = "substrate/frame/bounties", default-features = false } +pallet-bridge-grandpa = { path = "bridges/modules/grandpa", default-features = false } +pallet-bridge-messages = { path = "bridges/modules/messages", default-features = false } +pallet-bridge-parachains = { path = "bridges/modules/parachains", default-features = false } +pallet-bridge-relayers = { path = "bridges/modules/relayers", default-features = false } +pallet-broker = { path = "substrate/frame/broker", default-features = false } +pallet-child-bounties = { path = "substrate/frame/child-bounties", default-features = false } +pallet-collator-selection = { path = "cumulus/pallets/collator-selection", default-features = false } +pallet-collective = { path = "substrate/frame/collective", default-features = false } +pallet-collective-content = { path = "cumulus/parachains/pallets/collective-content", default-features = false } +pallet-contracts = { path = "substrate/frame/contracts", default-features = false } +pallet-contracts-fixtures = { path = "substrate/frame/contracts/fixtures", default-features = false } +pallet-contracts-mock-network = { default-features = false, path = "substrate/frame/contracts/mock-network" } +pallet-contracts-proc-macro = { path = "substrate/frame/contracts/proc-macro", default-features = false } +pallet-contracts-uapi = { path = "substrate/frame/contracts/uapi", default-features = false } +pallet-conviction-voting = { path = "substrate/frame/conviction-voting", default-features = false } +pallet-core-fellowship = { path = "substrate/frame/core-fellowship", default-features = false } +pallet-default-config-example = { path = "substrate/frame/examples/default-config", default-features = false } +pallet-delegated-staking = { path = "substrate/frame/delegated-staking", default-features = false } +pallet-democracy = { path = "substrate/frame/democracy", default-features = false } +pallet-dev-mode = { path = "substrate/frame/examples/dev-mode", default-features = false } +pallet-dummy-dim = { path = "substrate/frame/dummy-dim", default-features = false } +pallet-election-provider-multi-block = { path = "substrate/frame/election-provider-multi-block", default-features = false } +pallet-election-provider-multi-phase = { path = "substrate/frame/election-provider-multi-phase", default-features = false } +pallet-election-provider-support-benchmarking = { path = "substrate/frame/election-provider-support/benchmarking", default-features = false } +pallet-elections-phragmen = { path = "substrate/frame/elections-phragmen", default-features = false } +pallet-example-authorization-tx-extension = { path = "substrate/frame/examples/authorization-tx-extension", default-features = false } +pallet-example-basic = { path = "substrate/frame/examples/basic", default-features = false } +pallet-example-frame-crate = { path = "substrate/frame/examples/frame-crate", default-features = false } +pallet-example-kitchensink = { path = "substrate/frame/examples/kitchensink", default-features = false } +pallet-example-mbm = { path = "substrate/frame/examples/multi-block-migrations", default-features = false } +pallet-example-offchain-worker = { path = "substrate/frame/examples/offchain-worker", default-features = false } +pallet-example-single-block-migrations = { path = "substrate/frame/examples/single-block-migrations", default-features = false } +pallet-example-split = { path = "substrate/frame/examples/split", default-features = false } +pallet-example-tasks = { path = "substrate/frame/examples/tasks", default-features = false } +pallet-example-view-functions = { path = "substrate/frame/examples/view-functions", default-features = false } +pallet-examples = { path = "substrate/frame/examples" } +pallet-fast-unstake = { path = "substrate/frame/fast-unstake", default-features = false } +pallet-glutton = { path = "substrate/frame/glutton", default-features = false } +pallet-grandpa = { path = "substrate/frame/grandpa", default-features = false } +pallet-identity = { path = "substrate/frame/identity", default-features = false } +pallet-im-online = { path = "substrate/frame/im-online", default-features = false } +pallet-indices = { path = "substrate/frame/indices", default-features = false } +pallet-insecure-randomness-collective-flip = { path = "substrate/frame/insecure-randomness-collective-flip", default-features = false } +pallet-lottery = { default-features = false, path = "substrate/frame/lottery" } +pallet-membership = { path = "substrate/frame/membership", default-features = false } +pallet-message-queue = { path = "substrate/frame/message-queue", default-features = false } +pallet-meta-tx = { path = "substrate/frame/meta-tx", default-features = false } +pallet-migrations = { path = "substrate/frame/migrations", default-features = false } +pallet-minimal-template = { path = "templates/minimal/pallets/template", default-features = false } +pallet-mixnet = { default-features = false, path = "substrate/frame/mixnet" } +pallet-mmr = { path = "substrate/frame/merkle-mountain-range", default-features = false } +pallet-multisig = { path = "substrate/frame/multisig", default-features = false } +pallet-nft-fractionalization = { path = "substrate/frame/nft-fractionalization", default-features = false } +pallet-nfts = { path = "substrate/frame/nfts", default-features = false } +pallet-nfts-runtime-api = { path = "substrate/frame/nfts/runtime-api", default-features = false } +pallet-nis = { path = "substrate/frame/nis", default-features = false } +pallet-node-authorization = { default-features = false, path = "substrate/frame/node-authorization" } +pallet-nomination-pools = { path = "substrate/frame/nomination-pools", default-features = false } +pallet-nomination-pools-benchmarking = { path = "substrate/frame/nomination-pools/benchmarking", default-features = false } +pallet-nomination-pools-runtime-api = { path = "substrate/frame/nomination-pools/runtime-api", default-features = false } +pallet-offences = { path = "substrate/frame/offences", default-features = false } +pallet-offences-benchmarking = { path = "substrate/frame/offences/benchmarking", default-features = false } +pallet-origin-restriction = { path = "substrate/frame/origin-restriction", default-features = false } +pallet-paged-list = { path = "substrate/frame/paged-list", default-features = false } +pallet-parachain-template = { path = "templates/parachain/pallets/template", default-features = false } +pallet-parameters = { path = "substrate/frame/parameters", default-features = false } +pallet-people = { path = "substrate/frame/people", default-features = false } +pallet-preimage = { path = "substrate/frame/preimage", default-features = false } +pallet-proxy = { path = "substrate/frame/proxy", default-features = false } +pallet-ranked-collective = { path = "substrate/frame/ranked-collective", default-features = false } +pallet-recovery = { path = "substrate/frame/recovery", default-features = false } +pallet-referenda = { path = "substrate/frame/referenda", default-features = false } +pallet-remark = { default-features = false, path = "substrate/frame/remark" } +pallet-revive = { path = "substrate/frame/revive", default-features = false } +pallet-revive-eth-rpc = { path = "substrate/frame/revive/rpc", default-features = false } +pallet-revive-fixtures = { path = "substrate/frame/revive/fixtures", default-features = false } +pallet-revive-proc-macro = { path = "substrate/frame/revive/proc-macro", default-features = false } +pallet-revive-uapi = { path = "substrate/frame/revive/uapi", default-features = false } +pallet-root-offences = { default-features = false, path = "substrate/frame/root-offences" } +pallet-root-testing = { path = "substrate/frame/root-testing", default-features = false } +pallet-safe-mode = { default-features = false, path = "substrate/frame/safe-mode" } +pallet-salary = { path = "substrate/frame/salary", default-features = false } +pallet-scheduler = { path = "substrate/frame/scheduler", default-features = false } +pallet-scored-pool = { default-features = false, path = "substrate/frame/scored-pool" } +pallet-session = { path = "substrate/frame/session", default-features = false } +pallet-session-benchmarking = { path = "substrate/frame/session/benchmarking", default-features = false } +pallet-skip-feeless-payment = { path = "substrate/frame/transaction-payment/skip-feeless-payment", default-features = false } +pallet-society = { path = "substrate/frame/society", default-features = false } +pallet-staking = { path = "substrate/frame/staking", default-features = false } +pallet-staking-reward-curve = { path = "substrate/frame/staking/reward-curve", default-features = false } +pallet-staking-reward-fn = { path = "substrate/frame/staking/reward-fn", default-features = false } +pallet-staking-runtime-api = { path = "substrate/frame/staking/runtime-api", default-features = false } +revive-dev-node = { path = "substrate/frame/revive/dev-node/node" } +revive-dev-runtime = { path = "substrate/frame/revive/dev-node/runtime" } +# TODO: remove the reward stuff as they are not needed here +pallet-staking-async = { path = "substrate/frame/staking-async", default-features = false } +pallet-staking-async-ah-client = { path = "substrate/frame/staking-async/ah-client", default-features = false } +pallet-staking-async-parachain-runtime = { path = "substrate/frame/staking-async/runtimes/parachain" } +pallet-staking-async-rc-client = { path = "substrate/frame/staking-async/rc-client", default-features = false } +pallet-staking-async-rc-runtime = { path = "substrate/frame/staking-async/runtimes/rc" } +pallet-staking-async-rc-runtime-constants = { path = "substrate/frame/staking-async/runtimes/rc/constants", default-features = false } +pallet-staking-async-reward-curve = { path = "substrate/frame/staking-async/reward-curve", default-features = false } +pallet-staking-async-reward-fn = { path = "substrate/frame/staking-async/reward-fn", default-features = false } +pallet-staking-async-runtime-api = { path = "substrate/frame/staking-async/runtime-api", default-features = false } +pallet-state-trie-migration = { path = "substrate/frame/state-trie-migration", default-features = false } +pallet-statement = { default-features = false, path = "substrate/frame/statement" } +pallet-sudo = { path = "substrate/frame/sudo", default-features = false } +pallet-template = { path = "templates/solochain/pallets/template", default-features = false } +pallet-timestamp = { path = "substrate/frame/timestamp", default-features = false } +pallet-tips = { path = "substrate/frame/tips", default-features = false } +pallet-transaction-payment = { path = "substrate/frame/transaction-payment", default-features = false } +pallet-transaction-payment-rpc = { path = "substrate/frame/transaction-payment/rpc", default-features = false } +pallet-transaction-payment-rpc-runtime-api = { path = "substrate/frame/transaction-payment/rpc/runtime-api", default-features = false } +pallet-transaction-storage = { default-features = false, path = "substrate/frame/transaction-storage" } +pallet-treasury = { path = "substrate/frame/treasury", default-features = false } +pallet-tx-pause = { default-features = false, path = "substrate/frame/tx-pause" } +pallet-uniques = { path = "substrate/frame/uniques", default-features = false } +pallet-utility = { path = "substrate/frame/utility", default-features = false } +pallet-verify-signature = { path = "substrate/frame/verify-signature", default-features = false } +pallet-vesting = { path = "substrate/frame/vesting", default-features = false } +pallet-whitelist = { path = "substrate/frame/whitelist", default-features = false } +pallet-xcm = { path = "polkadot/xcm/pallet-xcm", default-features = false } +pallet-xcm-benchmarks = { path = "polkadot/xcm/pallet-xcm-benchmarks", default-features = false } +pallet-xcm-bridge-hub = { path = "bridges/modules/xcm-bridge-hub", default-features = false } +pallet-xcm-bridge-hub-router = { path = "bridges/modules/xcm-bridge-hub-router", default-features = false } +parachain-info = { path = "cumulus/parachains/pallets/parachain-info", default-features = false, package = "staging-parachain-info" } +parachain-template-runtime = { path = "templates/parachain/runtime" } +parachains-common = { path = "cumulus/parachains/common", default-features = false } +parachains-relay = { path = "bridges/relays/parachains" } +parachains-runtimes-test-utils = { path = "cumulus/parachains/runtimes/test-utils", default-features = false } +parity-bytes = { version = "0.1.2", default-features = false } +parity-db = { version = "0.4.12" } +parity-wasm = { version = "0.45.0" } +parking_lot = { version = "0.12.1", default-features = false } +partial_sort = { version = "0.2.0" } +paste = { version = "1.0.15", default-features = false } +pbkdf2 = { version = "0.12.2", default-features = false } +penpal-emulated-chain = { path = "cumulus/parachains/integration-tests/emulated/chains/parachains/testing/penpal" } +penpal-runtime = { path = "cumulus/parachains/runtimes/testing/penpal" } +people-rococo-emulated-chain = { path = "cumulus/parachains/integration-tests/emulated/chains/parachains/people/people-rococo" } +people-rococo-runtime = { path = "cumulus/parachains/runtimes/people/people-rococo" } +people-westend-emulated-chain = { path = "cumulus/parachains/integration-tests/emulated/chains/parachains/people/people-westend" } +people-westend-runtime = { path = "cumulus/parachains/runtimes/people/people-westend" } +pin-project = { version = "1.1.3" } +polkadot-approval-distribution = { path = "polkadot/node/network/approval-distribution", default-features = false } +polkadot-availability-bitfield-distribution = { path = "polkadot/node/network/bitfield-distribution", default-features = false } +polkadot-availability-distribution = { path = "polkadot/node/network/availability-distribution", default-features = false } +polkadot-availability-recovery = { path = "polkadot/node/network/availability-recovery", default-features = false } +polkadot-cli = { path = "polkadot/cli", default-features = false } +polkadot-collator-protocol = { path = "polkadot/node/network/collator-protocol", default-features = false } +polkadot-core-primitives = { path = "polkadot/core-primitives", default-features = false } +polkadot-dispute-distribution = { path = "polkadot/node/network/dispute-distribution", default-features = false } +polkadot-erasure-coding = { path = "polkadot/erasure-coding", default-features = false } +polkadot-gossip-support = { path = "polkadot/node/network/gossip-support", default-features = false } +polkadot-network-bridge = { path = "polkadot/node/network/bridge", default-features = false } +polkadot-node-collation-generation = { path = "polkadot/node/collation-generation", default-features = false } +polkadot-node-core-approval-voting = { path = "polkadot/node/core/approval-voting", default-features = false } +polkadot-node-core-approval-voting-parallel = { path = "polkadot/node/core/approval-voting-parallel", default-features = false } +polkadot-node-core-av-store = { path = "polkadot/node/core/av-store", default-features = false } +polkadot-node-core-backing = { path = "polkadot/node/core/backing", default-features = false } +polkadot-node-core-bitfield-signing = { path = "polkadot/node/core/bitfield-signing", default-features = false } +polkadot-node-core-candidate-validation = { path = "polkadot/node/core/candidate-validation", default-features = false } +polkadot-node-core-chain-api = { path = "polkadot/node/core/chain-api", default-features = false } +polkadot-node-core-chain-selection = { path = "polkadot/node/core/chain-selection", default-features = false } +polkadot-node-core-dispute-coordinator = { path = "polkadot/node/core/dispute-coordinator", default-features = false } +polkadot-node-core-parachains-inherent = { path = "polkadot/node/core/parachains-inherent", default-features = false } +polkadot-node-core-prospective-parachains = { path = "polkadot/node/core/prospective-parachains", default-features = false } +polkadot-node-core-provisioner = { path = "polkadot/node/core/provisioner", default-features = false } +polkadot-node-core-pvf = { path = "polkadot/node/core/pvf", default-features = false } +polkadot-node-core-pvf-checker = { path = "polkadot/node/core/pvf-checker", default-features = false } +polkadot-node-core-pvf-common = { path = "polkadot/node/core/pvf/common", default-features = false } +polkadot-node-core-pvf-execute-worker = { path = "polkadot/node/core/pvf/execute-worker", default-features = false } +polkadot-node-core-pvf-prepare-worker = { path = "polkadot/node/core/pvf/prepare-worker", default-features = false } +polkadot-node-core-runtime-api = { path = "polkadot/node/core/runtime-api", default-features = false } +polkadot-node-metrics = { path = "polkadot/node/metrics", default-features = false } +polkadot-node-network-protocol = { path = "polkadot/node/network/protocol", default-features = false } +polkadot-node-primitives = { path = "polkadot/node/primitives", default-features = false } +polkadot-node-subsystem = { path = "polkadot/node/subsystem", default-features = false } +polkadot-node-subsystem-test-helpers = { path = "polkadot/node/subsystem-test-helpers" } +polkadot-node-subsystem-types = { path = "polkadot/node/subsystem-types", default-features = false } +polkadot-node-subsystem-util = { path = "polkadot/node/subsystem-util", default-features = false } +polkadot-omni-node = { path = "cumulus/polkadot-omni-node", default-features = false } +polkadot-omni-node-lib = { path = "cumulus/polkadot-omni-node/lib", default-features = false } +polkadot-overseer = { path = "polkadot/node/overseer", default-features = false } +polkadot-parachain-primitives = { path = "polkadot/parachain", default-features = false } +polkadot-primitives = { path = "polkadot/primitives", default-features = false } +polkadot-primitives-test-helpers = { path = "polkadot/primitives/test-helpers" } +polkadot-rpc = { path = "polkadot/rpc", default-features = false } +polkadot-runtime-common = { path = "polkadot/runtime/common", default-features = false } +polkadot-runtime-metrics = { path = "polkadot/runtime/metrics", default-features = false } +polkadot-runtime-parachains = { path = "polkadot/runtime/parachains", default-features = false } +polkadot-sdk = { path = "umbrella", default-features = false } +polkadot-sdk-docs = { path = "docs/sdk" } +polkadot-service = { path = "polkadot/node/service", default-features = false } +polkadot-statement-distribution = { path = "polkadot/node/network/statement-distribution", default-features = false } +polkadot-statement-table = { path = "polkadot/statement-table", default-features = false } +polkadot-subsystem-bench = { path = "polkadot/node/subsystem-bench" } +polkadot-test-client = { path = "polkadot/node/test/client" } +polkadot-test-runtime = { path = "polkadot/runtime/test-runtime" } +polkadot-test-service = { path = "polkadot/node/test/service" } +polkavm = { version = "0.26.0", default-features = false } +polkavm-derive = "0.26.0" +polkavm-linker = "0.26.0" +portpicker = { version = "0.1.1" } +pretty_assertions = { version = "1.3.0" } +primitive-types = { version = "0.13.1", default-features = false, features = ["num-traits"] } +proc-macro-crate = { version = "3.0.0" } +proc-macro-warning = { version = "1.0.0", default-features = false } +proc-macro2 = { version = "1.0.86" } +procfs = { version = "0.16.0" } +prometheus = { version = "0.13.0", default-features = false } +prometheus-endpoint = { path = "substrate/utils/prometheus", default-features = false, package = "substrate-prometheus-endpoint" } +prometheus-parse = { version = "0.2.2" } +prost = { version = "0.12.4" } +prost-build = { version = "0.13.2" } +pyroscope = { version = "0.5.8" } +pyroscope_pprofrs = { version = "0.2.8" } +quick_cache = { version = "0.3" } +quickcheck = { version = "1.0.3", default-features = false } +quote = { version = "1.0.37" } +rand = { version = "0.8.5", default-features = false } +rand_chacha = { version = "0.3.1", default-features = false } +rand_core = { version = "0.6.2" } +rand_distr = { version = "0.4.3" } +rand_pcg = { version = "0.3.1" } +rbtag = { version = "0.3" } +ref-cast = { version = "1.0.23" } +regex = { version = "1.10.2" } +relay-substrate-client = { path = "bridges/relays/client-substrate" } +relay-utils = { path = "bridges/relays/utils" } +remote-externalities = { path = "substrate/utils/frame/remote-externalities", default-features = false, package = "frame-remote-externalities" } +ripemd = { version = "0.1.3", default-features = false } +rlp = { version = "0.6.1", default-features = false } +rococo-emulated-chain = { path = "cumulus/parachains/integration-tests/emulated/chains/relays/rococo" } +rococo-parachain-runtime = { path = "cumulus/parachains/runtimes/testing/rococo-parachain" } +rococo-runtime = { path = "polkadot/runtime/rococo" } +rococo-runtime-constants = { path = "polkadot/runtime/rococo/constants", default-features = false } +rococo-system-emulated-network = { path = "cumulus/parachains/integration-tests/emulated/networks/rococo-system" } +rococo-westend-system-emulated-network = { path = "cumulus/parachains/integration-tests/emulated/networks/rococo-westend-system" } +rpassword = { version = "7.0.0" } +rstest = { version = "0.18.2" } +rustc-hash = { version = "1.1.0" } +rustc-hex = { version = "2.1.0", default-features = false } +rustix = { version = "0.36.7", default-features = false } +rustls = { version = "0.23.18", default-features = false, features = [ + "logging", + "ring", + "std", + "tls12", +] } +rustversion = { version = "1.0.17" } +rusty-fork = { version = "0.3.0", default-features = false } +safe-mix = { version = "1.0", default-features = false } +sc-allocator = { path = "substrate/client/allocator", default-features = false } +sc-authority-discovery = { path = "substrate/client/authority-discovery", default-features = false } +sc-basic-authorship = { path = "substrate/client/basic-authorship", default-features = false } +sc-block-builder = { path = "substrate/client/block-builder", default-features = false } +sc-chain-spec = { path = "substrate/client/chain-spec", default-features = false } +sc-chain-spec-derive = { path = "substrate/client/chain-spec/derive", default-features = false } +sc-cli = { path = "substrate/client/cli", default-features = false } +sc-client-api = { path = "substrate/client/api", default-features = false } +sc-client-db = { path = "substrate/client/db", default-features = false } +sc-consensus = { path = "substrate/client/consensus/common", default-features = false } +sc-consensus-aura = { path = "substrate/client/consensus/aura", default-features = false } +sc-consensus-babe = { path = "substrate/client/consensus/babe", default-features = false } +sc-consensus-babe-rpc = { path = "substrate/client/consensus/babe/rpc", default-features = false } +sc-consensus-beefy = { path = "substrate/client/consensus/beefy", default-features = false } +sc-consensus-beefy-rpc = { path = "substrate/client/consensus/beefy/rpc", default-features = false } +sc-consensus-epochs = { path = "substrate/client/consensus/epochs", default-features = false } +sc-consensus-grandpa = { path = "substrate/client/consensus/grandpa", default-features = false } +sc-consensus-grandpa-rpc = { path = "substrate/client/consensus/grandpa/rpc", default-features = false } +sc-consensus-manual-seal = { path = "substrate/client/consensus/manual-seal", default-features = false } +sc-consensus-pow = { path = "substrate/client/consensus/pow", default-features = false } +sc-consensus-slots = { path = "substrate/client/consensus/slots", default-features = false } +sc-executor = { path = "substrate/client/executor", default-features = false } +sc-executor-common = { path = "substrate/client/executor/common", default-features = false } +sc-executor-polkavm = { path = "substrate/client/executor/polkavm", default-features = false } +sc-executor-wasmtime = { path = "substrate/client/executor/wasmtime", default-features = false } +sc-informant = { path = "substrate/client/informant", default-features = false } +sc-keystore = { path = "substrate/client/keystore", default-features = false } +sc-mixnet = { path = "substrate/client/mixnet", default-features = false } +sc-network = { path = "substrate/client/network", default-features = false } +sc-network-common = { path = "substrate/client/network/common", default-features = false } +sc-network-gossip = { path = "substrate/client/network-gossip", default-features = false } +sc-network-light = { path = "substrate/client/network/light", default-features = false } +sc-network-statement = { default-features = false, path = "substrate/client/network/statement" } +sc-network-sync = { path = "substrate/client/network/sync", default-features = false } +sc-network-test = { path = "substrate/client/network/test" } +sc-network-transactions = { path = "substrate/client/network/transactions", default-features = false } +sc-network-types = { path = "substrate/client/network/types", default-features = false } +sc-offchain = { path = "substrate/client/offchain", default-features = false } +sc-proposer-metrics = { path = "substrate/client/proposer-metrics", default-features = false } +sc-rpc = { path = "substrate/client/rpc", default-features = false } +sc-rpc-api = { path = "substrate/client/rpc-api", default-features = false } +sc-rpc-server = { path = "substrate/client/rpc-servers", default-features = false } +sc-rpc-spec-v2 = { path = "substrate/client/rpc-spec-v2", default-features = false } +sc-runtime-test = { path = "substrate/client/executor/runtime-test" } +sc-runtime-utilities = { path = "substrate/client/runtime-utilities", default-features = true } +sc-service = { path = "substrate/client/service", default-features = false } +sc-service-test = { path = "substrate/client/service/test" } +sc-state-db = { path = "substrate/client/state-db", default-features = false } +sc-statement-store = { default-features = false, path = "substrate/client/statement-store" } +sc-storage-monitor = { path = "substrate/client/storage-monitor", default-features = false } +sc-sync-state-rpc = { path = "substrate/client/sync-state-rpc", default-features = false } +sc-sysinfo = { path = "substrate/client/sysinfo", default-features = false } +sc-telemetry = { path = "substrate/client/telemetry", default-features = false } +sc-tracing = { path = "substrate/client/tracing", default-features = false } +sc-tracing-proc-macro = { path = "substrate/client/tracing/proc-macro", default-features = false } +sc-transaction-pool = { path = "substrate/client/transaction-pool", default-features = false } +sc-transaction-pool-api = { path = "substrate/client/transaction-pool/api", default-features = false } +sc-utils = { path = "substrate/client/utils", default-features = false } +scale-info = { version = "2.11.6", default-features = false } +schemars = { version = "0.8.13", default-features = false } +schnellru = { version = "0.2.3" } +schnorrkel = { version = "0.11.4", default-features = false } +seccompiler = { version = "0.4.0" } +secp256k1 = { version = "0.28.0", default-features = false } +secrecy = { version = "0.8.0", default-features = false } +serde = { version = "1.0.214", default-features = false } +>>>>>>> 7058819a (add block hashes to the randomness used by hashmaps and friends in validation context (#9127)) serde-big-array = { version = "0.3.2" } serde_derive = { version = "1.0.117" } serde_json = { version = "1.0.114", default-features = false } @@ -577,6 +1228,51 @@ serde_yaml = { version = "0.9" } syn = { version = "2.0.53" } thiserror = { version = "1.0.48" } tracing-subscriber = { version = "0.3.18" } +<<<<<<< HEAD +======= +tracking-allocator = { path = "polkadot/node/tracking-allocator", default-features = false, package = "staging-tracking-allocator" } +trie-bench = { version = "0.42.0" } +trie-db = { version = "0.30.0", default-features = false } +trie-root = { version = "0.18.0", default-features = false } +trie-standardmap = { version = "0.16.0" } +trybuild = { version = "1.0.103" } +tt-call = { version = "1.0.8" } +tuplex = { version = "0.1", default-features = false } +twox-hash = { version = "1.6.3", default-features = false } +txtesttool = { version = "0.6.0", package = "substrate-txtesttool" } +unsigned-varint = { version = "0.7.2" } +url = { version = "2.5.4" } +verifiable = { version = "0.1", default-features = false } +void = { version = "1.0.2" } +w3f-bls = { version = "0.1.9", default-features = false } +wait-timeout = { version = "0.2" } +walkdir = { version = "2.5.0" } +wasm-instrument = { version = "0.4", default-features = false } +wasm-opt = { version = "0.116" } +wasm-timer = { version = "0.2.5" } +wasmi = { version = "0.32.3", default-features = false } +wasmtime = { version = "8.0.1", default-features = false } +wat = { version = "1.0.0" } +westend-emulated-chain = { path = "cumulus/parachains/integration-tests/emulated/chains/relays/westend", default-features = false } +westend-runtime = { path = "polkadot/runtime/westend", default-features = false } +westend-runtime-constants = { path = "polkadot/runtime/westend/constants", default-features = false } +westend-system-emulated-network = { path = "cumulus/parachains/integration-tests/emulated/networks/westend-system" } +x25519-dalek = { version = "2.0" } +xcm = { path = "polkadot/xcm", default-features = false, package = "staging-xcm" } +xcm-builder = { path = "polkadot/xcm/xcm-builder", default-features = false, package = "staging-xcm-builder" } +xcm-docs = { path = "polkadot/xcm/docs" } +xcm-emulator = { path = "cumulus/xcm/xcm-emulator", default-features = false } +xcm-executor = { path = "polkadot/xcm/xcm-executor", default-features = false, package = "staging-xcm-executor" } +xcm-procedural = { path = "polkadot/xcm/procedural", default-features = false } +xcm-runtime-apis = { path = "polkadot/xcm/xcm-runtime-apis", default-features = false } +xcm-simulator = { path = "polkadot/xcm/xcm-simulator", default-features = false } +yet-another-parachain-runtime = { path = "cumulus/parachains/runtimes/testing/yet-another-parachain" } +zeroize = { version = "1.7.0", default-features = false } +zombienet-configuration = { version = "0.3.8" } +zombienet-orchestrator = { version = "0.3.8" } +zombienet-sdk = { version = "0.3.8" } +zstd = { version = "0.12.4", default-features = false } +>>>>>>> 7058819a (add block hashes to the randomness used by hashmaps and friends in validation context (#9127)) [profile.release] # Polkadot runtime requires unwinding. diff --git a/cumulus/pallets/parachain-system/src/validate_block/implementation.rs b/cumulus/pallets/parachain-system/src/validate_block/implementation.rs index 956962fce157d..a3691b9b6cacc 100644 --- a/cumulus/pallets/parachain-system/src/validate_block/implementation.rs +++ b/cumulus/pallets/parachain-system/src/validate_block/implementation.rs @@ -31,10 +31,20 @@ use codec::Encode; use frame_support::traits::{ExecuteBlock, ExtrinsicCall, Get, IsSubType}; use sp_core::storage::{ChildInfo, StateVersion}; use sp_externalities::{set_and_run_with_externalities, Externalities}; +<<<<<<< HEAD use sp_io::KillStorageResult; use sp_runtime::traits::{Block as BlockT, Extrinsic, HashingFor, Header as HeaderT}; use sp_std::prelude::*; use sp_trie::{MemoryDB, ProofSizeProvider}; +======= +use sp_io::{hashing::blake2_128, KillStorageResult}; +use sp_runtime::traits::{ + Block as BlockT, ExtrinsicCall, ExtrinsicLike, HashingFor, Header as HeaderT, +}; + +use sp_state_machine::OverlayedChanges; +use sp_trie::ProofSizeProvider; +>>>>>>> 7058819a (add block hashes to the randomness used by hashmaps and friends in validation context (#9127)) use trie_recorder::SizeOnlyRecorderProvider; type TrieBackend = sp_state_machine::TrieBackend< @@ -179,11 +189,182 @@ where .replace_implementation(host_storage_proof_size), ); +<<<<<<< HEAD run_with_externalities_and_recorder::(&backend, &mut recorder, || { let relay_chain_proof = crate::RelayChainStateProof::new( PSC::SelfParaId::get(), inherent_data.validation_data.relay_parent_storage_root, inherent_data.relay_chain_state.clone(), +======= + let block_data = codec::decode_from_bytes::>(block_data) + .expect("Invalid parachain block data"); + + // Initialize hashmaps randomness. + sp_trie::add_extra_randomness(build_seed_from_head_data( + &block_data, + relay_parent_storage_root, + )); + + let mut parent_header = + codec::decode_from_bytes::(parachain_head.clone()).expect("Invalid parent head"); + + let (blocks, proof) = block_data.into_inner(); + + assert_eq!( + *blocks + .first() + .expect("BlockData should have at least one block") + .header() + .parent_hash(), + parent_header.hash(), + "Parachain head needs to be the parent of the first block" + ); + + let mut processed_downward_messages = 0; + let mut upward_messages = BoundedVec::default(); + let mut upward_message_signals = Vec::>::new(); + let mut horizontal_messages = BoundedVec::default(); + let mut hrmp_watermark = Default::default(); + let mut head_data = None; + let mut new_validation_code = None; + let num_blocks = blocks.len(); + + // Create the db + let db = match proof.to_memory_db(Some(parent_header.state_root())) { + Ok((db, _)) => db, + Err(_) => panic!("Compact proof decoding failure."), + }; + + core::mem::drop(proof); + + let cache_provider = trie_cache::CacheProvider::new(); + // We use the storage root of the `parent_head` to ensure that it is the correct root. + // This is already being done above while creating the in-memory db, but let's be paranoid!! + let backend = sp_state_machine::TrieBackendBuilder::new_with_cache( + db, + *parent_header.state_root(), + cache_provider, + ) + .build(); + + // We use the same recorder when executing all blocks. So, each node only contributes once to + // the total size of the storage proof. This recorder should only be used for `execute_block`. + let mut execute_recorder = SizeOnlyRecorderProvider::default(); + // `backend` with the `execute_recorder`. As the `execute_recorder`, this should only be used + // for `execute_block`. + let execute_backend = sp_state_machine::TrieBackendBuilder::wrap(&backend) + .with_recorder(execute_recorder.clone()) + .build(); + + // We let all blocks contribute to the same overlay. Data written by a previous block will be + // directly accessible without going to the db. + let mut overlay = OverlayedChanges::default(); + + for (block_index, block) in blocks.into_iter().enumerate() { + parent_header = block.header().clone(); + let inherent_data = extract_parachain_inherent_data(&block); + + validate_validation_data( + &inherent_data.validation_data, + relay_parent_number, + relay_parent_storage_root, + ¶chain_head, + ); + + // We don't need the recorder or the overlay in here. + run_with_externalities_and_recorder::( + &backend, + &mut Default::default(), + &mut Default::default(), + || { + let relay_chain_proof = crate::RelayChainStateProof::new( + PSC::SelfParaId::get(), + inherent_data.validation_data.relay_parent_storage_root, + inherent_data.relay_chain_state.clone(), + ) + .expect("Invalid relay chain state proof"); + + #[allow(deprecated)] + let res = CI::check_inherents(&block, &relay_chain_proof); + + if !res.ok() { + if log::log_enabled!(log::Level::Error) { + res.into_errors().for_each(|e| { + log::error!("Checking inherent with identifier `{:?}` failed", e.0) + }); + } + + panic!("Checking inherents failed"); + } + }, + ); + + run_with_externalities_and_recorder::( + &execute_backend, + // Here is the only place where we want to use the recorder. + // We want to ensure that we not accidentally read something from the proof, that was + // not yet read and thus, alter the proof size. Otherwise we end up with mismatches in + // later blocks. + &mut execute_recorder, + &mut overlay, + || { + E::execute_block(block); + }, + ); + + run_with_externalities_and_recorder::( + &backend, + &mut Default::default(), + // We are only reading here, but need to know what the old block has written. Thus, we + // are passing here the overlay. + &mut overlay, + || { + new_validation_code = + new_validation_code.take().or(crate::NewValidationCode::::get()); + + let mut found_separator = false; + crate::UpwardMessages::::get() + .into_iter() + .filter_map(|m| { + // Filter out the `UMP_SEPARATOR` and the `UMPSignals`. + if cfg!(feature = "experimental-ump-signals") { + if m == UMP_SEPARATOR { + found_separator = true; + None + } else if found_separator { + if upward_message_signals.iter().all(|s| *s != m) { + upward_message_signals.push(m); + } + None + } else { + // No signal or separator + Some(m) + } + } else { + Some(m) + } + }) + .for_each(|m| { + upward_messages.try_push(m) + .expect( + "Number of upward messages should not be greater than `MAX_UPWARD_MESSAGE_NUM`", + ) + }); + + processed_downward_messages += crate::ProcessedDownwardMessages::::get(); + horizontal_messages.try_extend(crate::HrmpOutboundMessages::::get().into_iter()).expect( + "Number of horizontal messages should not be greater than `MAX_HORIZONTAL_MESSAGE_NUM`", + ); + hrmp_watermark = crate::HrmpWatermark::::get(); + + if block_index + 1 == num_blocks { + head_data = Some( + crate::CustomValidationHeadData::::get() + .map_or_else(|| HeadData(parent_header.encode()), HeadData), + ); + } + }, +>>>>>>> 7058819a (add block hashes to the randomness used by hashmaps and friends in validation context (#9127)) ) .expect("Invalid relay chain state proof"); @@ -276,6 +457,27 @@ fn validate_validation_data( ); } +/// Build a seed from the head data of the parachain block. +/// +/// Uses both the relay parent storage root and the hash of the blocks +/// in the block data, to make sure the seed changes every block and that +/// the user cannot find about it ahead of time. +fn build_seed_from_head_data( + block_data: &ParachainBlockData, + relay_parent_storage_root: crate::relay_chain::Hash, +) -> [u8; 16] { + let mut bytes_to_hash = Vec::with_capacity( + block_data.blocks().len() * size_of::() + size_of::(), + ); + + bytes_to_hash.extend_from_slice(relay_parent_storage_root.as_ref()); + block_data.blocks().iter().for_each(|block| { + bytes_to_hash.extend_from_slice(block.header().hash().as_ref()); + }); + + blake2_128(&bytes_to_hash) +} + /// Run the given closure with the externalities and recorder set. fn run_with_externalities_and_recorder R>( backend: &TrieBackend, diff --git a/cumulus/pallets/parachain-system/src/validate_block/trie_cache.rs b/cumulus/pallets/parachain-system/src/validate_block/trie_cache.rs index 5d785910fbe02..891a0d4c15c0b 100644 --- a/cumulus/pallets/parachain-system/src/validate_block/trie_cache.rs +++ b/cumulus/pallets/parachain-system/src/validate_block/trie_cache.rs @@ -16,20 +16,30 @@ // limitations under the License. use sp_state_machine::TrieCacheProvider; +<<<<<<< HEAD use sp_std::{ boxed::Box, cell::{RefCell, RefMut}, collections::btree_map::{BTreeMap, Entry}, }; use sp_trie::NodeCodec; +======= +use sp_trie::{NodeCodec, RandomState}; +>>>>>>> 7058819a (add block hashes to the randomness used by hashmaps and friends in validation context (#9127)) use trie_db::{node::NodeOwned, Hasher}; /// Special purpose trie cache implementation that is able to cache an unlimited number /// of values. To be used in `validate_block` to serve values and nodes that /// have already been loaded and decoded from the storage proof. +<<<<<<< HEAD pub(crate) struct TrieCache<'a, H: Hasher> { node_cache: RefMut<'a, BTreeMap>>, value_cache: Option, trie_db::CachedValue>>>, +======= +pub struct TrieCache<'a, H: Hasher> { + node_cache: RefMut<'a, HashMap, RandomState>>, + value_cache: Option, trie_db::CachedValue, RandomState>>>, +>>>>>>> 7058819a (add block hashes to the randomness used by hashmaps and friends in validation context (#9127)) } impl<'a, H: Hasher> trie_db::TrieCache> for TrieCache<'a, H> { @@ -65,15 +75,26 @@ impl<'a, H: Hasher> trie_db::TrieCache> for TrieCache<'a, H> { } /// Provider of [`TrieCache`] instances. +<<<<<<< HEAD pub(crate) struct CacheProvider { node_cache: RefCell>>, +======= +pub struct CacheProvider { + node_cache: RefCell, RandomState>>, +>>>>>>> 7058819a (add block hashes to the randomness used by hashmaps and friends in validation context (#9127)) /// Cache: `storage_root` => `storage_key` => `value`. /// /// One `block` can for example use multiple tries (child tries) and we need to distinguish the /// cached (`storage_key`, `value`) between them. For this we are using the `storage_root` to /// distinguish them (even if the storage root is the same for two child tries, it just means /// that both are exactly the same trie and there would happen no collision). +<<<<<<< HEAD value_cache: RefCell, trie_db::CachedValue>>>, +======= + value_cache: RefCell< + HashMap, trie_db::CachedValue, RandomState>, RandomState>, + >, +>>>>>>> 7058819a (add block hashes to the randomness used by hashmaps and friends in validation context (#9127)) } impl CacheProvider { diff --git a/cumulus/pallets/parachain-system/src/validate_block/trie_recorder.rs b/cumulus/pallets/parachain-system/src/validate_block/trie_recorder.rs index 48310670c074d..32c7f3cda9a26 100644 --- a/cumulus/pallets/parachain-system/src/validate_block/trie_recorder.rs +++ b/cumulus/pallets/parachain-system/src/validate_block/trie_recorder.rs @@ -22,22 +22,37 @@ use codec::Encode; +<<<<<<< HEAD use sp_std::{ cell::{RefCell, RefMut}, collections::{btree_map::BTreeMap, btree_set::BTreeSet}, rc::Rc, }; use sp_trie::{NodeCodec, ProofSizeProvider, StorageProof}; +======= +use alloc::rc::Rc; + +use core::cell::{RefCell, RefMut}; +use hashbrown::{HashMap, HashSet}; +use sp_trie::{NodeCodec, ProofSizeProvider, RandomState, StorageProof}; +>>>>>>> 7058819a (add block hashes to the randomness used by hashmaps and friends in validation context (#9127)) use trie_db::{Hasher, RecordedForKey, TrieAccess}; /// A trie recorder that only keeps track of the proof size. /// /// The internal size counting logic should align /// with ['sp_trie::recorder::Recorder']. +<<<<<<< HEAD pub(crate) struct SizeOnlyRecorder<'a, H: Hasher> { seen_nodes: RefMut<'a, BTreeSet>, encoded_size: RefMut<'a, usize>, recorded_keys: RefMut<'a, BTreeMap, RecordedForKey>>, +======= +pub struct SizeOnlyRecorder<'a, H: Hasher> { + seen_nodes: RefMut<'a, HashSet>, + encoded_size: RefMut<'a, usize>, + recorded_keys: RefMut<'a, HashMap, RecordedForKey, RandomState>>, +>>>>>>> 7058819a (add block hashes to the randomness used by hashmaps and friends in validation context (#9127)) } impl<'a, H: trie_db::Hasher> trie_db::TrieRecorder for SizeOnlyRecorder<'a, H> { @@ -90,10 +105,17 @@ impl<'a, H: trie_db::Hasher> trie_db::TrieRecorder for SizeOnlyRecorder< } #[derive(Clone)] +<<<<<<< HEAD pub(crate) struct SizeOnlyRecorderProvider { seen_nodes: Rc>>, encoded_size: Rc>, recorded_keys: Rc, RecordedForKey>>>, +======= +pub struct SizeOnlyRecorderProvider { + seen_nodes: Rc>>, + encoded_size: Rc>, + recorded_keys: Rc, RecordedForKey, RandomState>>>, +>>>>>>> 7058819a (add block hashes to the randomness used by hashmaps and friends in validation context (#9127)) } impl SizeOnlyRecorderProvider { diff --git a/prdoc/pr_9127.prdoc b/prdoc/pr_9127.prdoc new file mode 100644 index 0000000000000..ff474007cadbc --- /dev/null +++ b/prdoc/pr_9127.prdoc @@ -0,0 +1,25 @@ +title: add block hashes to the randomness used by hashmaps and friends in validation + context +doc: +- audience: Node Dev + description: |- + https://github.com/paritytech/polkadot-sdk/pull/8606 https://github.com/paritytech/trie/pull/221 replaced the usage of BTreeMap with HashMaps in validation context. The keys are already derived with a cryptographic hash function from user data, so users should not be able to manipulate it. + + To be on safe side this PR also modifies the TrieCache, TrieRecorder and MemoryDB to use a hasher that on top of the default generated randomness also adds randomness generated from the hash of the relaychain and that of the parachain blocks, which is not something users can control or guess ahead of time. +crates: +- name: bridge-runtime-common + bump: minor +- name: pallet-bridge-messages + bump: minor +- name: bp-test-utils + bump: minor +- name: cumulus-pallet-parachain-system + bump: minor +- name: sp-state-machine + bump: minor +- name: sp-trie + bump: minor +- name: pallet-session + bump: minor +- name: sp-runtime + bump: minor diff --git a/substrate/frame/session/src/historical/mod.rs b/substrate/frame/session/src/historical/mod.rs index b9cecea1a7f71..fd2e4eedcb712 100644 --- a/substrate/frame/session/src/historical/mod.rs +++ b/substrate/frame/session/src/historical/mod.rs @@ -40,7 +40,11 @@ use sp_staking::SessionIndex; use sp_std::prelude::*; use sp_trie::{ trie_types::{TrieDBBuilder, TrieDBMutBuilderV0}, +<<<<<<< HEAD LayoutV0, MemoryDB, Recorder, Trie, TrieMut, EMPTY_PREFIX, +======= + LayoutV0, MemoryDB, RandomState, Recorder, StorageProof, Trie, TrieMut, TrieRecorder, +>>>>>>> 7058819a (add block hashes to the randomness used by hashmaps and friends in validation context (#9127)) }; use frame_support::{ @@ -231,7 +235,7 @@ impl ProvingTrie { where I: IntoIterator, { - let mut db = MemoryDB::default(); + let mut db = MemoryDB::with_hasher(RandomState::default()); let mut root = Default::default(); { diff --git a/substrate/primitives/runtime/src/proving_trie/base16.rs b/substrate/primitives/runtime/src/proving_trie/base16.rs new file mode 100644 index 0000000000000..410b1d1e92b9b --- /dev/null +++ b/substrate/primitives/runtime/src/proving_trie/base16.rs @@ -0,0 +1,327 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Types for a compact base-16 merkle trie used for checking and generating proofs within the +//! runtime. The `sp-trie` crate exposes all of these same functionality (and more), but this +//! library is designed to work more easily with runtime native types, which simply need to +//! implement `Encode`/`Decode`. It also exposes a runtime friendly `TrieError` type which can be +//! use inside of a FRAME Pallet. +//! +//! Proofs are created with latest substrate trie format (`LayoutV1`), and are not compatible with +//! proofs using `LayoutV0`. + +use super::{ProofToHashes, ProvingTrie, TrieError}; +use crate::{Decode, DispatchError, Encode}; +use alloc::vec::Vec; +use codec::MaxEncodedLen; +use sp_trie::{ + trie_types::{TrieDBBuilder, TrieDBMutBuilderV1}, + LayoutV1, MemoryDB, RandomState, Trie, TrieMut, +}; + +/// A helper structure for building a basic base-16 merkle trie and creating compact proofs for that +/// trie. Proofs are created with latest substrate trie format (`LayoutV1`), and are not compatible +/// with proofs using `LayoutV0`. +pub struct BasicProvingTrie +where + Hashing: sp_core::Hasher, +{ + db: MemoryDB, + root: Hashing::Out, + _phantom: core::marker::PhantomData<(Key, Value)>, +} + +impl BasicProvingTrie +where + Hashing: sp_core::Hasher, + Key: Encode, +{ + /// Create a compact merkle proof needed to prove all `keys` and their values are in the trie. + /// + /// When verifying the proof created by this function, you must include all of the keys and + /// values of the proof, else the verifier will complain that extra nodes are provided in the + /// proof that are not needed. + pub fn create_multi_proof(&self, keys: &[Key]) -> Result, DispatchError> { + sp_trie::generate_trie_proof::, _, _, _>( + &self.db, + self.root, + &keys.into_iter().map(|k| k.encode()).collect::>>(), + ) + .map_err(|err| TrieError::from(*err).into()) + .map(|structured_proof| structured_proof.encode()) + } +} + +impl ProvingTrie for BasicProvingTrie +where + Hashing: sp_core::Hasher, + Key: Encode, + Value: Encode + Decode, +{ + /// Create a new instance of a `ProvingTrie` using an iterator of key/value pairs. + fn generate_for(items: I) -> Result + where + I: IntoIterator, + { + let mut db = MemoryDB::with_hasher(RandomState::default()); + let mut root = Default::default(); + + { + let mut trie = TrieDBMutBuilderV1::new(&mut db, &mut root).build(); + for (key, value) in items.into_iter() { + key.using_encoded(|k| value.using_encoded(|v| trie.insert(k, v))) + .map_err(|_| "failed to insert into trie")?; + } + } + + Ok(Self { db, root, _phantom: Default::default() }) + } + + /// Access the underlying trie root. + fn root(&self) -> &Hashing::Out { + &self.root + } + + /// Query a value contained within the current trie. Returns `None` if the + /// nodes within the current `MemoryDB` are insufficient to query the item. + fn query(&self, key: &Key) -> Option { + let trie = TrieDBBuilder::new(&self.db, &self.root).build(); + key.using_encoded(|s| trie.get(s)) + .ok()? + .and_then(|raw| Value::decode(&mut &*raw).ok()) + } + + /// Create a compact merkle proof needed to prove a single key and its value are in the trie. + fn create_proof(&self, key: &Key) -> Result, DispatchError> { + sp_trie::generate_trie_proof::, _, _, _>( + &self.db, + self.root, + &[key.encode()], + ) + .map_err(|err| TrieError::from(*err).into()) + .map(|structured_proof| structured_proof.encode()) + } + + /// Verify the existence of `key` and `value` in a given trie root and proof. + fn verify_proof( + root: &Hashing::Out, + proof: &[u8], + key: &Key, + value: &Value, + ) -> Result<(), DispatchError> { + verify_proof::(root, proof, key, value) + } +} + +impl ProofToHashes for BasicProvingTrie +where + Hashing: sp_core::Hasher, + Hashing::Out: MaxEncodedLen, +{ + // Our proof is just raw bytes. + type Proof = [u8]; + // This base 16 trie uses a raw proof of `Vec`, where the length of the first `Vec` + // is the depth of the trie. We can use this to predict the number of hashes. + fn proof_to_hashes(proof: &[u8]) -> Result { + use codec::DecodeLength; + let depth = + > as DecodeLength>::len(proof).map_err(|_| TrieError::DecodeError)?; + Ok(depth as u32) + } +} + +/// Verify the existence of `key` and `value` in a given trie root and proof. +pub fn verify_proof( + root: &Hashing::Out, + proof: &[u8], + key: &Key, + value: &Value, +) -> Result<(), DispatchError> +where + Hashing: sp_core::Hasher, + Key: Encode, + Value: Encode, +{ + let structured_proof: Vec> = + Decode::decode(&mut &proof[..]).map_err(|_| TrieError::DecodeError)?; + sp_trie::verify_trie_proof::, _, _, _>( + &root, + &structured_proof, + &[(key.encode(), Some(value.encode()))], + ) + .map_err(|err| TrieError::from(err).into()) +} + +/// Verify the existence of multiple `items` in a given trie root and proof. +pub fn verify_multi_proof( + root: &Hashing::Out, + proof: &[u8], + items: &[(Key, Value)], +) -> Result<(), DispatchError> +where + Hashing: sp_core::Hasher, + Key: Encode, + Value: Encode, +{ + let structured_proof: Vec> = + Decode::decode(&mut &proof[..]).map_err(|_| TrieError::DecodeError)?; + let items_encoded = items + .into_iter() + .map(|(key, value)| (key.encode(), Some(value.encode()))) + .collect::, Option>)>>(); + + sp_trie::verify_trie_proof::, _, _, _>( + &root, + &structured_proof, + &items_encoded, + ) + .map_err(|err| TrieError::from(err).into()) +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::traits::BlakeTwo256; + use sp_core::H256; + use std::collections::BTreeMap; + + // A trie which simulates a trie of accounts (u32) and balances (u128). + type BalanceTrie = BasicProvingTrie; + + // The expected root hash for an empty trie. + fn empty_root() -> H256 { + sp_trie::empty_trie_root::>() + } + + fn create_balance_trie() -> BalanceTrie { + // Create a map of users and their balances. + let mut map = BTreeMap::::new(); + for i in 0..100u32 { + map.insert(i, i.into()); + } + + // Put items into the trie. + let balance_trie = BalanceTrie::generate_for(map).unwrap(); + + // Root is changed. + let root = *balance_trie.root(); + assert!(root != empty_root()); + + // Assert valid keys are queryable. + assert_eq!(balance_trie.query(&6u32), Some(6u128)); + assert_eq!(balance_trie.query(&9u32), Some(9u128)); + assert_eq!(balance_trie.query(&69u32), Some(69u128)); + // Invalid key returns none. + assert_eq!(balance_trie.query(&6969u32), None); + + balance_trie + } + + #[test] + fn empty_trie_works() { + let empty_trie = BalanceTrie::generate_for(Vec::new()).unwrap(); + assert_eq!(*empty_trie.root(), empty_root()); + } + + #[test] + fn basic_end_to_end_single_value() { + let balance_trie = create_balance_trie(); + let root = *balance_trie.root(); + + // Create a proof for a valid key. + let proof = balance_trie.create_proof(&6u32).unwrap(); + + // Assert key is provable, all other keys are invalid. + for i in 0..200u32 { + if i == 6 { + assert_eq!( + verify_proof::(&root, &proof, &i, &u128::from(i)), + Ok(()) + ); + // Wrong value is invalid. + assert_eq!( + verify_proof::(&root, &proof, &i, &u128::from(i + 1)), + Err(TrieError::RootMismatch.into()) + ); + } else { + assert!( + verify_proof::(&root, &proof, &i, &u128::from(i)).is_err() + ); + } + } + } + + #[test] + fn basic_end_to_end_multi() { + let balance_trie = create_balance_trie(); + let root = *balance_trie.root(); + + // Create a proof for a valid and invalid key. + let proof = balance_trie.create_multi_proof(&[6u32, 9u32, 69u32]).unwrap(); + let items = [(6u32, 6u128), (9u32, 9u128), (69u32, 69u128)]; + + assert_eq!(verify_multi_proof::(&root, &proof, &items), Ok(())); + } + + #[test] + fn proof_fails_with_bad_data() { + let balance_trie = create_balance_trie(); + let root = *balance_trie.root(); + + // Create a proof for a valid key. + let proof = balance_trie.create_proof(&6u32).unwrap(); + + // Correct data verifies successfully + assert_eq!(verify_proof::(&root, &proof, &6u32, &6u128), Ok(())); + + // Fail to verify proof with wrong root + assert_eq!( + verify_proof::(&Default::default(), &proof, &6u32, &6u128), + Err(TrieError::RootMismatch.into()) + ); + + // Crete a bad proof. + let bad_proof = balance_trie.create_proof(&99u32).unwrap(); + + // Fail to verify data with the wrong proof + assert_eq!( + verify_proof::(&root, &bad_proof, &6u32, &6u128), + Err(TrieError::ExtraneousHashReference.into()) + ); + } + + #[test] + fn proof_to_hashes() { + let mut i: u32 = 1; + // Compute log base 16 and round up + let log16 = |x: u32| -> u32 { + let x_f64 = x as f64; + let log16_x = (x_f64.ln() / 16_f64.ln()).ceil(); + log16_x as u32 + }; + + while i < 10_000_000 { + let trie = BalanceTrie::generate_for((0..i).map(|i| (i, u128::from(i)))).unwrap(); + let proof = trie.create_proof(&0).unwrap(); + let hashes = BalanceTrie::proof_to_hashes(&proof).unwrap(); + let log16 = log16(i).max(1); + + assert_eq!(hashes, log16); + i = i * 10; + } + } +} diff --git a/substrate/primitives/state-machine/src/backend.rs b/substrate/primitives/state-machine/src/backend.rs index 90be55d58a4ed..b0934a1b07cdb 100644 --- a/substrate/primitives/state-machine/src/backend.rs +++ b/substrate/primitives/state-machine/src/backend.rs @@ -30,7 +30,7 @@ use hash_db::Hasher; use sp_core::storage::{ChildInfo, StateVersion, TrackedStorageKey}; #[cfg(feature = "std")] use sp_core::traits::RuntimeCode; -use sp_trie::{MerkleValue, PrefixedMemoryDB}; +use sp_trie::{MerkleValue, PrefixedMemoryDB, RandomState}; /// A struct containing arguments for iterating over the storage. #[derive(Default)] @@ -301,7 +301,7 @@ pub trait Backend: core::fmt::Debug { where H::Out: Ord + Encode, { - let mut txs = BackendTransaction::default(); + let mut txs = BackendTransaction::with_hasher(RandomState::default()); let mut child_roots: Vec<_> = Default::default(); // child first for (child_info, child_delta) in child_deltas { diff --git a/substrate/primitives/state-machine/src/in_memory_backend.rs b/substrate/primitives/state-machine/src/in_memory_backend.rs index 7ba7457a6bf18..63b65e4948713 100644 --- a/substrate/primitives/state-machine/src/in_memory_backend.rs +++ b/substrate/primitives/state-machine/src/in_memory_backend.rs @@ -24,8 +24,18 @@ use crate::{ use codec::Codec; use hash_db::Hasher; use sp_core::storage::{ChildInfo, StateVersion, Storage}; +<<<<<<< HEAD use sp_trie::{empty_trie_root, LayoutV1, PrefixedMemoryDB}; use std::collections::{BTreeMap, HashMap}; +======= +use sp_trie::{empty_trie_root, LayoutV1, PrefixedMemoryDB, RandomState}; + +#[cfg(feature = "std")] +use std::collections::HashMap as MapType; + +#[cfg(not(feature = "std"))] +use alloc::collections::BTreeMap as MapType; +>>>>>>> 7058819a (add block hashes to the randomness used by hashmaps and friends in validation context (#9127)) /// Create a new empty instance of in-memory backend. pub fn new_in_mem() -> TrieBackend, H> @@ -34,7 +44,11 @@ where H::Out: Codec + Ord, { // V1 is same as V0 for an empty trie. - TrieBackendBuilder::new(Default::default(), empty_trie_root::>()).build() + TrieBackendBuilder::new( + PrefixedMemoryDB::with_hasher(RandomState::default()), + empty_trie_root::>(), + ) + .build() } impl TrieBackend, H> diff --git a/substrate/primitives/state-machine/src/overlayed_changes/mod.rs b/substrate/primitives/state-machine/src/overlayed_changes/mod.rs index c2dc637bc71a7..aa76bef59ba04 100644 --- a/substrate/primitives/state-machine/src/overlayed_changes/mod.rs +++ b/substrate/primitives/state-machine/src/overlayed_changes/mod.rs @@ -228,7 +228,7 @@ impl Default for StorageChanges { main_storage_changes: Default::default(), child_storage_changes: Default::default(), offchain_storage_changes: Default::default(), - transaction: Default::default(), + transaction: BackendTransaction::with_hasher(Default::default()), transaction_storage_root: Default::default(), #[cfg(feature = "std")] transaction_index_changes: Default::default(), diff --git a/substrate/primitives/state-machine/src/trie_backend_essence.rs b/substrate/primitives/state-machine/src/trie_backend_essence.rs index a1f0057987411..057c742649db1 100644 --- a/substrate/primitives/state-machine/src/trie_backend_essence.rs +++ b/substrate/primitives/state-machine/src/trie_backend_essence.rs @@ -37,7 +37,7 @@ use sp_trie::{ read_child_trie_first_descendant_value, read_child_trie_hash, read_child_trie_value, read_trie_first_descendant_value, read_trie_value, trie_types::{TrieDBBuilder, TrieError}, - DBValue, KeySpacedDB, MerkleValue, NodeCodec, PrefixedMemoryDB, Trie, TrieCache, + DBValue, KeySpacedDB, MerkleValue, NodeCodec, PrefixedMemoryDB, RandomState, Trie, TrieCache, TrieDBRawIterator, TrieRecorder, TrieRecorderProvider, }; #[cfg(feature = "std")] @@ -631,7 +631,7 @@ where delta: impl Iterator)>, state_version: StateVersion, ) -> (H::Out, PrefixedMemoryDB) { - let mut write_overlay = PrefixedMemoryDB::default(); + let mut write_overlay = PrefixedMemoryDB::with_hasher(RandomState::default()); let root = self.with_recorder_and_cache_for_storage_root(None, |recorder, cache| { let mut eph = Ephemeral::new(self.backend_storage(), &mut write_overlay); @@ -667,7 +667,7 @@ where let default_root = match child_info.child_type() { ChildType::ParentKeyId => empty_child_trie_root::>(), }; - let mut write_overlay = PrefixedMemoryDB::default(); + let mut write_overlay = PrefixedMemoryDB::with_hasher(RandomState::default()); let child_root = match self.child_root(child_info) { Ok(Some(hash)) => hash, Ok(None) => default_root, diff --git a/substrate/primitives/trie/Cargo.toml b/substrate/primitives/trie/Cargo.toml index 45459c180d40d..ab66f95efdca3 100644 --- a/substrate/primitives/trie/Cargo.toml +++ b/substrate/primitives/trie/Cargo.toml @@ -21,6 +21,7 @@ name = "bench" harness = false [dependencies] +<<<<<<< HEAD ahash = { version = "0.8.2", optional = true } codec = { package = "parity-scale-codec", version = "3.6.12", default-features = false } hash-db = { version = "0.16.0", default-features = false } @@ -30,6 +31,22 @@ nohash-hasher = { version = "0.2.0", optional = true } parking_lot = { version = "0.12.1", optional = true } rand = { version = "0.8", optional = true } scale-info = { version = "2.11.1", default-features = false, features = ["derive"] } +======= +ahash = { optional = true, workspace = true } +codec = { workspace = true } +foldhash = { workspace = true } +hash-db = { workspace = true } +hashbrown = { workspace = true } +memory-db = { workspace = true } +nohash-hasher = { optional = true, workspace = true } +parking_lot = { optional = true, workspace = true, default-features = true } +prometheus-endpoint = { optional = true, workspace = true, default-features = true } +rand = { optional = true, workspace = true, default-features = true } +scale-info = { features = ["derive"], workspace = true } +schnellru = { optional = true, workspace = true } +sp-core = { workspace = true } +sp-externalities = { workspace = true } +>>>>>>> 7058819a (add block hashes to the randomness used by hashmaps and friends in validation context (#9127)) thiserror = { optional = true, workspace = true } tracing = { version = "0.1.29", optional = true } trie-db = { version = "0.29.0", default-features = false } @@ -50,6 +67,7 @@ default = ["std"] std = [ "ahash", "codec/std", + "foldhash/std", "hash-db/std", "lazy_static", "memory-db/std", diff --git a/substrate/primitives/trie/src/hasher_random_state.rs b/substrate/primitives/trie/src/hasher_random_state.rs new file mode 100644 index 0000000000000..36ae337ec416c --- /dev/null +++ b/substrate/primitives/trie/src/hasher_random_state.rs @@ -0,0 +1,171 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Utility module to use a custom random state for HashMap and friends +//! in a no_std environment. + +use core::{ + cell::UnsafeCell, + hash::Hasher as CoreHasher, + sync::atomic::{AtomicU8, Ordering}, +}; + +use core::hash::BuildHasher; +use foldhash::quality::RandomState as FoldHashBuilder; + +// Constants to represent the state of the global extra randomness. +// UNINITIALIZED: The extra randomness has not been set yet. +const UNINITIALIZED: u8 = 0; +// LOCKED: The extra randomness is being set. +const LOCKED: u8 = 1; +// INITIALIZED: The extra randomness has been set and is ready to use. +const INITIALIZED: u8 = 2; + +// SAFETY: we only mutate the UnsafeCells when state is in the thread-exclusive +// LOCKED state, and only read when state is in the INITIALIZED state. +unsafe impl Sync for GlobalExtraRandomnesss {} +struct GlobalExtraRandomnesss { + initialized: AtomicU8, + randomness: UnsafeCell<[u8; 16]>, +} + +// Extra randomness to be used besides the one provided by the `FoldHashBuilder`. +static EXTRA_RANDOMNESS: GlobalExtraRandomnesss = GlobalExtraRandomnesss { + initialized: AtomicU8::new(UNINITIALIZED), + randomness: UnsafeCell::new([0u8; 16]), +}; + +/// Adds extra randomness to be used by all new instances of RandomState. +pub fn add_extra_randomness(extra_randomness: [u8; 16]) { + match EXTRA_RANDOMNESS.initialized.compare_exchange( + UNINITIALIZED, + LOCKED, + Ordering::Acquire, + Ordering::Acquire, + ) { + Ok(_) => { + // SAFETY: We are the only ones writing exclusively to this memory. + unsafe { *EXTRA_RANDOMNESS.randomness.get() = extra_randomness }; + EXTRA_RANDOMNESS.initialized.store(INITIALIZED, Ordering::Release); + }, + Err(_) => { + panic!("Extra randomness has already been set, cannot set it again."); + }, + } +} + +// Returns the extra randomness if it has been set, otherwise returns None. +fn extra_randomness() -> Option<&'static [u8; 16]> { + // SAFETY: We are reading from a static memory location that is initialized + // only once, so it is safe to read from it. + if EXTRA_RANDOMNESS.initialized.load(Ordering::Acquire) == INITIALIZED { + Some(unsafe { &*EXTRA_RANDOMNESS.randomness.get() }) + } else { + None + } +} + +/// A wrapper around `FoldHashBuilder` that adds extra randomness to the hashers it creates. +#[derive(Copy, Clone, Debug)] +pub struct RandomState { + default: FoldHashBuilder, + extra_randomness: Option<&'static [u8; 16]>, +} + +impl Default for RandomState { + #[inline(always)] + fn default() -> Self { + RandomState { + // FoldHashBuilder already uses a random seed, so we use that as the base. + default: FoldHashBuilder::default(), + extra_randomness: extra_randomness(), + } + } +} + +impl BuildHasher for RandomState { + type Hasher = ::Hasher; + + #[inline(always)] + fn build_hasher(&self) -> Self::Hasher { + let mut hasher = self.default.build_hasher(); + if let Some(extra) = self.extra_randomness { + // If extra randomness is set, we write it into the hasher. + hasher.write(extra); + } + + hasher + } +} + +#[cfg(test)] +mod tests { + use core::hash::{BuildHasher, Hasher}; + + #[test] + fn hashbuilder_produces_same_result() { + let haser_builder = super::RandomState::default(); + let mut hasher_1 = haser_builder.build_hasher(); + let mut hasher_2 = haser_builder.build_hasher(); + + hasher_1.write_u32(8128); + hasher_2.write_u32(8128); + + assert_eq!(hasher_1.finish(), hasher_2.finish()); + } + + #[test] + fn adding_randomness_does_not_affect_already_instantiated_builders() { + let hasher_builder = super::RandomState::default(); + let mut hasher_1 = hasher_builder.build_hasher(); + + let randomness = [0xde; 16]; + super::add_extra_randomness(randomness); + let builder_after_randomness_added = super::RandomState::default(); + assert_eq!(builder_after_randomness_added.extra_randomness, Some(&randomness)); + + let mut hasher_2 = hasher_builder.build_hasher(); + + hasher_1.write_u32(8128); + hasher_2.write_u32(8128); + + assert_eq!(hasher_1.finish(), hasher_2.finish()); + } + + #[test] + fn sanity_check() { + let haser_builder = super::RandomState::default(); + let mut hasher_create_manually = + hashbrown::HashMap::::with_hasher(haser_builder); + let mut default_built = hashbrown::HashMap::::default(); + + for x in 0..100 { + default_built.insert(x, x * 2); + hasher_create_manually.insert(x, x * 2); + } + + for x in 0..100 { + assert_eq!(default_built.get(&x), Some(&(x * 2))); + assert_eq!(hasher_create_manually.get(&x), Some(&(x * 2))); + } + + for x in 100..200 { + assert_eq!(default_built.get(&x), None); + assert_eq!(hasher_create_manually.get(&x), None); + } + } +} diff --git a/substrate/primitives/trie/src/lib.rs b/substrate/primitives/trie/src/lib.rs index 54f202eda0c9a..c6717a98e9268 100644 --- a/substrate/primitives/trie/src/lib.rs +++ b/substrate/primitives/trie/src/lib.rs @@ -24,6 +24,8 @@ extern crate alloc; #[cfg(feature = "std")] pub mod cache; mod error; +#[cfg(any(not(feature = "std"), test))] +mod hasher_random_state; mod node_codec; mod node_header; #[cfg(feature = "std")] @@ -35,6 +37,12 @@ mod trie_stream; #[cfg(feature = "std")] pub mod proof_size_extension; +#[cfg(feature = "std")] +pub use std::hash::RandomState; + +#[cfg(not(feature = "std"))] +pub use hasher_random_state::{add_extra_randomness, RandomState}; + use alloc::{borrow::Borrow, boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; /// Our `NodeCodec`-specific error. @@ -187,13 +195,16 @@ pub type HashDB<'a, H> = dyn hash_db::HashDB + 'a; /// Reexport from `hash_db`, with genericity set for `Hasher` trait. /// This uses a `KeyFunction` for prefixing keys internally (avoiding /// key conflict for non random keys). -pub type PrefixedMemoryDB = memory_db::MemoryDB, trie_db::DBValue>; +pub type PrefixedMemoryDB = + memory_db::MemoryDB, trie_db::DBValue, RS>; /// Reexport from `hash_db`, with genericity set for `Hasher` trait. /// This uses a noops `KeyFunction` (key addressing must be hashed or using /// an encoding scheme that avoid key conflict). -pub type MemoryDB = memory_db::MemoryDB, trie_db::DBValue>; +pub type MemoryDB = + memory_db::MemoryDB, trie_db::DBValue, RS>; /// Reexport from `hash_db`, with genericity set for `Hasher` trait. -pub type GenericMemoryDB = memory_db::MemoryDB; +pub type GenericMemoryDB = + memory_db::MemoryDB; /// Persistent trie database read-access interface for the a given hasher. pub type TrieDB<'a, 'cache, L> = trie_db::TrieDB<'a, 'cache, L>; diff --git a/substrate/primitives/trie/src/storage_proof.rs b/substrate/primitives/trie/src/storage_proof.rs index e46c49be19cb8..3fc4684891fab 100644 --- a/substrate/primitives/trie/src/storage_proof.rs +++ b/substrate/primitives/trie/src/storage_proof.rs @@ -135,7 +135,7 @@ impl From for crate::MemoryDB { impl From<&StorageProof> for crate::MemoryDB { fn from(proof: &StorageProof) -> Self { - let mut db = crate::MemoryDB::default(); + let mut db = crate::MemoryDB::with_hasher(crate::RandomState::default()); proof.iter_nodes().for_each(|n| { db.insert(crate::EMPTY_PREFIX, &n); });