diff --git a/Cargo.lock b/Cargo.lock index 228b378f4..db09da8d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2268,7 +2268,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "parity-scale-codec", ] @@ -2291,7 +2291,7 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "frame-support", "frame-support-procedural", @@ -2316,7 +2316,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "frame-support", "frame-system", @@ -2357,7 +2357,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "bitflags 1.3.2", "environmental", @@ -2390,7 +2390,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "Inflector", "cfg-expr", @@ -2408,7 +2408,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -2420,7 +2420,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "proc-macro2", "quote", @@ -2430,7 +2430,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "cfg-if", "frame-support", @@ -2449,7 +2449,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "parity-scale-codec", "sp-api", @@ -2458,7 +2458,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "frame-support", "parity-scale-codec", @@ -4964,26 +4964,10 @@ dependencies = [ "group", ] -[[package]] -name = "pallet-authority-discovery" -version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" -dependencies = [ - "frame-support", - "frame-system", - "pallet-session", - "parity-scale-codec", - "scale-info", - "sp-application-crypto", - "sp-authority-discovery", - "sp-runtime", - "sp-std", -] - [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "frame-support", "frame-system", @@ -4997,7 +4981,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5021,7 +5005,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5044,7 +5028,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "frame-support", "frame-system", @@ -5065,7 +5049,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5083,7 +5067,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "frame-support", "frame-system", @@ -5099,7 +5083,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -5115,7 +5099,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -6284,7 +6268,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "log", "sp-core", @@ -6295,7 +6279,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "async-trait", "futures", @@ -6323,7 +6307,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "futures", "futures-timer", @@ -6346,7 +6330,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -6361,7 +6345,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "memmap2", "sc-chain-spec-derive", @@ -6380,7 +6364,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -6391,7 +6375,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "array-bytes", "chrono", @@ -6430,7 +6414,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "fnv", "futures", @@ -6455,7 +6439,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "hash-db", "kvdb", @@ -6481,7 +6465,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "async-trait", "futures", @@ -6506,7 +6490,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "async-trait", "fork-tree", @@ -6542,7 +6526,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "fork-tree", "parity-scale-codec", @@ -6555,7 +6539,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "ahash", "array-bytes", @@ -6596,7 +6580,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "async-trait", "futures", @@ -6619,7 +6603,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "parity-scale-codec", "parking_lot 0.12.1", @@ -6641,7 +6625,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", @@ -6653,7 +6637,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "anyhow", "cfg-if", @@ -6670,7 +6654,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "anstyle", "futures", @@ -6686,7 +6670,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "array-bytes", "parking_lot 0.12.1", @@ -6700,7 +6684,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "array-bytes", "async-channel", @@ -6742,7 +6726,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "async-channel", "cid", @@ -6762,7 +6746,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "async-trait", "bitflags 1.3.2", @@ -6779,7 +6763,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "ahash", "futures", @@ -6798,7 +6782,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "array-bytes", "async-channel", @@ -6819,7 +6803,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "array-bytes", "async-channel", @@ -6853,7 +6837,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "array-bytes", "futures", @@ -6871,7 +6855,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "bytes", "fnv", @@ -6903,7 +6887,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -6912,7 +6896,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "futures", "jsonrpsee", @@ -6942,7 +6926,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -6961,7 +6945,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "http", "jsonrpsee", @@ -6976,7 +6960,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "array-bytes", "futures", @@ -7002,7 +6986,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "async-trait", "directories", @@ -7065,7 +7049,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "log", "parity-scale-codec", @@ -7076,7 +7060,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "futures", "libc", @@ -7095,7 +7079,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "chrono", "futures", @@ -7114,7 +7098,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "anstyle", "chrono", @@ -7142,7 +7126,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7153,7 +7137,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "async-trait", "futures", @@ -7179,7 +7163,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "async-trait", "futures", @@ -7195,7 +7179,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "async-channel", "futures", @@ -7910,10 +7894,8 @@ dependencies = [ "frame-support", "frame-system", "frame-system-rpc-runtime-api", - "pallet-authority-discovery", "pallet-babe", "pallet-grandpa", - "pallet-session", "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", @@ -7961,7 +7943,8 @@ version = "0.1.0" dependencies = [ "frame-support", "frame-system", - "pallet-session", + "pallet-babe", + "pallet-grandpa", "parity-scale-codec", "scale-info", "serai-coins-pallet", @@ -7971,6 +7954,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", + "sp-session", "sp-std", ] @@ -8281,7 +8265,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "hash-db", "log", @@ -8302,7 +8286,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "Inflector", "blake2", @@ -8316,7 +8300,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "23.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "parity-scale-codec", "scale-info", @@ -8329,7 +8313,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "16.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "integer-sqrt", "num-traits", @@ -8343,7 +8327,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "parity-scale-codec", "scale-info", @@ -8355,7 +8339,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "sp-api", "sp-inherents", @@ -8366,7 +8350,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "futures", "log", @@ -8384,7 +8368,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "async-trait", "futures", @@ -8398,7 +8382,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "async-trait", "parity-scale-codec", @@ -8417,7 +8401,7 @@ dependencies = [ [[package]] name = "sp-consensus-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "finality-grandpa", "log", @@ -8435,7 +8419,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "parity-scale-codec", "scale-info", @@ -8447,7 +8431,7 @@ dependencies = [ [[package]] name = "sp-core" version = "21.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "array-bytes", "bitflags 1.3.2", @@ -8490,7 +8474,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "9.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "blake2b_simd", "byteorder", @@ -8502,7 +8486,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "9.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "quote", "sp-core-hashing", @@ -8512,7 +8496,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -8521,7 +8505,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "8.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "proc-macro2", "quote", @@ -8531,7 +8515,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.19.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "environmental", "parity-scale-codec", @@ -8542,7 +8526,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -8556,7 +8540,7 @@ dependencies = [ [[package]] name = "sp-io" version = "23.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "bytes", "ed25519", @@ -8578,7 +8562,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "24.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "lazy_static", "sp-core", @@ -8589,7 +8573,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.27.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "parity-scale-codec", "parking_lot 0.12.1", @@ -8601,7 +8585,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "thiserror", "zstd 0.12.4", @@ -8610,7 +8594,7 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.1.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "frame-metadata 16.0.0", "parity-scale-codec", @@ -8621,7 +8605,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "sp-api", "sp-core", @@ -8631,7 +8615,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "8.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "backtrace", "lazy_static", @@ -8641,7 +8625,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "rustc-hash", "serde", @@ -8651,7 +8635,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "24.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "either", "hash256-std-hasher", @@ -8673,7 +8657,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "17.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -8691,7 +8675,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "11.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "Inflector", "proc-macro-crate", @@ -8703,7 +8687,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "parity-scale-codec", "scale-info", @@ -8718,7 +8702,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -8732,7 +8716,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.28.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "hash-db", "log", @@ -8753,12 +8737,12 @@ dependencies = [ [[package]] name = "sp-std" version = "8.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" [[package]] name = "sp-storage" version = "13.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "impl-serde", "parity-scale-codec", @@ -8771,7 +8755,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "async-trait", "parity-scale-codec", @@ -8784,7 +8768,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "10.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "parity-scale-codec", "sp-std", @@ -8796,7 +8780,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "sp-api", "sp-runtime", @@ -8805,7 +8789,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "22.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "ahash", "hash-db", @@ -8828,7 +8812,7 @@ dependencies = [ [[package]] name = "sp-version" version = "22.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "impl-serde", "parity-scale-codec", @@ -8845,7 +8829,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "8.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -8856,7 +8840,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "14.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -8869,7 +8853,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "20.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "parity-scale-codec", "scale-info", @@ -9047,12 +9031,12 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -9071,7 +9055,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "hyper", "log", @@ -9083,7 +9067,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" +source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d" dependencies = [ "anstyle", "build-helper", diff --git a/coordinator/src/substrate/mod.rs b/coordinator/src/substrate/mod.rs index e34ca1994..8f810fa8f 100644 --- a/coordinator/src/substrate/mod.rs +++ b/coordinator/src/substrate/mod.rs @@ -45,7 +45,7 @@ async fn in_set( return Ok(None); }; let key = (Ristretto::generator() * key.deref()).to_bytes(); - Ok(Some(participants.iter().any(|participant| participant.0 == key))) + Ok(Some(participants.iter().any(|(participant, _)| participant.0 == key))) } async fn handle_new_set( @@ -67,21 +67,10 @@ async fn handle_new_set( let set_participants = serai.participants(set.network).await?.expect("NewSet for set which doesn't exist"); - let allocation_per_key_share = serai - .allocation_per_key_share(set.network) - .await? - .expect("NewSet for set which didn't have an allocation per key share") - .0; - - let mut set_data = vec![]; - for participant in set_participants { - let allocation = serai - .allocation(set.network, participant) - .await? - .expect("validator selected for set yet didn't have an allocation") - .0; - set_data.push((participant, u16::try_from(allocation / allocation_per_key_share).unwrap())); - } + let mut set_data = set_participants + .into_iter() + .map(|(k, w)| (k, u16::try_from(w).unwrap())) + .collect::>(); amortize_excess_key_shares(&mut set_data); set_data }; diff --git a/substrate/client/src/serai/validator_sets.rs b/substrate/client/src/serai/validator_sets.rs index 2bb474792..bd5868798 100644 --- a/substrate/client/src/serai/validator_sets.rs +++ b/substrate/client/src/serai/validator_sets.rs @@ -44,7 +44,10 @@ impl<'a> SeraiValidatorSets<'a> { self.0.storage(PALLET, "CurrentSession", Some(vec![scale_value(network)])).await } - pub async fn participants(&self, network: NetworkId) -> Result>, SeraiError> { + pub async fn participants( + &self, + network: NetworkId, + ) -> Result>, SeraiError> { self.0.storage(PALLET, "Participants", Some(vec![scale_value(network)])).await } diff --git a/substrate/client/tests/validator_sets.rs b/substrate/client/tests/validator_sets.rs index 175724133..f71751715 100644 --- a/substrate/client/tests/validator_sets.rs +++ b/substrate/client/tests/validator_sets.rs @@ -49,7 +49,12 @@ serai_test!( { let vs_serai = serai.with_current_latest_block().await.unwrap().validator_sets(); - let participants = vs_serai.participants(set.network).await.unwrap().unwrap(); + let participants = vs_serai.participants(set.network).await + .unwrap() + .unwrap() + .into_iter() + .map(|(k, _)| k) + .collect::>(); let participants_ref: &[_] = participants.as_ref(); assert_eq!(participants_ref, [public].as_ref()); assert_eq!(vs_serai.musig_key(set).await.unwrap().unwrap(), musig_key(set, &[public]).0); diff --git a/substrate/node/src/chain_spec.rs b/substrate/node/src/chain_spec.rs index 1c0e4f659..f206c534e 100644 --- a/substrate/node/src/chain_spec.rs +++ b/substrate/node/src/chain_spec.rs @@ -5,9 +5,8 @@ use sp_core::Pair as PairTrait; use sc_service::ChainType; use serai_runtime::{ - primitives::*, WASM_BINARY, opaque::SessionKeys, BABE_GENESIS_EPOCH_CONFIG, RuntimeGenesisConfig, - SystemConfig, CoinsConfig, DexConfig, ValidatorSetsConfig, SessionConfig, BabeConfig, - GrandpaConfig, AuthorityDiscoveryConfig, + primitives::*, WASM_BINARY, BABE_GENESIS_EPOCH_CONFIG, RuntimeGenesisConfig, SystemConfig, + CoinsConfig, DexConfig, ValidatorSetsConfig, BabeConfig, GrandpaConfig, }; pub type ChainSpec = sc_service::GenericChainSpec; @@ -21,16 +20,7 @@ fn testnet_genesis( validators: &[&'static str], endowed_accounts: Vec, ) -> RuntimeGenesisConfig { - let session_key = |name| { - let key = account_from_name(name); - ( - key, - key, - // TODO: Properly diversify these? - SessionKeys { babe: key.into(), grandpa: key.into(), authority_discovery: key.into() }, - ) - }; - + let validators = validators.iter().map(|name| account_from_name(name)).collect::>(); RuntimeGenesisConfig { system: SystemConfig { code: wasm_binary.to_vec(), _config: PhantomData }, @@ -59,17 +49,17 @@ fn testnet_genesis( NetworkId::Monero => (NetworkId::Monero, Amount(100_000 * 10_u64.pow(8))), }) .collect(), - participants: validators.iter().map(|name| account_from_name(name)).collect(), + participants: validators.clone(), }, - session: SessionConfig { keys: validators.iter().map(|name| session_key(*name)).collect() }, babe: BabeConfig { - authorities: vec![], + authorities: validators.iter().map(|validator| ((*validator).into(), 1)).collect(), epoch_config: Some(BABE_GENESIS_EPOCH_CONFIG), _config: PhantomData, }, - grandpa: GrandpaConfig { authorities: vec![], _config: PhantomData }, - - authority_discovery: AuthorityDiscoveryConfig { keys: vec![], _config: PhantomData }, + grandpa: GrandpaConfig { + authorities: validators.into_iter().map(|validator| (validator.into(), 1)).collect(), + _config: PhantomData, + }, } } diff --git a/substrate/runtime/Cargo.toml b/substrate/runtime/Cargo.toml index 6e1db90ab..46c017128 100644 --- a/substrate/runtime/Cargo.toml +++ b/substrate/runtime/Cargo.toml @@ -49,7 +49,6 @@ coins-pallet = { package = "serai-coins-pallet", path = "../coins/pallet", defau dex-pallet = { package = "serai-dex-pallet", path = "../dex/pallet", default-features = false } validator-sets-pallet = { package = "serai-validator-sets-pallet", path = "../validator-sets/pallet", default-features = false } -pallet-session = { git = "https://github.com/serai-dex/substrate", default-features = false } in-instructions-pallet = { package = "serai-in-instructions-pallet", path = "../in-instructions/pallet", default-features = false } @@ -58,8 +57,6 @@ signals-pallet = { package = "serai-signals-pallet", path = "../signals/pallet", pallet-babe = { git = "https://github.com/serai-dex/substrate", default-features = false } pallet-grandpa = { git = "https://github.com/serai-dex/substrate", default-features = false } -pallet-authority-discovery = { git = "https://github.com/serai-dex/substrate", default-features = false } - frame-system-rpc-runtime-api = { git = "https://github.com/serai-dex/substrate", default-features = false } pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/serai-dex/substrate", default-features = false } @@ -104,7 +101,6 @@ std = [ "dex-pallet/std", "validator-sets-pallet/std", - "pallet-session/std", "in-instructions-pallet/std", @@ -113,8 +109,6 @@ std = [ "pallet-babe/std", "pallet-grandpa/std", - "pallet-authority-discovery/std", - "frame-system-rpc-runtime-api/std", "pallet-transaction-payment-rpc-runtime-api/std", ] diff --git a/substrate/runtime/src/lib.rs b/substrate/runtime/src/lib.rs index 2a30e4707..f471ce345 100644 --- a/substrate/runtime/src/lib.rs +++ b/substrate/runtime/src/lib.rs @@ -20,7 +20,6 @@ pub use coins_pallet as coins; pub use dex_pallet as dex; pub use validator_sets_pallet as validator_sets; -pub use pallet_session as session; pub use in_instructions_pallet as in_instructions; @@ -29,8 +28,6 @@ pub use signals_pallet as signals; pub use pallet_babe as babe; pub use pallet_grandpa as grandpa; -pub use pallet_authority_discovery as authority_discovery; - // Actually used by the runtime use sp_core::OpaqueMetadata; use sp_std::prelude::*; @@ -41,7 +38,7 @@ use sp_version::NativeVersion; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, KeyTypeId, - traits::{Convert, OpaqueKeys, BlakeTwo256, Block as BlockT}, + traits::{Convert, BlakeTwo256, Block as BlockT}, transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, Perbill, }; @@ -83,13 +80,10 @@ pub mod opaque { pub struct SessionKeys { pub babe: Babe, pub grandpa: Grandpa, - pub authority_discovery: AuthorityDiscovery, } } } -use opaque::SessionKeys; - #[sp_version::runtime_version] pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("serai"), @@ -167,12 +161,6 @@ impl Contains for CallFilter { RuntimeCall::InInstructions(call) => !matches!(call, in_instructions::Call::__Ignore(_, _)), RuntimeCall::Signals(call) => !matches!(call, signals::Call::__Ignore(_, _)), - RuntimeCall::Session(call) => match call { - session::Call::set_keys { .. } => true, - session::Call::purge_keys { .. } => false, - session::Call::__Ignore(_, _) => false, - }, - RuntimeCall::Babe(call) => match call { babe::Call::report_equivocation { .. } => true, babe::Call::report_equivocation_unsigned { .. } => true, @@ -256,6 +244,8 @@ impl dex::Config for Runtime { impl validator_sets::Config for Runtime { type RuntimeEvent = RuntimeEvent; + + type ShouldEndSession = Babe; } pub struct IdentityValidatorIdOf; @@ -265,18 +255,6 @@ impl Convert> for IdentityValidatorIdOf { } } -impl session::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type ValidatorId = PublicKey; - type ValidatorIdOf = IdentityValidatorIdOf; - type ShouldEndSession = Babe; - type NextSessionRotation = Babe; - type SessionManager = ValidatorSets; - type SessionHandler = ::KeyTypeIdProviders; - type Keys = SessionKeys; - type WeightInfo = session::weights::SubstrateWeight; -} - impl signals::Config for Runtime { type RuntimeEvent = RuntimeEvent; // 1 week @@ -294,7 +272,7 @@ impl babe::Config for Runtime { type EpochDuration = ConstU64<{ 1 * DAYS }>; type ExpectedBlockTime = ConstU64<{ TARGET_BLOCK_TIME * 1000 }>; type EpochChangeTrigger = pallet_babe::ExternalTrigger; - type DisabledValidators = Session; + type DisabledValidators = ValidatorSets; type WeightInfo = (); @@ -317,10 +295,6 @@ impl grandpa::Config for Runtime { type EquivocationReportSystem = (); } -impl authority_discovery::Config for Runtime { - type MaxAuthorities = MaxAuthorities; -} - pub type Header = generic::Header; pub type Block = generic::Block; pub type SignedExtra = ( @@ -357,7 +331,6 @@ construct_runtime!( Dex: dex, ValidatorSets: validator_sets, - Session: session, InInstructions: in_instructions, @@ -365,8 +338,6 @@ construct_runtime!( Babe: babe, Grandpa: grandpa, - - AuthorityDiscovery: authority_discovery, } ); @@ -569,7 +540,10 @@ sp_api::impl_runtime_apis! { impl sp_authority_discovery::AuthorityDiscoveryApi for Runtime { fn authorities() -> Vec { - AuthorityDiscovery::authorities() + Babe::authorities() + .into_iter() + .map(|(id, _)| AuthorityDiscoveryId::from(id.into_inner())) + .collect() } } } diff --git a/substrate/validator-sets/pallet/Cargo.toml b/substrate/validator-sets/pallet/Cargo.toml index 110679f8f..ae526b876 100644 --- a/substrate/validator-sets/pallet/Cargo.toml +++ b/substrate/validator-sets/pallet/Cargo.toml @@ -20,11 +20,13 @@ sp-io = { git = "https://github.com/serai-dex/substrate", default-features = fal sp-std = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-application-crypto = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-runtime = { git = "https://github.com/serai-dex/substrate", default-features = false } +sp-session = { git = "https://github.com/serai-dex/substrate", default-features = false } frame-system = { git = "https://github.com/serai-dex/substrate", default-features = false } frame-support = { git = "https://github.com/serai-dex/substrate", default-features = false } -pallet-session = { git = "https://github.com/serai-dex/substrate", default-features = false } +pallet-babe = { git = "https://github.com/serai-dex/substrate", default-features = false } +pallet-grandpa = { git = "https://github.com/serai-dex/substrate", default-features = false } serai-primitives = { path = "../../primitives", default-features = false } validator-sets-primitives = { package = "serai-validator-sets-primitives", path = "../primitives", default-features = false } @@ -41,11 +43,13 @@ std = [ "sp-std/std", "sp-application-crypto/std", "sp-runtime/std", + "sp-session/std", "frame-system/std", "frame-support/std", - "pallet-session/std", + "pallet-babe/std", + "pallet-grandpa/std", "serai-primitives/std", "validator-sets-primitives/std", diff --git a/substrate/validator-sets/pallet/src/lib.rs b/substrate/validator-sets/pallet/src/lib.rs index 28ec02b8b..41fbc090b 100644 --- a/substrate/validator-sets/pallet/src/lib.rs +++ b/substrate/validator-sets/pallet/src/lib.rs @@ -3,14 +3,20 @@ #[allow(deprecated, clippy::let_unit_value)] // TODO #[frame_support::pallet] pub mod pallet { + use super::*; + use scale_info::TypeInfo; use sp_core::sr25519::{Public, Signature}; use sp_std::{vec, vec::Vec}; use sp_application_crypto::RuntimePublic; + use sp_session::ShouldEndSession; + use sp_runtime::traits::IsMember; use frame_system::pallet_prelude::*; - use frame_support::{pallet_prelude::*, StoragePrefixedMap}; + use frame_support::{ + pallet_prelude::*, traits::DisabledValidators, BoundedVec, WeakBoundedVec, StoragePrefixedMap, + }; use serai_primitives::*; pub use validator_sets_primitives as primitives; @@ -18,14 +24,20 @@ pub mod pallet { use coins_pallet::Pallet as Coins; + use pallet_babe::{Pallet as Babe, AuthorityId as BabeAuthorityId}; + use pallet_grandpa::{Pallet as Grandpa, AuthorityId as GrandpaAuthorityId}; + #[pallet::config] pub trait Config: frame_system::Config + coins_pallet::Config - + pallet_session::Config + + pallet_babe::Config + + pallet_grandpa::Config + TypeInfo { type RuntimeEvent: IsType<::RuntimeEvent> + From>; + + type ShouldEndSession: ShouldEndSession>; } #[pallet::genesis_config] @@ -52,22 +64,18 @@ pub mod pallet { pub struct Pallet(PhantomData); /// The current session for a network. - /// - /// This does not store the current session for Serai. pallet_session handles that. // Uses Identity for the lookup to avoid a hash of a severely limited fixed key-space. #[pallet::storage] + #[pallet::getter(fn session)] pub type CurrentSession = StorageMap<_, Identity, NetworkId, Session, OptionQuery>; impl Pallet { - pub fn session(network: NetworkId) -> Option { + pub fn latest_decided_session(network: NetworkId) -> Option { + let session = Self::session(network); + // we already decided about the next session for serai. if network == NetworkId::Serai { - Some(Session(pallet_session::Pallet::::current_index())) - } else { - CurrentSession::::get(network) + return session.map(|s| Session(s.0 + 1)); } - } - - pub fn latest_decided_session(network: NetworkId) -> Option { - CurrentSession::::get(network) + session } } @@ -84,7 +92,7 @@ pub mod pallet { _, Identity, NetworkId, - BoundedVec>, + BoundedVec<(Public, u64), ConstU32<{ MAX_KEY_SHARES_PER_SET }>>, ValueQuery, >; /// The validators selected to be in-set, yet with the ability to perform a check for presence. @@ -105,13 +113,8 @@ pub mod pallet { // current set's validators #[inline] fn in_active_serai_set(account: Public) -> bool { - // TODO: This is bounded O(n). Can we get O(1) via a storage lookup, like we do with InSet? - for validator in pallet_session::Pallet::::validators() { - if validator == account { - return true; - } - } - false + // TODO: is_member is internally O(n). Update Babe to use an O(1) storage lookup? + Babe::::is_member(&BabeAuthorityId::from(account)) } /// Returns true if the account is included in an active set. @@ -297,14 +300,12 @@ pub mod pallet { impl Pallet { fn new_set(network: NetworkId) { // Update CurrentSession - let session = if network != NetworkId::Serai { + let session = { let new_session = CurrentSession::::get(network) .map(|session| Session(session.0 + 1)) .unwrap_or(Session(0)); CurrentSession::::set(network, Some(new_session)); new_session - } else { - Self::session(network).unwrap_or(Session(0)) }; // Clear the current InSet @@ -326,20 +327,26 @@ pub mod pallet { while key_shares < u64::from(MAX_KEY_SHARES_PER_SET) { let Some((key, amount)) = iter.next() else { break }; + let these_key_shares = amount.0 / allocation_per_key_share; InSet::::set(Self::in_set_key(network, key), Some(())); - participants.push(key); + participants.push((key, these_key_shares)); // This can technically set key_shares to a value exceeding MAX_KEY_SHARES_PER_SET // Off-chain, the key shares per validator will be accordingly adjusted - key_shares += amount.0 / allocation_per_key_share; + key_shares += these_key_shares; total_stake += amount.0; } TotalAllocatedStake::::set(network, Some(Amount(total_stake))); let set = ValidatorSet { network, session }; Pallet::::deposit_event(Event::NewSet { set }); + + // Only set the MuSig key for non-Serai sets, as only non-Serai sets should publish keys if network != NetworkId::Serai { - MuSigKeys::::set(set, Some(musig_key(set, &participants))); + MuSigKeys::::set( + set, + Some(musig_key(set, &participants.iter().map(|(id, _)| *id).collect::>())), + ); } Participants::::set(network, participants.try_into().unwrap()); } @@ -372,6 +379,19 @@ pub mod pallet { NonExistentValidator, } + #[pallet::hooks] + impl Hooks> for Pallet { + fn on_initialize(n: BlockNumberFor) -> Weight { + if T::ShouldEndSession::should_end_session(n) { + Self::rotate_session(); + // TODO: set the proper weights + T::BlockWeights::get().max_block + } else { + Weight::zero() + } + } + } + #[pallet::genesis_build] impl BuildGenesisConfig for GenesisConfig { fn build(&self) { @@ -621,9 +641,10 @@ pub mod pallet { for network in serai_primitives::NETWORKS { // If this network hasn't started sessions yet, don't start one now let Some(current_session) = Self::session(network) else { continue }; - // Only spawn a NewSet if the current set was actually established with a completed - // handover protocol - if Self::handover_completed(network, current_session) { + // Only spawn a new set if: + // - This is Serai, as we need to rotate Serai upon a new session (per Babe) + // - The current set was actually established with a completed handover protocol + if (network == NetworkId::Serai) || Self::handover_completed(network, current_session) { Pallet::::new_set(network); } } @@ -649,6 +670,39 @@ pub mod pallet { } PendingDeallocations::::take((network, session, key)) } + + fn rotate_session() { + let prior_serai_participants = Self::participants(NetworkId::Serai); + let prior_serai_session = Self::session(NetworkId::Serai).unwrap(); + + // TODO: T::SessionHandler::on_before_session_ending() was here. + // end the current serai session. + Self::retire_set(ValidatorSet { network: NetworkId::Serai, session: prior_serai_session }); + + // make a new session and get the next validator set. + Self::new_session(); + + // Update Babe and Grandpa + let session = prior_serai_session.0 + 1; + let validators = prior_serai_participants; + let next_validators = Self::participants(NetworkId::Serai); + Babe::::enact_epoch_change( + WeakBoundedVec::force_from( + validators.iter().copied().map(|(id, w)| (BabeAuthorityId::from(id), w)).collect(), + None, + ), + WeakBoundedVec::force_from( + next_validators.into_iter().map(|(id, w)| (BabeAuthorityId::from(id), w)).collect(), + None, + ), + Some(session), + ); + Grandpa::::new_session( + true, + session, + validators.into_iter().map(|(id, w)| (GrandpaAuthorityId::from(id), w)).collect(), + ); + } } #[pallet::call] @@ -667,7 +721,7 @@ pub mod pallet { // (called by pre_dispatch) checks it let _ = signature; - let session = Session(pallet_session::Pallet::::current_index()); + let session = Self::session(NetworkId::Serai).unwrap(); let set = ValidatorSet { session, network }; @@ -742,11 +796,13 @@ pub mod pallet { }; // Don't allow the Serai set to set_keys, as they have no reason to do so + // This should already be covered by the lack of key in MuSigKeys, yet it doesn't hurt to be + // explicit if network == &NetworkId::Serai { Err(InvalidTransaction::Custom(0))?; } - let session = Session(pallet_session::Pallet::::current_index()); + let session = Self::session(NetworkId::Serai).unwrap(); let set = ValidatorSet { session, network: *network }; match Self::verify_signature(set, key_pair, signature) { @@ -779,26 +835,11 @@ pub mod pallet { } } - // Call order is end_session(i - 1) -> start_session(i) -> new_session(i + 1) - // new_session(i + 1) is called immediately after start_session(i) - // then we wait until the session ends then get a call to end_session(i) and so on. - impl pallet_session::SessionManager for Pallet { - fn new_session(_new_index: u32) -> Option> { - Self::new_session(); - // TODO: Where do we return their stake? - Some(Self::participants(NetworkId::Serai).into()) - } - - fn new_session_genesis(_: u32) -> Option> { - // TODO: Because we don't call new_session here, we don't emit NewSet { Serai, session: 1 } - Some(Self::participants(NetworkId::Serai).into()) - } - - fn end_session(end_index: u32) { - Self::retire_set(ValidatorSet { network: NetworkId::Serai, session: Session(end_index) }) + impl DisabledValidators for Pallet { + fn is_disabled(_: u32) -> bool { + // TODO + false } - - fn start_session(_start_index: u32) {} } }