Integrate session pallet into validator-sets pallet (#440)

* remove pallet-session

* Store key shares in InSet

* integrate grandpa to vs-pallet

* integrate pallet babe

* remove pallet-session & authority discovery from runtime

* update the grandpa pallet path

* cargo update grandpa

* cargo update substrate

* Misc tweaks

Sets validators for BABE/GRANDPA in chain_spec, per Akil's realization that was
the missing piece.

* fix pr comments

* bug fix & tidy up

---------

Co-authored-by: Luke Parker <lukeparker5132@gmail.com>
This commit is contained in:
akildemir 2023-11-22 14:22:46 +03:00 committed by GitHub
parent 07c657306b
commit fcfdadc791
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 238 additions and 254 deletions

232
Cargo.lock generated
View file

@ -2291,7 +2291,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]] [[package]]
name = "fork-tree" name = "fork-tree"
version = "3.0.0" version = "3.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
] ]
@ -2314,7 +2314,7 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa"
[[package]] [[package]]
name = "frame-benchmarking" name = "frame-benchmarking"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"frame-support", "frame-support",
"frame-support-procedural", "frame-support-procedural",
@ -2339,7 +2339,7 @@ dependencies = [
[[package]] [[package]]
name = "frame-executive" name = "frame-executive"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"frame-support", "frame-support",
"frame-system", "frame-system",
@ -2380,7 +2380,7 @@ dependencies = [
[[package]] [[package]]
name = "frame-support" name = "frame-support"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
"environmental", "environmental",
@ -2413,7 +2413,7 @@ dependencies = [
[[package]] [[package]]
name = "frame-support-procedural" name = "frame-support-procedural"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"Inflector", "Inflector",
"cfg-expr", "cfg-expr",
@ -2431,7 +2431,7 @@ dependencies = [
[[package]] [[package]]
name = "frame-support-procedural-tools" name = "frame-support-procedural-tools"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"frame-support-procedural-tools-derive", "frame-support-procedural-tools-derive",
"proc-macro-crate", "proc-macro-crate",
@ -2443,7 +2443,7 @@ dependencies = [
[[package]] [[package]]
name = "frame-support-procedural-tools-derive" name = "frame-support-procedural-tools-derive"
version = "3.0.0" version = "3.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2453,7 +2453,7 @@ dependencies = [
[[package]] [[package]]
name = "frame-system" name = "frame-system"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"frame-support", "frame-support",
@ -2472,7 +2472,7 @@ dependencies = [
[[package]] [[package]]
name = "frame-system-rpc-runtime-api" name = "frame-system-rpc-runtime-api"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"sp-api", "sp-api",
@ -2481,7 +2481,7 @@ dependencies = [
[[package]] [[package]]
name = "frame-try-runtime" name = "frame-try-runtime"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"frame-support", "frame-support",
"parity-scale-codec", "parity-scale-codec",
@ -4965,26 +4965,10 @@ dependencies = [
"group", "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]] [[package]]
name = "pallet-authorship" name = "pallet-authorship"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"frame-support", "frame-support",
"frame-system", "frame-system",
@ -4998,7 +4982,7 @@ dependencies = [
[[package]] [[package]]
name = "pallet-babe" name = "pallet-babe"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"frame-benchmarking", "frame-benchmarking",
"frame-support", "frame-support",
@ -5022,7 +5006,7 @@ dependencies = [
[[package]] [[package]]
name = "pallet-grandpa" name = "pallet-grandpa"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"frame-benchmarking", "frame-benchmarking",
"frame-support", "frame-support",
@ -5045,7 +5029,7 @@ dependencies = [
[[package]] [[package]]
name = "pallet-session" name = "pallet-session"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"frame-support", "frame-support",
"frame-system", "frame-system",
@ -5066,7 +5050,7 @@ dependencies = [
[[package]] [[package]]
name = "pallet-timestamp" name = "pallet-timestamp"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"frame-benchmarking", "frame-benchmarking",
"frame-support", "frame-support",
@ -5084,7 +5068,7 @@ dependencies = [
[[package]] [[package]]
name = "pallet-transaction-payment" name = "pallet-transaction-payment"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"frame-support", "frame-support",
"frame-system", "frame-system",
@ -5100,7 +5084,7 @@ dependencies = [
[[package]] [[package]]
name = "pallet-transaction-payment-rpc" name = "pallet-transaction-payment-rpc"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"jsonrpsee", "jsonrpsee",
"pallet-transaction-payment-rpc-runtime-api", "pallet-transaction-payment-rpc-runtime-api",
@ -5116,7 +5100,7 @@ dependencies = [
[[package]] [[package]]
name = "pallet-transaction-payment-rpc-runtime-api" name = "pallet-transaction-payment-rpc-runtime-api"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"pallet-transaction-payment", "pallet-transaction-payment",
"parity-scale-codec", "parity-scale-codec",
@ -6269,7 +6253,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-allocator" name = "sc-allocator"
version = "4.1.0-dev" version = "4.1.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"log", "log",
"sp-core", "sp-core",
@ -6280,7 +6264,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-authority-discovery" name = "sc-authority-discovery"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"futures", "futures",
@ -6308,7 +6292,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-basic-authorship" name = "sc-basic-authorship"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"futures", "futures",
"futures-timer", "futures-timer",
@ -6331,7 +6315,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-block-builder" name = "sc-block-builder"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"sc-client-api", "sc-client-api",
@ -6346,7 +6330,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-chain-spec" name = "sc-chain-spec"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"memmap2", "memmap2",
"sc-chain-spec-derive", "sc-chain-spec-derive",
@ -6365,7 +6349,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-chain-spec-derive" name = "sc-chain-spec-derive"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2", "proc-macro2",
@ -6376,7 +6360,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-cli" name = "sc-cli"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"array-bytes", "array-bytes",
"chrono", "chrono",
@ -6415,7 +6399,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-client-api" name = "sc-client-api"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"fnv", "fnv",
"futures", "futures",
@ -6440,7 +6424,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-client-db" name = "sc-client-db"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"hash-db", "hash-db",
"kvdb", "kvdb",
@ -6466,7 +6450,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-consensus" name = "sc-consensus"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"futures", "futures",
@ -6491,7 +6475,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-consensus-babe" name = "sc-consensus-babe"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"fork-tree", "fork-tree",
@ -6527,7 +6511,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-consensus-epochs" name = "sc-consensus-epochs"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"fork-tree", "fork-tree",
"parity-scale-codec", "parity-scale-codec",
@ -6540,7 +6524,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-consensus-grandpa" name = "sc-consensus-grandpa"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"ahash", "ahash",
"array-bytes", "array-bytes",
@ -6581,7 +6565,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-consensus-slots" name = "sc-consensus-slots"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"futures", "futures",
@ -6604,7 +6588,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-executor" name = "sc-executor"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"parking_lot 0.12.1", "parking_lot 0.12.1",
@ -6626,7 +6610,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-executor-common" name = "sc-executor-common"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"sc-allocator", "sc-allocator",
"sp-maybe-compressed-blob", "sp-maybe-compressed-blob",
@ -6638,7 +6622,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-executor-wasmtime" name = "sc-executor-wasmtime"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cfg-if", "cfg-if",
@ -6655,7 +6639,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-informant" name = "sc-informant"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"futures", "futures",
@ -6671,7 +6655,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-keystore" name = "sc-keystore"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"array-bytes", "array-bytes",
"parking_lot 0.12.1", "parking_lot 0.12.1",
@ -6685,7 +6669,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-network" name = "sc-network"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"array-bytes", "array-bytes",
"async-channel", "async-channel",
@ -6727,7 +6711,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-network-bitswap" name = "sc-network-bitswap"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"async-channel", "async-channel",
"cid", "cid",
@ -6747,7 +6731,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-network-common" name = "sc-network-common"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"bitflags 1.3.2", "bitflags 1.3.2",
@ -6764,7 +6748,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-network-gossip" name = "sc-network-gossip"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"ahash", "ahash",
"futures", "futures",
@ -6783,7 +6767,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-network-light" name = "sc-network-light"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"array-bytes", "array-bytes",
"async-channel", "async-channel",
@ -6804,7 +6788,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-network-sync" name = "sc-network-sync"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"array-bytes", "array-bytes",
"async-channel", "async-channel",
@ -6838,7 +6822,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-network-transactions" name = "sc-network-transactions"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"array-bytes", "array-bytes",
"futures", "futures",
@ -6856,7 +6840,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-offchain" name = "sc-offchain"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"bytes", "bytes",
"fnv", "fnv",
@ -6888,7 +6872,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-proposer-metrics" name = "sc-proposer-metrics"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"log", "log",
"substrate-prometheus-endpoint", "substrate-prometheus-endpoint",
@ -6897,7 +6881,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-rpc" name = "sc-rpc"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"futures", "futures",
"jsonrpsee", "jsonrpsee",
@ -6927,7 +6911,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-rpc-api" name = "sc-rpc-api"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"jsonrpsee", "jsonrpsee",
"parity-scale-codec", "parity-scale-codec",
@ -6946,7 +6930,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-rpc-server" name = "sc-rpc-server"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"http", "http",
"jsonrpsee", "jsonrpsee",
@ -6961,7 +6945,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-rpc-spec-v2" name = "sc-rpc-spec-v2"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"array-bytes", "array-bytes",
"futures", "futures",
@ -6987,7 +6971,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-service" name = "sc-service"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"directories", "directories",
@ -7050,7 +7034,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-state-db" name = "sc-state-db"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"log", "log",
"parity-scale-codec", "parity-scale-codec",
@ -7061,7 +7045,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-sysinfo" name = "sc-sysinfo"
version = "6.0.0-dev" version = "6.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"futures", "futures",
"libc", "libc",
@ -7080,7 +7064,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-telemetry" name = "sc-telemetry"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"chrono", "chrono",
"futures", "futures",
@ -7099,7 +7083,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-tracing" name = "sc-tracing"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"chrono", "chrono",
@ -7127,7 +7111,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-tracing-proc-macro" name = "sc-tracing-proc-macro"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2", "proc-macro2",
@ -7138,7 +7122,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-transaction-pool" name = "sc-transaction-pool"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"futures", "futures",
@ -7164,7 +7148,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-transaction-pool-api" name = "sc-transaction-pool-api"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"futures", "futures",
@ -7180,7 +7164,7 @@ dependencies = [
[[package]] [[package]]
name = "sc-utils" name = "sc-utils"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"async-channel", "async-channel",
"futures", "futures",
@ -7895,10 +7879,8 @@ dependencies = [
"frame-support", "frame-support",
"frame-system", "frame-system",
"frame-system-rpc-runtime-api", "frame-system-rpc-runtime-api",
"pallet-authority-discovery",
"pallet-babe", "pallet-babe",
"pallet-grandpa", "pallet-grandpa",
"pallet-session",
"pallet-timestamp", "pallet-timestamp",
"pallet-transaction-payment", "pallet-transaction-payment",
"pallet-transaction-payment-rpc-runtime-api", "pallet-transaction-payment-rpc-runtime-api",
@ -7946,7 +7928,8 @@ version = "0.1.0"
dependencies = [ dependencies = [
"frame-support", "frame-support",
"frame-system", "frame-system",
"pallet-session", "pallet-babe",
"pallet-grandpa",
"parity-scale-codec", "parity-scale-codec",
"scale-info", "scale-info",
"serai-coins-pallet", "serai-coins-pallet",
@ -7956,6 +7939,7 @@ dependencies = [
"sp-core", "sp-core",
"sp-io", "sp-io",
"sp-runtime", "sp-runtime",
"sp-session",
"sp-std", "sp-std",
] ]
@ -8266,7 +8250,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-api" name = "sp-api"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"hash-db", "hash-db",
"log", "log",
@ -8287,7 +8271,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-api-proc-macro" name = "sp-api-proc-macro"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"Inflector", "Inflector",
"blake2", "blake2",
@ -8301,7 +8285,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-application-crypto" name = "sp-application-crypto"
version = "23.0.0" version = "23.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"scale-info", "scale-info",
@ -8314,7 +8298,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-arithmetic" name = "sp-arithmetic"
version = "16.0.0" version = "16.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"integer-sqrt", "integer-sqrt",
"num-traits", "num-traits",
@ -8328,7 +8312,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-authority-discovery" name = "sp-authority-discovery"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"scale-info", "scale-info",
@ -8340,7 +8324,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-block-builder" name = "sp-block-builder"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"sp-api", "sp-api",
"sp-inherents", "sp-inherents",
@ -8351,7 +8335,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-blockchain" name = "sp-blockchain"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"futures", "futures",
"log", "log",
@ -8369,7 +8353,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-consensus" name = "sp-consensus"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"futures", "futures",
@ -8383,7 +8367,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-consensus-babe" name = "sp-consensus-babe"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"parity-scale-codec", "parity-scale-codec",
@ -8402,7 +8386,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-consensus-grandpa" name = "sp-consensus-grandpa"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"finality-grandpa", "finality-grandpa",
"log", "log",
@ -8420,7 +8404,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-consensus-slots" name = "sp-consensus-slots"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"scale-info", "scale-info",
@ -8432,7 +8416,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-core" name = "sp-core"
version = "21.0.0" version = "21.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"array-bytes", "array-bytes",
"bitflags 1.3.2", "bitflags 1.3.2",
@ -8475,7 +8459,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-core-hashing" name = "sp-core-hashing"
version = "9.0.0" version = "9.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"blake2b_simd", "blake2b_simd",
"byteorder", "byteorder",
@ -8487,7 +8471,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-core-hashing-proc-macro" name = "sp-core-hashing-proc-macro"
version = "9.0.0" version = "9.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"quote", "quote",
"sp-core-hashing", "sp-core-hashing",
@ -8497,7 +8481,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-database" name = "sp-database"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"kvdb", "kvdb",
"parking_lot 0.12.1", "parking_lot 0.12.1",
@ -8506,7 +8490,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-debug-derive" name = "sp-debug-derive"
version = "8.0.0" version = "8.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -8516,7 +8500,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-externalities" name = "sp-externalities"
version = "0.19.0" version = "0.19.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"environmental", "environmental",
"parity-scale-codec", "parity-scale-codec",
@ -8527,7 +8511,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-inherents" name = "sp-inherents"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"impl-trait-for-tuples", "impl-trait-for-tuples",
@ -8541,7 +8525,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-io" name = "sp-io"
version = "23.0.0" version = "23.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"bytes", "bytes",
"ed25519", "ed25519",
@ -8563,7 +8547,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-keyring" name = "sp-keyring"
version = "24.0.0" version = "24.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"lazy_static", "lazy_static",
"sp-core", "sp-core",
@ -8574,7 +8558,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-keystore" name = "sp-keystore"
version = "0.27.0" version = "0.27.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"parking_lot 0.12.1", "parking_lot 0.12.1",
@ -8586,7 +8570,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-maybe-compressed-blob" name = "sp-maybe-compressed-blob"
version = "4.1.0-dev" version = "4.1.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"thiserror", "thiserror",
"zstd 0.12.4", "zstd 0.12.4",
@ -8595,7 +8579,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-metadata-ir" name = "sp-metadata-ir"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"frame-metadata 16.0.0", "frame-metadata 16.0.0",
"parity-scale-codec", "parity-scale-codec",
@ -8606,7 +8590,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-offchain" name = "sp-offchain"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"sp-api", "sp-api",
"sp-core", "sp-core",
@ -8616,7 +8600,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-panic-handler" name = "sp-panic-handler"
version = "8.0.0" version = "8.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"lazy_static", "lazy_static",
@ -8626,7 +8610,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-rpc" name = "sp-rpc"
version = "6.0.0" version = "6.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"rustc-hash", "rustc-hash",
"serde", "serde",
@ -8636,7 +8620,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-runtime" name = "sp-runtime"
version = "24.0.0" version = "24.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"either", "either",
"hash256-std-hasher", "hash256-std-hasher",
@ -8658,7 +8642,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-runtime-interface" name = "sp-runtime-interface"
version = "17.0.0" version = "17.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"bytes", "bytes",
"impl-trait-for-tuples", "impl-trait-for-tuples",
@ -8676,7 +8660,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-runtime-interface-proc-macro" name = "sp-runtime-interface-proc-macro"
version = "11.0.0" version = "11.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"Inflector", "Inflector",
"proc-macro-crate", "proc-macro-crate",
@ -8688,7 +8672,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-session" name = "sp-session"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"scale-info", "scale-info",
@ -8703,7 +8687,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-staking" name = "sp-staking"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"impl-trait-for-tuples", "impl-trait-for-tuples",
"parity-scale-codec", "parity-scale-codec",
@ -8717,7 +8701,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-state-machine" name = "sp-state-machine"
version = "0.28.0" version = "0.28.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"hash-db", "hash-db",
"log", "log",
@ -8738,12 +8722,12 @@ dependencies = [
[[package]] [[package]]
name = "sp-std" name = "sp-std"
version = "8.0.0" version = "8.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
[[package]] [[package]]
name = "sp-storage" name = "sp-storage"
version = "13.0.0" version = "13.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"impl-serde", "impl-serde",
"parity-scale-codec", "parity-scale-codec",
@ -8756,7 +8740,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-timestamp" name = "sp-timestamp"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"parity-scale-codec", "parity-scale-codec",
@ -8769,7 +8753,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-tracing" name = "sp-tracing"
version = "10.0.0" version = "10.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"sp-std", "sp-std",
@ -8781,7 +8765,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-transaction-pool" name = "sp-transaction-pool"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"sp-api", "sp-api",
"sp-runtime", "sp-runtime",
@ -8790,7 +8774,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-trie" name = "sp-trie"
version = "22.0.0" version = "22.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"ahash", "ahash",
"hash-db", "hash-db",
@ -8813,7 +8797,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-version" name = "sp-version"
version = "22.0.0" version = "22.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"impl-serde", "impl-serde",
"parity-scale-codec", "parity-scale-codec",
@ -8830,7 +8814,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-version-proc-macro" name = "sp-version-proc-macro"
version = "8.0.0" version = "8.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"proc-macro2", "proc-macro2",
@ -8841,7 +8825,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-wasm-interface" name = "sp-wasm-interface"
version = "14.0.0" version = "14.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"impl-trait-for-tuples", "impl-trait-for-tuples",
@ -8854,7 +8838,7 @@ dependencies = [
[[package]] [[package]]
name = "sp-weights" name = "sp-weights"
version = "20.0.0" version = "20.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"scale-info", "scale-info",
@ -9032,12 +9016,12 @@ dependencies = [
[[package]] [[package]]
name = "substrate-build-script-utils" name = "substrate-build-script-utils"
version = "3.0.0" version = "3.0.0"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
[[package]] [[package]]
name = "substrate-frame-rpc-system" name = "substrate-frame-rpc-system"
version = "4.0.0-dev" version = "4.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"frame-system-rpc-runtime-api", "frame-system-rpc-runtime-api",
"futures", "futures",
@ -9056,7 +9040,7 @@ dependencies = [
[[package]] [[package]]
name = "substrate-prometheus-endpoint" name = "substrate-prometheus-endpoint"
version = "0.10.0-dev" version = "0.10.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"hyper", "hyper",
"log", "log",
@ -9068,7 +9052,7 @@ dependencies = [
[[package]] [[package]]
name = "substrate-wasm-builder" name = "substrate-wasm-builder"
version = "5.0.0-dev" version = "5.0.0-dev"
source = "git+https://github.com/serai-dex/substrate#1036864670acffb8a308908268a6ed3fc4cb7259" source = "git+https://github.com/serai-dex/substrate#49b7d20ef96b6ad42ea0266ea27f128e0ef3214d"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"build-helper", "build-helper",

View file

@ -45,7 +45,7 @@ async fn in_set(
return Ok(None); return Ok(None);
}; };
let key = (Ristretto::generator() * key.deref()).to_bytes(); 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<D: Db>( async fn handle_new_set<D: Db>(
@ -67,21 +67,10 @@ async fn handle_new_set<D: Db>(
let set_participants = let set_participants =
serai.participants(set.network).await?.expect("NewSet for set which doesn't exist"); serai.participants(set.network).await?.expect("NewSet for set which doesn't exist");
let allocation_per_key_share = serai let mut set_data = set_participants
.allocation_per_key_share(set.network) .into_iter()
.await? .map(|(k, w)| (k, u16::try_from(w).unwrap()))
.expect("NewSet for set which didn't have an allocation per key share") .collect::<Vec<_>>();
.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()));
}
amortize_excess_key_shares(&mut set_data); amortize_excess_key_shares(&mut set_data);
set_data set_data
}; };

View file

@ -44,7 +44,10 @@ impl<'a> SeraiValidatorSets<'a> {
self.0.storage(PALLET, "CurrentSession", Some(vec![scale_value(network)])).await self.0.storage(PALLET, "CurrentSession", Some(vec![scale_value(network)])).await
} }
pub async fn participants(&self, network: NetworkId) -> Result<Option<Vec<Public>>, SeraiError> { pub async fn participants(
&self,
network: NetworkId,
) -> Result<Option<Vec<(Public, u64)>>, SeraiError> {
self.0.storage(PALLET, "Participants", Some(vec![scale_value(network)])).await self.0.storage(PALLET, "Participants", Some(vec![scale_value(network)])).await
} }

View file

@ -49,7 +49,12 @@ serai_test!(
{ {
let vs_serai = serai.with_current_latest_block().await.unwrap().validator_sets(); 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::<Vec<_>>();
let participants_ref: &[_] = participants.as_ref(); let participants_ref: &[_] = participants.as_ref();
assert_eq!(participants_ref, [public].as_ref()); assert_eq!(participants_ref, [public].as_ref());
assert_eq!(vs_serai.musig_key(set).await.unwrap().unwrap(), musig_key(set, &[public]).0); assert_eq!(vs_serai.musig_key(set).await.unwrap().unwrap(), musig_key(set, &[public]).0);

View file

@ -5,9 +5,8 @@ use sp_core::Pair as PairTrait;
use sc_service::ChainType; use sc_service::ChainType;
use serai_runtime::{ use serai_runtime::{
primitives::*, WASM_BINARY, opaque::SessionKeys, BABE_GENESIS_EPOCH_CONFIG, RuntimeGenesisConfig, primitives::*, WASM_BINARY, BABE_GENESIS_EPOCH_CONFIG, RuntimeGenesisConfig, SystemConfig,
SystemConfig, CoinsConfig, DexConfig, ValidatorSetsConfig, SessionConfig, BabeConfig, CoinsConfig, DexConfig, ValidatorSetsConfig, BabeConfig, GrandpaConfig,
GrandpaConfig, AuthorityDiscoveryConfig,
}; };
pub type ChainSpec = sc_service::GenericChainSpec<RuntimeGenesisConfig>; pub type ChainSpec = sc_service::GenericChainSpec<RuntimeGenesisConfig>;
@ -21,16 +20,7 @@ fn testnet_genesis(
validators: &[&'static str], validators: &[&'static str],
endowed_accounts: Vec<PublicKey>, endowed_accounts: Vec<PublicKey>,
) -> RuntimeGenesisConfig { ) -> RuntimeGenesisConfig {
let session_key = |name| { let validators = validators.iter().map(|name| account_from_name(name)).collect::<Vec<_>>();
let key = account_from_name(name);
(
key,
key,
// TODO: Properly diversify these?
SessionKeys { babe: key.into(), grandpa: key.into(), authority_discovery: key.into() },
)
};
RuntimeGenesisConfig { RuntimeGenesisConfig {
system: SystemConfig { code: wasm_binary.to_vec(), _config: PhantomData }, 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))), NetworkId::Monero => (NetworkId::Monero, Amount(100_000 * 10_u64.pow(8))),
}) })
.collect(), .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 { babe: BabeConfig {
authorities: vec![], authorities: validators.iter().map(|validator| ((*validator).into(), 1)).collect(),
epoch_config: Some(BABE_GENESIS_EPOCH_CONFIG), epoch_config: Some(BABE_GENESIS_EPOCH_CONFIG),
_config: PhantomData, _config: PhantomData,
}, },
grandpa: GrandpaConfig { authorities: vec![], _config: PhantomData }, grandpa: GrandpaConfig {
authorities: validators.into_iter().map(|validator| (validator.into(), 1)).collect(),
authority_discovery: AuthorityDiscoveryConfig { keys: vec![], _config: PhantomData }, _config: PhantomData,
},
} }
} }

View file

@ -50,7 +50,6 @@ coins-pallet = { package = "serai-coins-pallet", path = "../coins/pallet", defau
dex-pallet = { package = "serai-dex-pallet", path = "../dex/pallet", default-features = false } 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 } 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 } in-instructions-pallet = { package = "serai-in-instructions-pallet", path = "../in-instructions/pallet", default-features = false }
@ -59,8 +58,6 @@ signals-pallet = { package = "serai-signals-pallet", path = "../signals/pallet",
pallet-babe = { 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 } 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 } 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 } pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/serai-dex/substrate", default-features = false }
@ -105,7 +102,6 @@ std = [
"dex-pallet/std", "dex-pallet/std",
"validator-sets-pallet/std", "validator-sets-pallet/std",
"pallet-session/std",
"in-instructions-pallet/std", "in-instructions-pallet/std",
@ -114,8 +110,6 @@ std = [
"pallet-babe/std", "pallet-babe/std",
"pallet-grandpa/std", "pallet-grandpa/std",
"pallet-authority-discovery/std",
"frame-system-rpc-runtime-api/std", "frame-system-rpc-runtime-api/std",
"pallet-transaction-payment-rpc-runtime-api/std", "pallet-transaction-payment-rpc-runtime-api/std",
] ]

View file

@ -20,7 +20,6 @@ pub use coins_pallet as coins;
pub use dex_pallet as dex; pub use dex_pallet as dex;
pub use validator_sets_pallet as validator_sets; pub use validator_sets_pallet as validator_sets;
pub use pallet_session as session;
pub use in_instructions_pallet as in_instructions; 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_babe as babe;
pub use pallet_grandpa as grandpa; pub use pallet_grandpa as grandpa;
pub use pallet_authority_discovery as authority_discovery;
// Actually used by the runtime // Actually used by the runtime
use sp_core::OpaqueMetadata; use sp_core::OpaqueMetadata;
use sp_std::prelude::*; use sp_std::prelude::*;
@ -41,7 +38,7 @@ use sp_version::NativeVersion;
use sp_runtime::{ use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys, KeyTypeId, 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}, transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, Perbill, ApplyExtrinsicResult, Perbill,
}; };
@ -83,13 +80,10 @@ pub mod opaque {
pub struct SessionKeys { pub struct SessionKeys {
pub babe: Babe, pub babe: Babe,
pub grandpa: Grandpa, pub grandpa: Grandpa,
pub authority_discovery: AuthorityDiscovery,
} }
} }
} }
use opaque::SessionKeys;
#[sp_version::runtime_version] #[sp_version::runtime_version]
pub const VERSION: RuntimeVersion = RuntimeVersion { pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("serai"), spec_name: create_runtime_str!("serai"),
@ -167,12 +161,6 @@ impl Contains<RuntimeCall> for CallFilter {
RuntimeCall::InInstructions(call) => !matches!(call, in_instructions::Call::__Ignore(_, _)), RuntimeCall::InInstructions(call) => !matches!(call, in_instructions::Call::__Ignore(_, _)),
RuntimeCall::Signals(call) => !matches!(call, signals::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 { RuntimeCall::Babe(call) => match call {
babe::Call::report_equivocation { .. } => true, babe::Call::report_equivocation { .. } => true,
babe::Call::report_equivocation_unsigned { .. } => true, babe::Call::report_equivocation_unsigned { .. } => true,
@ -256,6 +244,8 @@ impl dex::Config for Runtime {
impl validator_sets::Config for Runtime { impl validator_sets::Config for Runtime {
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
type ShouldEndSession = Babe;
} }
pub struct IdentityValidatorIdOf; pub struct IdentityValidatorIdOf;
@ -265,18 +255,6 @@ impl Convert<PublicKey, Option<PublicKey>> 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 = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type WeightInfo = session::weights::SubstrateWeight<Runtime>;
}
impl signals::Config for Runtime { impl signals::Config for Runtime {
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
// 1 week // 1 week
@ -294,7 +272,7 @@ impl babe::Config for Runtime {
type EpochDuration = ConstU64<{ 1 * DAYS }>; type EpochDuration = ConstU64<{ 1 * DAYS }>;
type ExpectedBlockTime = ConstU64<{ TARGET_BLOCK_TIME * 1000 }>; type ExpectedBlockTime = ConstU64<{ TARGET_BLOCK_TIME * 1000 }>;
type EpochChangeTrigger = pallet_babe::ExternalTrigger; type EpochChangeTrigger = pallet_babe::ExternalTrigger;
type DisabledValidators = Session; type DisabledValidators = ValidatorSets;
type WeightInfo = (); type WeightInfo = ();
@ -317,10 +295,6 @@ impl grandpa::Config for Runtime {
type EquivocationReportSystem = (); type EquivocationReportSystem = ();
} }
impl authority_discovery::Config for Runtime {
type MaxAuthorities = MaxAuthorities;
}
pub type Header = generic::Header<BlockNumber, BlakeTwo256>; pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
pub type Block = generic::Block<Header, UncheckedExtrinsic>; pub type Block = generic::Block<Header, UncheckedExtrinsic>;
pub type SignedExtra = ( pub type SignedExtra = (
@ -357,7 +331,6 @@ construct_runtime!(
Dex: dex, Dex: dex,
ValidatorSets: validator_sets, ValidatorSets: validator_sets,
Session: session,
InInstructions: in_instructions, InInstructions: in_instructions,
@ -365,8 +338,6 @@ construct_runtime!(
Babe: babe, Babe: babe,
Grandpa: grandpa, Grandpa: grandpa,
AuthorityDiscovery: authority_discovery,
} }
); );
@ -569,7 +540,10 @@ sp_api::impl_runtime_apis! {
impl sp_authority_discovery::AuthorityDiscoveryApi<Block> for Runtime { impl sp_authority_discovery::AuthorityDiscoveryApi<Block> for Runtime {
fn authorities() -> Vec<AuthorityDiscoveryId> { fn authorities() -> Vec<AuthorityDiscoveryId> {
AuthorityDiscovery::authorities() Babe::authorities()
.into_iter()
.map(|(id, _)| AuthorityDiscoveryId::from(id.into_inner()))
.collect()
} }
} }
} }

View file

@ -21,11 +21,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-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-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-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-system = { git = "https://github.com/serai-dex/substrate", default-features = false }
frame-support = { 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 } serai-primitives = { path = "../../primitives", default-features = false }
validator-sets-primitives = { package = "serai-validator-sets-primitives", path = "../primitives", default-features = false } validator-sets-primitives = { package = "serai-validator-sets-primitives", path = "../primitives", default-features = false }
@ -42,11 +44,13 @@ std = [
"sp-std/std", "sp-std/std",
"sp-application-crypto/std", "sp-application-crypto/std",
"sp-runtime/std", "sp-runtime/std",
"sp-session/std",
"frame-system/std", "frame-system/std",
"frame-support/std", "frame-support/std",
"pallet-session/std", "pallet-babe/std",
"pallet-grandpa/std",
"serai-primitives/std", "serai-primitives/std",
"validator-sets-primitives/std", "validator-sets-primitives/std",

View file

@ -3,14 +3,20 @@
#[allow(deprecated, clippy::let_unit_value)] // TODO #[allow(deprecated, clippy::let_unit_value)] // TODO
#[frame_support::pallet] #[frame_support::pallet]
pub mod pallet { pub mod pallet {
use super::*;
use scale_info::TypeInfo; use scale_info::TypeInfo;
use sp_core::sr25519::{Public, Signature}; use sp_core::sr25519::{Public, Signature};
use sp_std::{vec, vec::Vec}; use sp_std::{vec, vec::Vec};
use sp_application_crypto::RuntimePublic; use sp_application_crypto::RuntimePublic;
use sp_session::ShouldEndSession;
use sp_runtime::traits::IsMember;
use frame_system::pallet_prelude::*; use frame_system::pallet_prelude::*;
use frame_support::{pallet_prelude::*, StoragePrefixedMap}; use frame_support::{
pallet_prelude::*, traits::DisabledValidators, BoundedVec, WeakBoundedVec, StoragePrefixedMap,
};
use serai_primitives::*; use serai_primitives::*;
pub use validator_sets_primitives as primitives; pub use validator_sets_primitives as primitives;
@ -18,14 +24,20 @@ pub mod pallet {
use coins_pallet::Pallet as Coins; 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] #[pallet::config]
pub trait Config: pub trait Config:
frame_system::Config<AccountId = Public> frame_system::Config<AccountId = Public>
+ coins_pallet::Config + coins_pallet::Config
+ pallet_session::Config<ValidatorId = Public> + pallet_babe::Config
+ pallet_grandpa::Config
+ TypeInfo + TypeInfo
{ {
type RuntimeEvent: IsType<<Self as frame_system::Config>::RuntimeEvent> + From<Event<Self>>; type RuntimeEvent: IsType<<Self as frame_system::Config>::RuntimeEvent> + From<Event<Self>>;
type ShouldEndSession: ShouldEndSession<BlockNumberFor<Self>>;
} }
#[pallet::genesis_config] #[pallet::genesis_config]
@ -52,22 +64,18 @@ pub mod pallet {
pub struct Pallet<T>(PhantomData<T>); pub struct Pallet<T>(PhantomData<T>);
/// The current session for a network. /// 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. // Uses Identity for the lookup to avoid a hash of a severely limited fixed key-space.
#[pallet::storage] #[pallet::storage]
#[pallet::getter(fn session)]
pub type CurrentSession<T: Config> = StorageMap<_, Identity, NetworkId, Session, OptionQuery>; pub type CurrentSession<T: Config> = StorageMap<_, Identity, NetworkId, Session, OptionQuery>;
impl<T: Config> Pallet<T> { impl<T: Config> Pallet<T> {
pub fn session(network: NetworkId) -> Option<Session> {
if network == NetworkId::Serai {
Some(Session(pallet_session::Pallet::<T>::current_index()))
} else {
CurrentSession::<T>::get(network)
}
}
pub fn latest_decided_session(network: NetworkId) -> Option<Session> { pub fn latest_decided_session(network: NetworkId) -> Option<Session> {
CurrentSession::<T>::get(network) let session = Self::session(network);
// we already decided about the next session for serai.
if network == NetworkId::Serai {
return session.map(|s| Session(s.0 + 1));
}
session
} }
} }
@ -84,7 +92,7 @@ pub mod pallet {
_, _,
Identity, Identity,
NetworkId, NetworkId,
BoundedVec<Public, ConstU32<{ MAX_KEY_SHARES_PER_SET }>>, BoundedVec<(Public, u64), ConstU32<{ MAX_KEY_SHARES_PER_SET }>>,
ValueQuery, ValueQuery,
>; >;
/// The validators selected to be in-set, yet with the ability to perform a check for presence. /// 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 // current set's validators
#[inline] #[inline]
fn in_active_serai_set(account: Public) -> bool { 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? // TODO: is_member is internally O(n). Update Babe to use an O(1) storage lookup?
for validator in pallet_session::Pallet::<T>::validators() { Babe::<T>::is_member(&BabeAuthorityId::from(account))
if validator == account {
return true;
}
}
false
} }
/// Returns true if the account is included in an active set. /// Returns true if the account is included in an active set.
@ -297,14 +300,12 @@ pub mod pallet {
impl<T: Config> Pallet<T> { impl<T: Config> Pallet<T> {
fn new_set(network: NetworkId) { fn new_set(network: NetworkId) {
// Update CurrentSession // Update CurrentSession
let session = if network != NetworkId::Serai { let session = {
let new_session = CurrentSession::<T>::get(network) let new_session = CurrentSession::<T>::get(network)
.map(|session| Session(session.0 + 1)) .map(|session| Session(session.0 + 1))
.unwrap_or(Session(0)); .unwrap_or(Session(0));
CurrentSession::<T>::set(network, Some(new_session)); CurrentSession::<T>::set(network, Some(new_session));
new_session new_session
} else {
Self::session(network).unwrap_or(Session(0))
}; };
// Clear the current InSet // Clear the current InSet
@ -326,20 +327,26 @@ pub mod pallet {
while key_shares < u64::from(MAX_KEY_SHARES_PER_SET) { while key_shares < u64::from(MAX_KEY_SHARES_PER_SET) {
let Some((key, amount)) = iter.next() else { break }; let Some((key, amount)) = iter.next() else { break };
let these_key_shares = amount.0 / allocation_per_key_share;
InSet::<T>::set(Self::in_set_key(network, key), Some(())); InSet::<T>::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 // 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 // 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; total_stake += amount.0;
} }
TotalAllocatedStake::<T>::set(network, Some(Amount(total_stake))); TotalAllocatedStake::<T>::set(network, Some(Amount(total_stake)));
let set = ValidatorSet { network, session }; let set = ValidatorSet { network, session };
Pallet::<T>::deposit_event(Event::NewSet { set }); Pallet::<T>::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 { if network != NetworkId::Serai {
MuSigKeys::<T>::set(set, Some(musig_key(set, &participants))); MuSigKeys::<T>::set(
set,
Some(musig_key(set, &participants.iter().map(|(id, _)| *id).collect::<Vec<_>>())),
);
} }
Participants::<T>::set(network, participants.try_into().unwrap()); Participants::<T>::set(network, participants.try_into().unwrap());
} }
@ -372,6 +379,19 @@ pub mod pallet {
NonExistentValidator, NonExistentValidator,
} }
#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
fn on_initialize(n: BlockNumberFor<T>) -> 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] #[pallet::genesis_build]
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> { impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
fn build(&self) { fn build(&self) {
@ -621,9 +641,10 @@ pub mod pallet {
for network in serai_primitives::NETWORKS { for network in serai_primitives::NETWORKS {
// If this network hasn't started sessions yet, don't start one now // If this network hasn't started sessions yet, don't start one now
let Some(current_session) = Self::session(network) else { continue }; let Some(current_session) = Self::session(network) else { continue };
// Only spawn a NewSet if the current set was actually established with a completed // Only spawn a new set if:
// handover protocol // - This is Serai, as we need to rotate Serai upon a new session (per Babe)
if Self::handover_completed(network, current_session) { // - The current set was actually established with a completed handover protocol
if (network == NetworkId::Serai) || Self::handover_completed(network, current_session) {
Pallet::<T>::new_set(network); Pallet::<T>::new_set(network);
} }
} }
@ -649,6 +670,39 @@ pub mod pallet {
} }
PendingDeallocations::<T>::take((network, session, key)) PendingDeallocations::<T>::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::<T>::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::<T>::new_session(
true,
session,
validators.into_iter().map(|(id, w)| (GrandpaAuthorityId::from(id), w)).collect(),
);
}
} }
#[pallet::call] #[pallet::call]
@ -667,7 +721,7 @@ pub mod pallet {
// (called by pre_dispatch) checks it // (called by pre_dispatch) checks it
let _ = signature; let _ = signature;
let session = Session(pallet_session::Pallet::<T>::current_index()); let session = Self::session(NetworkId::Serai).unwrap();
let set = ValidatorSet { session, network }; 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 // 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 { if network == &NetworkId::Serai {
Err(InvalidTransaction::Custom(0))?; Err(InvalidTransaction::Custom(0))?;
} }
let session = Session(pallet_session::Pallet::<T>::current_index()); let session = Self::session(NetworkId::Serai).unwrap();
let set = ValidatorSet { session, network: *network }; let set = ValidatorSet { session, network: *network };
match Self::verify_signature(set, key_pair, signature) { 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) impl<T: Config> DisabledValidators for Pallet<T> {
// new_session(i + 1) is called immediately after start_session(i) fn is_disabled(_: u32) -> bool {
// then we wait until the session ends then get a call to end_session(i) and so on. // TODO
impl<T: Config> pallet_session::SessionManager<T::ValidatorId> for Pallet<T> { false
fn new_session(_new_index: u32) -> Option<Vec<T::ValidatorId>> {
Self::new_session();
// TODO: Where do we return their stake?
Some(Self::participants(NetworkId::Serai).into())
} }
fn new_session_genesis(_: u32) -> Option<Vec<T::ValidatorId>> {
// 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) })
}
fn start_session(_start_index: u32) {}
} }
} }