Move serai-client off serai-runtime, MIT licensing it

Uses a full-fledged serai-abi to do so.

Removes use of UncheckedExtrinsic as a pointlessly (for us) length-prefixed
block with a more complicated signing algorithm than advantageous.

In the future, we should considering consolidating the various primitives
crates. I'm not convinced we benefit from one primitives crate per pallet.
This commit is contained in:
Luke Parker 2023-12-07 02:30:09 -05:00
parent 6416e0079b
commit c511a54d18
No known key found for this signature in database
38 changed files with 484 additions and 378 deletions

216
Cargo.lock generated
View file

@ -2219,7 +2219,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
] ]
@ -2242,7 +2242,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"frame-support", "frame-support",
"frame-support-procedural", "frame-support-procedural",
@ -2267,7 +2267,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"frame-support", "frame-support",
"frame-system", "frame-system",
@ -2296,7 +2296,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
"environmental", "environmental",
@ -2329,7 +2329,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"Inflector", "Inflector",
"cfg-expr", "cfg-expr",
@ -2347,7 +2347,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"frame-support-procedural-tools-derive", "frame-support-procedural-tools-derive",
"proc-macro-crate 1.3.1", "proc-macro-crate 1.3.1",
@ -2359,7 +2359,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2369,7 +2369,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"frame-support", "frame-support",
@ -2388,7 +2388,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"sp-api", "sp-api",
@ -2397,7 +2397,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"frame-support", "frame-support",
"parity-scale-codec", "parity-scale-codec",
@ -4831,7 +4831,7 @@ dependencies = [
[[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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"frame-support", "frame-support",
"frame-system", "frame-system",
@ -4845,7 +4845,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"frame-benchmarking", "frame-benchmarking",
"frame-support", "frame-support",
@ -4869,7 +4869,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"frame-benchmarking", "frame-benchmarking",
"frame-support", "frame-support",
@ -4892,7 +4892,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"frame-support", "frame-support",
"frame-system", "frame-system",
@ -4913,7 +4913,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"frame-benchmarking", "frame-benchmarking",
"frame-support", "frame-support",
@ -4931,7 +4931,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"frame-support", "frame-support",
"frame-system", "frame-system",
@ -4947,7 +4947,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"jsonrpsee", "jsonrpsee",
"pallet-transaction-payment-rpc-runtime-api", "pallet-transaction-payment-rpc-runtime-api",
@ -4963,7 +4963,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"pallet-transaction-payment", "pallet-transaction-payment",
"parity-scale-codec", "parity-scale-codec",
@ -6116,7 +6116,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"log", "log",
"sp-core", "sp-core",
@ -6127,7 +6127,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"futures", "futures",
@ -6155,7 +6155,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"futures", "futures",
"futures-timer", "futures-timer",
@ -6178,7 +6178,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"sc-client-api", "sc-client-api",
@ -6193,7 +6193,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"memmap2", "memmap2",
"sc-chain-spec-derive", "sc-chain-spec-derive",
@ -6212,7 +6212,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"proc-macro-crate 1.3.1", "proc-macro-crate 1.3.1",
"proc-macro2", "proc-macro2",
@ -6223,7 +6223,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"array-bytes", "array-bytes",
"chrono", "chrono",
@ -6262,7 +6262,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"fnv", "fnv",
"futures", "futures",
@ -6287,7 +6287,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"hash-db", "hash-db",
"kvdb", "kvdb",
@ -6313,7 +6313,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"futures", "futures",
@ -6338,7 +6338,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"fork-tree", "fork-tree",
@ -6374,7 +6374,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"fork-tree", "fork-tree",
"parity-scale-codec", "parity-scale-codec",
@ -6387,7 +6387,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"ahash", "ahash",
"array-bytes", "array-bytes",
@ -6428,7 +6428,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"futures", "futures",
@ -6451,7 +6451,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"parking_lot 0.12.1", "parking_lot 0.12.1",
@ -6473,7 +6473,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"sc-allocator", "sc-allocator",
"sp-maybe-compressed-blob", "sp-maybe-compressed-blob",
@ -6485,7 +6485,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cfg-if", "cfg-if",
@ -6502,7 +6502,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"futures", "futures",
@ -6518,7 +6518,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"array-bytes", "array-bytes",
"parking_lot 0.12.1", "parking_lot 0.12.1",
@ -6532,7 +6532,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"array-bytes", "array-bytes",
"async-channel", "async-channel",
@ -6574,7 +6574,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"async-channel", "async-channel",
"cid", "cid",
@ -6594,7 +6594,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"bitflags 1.3.2", "bitflags 1.3.2",
@ -6611,7 +6611,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"ahash", "ahash",
"futures", "futures",
@ -6630,7 +6630,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"array-bytes", "array-bytes",
"async-channel", "async-channel",
@ -6651,7 +6651,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"array-bytes", "array-bytes",
"async-channel", "async-channel",
@ -6685,7 +6685,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"array-bytes", "array-bytes",
"futures", "futures",
@ -6703,7 +6703,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"bytes", "bytes",
"fnv", "fnv",
@ -6735,7 +6735,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"log", "log",
"substrate-prometheus-endpoint", "substrate-prometheus-endpoint",
@ -6744,7 +6744,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"futures", "futures",
"jsonrpsee", "jsonrpsee",
@ -6774,7 +6774,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"jsonrpsee", "jsonrpsee",
"parity-scale-codec", "parity-scale-codec",
@ -6793,7 +6793,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"http", "http",
"jsonrpsee", "jsonrpsee",
@ -6808,7 +6808,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"array-bytes", "array-bytes",
"futures", "futures",
@ -6834,7 +6834,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"directories", "directories",
@ -6897,7 +6897,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"log", "log",
"parity-scale-codec", "parity-scale-codec",
@ -6908,7 +6908,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"futures", "futures",
"libc", "libc",
@ -6927,7 +6927,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"chrono", "chrono",
"futures", "futures",
@ -6946,7 +6946,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"chrono", "chrono",
@ -6974,7 +6974,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"proc-macro-crate 1.3.1", "proc-macro-crate 1.3.1",
"proc-macro2", "proc-macro2",
@ -6985,7 +6985,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"futures", "futures",
@ -7011,7 +7011,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"futures", "futures",
@ -7027,7 +7027,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"async-channel", "async-channel",
"futures", "futures",
@ -7256,13 +7256,13 @@ dependencies = [
"borsh", "borsh",
"frame-support", "frame-support",
"parity-scale-codec", "parity-scale-codec",
"scale-info",
"serai-coins-primitives", "serai-coins-primitives",
"serai-in-instructions-primitives", "serai-in-instructions-primitives",
"serai-primitives", "serai-primitives",
"serai-signals-primitives", "serai-signals-primitives",
"serai-validator-sets-primitives", "serai-validator-sets-primitives",
"serde", "serde",
"sp-application-crypto",
"sp-consensus-babe", "sp-consensus-babe",
"sp-consensus-grandpa", "sp-consensus-grandpa",
"sp-core", "sp-core",
@ -7277,14 +7277,15 @@ dependencies = [
"blake2", "blake2",
"ciphersuite", "ciphersuite",
"dockertest", "dockertest",
"frame-system",
"frost-schnorrkel", "frost-schnorrkel",
"hex", "hex",
"modular-frost", "modular-frost",
"monero-serai", "monero-serai",
"parity-scale-codec", "parity-scale-codec",
"rand_core", "rand_core",
"serai-abi",
"serai-docker-tests", "serai-docker-tests",
"serai-runtime",
"serde", "serde",
"serde_json", "serde_json",
"simple-request", "simple-request",
@ -7567,6 +7568,7 @@ name = "serai-primitives"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"borsh", "borsh",
"frame-support",
"parity-scale-codec", "parity-scale-codec",
"scale-info", "scale-info",
"serde", "serde",
@ -8058,7 +8060,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"hash-db", "hash-db",
"log", "log",
@ -8079,7 +8081,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"Inflector", "Inflector",
"blake2", "blake2",
@ -8093,7 +8095,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"scale-info", "scale-info",
@ -8106,7 +8108,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"integer-sqrt", "integer-sqrt",
"num-traits", "num-traits",
@ -8120,7 +8122,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"scale-info", "scale-info",
@ -8132,7 +8134,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"sp-api", "sp-api",
"sp-inherents", "sp-inherents",
@ -8143,7 +8145,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"futures", "futures",
"log", "log",
@ -8161,7 +8163,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"futures", "futures",
@ -8175,7 +8177,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"parity-scale-codec", "parity-scale-codec",
@ -8194,7 +8196,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"finality-grandpa", "finality-grandpa",
"log", "log",
@ -8212,7 +8214,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"scale-info", "scale-info",
@ -8224,7 +8226,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"array-bytes", "array-bytes",
"bitflags 1.3.2", "bitflags 1.3.2",
@ -8267,7 +8269,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"blake2b_simd", "blake2b_simd",
"byteorder", "byteorder",
@ -8279,7 +8281,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"quote", "quote",
"sp-core-hashing", "sp-core-hashing",
@ -8289,7 +8291,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"kvdb", "kvdb",
"parking_lot 0.12.1", "parking_lot 0.12.1",
@ -8298,7 +8300,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -8308,7 +8310,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"environmental", "environmental",
"parity-scale-codec", "parity-scale-codec",
@ -8319,7 +8321,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"impl-trait-for-tuples", "impl-trait-for-tuples",
@ -8333,7 +8335,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"bytes", "bytes",
"ed25519", "ed25519",
@ -8355,7 +8357,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"lazy_static", "lazy_static",
"sp-core", "sp-core",
@ -8366,7 +8368,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"parking_lot 0.12.1", "parking_lot 0.12.1",
@ -8378,7 +8380,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"thiserror", "thiserror",
"zstd 0.12.4", "zstd 0.12.4",
@ -8387,7 +8389,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"frame-metadata", "frame-metadata",
"parity-scale-codec", "parity-scale-codec",
@ -8398,7 +8400,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"sp-api", "sp-api",
"sp-core", "sp-core",
@ -8408,7 +8410,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"lazy_static", "lazy_static",
@ -8418,7 +8420,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"rustc-hash", "rustc-hash",
"serde", "serde",
@ -8428,7 +8430,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"either", "either",
"hash256-std-hasher", "hash256-std-hasher",
@ -8450,7 +8452,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"bytes", "bytes",
"impl-trait-for-tuples", "impl-trait-for-tuples",
@ -8468,7 +8470,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"Inflector", "Inflector",
"proc-macro-crate 1.3.1", "proc-macro-crate 1.3.1",
@ -8480,7 +8482,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"scale-info", "scale-info",
@ -8495,7 +8497,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"impl-trait-for-tuples", "impl-trait-for-tuples",
"parity-scale-codec", "parity-scale-codec",
@ -8509,7 +8511,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"hash-db", "hash-db",
"log", "log",
@ -8530,12 +8532,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
[[package]] [[package]]
name = "sp-storage" name = "sp-storage"
version = "13.0.0" version = "13.0.0"
source = "git+https://github.com/serai-dex/substrate#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"impl-serde", "impl-serde",
"parity-scale-codec", "parity-scale-codec",
@ -8548,7 +8550,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"parity-scale-codec", "parity-scale-codec",
@ -8561,7 +8563,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"sp-std", "sp-std",
@ -8573,7 +8575,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"sp-api", "sp-api",
"sp-runtime", "sp-runtime",
@ -8582,7 +8584,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"ahash", "ahash",
"hash-db", "hash-db",
@ -8605,7 +8607,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"impl-serde", "impl-serde",
"parity-scale-codec", "parity-scale-codec",
@ -8622,7 +8624,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"proc-macro2", "proc-macro2",
@ -8633,7 +8635,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"impl-trait-for-tuples", "impl-trait-for-tuples",
@ -8646,7 +8648,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"scale-info", "scale-info",
@ -8824,12 +8826,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
[[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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"frame-system-rpc-runtime-api", "frame-system-rpc-runtime-api",
"futures", "futures",
@ -8848,7 +8850,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"hyper", "hyper",
"log", "log",
@ -8860,7 +8862,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#66af818c352bc9bcfbb9a1f04979587d06c7e02c" source = "git+https://github.com/serai-dex/substrate#34c8c3595e7a3230058ee5e181c9d7e4be329ed2"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"build-helper", "build-helper",

View file

@ -151,7 +151,7 @@ impl<D: Db> CosignEvaluator<D> {
// included the set_keys and one didn't // included the set_keys and one didn't
// Because set_keys will force a cosign, it will force detection of distinct blocks // Because set_keys will force a cosign, it will force detection of distinct blocks
// re: set_keys using keys prior to set_keys (assumed amenable to all) // re: set_keys using keys prior to set_keys (assumed amenable to all)
let serai = self.serai.as_of(block.header().parent_hash.into()); let serai = self.serai.as_of(block.header.parent_hash.into());
let Some(set_with_keys) = set_with_keys_fn(&serai, cosign.network).await? else { let Some(set_with_keys) = set_with_keys_fn(&serai, cosign.network).await? else {
return Ok(()); return Ok(());

View file

@ -464,7 +464,7 @@ async fn handle_new_blocks<D: Db, Pro: Processors>(
// Get the keys as of the prior block // Get the keys as of the prior block
// That means if this block is setting new keys (which won't lock in until we process this // That means if this block is setting new keys (which won't lock in until we process this
// block), we won't freeze up waiting for the yet-to-be-processed keys to sign this block // block), we won't freeze up waiting for the yet-to-be-processed keys to sign this block
let serai = serai.as_of(actual_block.header().parent_hash.into()); let serai = serai.as_of(actual_block.header.parent_hash.into());
has_no_cosigners = Some(actual_block.clone()); has_no_cosigners = Some(actual_block.clone());
@ -583,7 +583,7 @@ pub async fn scan_task<D: Db, Pro: Processors>(
loop { loop {
match serai.latest_finalized_block().await { match serai.latest_finalized_block().await {
Ok(latest) => { Ok(latest) => {
if latest.header().number >= next_substrate_block { if latest.header.number >= next_substrate_block {
return latest; return latest;
} else { } else {
sleep(Duration::from_secs(3)).await; sleep(Duration::from_secs(3)).await;

View file

@ -4,8 +4,6 @@ use std::collections::HashMap;
use zeroize::Zeroizing; use zeroize::Zeroizing;
use rand_core::{RngCore, OsRng}; use rand_core::{RngCore, OsRng};
use scale::Decode;
use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto}; use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto};
use frost::Participant; use frost::Participant;
@ -340,27 +338,10 @@ async fn dkg_test() {
let spec = spec.clone(); let spec = spec.clone();
let key_pair = key_pair.clone(); let key_pair = key_pair.clone();
async move { async move {
// Version, Pallet, Call, Network, Key Pair, Signature assert_eq!(tx.signature, None);
let expected_len = 1 + 1 + 1 + 1 + 32 + 1 + key_pair.1.len() + 64; match tx.call {
// It's length prefixed serai_client::abi::Call::ValidatorSets(
assert_eq!(tx.len(), 2 + expected_len); serai_client::abi::validator_sets::Call::set_keys {
let expected_len = u16::try_from(expected_len).unwrap();
// Check the encoded length
// This is the compact encoding from SCALE, specifically the two-byte length encoding case
let bottom_six = expected_len & 0b111111;
let upper_eight = expected_len >> 6;
assert_eq!(u8::try_from((bottom_six << 2) | 1).unwrap(), tx[0]);
assert_eq!(u8::try_from(upper_eight).unwrap(), tx[1]);
// Version
assert_eq!(tx[2], 4);
// Call
let tx = serai_client::runtime::RuntimeCall::decode(&mut &tx[3 ..]).unwrap();
match tx {
serai_client::runtime::RuntimeCall::ValidatorSets(
serai_client::runtime::validator_sets::Call::set_keys {
network, network,
key_pair: set_key_pair, key_pair: set_key_pair,
signature, signature,

View file

@ -19,7 +19,7 @@ use frost::{
use frost_schnorrkel::Schnorrkel; use frost_schnorrkel::Schnorrkel;
use serai_client::{ use serai_client::{
Public, Public, SeraiAddress,
validator_sets::primitives::{musig_context, remove_participant_message}, validator_sets::primitives::{musig_context, remove_participant_message},
}; };
@ -190,7 +190,7 @@ impl DkgRemoval {
preprocesses: HashMap<Participant, Vec<u8>>, preprocesses: HashMap<Participant, Vec<u8>>,
removed: [u8; 32], removed: [u8; 32],
mut shares: HashMap<Participant, Vec<u8>>, mut shares: HashMap<Participant, Vec<u8>>,
) -> Result<(Vec<Public>, [u8; 64]), Participant> { ) -> Result<(Vec<SeraiAddress>, [u8; 64]), Participant> {
// TODO: Remove this ugly blob // TODO: Remove this ugly blob
let shares = { let shares = {
let mut shares_participants = shares.keys().cloned().collect::<Vec<_>>(); let mut shares_participants = shares.keys().cloned().collect::<Vec<_>>();
@ -213,7 +213,7 @@ impl DkgRemoval {
new_shares new_shares
}; };
let mut signers = shares.keys().cloned().map(Public).collect::<Vec<_>>(); let mut signers = shares.keys().cloned().map(SeraiAddress).collect::<Vec<_>>();
signers.sort(); signers.sort();
let machine = Self::share_internal(spec, key, attempt, preprocesses, removed) let machine = Self::share_internal(spec, key, attempt, preprocesses, removed)

View file

@ -10,7 +10,7 @@ use frost::dkg::Participant;
use scale::{Encode, Decode}; use scale::{Encode, Decode};
use serai_client::{ use serai_client::{
Public, Signature, Public, SeraiAddress, Signature,
validator_sets::primitives::{ValidatorSet, KeyPair}, validator_sets::primitives::{ValidatorSet, KeyPair},
SeraiValidatorSets, SeraiValidatorSets,
}; };
@ -174,7 +174,7 @@ pub(crate) async fn handle_application_tx<
D: Db, D: Db,
Pro: Processors, Pro: Processors,
FPst: Future<Output = ()>, FPst: Future<Output = ()>,
PST: Clone + Fn(ValidatorSet, PstTxType, Vec<u8>) -> FPst, PST: Clone + Fn(ValidatorSet, PstTxType, serai_client::Transaction) -> FPst,
FPtt: Future<Output = ()>, FPtt: Future<Output = ()>,
PTT: Clone + Fn(Transaction) -> FPtt, PTT: Clone + Fn(Transaction) -> FPtt,
FRid: Future<Output = ()>, FRid: Future<Output = ()>,
@ -734,7 +734,7 @@ pub(crate) async fn handle_application_tx<
let tx = serai_client::SeraiValidatorSets::remove_participant( let tx = serai_client::SeraiValidatorSets::remove_participant(
spec.set().network, spec.set().network,
Public(data.plan), SeraiAddress(data.plan),
signers, signers,
Signature(signature), Signature(signature),
); );

View file

@ -55,7 +55,7 @@ async fn handle_block<
D: Db, D: Db,
Pro: Processors, Pro: Processors,
FPst: Future<Output = ()>, FPst: Future<Output = ()>,
PST: Clone + Fn(ValidatorSet, PstTxType, Vec<u8>) -> FPst, PST: Clone + Fn(ValidatorSet, PstTxType, serai_client::Transaction) -> FPst,
FPtt: Future<Output = ()>, FPtt: Future<Output = ()>,
PTT: Clone + Fn(Transaction) -> FPtt, PTT: Clone + Fn(Transaction) -> FPtt,
FRid: Future<Output = ()>, FRid: Future<Output = ()>,
@ -148,7 +148,7 @@ pub(crate) async fn handle_new_blocks<
D: Db, D: Db,
Pro: Processors, Pro: Processors,
FPst: Future<Output = ()>, FPst: Future<Output = ()>,
PST: Clone + Fn(ValidatorSet, PstTxType, Vec<u8>) -> FPst, PST: Clone + Fn(ValidatorSet, PstTxType, serai_client::Transaction) -> FPst,
FPtt: Future<Output = ()>, FPtt: Future<Output = ()>,
PTT: Clone + Fn(Transaction) -> FPtt, PTT: Clone + Fn(Transaction) -> FPtt,
FRid: Future<Output = ()>, FRid: Future<Output = ()>,

View file

@ -14,11 +14,11 @@ rustdoc-args = ["--cfg", "docsrs"]
[dependencies] [dependencies]
scale = { package = "parity-scale-codec", version = "3", features = ["derive"] } scale = { package = "parity-scale-codec", version = "3", features = ["derive"] }
scale-info = { version = "2", features = ["derive"] }
borsh = { version = "1", features = ["derive", "de_strict_order"], optional = true } borsh = { version = "1", features = ["derive", "de_strict_order"], optional = true }
serde = { version = "1", features = ["derive", "alloc"], optional = true } serde = { version = "1", features = ["derive", "alloc"], optional = true }
sp-application-crypto = { git = "https://github.com/serai-dex/substrate" }
sp-core = { git = "https://github.com/serai-dex/substrate" } sp-core = { git = "https://github.com/serai-dex/substrate" }
sp-runtime = { git = "https://github.com/serai-dex/substrate" } sp-runtime = { git = "https://github.com/serai-dex/substrate" }

View file

@ -2,13 +2,15 @@ use sp_consensus_babe::EquivocationProof;
use serai_primitives::Header; use serai_primitives::Header;
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] #[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)]
pub struct ReportEquivocation { pub struct ReportEquivocation {
pub equivocation_proof: Box<EquivocationProof<Header>>, pub equivocation_proof: Box<EquivocationProof<Header>>,
pub key_owner_proof: (), pub key_owner_proof: (),
} }
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] // We could define a Babe Config here and use the literal pallet_babe::Call
// The disadvantage to this would be the complexity and presence of junk fields such as `__Ignore`
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)]
pub enum Call { pub enum Call {
report_equivocation(ReportEquivocation), report_equivocation(ReportEquivocation),
report_equivocation_unsigned(ReportEquivocation), report_equivocation_unsigned(ReportEquivocation),

View file

@ -3,7 +3,7 @@ use serai_primitives::{Balance, SeraiAddress};
pub use serai_coins_primitives as primitives; pub use serai_coins_primitives as primitives;
use primitives::OutInstructionWithBalance; use primitives::OutInstructionWithBalance;
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] #[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)]
#[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))] #[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Call { pub enum Call {
@ -12,7 +12,7 @@ pub enum Call {
burn_with_instruction { instruction: OutInstructionWithBalance }, burn_with_instruction { instruction: OutInstructionWithBalance },
} }
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] #[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)]
#[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))] #[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Event { pub enum Event {

View file

@ -6,7 +6,7 @@ type PoolId = Coin;
type PoolCoinId = Coin; type PoolCoinId = Coin;
type MaxSwapPathLength = sp_core::ConstU32<3>; type MaxSwapPathLength = sp_core::ConstU32<3>;
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] #[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Call { pub enum Call {
add_liquidity { add_liquidity {
@ -38,7 +38,7 @@ pub enum Call {
}, },
} }
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] #[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Event { pub enum Event {
PoolCreated { PoolCreated {

View file

@ -2,23 +2,24 @@ use sp_consensus_grandpa::EquivocationProof;
use serai_primitives::{BlockNumber, SeraiAddress}; use serai_primitives::{BlockNumber, SeraiAddress};
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] #[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)]
pub struct ReportEquivocation { pub struct ReportEquivocation {
pub equivocation_proof: Box<EquivocationProof<[u8; 32], BlockNumber>>, pub equivocation_proof: Box<EquivocationProof<[u8; 32], BlockNumber>>,
pub key_owner_proof: (), pub key_owner_proof: (),
} }
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] #[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)]
pub enum Call { pub enum Call {
report_equivocation(ReportEquivocation), report_equivocation(ReportEquivocation),
report_equivocation_unsigned(ReportEquivocation), report_equivocation_unsigned(ReportEquivocation),
} }
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] #[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)]
#[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))] #[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Event { pub enum Event {
NewAuthorities { authority_set: Vec<(SeraiAddress, u64)> }, NewAuthorities { authority_set: Vec<(SeraiAddress, u64)> },
// TODO: Remove these
Paused, Paused,
Resumed, Resumed,
} }

View file

@ -3,14 +3,14 @@ use serai_primitives::*;
pub use serai_in_instructions_primitives as primitives; pub use serai_in_instructions_primitives as primitives;
use primitives::SignedBatch; use primitives::SignedBatch;
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] #[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)]
#[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))] #[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Call { pub enum Call {
execute_batch { batch: SignedBatch }, execute_batch { batch: SignedBatch },
} }
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] #[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)]
#[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))] #[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Event { pub enum Event {

View file

@ -16,9 +16,11 @@ pub mod grandpa;
pub use serai_primitives as primitives; pub use serai_primitives as primitives;
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] #[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)]
pub enum Call { pub enum Call {
System,
Timestamp(timestamp::Call), Timestamp(timestamp::Call),
TransactionPayment,
Coins(coins::Call), Coins(coins::Call),
LiquidityTokens(coins::Call), LiquidityTokens(coins::Call),
Dex(dex::Call), Dex(dex::Call),
@ -29,14 +31,43 @@ pub enum Call {
Grandpa(grandpa::Call), Grandpa(grandpa::Call),
} }
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] // TODO: Remove this
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)]
pub enum TransactionPaymentEvent {
TransactionFeePaid { who: serai_primitives::SeraiAddress, actual_fee: u64, tip: u64 },
}
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)]
pub enum Event { pub enum Event {
System(system::Event), System(system::Event),
Timestamp,
TransactionPayment(TransactionPaymentEvent),
Coins(coins::Event), Coins(coins::Event),
LiquidityTokens(coins::Event), LiquidityTokens(coins::Event),
Dex(dex::Event), Dex(dex::Event),
ValidatorSets(validator_sets::Event), ValidatorSets(validator_sets::Event),
InInstructions(in_instructions::Event), InInstructions(in_instructions::Event),
Signals(signals::Event), Signals(signals::Event),
Babe,
Grandpa(grandpa::Event), Grandpa(grandpa::Event),
} }
#[derive(Clone, Copy, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Extra {
pub era: sp_runtime::generic::Era,
pub nonce: scale::Compact<u32>,
pub tip: scale::Compact<u64>,
}
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)]
#[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct SignedPayloadExtra {
pub spec_version: u32,
pub tx_version: u32,
pub genesis: [u8; 32],
pub mortality_checkpoint: [u8; 32],
}
pub type Transaction = primitives::Transaction<Call, Extra>;

View file

@ -5,7 +5,7 @@ use serai_validator_sets_primitives::ValidatorSet;
pub use serai_signals_primitives as primitives; pub use serai_signals_primitives as primitives;
use primitives::SignalId; use primitives::SignalId;
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] #[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)]
#[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))] #[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Call { pub enum Call {
@ -16,7 +16,7 @@ pub enum Call {
stand_against { signal_id: SignalId, for_network: NetworkId }, stand_against { signal_id: SignalId, for_network: NetworkId },
} }
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] #[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)]
#[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))] #[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Event { pub enum Event {

View file

@ -1,8 +1,14 @@
use frame_support::dispatch::{DispatchInfo, DispatchError}; use frame_support::dispatch::{DispatchInfo, DispatchError};
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] use serai_primitives::SeraiAddress;
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Event { pub enum Event {
ExtrinsicSuccess { dispatch_info: DispatchInfo }, ExtrinsicSuccess { dispatch_info: DispatchInfo },
ExtrinsicFailed { dispatch_error: DispatchError, dispatch_info: DispatchInfo }, ExtrinsicFailed { dispatch_error: DispatchError, dispatch_info: DispatchInfo },
CodeUpdated,
NewAccount { account: SeraiAddress },
KilledAccount { account: SeraiAddress },
Remarked { sender: SeraiAddress, hash: [u8; 32] },
} }

View file

@ -1,6 +1,5 @@
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] #[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)]
#[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Call { pub enum Call {
set { now: u64 }, set { now: scale::Compact<u64> },
} }

View file

@ -3,7 +3,7 @@ pub use serai_validator_sets_primitives as primitives;
use serai_primitives::*; use serai_primitives::*;
use serai_validator_sets_primitives::*; use serai_validator_sets_primitives::*;
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] #[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Call { pub enum Call {
set_keys { set_keys {
@ -31,7 +31,7 @@ pub enum Call {
}, },
} }
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)] #[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)]
#[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))] #[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Event { pub enum Event {

View file

@ -2,7 +2,7 @@
name = "serai-client" name = "serai-client"
version = "0.1.0" version = "0.1.0"
description = "Client library for the Serai network" description = "Client library for the Serai network"
license = "AGPL-3.0-only" license = "MIT"
repository = "https://github.com/serai-dex/serai/tree/develop/substrate/client" repository = "https://github.com/serai-dex/serai/tree/develop/substrate/client"
authors = ["Luke Parker <lukeparker5132@gmail.com>"] authors = ["Luke Parker <lukeparker5132@gmail.com>"]
keywords = ["serai"] keywords = ["serai"]
@ -19,13 +19,16 @@ thiserror = { version = "1", optional = true }
hex = "0.4" hex = "0.4"
scale = { package = "parity-scale-codec", version = "3" } scale = { package = "parity-scale-codec", version = "3" }
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"], optional = true }
serde_json = "1" serde_json = { version = "1", optional = true }
sp-core = { git = "https://github.com/serai-dex/substrate" } serai-abi = { path = "../abi", version = "0.1" }
sp-runtime = { git = "https://github.com/serai-dex/substrate" }
serai-runtime = { path = "../runtime", version = "0.1" } sp-core = { git = "https://github.com/serai-dex/substrate", optional = true }
simple-request = { path = "../../common/request", version = "0.1" } sp-runtime = { git = "https://github.com/serai-dex/substrate", optional = true }
frame-system = { git = "https://github.com/serai-dex/substrate", optional = true }
simple-request = { path = "../../common/request", version = "0.1", optional = true }
bitcoin = { version = "0.31", optional = true } bitcoin = { version = "0.31", optional = true }
@ -48,7 +51,7 @@ dockertest = "0.4"
serai-docker-tests = { path = "../../tests/docker" } serai-docker-tests = { path = "../../tests/docker" }
[features] [features]
serai = ["thiserror"] serai = ["thiserror", "serde", "serde_json", "sp-core", "sp-runtime", "frame-system", "simple-request"]
networks = [] networks = []
bitcoin = ["networks", "dep:bitcoin"] bitcoin = ["networks", "dep:bitcoin"]

View file

@ -1,15 +1,21 @@
AGPL-3.0-only license MIT License
Copyright (c) 2022-2023 Luke Parker Copyright (c) 2022-2023 Luke Parker
This program is free software: you can redistribute it and/or modify Permission is hereby granted, free of charge, to any person obtaining a copy
it under the terms of the GNU Affero General Public License Version 3 as of this software and associated documentation files (the "Software"), to deal
published by the Free Software Foundation. in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
This program is distributed in the hope that it will be useful, The above copyright notice and this permission notice shall be included in all
but WITHOUT ANY WARRANTY; without even the implied warranty of copies or substantial portions of the Software.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
along with this program. If not, see <http://www.gnu.org/licenses/>. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -6,19 +6,18 @@ mod serai;
#[cfg(feature = "serai")] #[cfg(feature = "serai")]
pub use serai::*; pub use serai::*;
// If we aren't exposing the Serai client (subxt), still expose all primitives
#[cfg(not(feature = "serai"))] #[cfg(not(feature = "serai"))]
pub use serai_runtime::primitives; pub use serai_abi::primitives;
#[cfg(not(feature = "serai"))] #[cfg(not(feature = "serai"))]
mod other_primitives { mod other_primitives {
pub mod in_instructions {
pub use serai_runtime::in_instructions::primitives;
}
pub mod coins { pub mod coins {
pub use serai_runtime::coins::primitives; pub use serai_abi::coins::primitives;
} }
pub mod validator_sets { pub mod validator_sets {
pub use serai_runtime::validator_sets::primitives; pub use serai_abi::validator_sets::primitives;
}
pub mod in_instructions {
pub use serai_abi::in_instructions::primitives;
} }
} }
#[cfg(not(feature = "serai"))] #[cfg(not(feature = "serai"))]

View file

@ -1,17 +1,14 @@
use scale::Encode; use scale::Encode;
use serai_runtime::{ use serai_abi::primitives::{SeraiAddress, Amount, Coin, Balance};
primitives::{SeraiAddress, Amount, Coin, Balance}, pub use serai_abi::coins::primitives;
coins, Runtime,
};
pub use coins::primitives;
use primitives::OutInstructionWithBalance; use primitives::OutInstructionWithBalance;
use crate::{TemporalSerai, SeraiError}; use crate::{TemporalSerai, SeraiError};
const PALLET: &str = "Coins"; const PALLET: &str = "Coins";
pub type CoinsEvent = coins::Event<Runtime>; pub type CoinsEvent = serai_abi::coins::Event;
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
pub struct SeraiCoins<'a>(pub(crate) TemporalSerai<'a>); pub struct SeraiCoins<'a>(pub(crate) TemporalSerai<'a>);
@ -24,7 +21,7 @@ impl<'a> SeraiCoins<'a> {
self self
.0 .0
.events(|event| { .events(|event| {
if let serai_runtime::RuntimeEvent::Coins(event) = event { if let serai_abi::Event::Coins(event) = event {
Some(event).filter(|event| matches!(event, CoinsEvent::Mint { .. })) Some(event).filter(|event| matches!(event, CoinsEvent::Mint { .. }))
} else { } else {
None None
@ -37,7 +34,7 @@ impl<'a> SeraiCoins<'a> {
self self
.0 .0
.events(|event| { .events(|event| {
if let serai_runtime::RuntimeEvent::Coins(event) = event { if let serai_abi::Event::Coins(event) = event {
Some(event).filter(|event| matches!(event, CoinsEvent::BurnWithInstruction { .. })) Some(event).filter(|event| matches!(event, CoinsEvent::BurnWithInstruction { .. }))
} else { } else {
None None
@ -68,22 +65,15 @@ impl<'a> SeraiCoins<'a> {
) )
} }
pub fn transfer(to: SeraiAddress, balance: Balance) -> serai_runtime::RuntimeCall { pub fn transfer(to: SeraiAddress, balance: Balance) -> serai_abi::Call {
serai_runtime::RuntimeCall::Coins(serai_runtime::coins::Call::<Runtime>::transfer { serai_abi::Call::Coins(serai_abi::coins::Call::transfer { to, balance })
to: to.into(),
balance,
})
} }
pub fn burn(balance: Balance) -> serai_runtime::RuntimeCall { pub fn burn(balance: Balance) -> serai_abi::Call {
serai_runtime::RuntimeCall::Coins(serai_runtime::coins::Call::<Runtime>::burn { balance }) serai_abi::Call::Coins(serai_abi::coins::Call::burn { balance })
} }
pub fn burn_with_instruction( pub fn burn_with_instruction(instruction: OutInstructionWithBalance) -> serai_abi::Call {
instruction: OutInstructionWithBalance, serai_abi::Call::Coins(serai_abi::coins::Call::burn_with_instruction { instruction })
) -> serai_runtime::RuntimeCall {
serai_runtime::RuntimeCall::Coins(
serai_runtime::coins::Call::<Runtime>::burn_with_instruction { instruction },
)
} }
} }

View file

@ -1,12 +1,9 @@
use sp_core::bounded_vec::BoundedVec; use sp_core::bounded_vec::BoundedVec;
use serai_runtime::{ use serai_abi::primitives::{SeraiAddress, Amount, Coin};
primitives::{SeraiAddress, Amount, Coin},
dex, Runtime,
};
use crate::{SeraiError, TemporalSerai}; use crate::{SeraiError, TemporalSerai};
pub type DexEvent = dex::Event<Runtime>; pub type DexEvent = serai_abi::dex::Event;
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
pub struct SeraiDex<'a>(pub(crate) TemporalSerai<'a>); pub struct SeraiDex<'a>(pub(crate) TemporalSerai<'a>);
@ -14,15 +11,7 @@ impl<'a> SeraiDex<'a> {
pub async fn events(&self) -> Result<Vec<DexEvent>, SeraiError> { pub async fn events(&self) -> Result<Vec<DexEvent>, SeraiError> {
self self
.0 .0
.events( .events(|event| if let serai_abi::Event::Dex(event) = event { Some(event) } else { None })
|event| {
if let serai_runtime::RuntimeEvent::Dex(event) = event {
Some(event)
} else {
None
}
},
)
.await .await
} }
@ -33,14 +22,14 @@ impl<'a> SeraiDex<'a> {
min_coin_amount: Amount, min_coin_amount: Amount,
min_sri_amount: Amount, min_sri_amount: Amount,
address: SeraiAddress, address: SeraiAddress,
) -> serai_runtime::RuntimeCall { ) -> serai_abi::Call {
serai_runtime::RuntimeCall::Dex(dex::Call::<Runtime>::add_liquidity { serai_abi::Call::Dex(serai_abi::dex::Call::add_liquidity {
coin, coin,
coin_desired: coin_amount.0, coin_desired: coin_amount.0,
sri_desired: sri_amount.0, sri_desired: sri_amount.0,
coin_min: min_coin_amount.0, coin_min: min_coin_amount.0,
sri_min: min_sri_amount.0, sri_min: min_sri_amount.0,
mint_to: address.into(), mint_to: address,
}) })
} }
@ -50,7 +39,7 @@ impl<'a> SeraiDex<'a> {
amount_in: Amount, amount_in: Amount,
amount_out_min: Amount, amount_out_min: Amount,
address: SeraiAddress, address: SeraiAddress,
) -> serai_runtime::RuntimeCall { ) -> serai_abi::Call {
let path = if to_coin.is_native() { let path = if to_coin.is_native() {
BoundedVec::try_from(vec![from_coin, Coin::Serai]).unwrap() BoundedVec::try_from(vec![from_coin, Coin::Serai]).unwrap()
} else if from_coin.is_native() { } else if from_coin.is_native() {
@ -59,11 +48,11 @@ impl<'a> SeraiDex<'a> {
BoundedVec::try_from(vec![from_coin, Coin::Serai, to_coin]).unwrap() BoundedVec::try_from(vec![from_coin, Coin::Serai, to_coin]).unwrap()
}; };
serai_runtime::RuntimeCall::Dex(dex::Call::<Runtime>::swap_exact_tokens_for_tokens { serai_abi::Call::Dex(serai_abi::dex::Call::swap_exact_tokens_for_tokens {
path, path,
amount_in: amount_in.0, amount_in: amount_in.0,
amount_out_min: amount_out_min.0, amount_out_min: amount_out_min.0,
send_to: address.into(), send_to: address,
}) })
} }
} }

View file

@ -1,13 +1,12 @@
use serai_runtime::{in_instructions, Runtime}; pub use serai_abi::in_instructions::primitives;
pub use in_instructions::primitives;
use primitives::SignedBatch; use primitives::SignedBatch;
use crate::{ use crate::{
primitives::{BlockHash, NetworkId}, primitives::{BlockHash, NetworkId},
SeraiError, Serai, TemporalSerai, Transaction, SeraiError, Serai, TemporalSerai,
}; };
pub type InInstructionsEvent = in_instructions::Event<Runtime>; pub type InInstructionsEvent = serai_abi::in_instructions::Event;
const PALLET: &str = "InInstructions"; const PALLET: &str = "InInstructions";
@ -36,7 +35,7 @@ impl<'a> SeraiInInstructions<'a> {
self self
.0 .0
.events(|event| { .events(|event| {
if let serai_runtime::RuntimeEvent::InInstructions(event) = event { if let serai_abi::Event::InInstructions(event) = event {
Some(event).filter(|event| matches!(event, InInstructionsEvent::Batch { .. })) Some(event).filter(|event| matches!(event, InInstructionsEvent::Batch { .. }))
} else { } else {
None None
@ -45,9 +44,9 @@ impl<'a> SeraiInInstructions<'a> {
.await .await
} }
pub fn execute_batch(batch: SignedBatch) -> Vec<u8> { pub fn execute_batch(batch: SignedBatch) -> Transaction {
Serai::unsigned(&serai_runtime::RuntimeCall::InInstructions( Serai::unsigned(serai_abi::Call::InInstructions(
in_instructions::Call::<Runtime>::execute_batch { batch }, serai_abi::in_instructions::Call::execute_batch { batch },
)) ))
} }
} }

View file

@ -10,11 +10,12 @@ pub use sp_core::{
sr25519::{Public, Pair}, sr25519::{Public, Pair},
}; };
pub use serai_runtime::primitives; pub use serai_abi as abi;
pub use primitives::{SeraiAddress, Signature, Amount}; pub use abi::{primitives, Transaction};
use abi::*;
pub use serai_runtime as runtime; pub use primitives::{SeraiAddress, Signature, Amount};
use serai_runtime::{Header, Block as SeraiBlock}; use primitives::Header;
pub mod coins; pub mod coins;
pub use coins::SeraiCoins; pub use coins::SeraiCoins;
@ -25,36 +26,28 @@ pub use in_instructions::SeraiInInstructions;
pub mod validator_sets; pub mod validator_sets;
pub use validator_sets::SeraiValidatorSets; pub use validator_sets::SeraiValidatorSets;
pub type Transaction = serai_runtime::UncheckedExtrinsic; #[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode)]
pub struct Block {
#[derive(Clone, Debug)] pub header: Header,
pub struct Block(SeraiBlock); pub transactions: Vec<Transaction>,
}
impl Block { impl Block {
pub fn hash(&self) -> [u8; 32] { pub fn hash(&self) -> [u8; 32] {
self.0.header.hash().into() self.header.hash().into()
} }
pub fn number(&self) -> u64 { pub fn number(&self) -> u64 {
self.0.header.number self.header.number
} }
/// Returns the time of this block, set by its producer, in milliseconds since the epoch. /// Returns the time of this block, set by its producer, in milliseconds since the epoch.
pub fn time(&self) -> Result<u64, SeraiError> { pub fn time(&self) -> Result<u64, SeraiError> {
for extrinsic in &self.0.extrinsics { for transaction in &self.transactions {
if let serai_runtime::RuntimeCall::Timestamp(serai_runtime::timestamp::Call::set { now }) = if let Call::Timestamp(timestamp::Call::set { now }) = &transaction.call {
&extrinsic.function return Ok(u64::from(*now));
{
return Ok(*now);
} }
} }
Err(SeraiError::InvalidNode("no time was present in block".to_string())) Err(SeraiError::InvalidNode("no time was present in block".to_string()))
} }
pub fn header(&self) -> &Header {
&self.0.header
}
pub fn transactions(&self) -> &[Transaction] {
&self.0.extrinsics
}
} }
#[derive(Error, Debug)] #[derive(Error, Debug)]
@ -158,54 +151,37 @@ impl Serai {
Ok(res) Ok(res)
} }
fn unsigned(call: &serai_runtime::RuntimeCall) -> Vec<u8> { fn unsigned(call: Call) -> Transaction {
// TODO: Should Serai purge the old transaction code AND set this to 0/1? Transaction { call, signature: None }
const EXTRINSIC_FORMAT_VERSION: u8 = 4;
let mut tx = vec![EXTRINSIC_FORMAT_VERSION];
tx.extend(call.encode());
let mut length_prefixed = Compact(u32::try_from(tx.len()).unwrap()).encode();
length_prefixed.extend(tx);
length_prefixed
} }
pub fn sign( pub fn sign(&self, signer: &Pair, call: Call, nonce: u32, tip: u64) -> Transaction {
&self,
signer: &Pair,
call: &serai_runtime::RuntimeCall,
nonce: u32,
tip: u64,
) -> Vec<u8> {
const SPEC_VERSION: u32 = 1; const SPEC_VERSION: u32 = 1;
const TX_VERSION: u32 = 1; const TX_VERSION: u32 = 1;
const EXTRINSIC_FORMAT_VERSION: u8 = 4;
let era = sp_runtime::generic::Era::Immortal; let extra =
let extra = (era, Compact(nonce), Compact(tip)); Extra { era: sp_runtime::generic::Era::Immortal, nonce: Compact(nonce), tip: Compact(tip) };
let genesis = self.genesis; let signature_payload = (
let mortality_checkpoint = genesis; &call,
let mut signature_payload = &extra,
(call, extra, SPEC_VERSION, TX_VERSION, genesis, mortality_checkpoint).encode(); SignedPayloadExtra {
if signature_payload.len() > 256 { spec_version: SPEC_VERSION,
signature_payload = sp_core::blake2_256(&signature_payload).to_vec(); tx_version: TX_VERSION,
} genesis: self.genesis,
mortality_checkpoint: self.genesis,
},
)
.encode();
let signature = signer.sign(&signature_payload); let signature = signer.sign(&signature_payload);
let signed = 1 << 7; Transaction { call, signature: Some((signer.public().into(), signature, extra)) }
let tx = (signed + EXTRINSIC_FORMAT_VERSION, signer.public(), signature, extra, call).encode();
let mut length_prefixed = Compact(u32::try_from(tx.len()).unwrap()).encode();
length_prefixed.extend(tx);
length_prefixed
} }
// TODO: Move this to take in Transaction pub async fn publish(&self, tx: &Transaction) -> Result<(), SeraiError> {
pub async fn publish(&self, tx: &[u8]) -> Result<(), SeraiError> {
// Drop the returned hash, which is the hash of the raw extrinsic, as extrinsics are allowed // Drop the returned hash, which is the hash of the raw extrinsic, as extrinsics are allowed
// to share hashes and this hash is accordingly useless/unsafe // to share hashes and this hash is accordingly useless/unsafe
// If we are to return something, it should be block included in and position within block // If we are to return something, it should be block included in and position within block
let _: String = self.call("author_submitExtrinsic", [hex::encode(tx)]).await?; let _: String = self.call("author_submitExtrinsic", [hex::encode(tx.encode())]).await?;
Ok(()) Ok(())
} }
@ -221,14 +197,15 @@ impl Serai {
} }
pub async fn block(&self, hash: [u8; 32]) -> Result<Option<Block>, SeraiError> { pub async fn block(&self, hash: [u8; 32]) -> Result<Option<Block>, SeraiError> {
// TODO: Remove this wrapping from Serai? let block: Option<String> = self.call("chain_getBlockBin", [hex::encode(hash)]).await?;
#[derive(Deserialize)]
struct WrappedBlock {
block: SeraiBlock,
}
let block: Option<WrappedBlock> = self.call("chain_getBlock", [hex::encode(hash)]).await?;
let Some(block) = block else { return Ok(None) }; let Some(block) = block else { return Ok(None) };
Ok(Some(Block(block.block))) let Ok(bytes) = Self::hex_decode(block) else {
Err(SeraiError::InvalidNode("didn't return a hex-encoded block".to_string()))?
};
let Ok(block) = Block::decode(&mut bytes.as_slice()) else {
Err(SeraiError::InvalidNode("didn't return a block".to_string()))?
};
Ok(Some(block))
} }
pub async fn latest_finalized_block(&self) -> Result<Block, SeraiError> { pub async fn latest_finalized_block(&self) -> Result<Block, SeraiError> {
@ -276,7 +253,7 @@ impl Serai {
let hash = self.block_hash(number).await?; let hash = self.block_hash(number).await?;
let Some(hash) = hash else { return Ok(None) }; let Some(hash) = hash else { return Ok(None) };
let Some(block) = self.block(hash).await? else { return Ok(None) }; let Some(block) = self.block(hash).await? else { return Ok(None) };
if !self.is_finalized(&block.0.header).await? { if !self.is_finalized(&block.header).await? {
return Ok(None); return Ok(None);
} }
Ok(Some(block)) Ok(Some(block))
@ -326,14 +303,10 @@ impl<'a> TemporalSerai<'a> {
self.0 self.0
} }
async fn events<E>( async fn events<E>(&self, filter_map: impl Fn(Event) -> Option<E>) -> Result<Vec<E>, SeraiError> {
&self,
filter_map: impl Fn(serai_runtime::RuntimeEvent) -> Option<E>,
) -> Result<Vec<E>, SeraiError> {
let mut res = vec![]; let mut res = vec![];
let all_events: Option< let all_events: Option<Vec<frame_system::EventRecord<Event, [u8; 32]>>> =
Vec<serai_runtime::system::EventRecord<serai_runtime::RuntimeEvent, [u8; 32]>>, self.storage("System", "Events", ()).await?;
> = self.storage("System", "Events", ()).await?;
#[allow(clippy::unwrap_or_default)] #[allow(clippy::unwrap_or_default)]
for event in all_events.unwrap_or(vec![]) { for event in all_events.unwrap_or(vec![]) {
if let Some(event) = filter_map(event.event) { if let Some(event) = filter_map(event.event) {

View file

@ -2,15 +2,18 @@ use scale::Encode;
use sp_core::sr25519::{Public, Signature}; use sp_core::sr25519::{Public, Signature};
use serai_runtime::{primitives::Amount, validator_sets, Runtime}; use serai_abi::primitives::Amount;
pub use validator_sets::primitives; pub use serai_abi::validator_sets::primitives;
use primitives::{Session, ValidatorSet, KeyPair}; use primitives::{Session, ValidatorSet, KeyPair};
use crate::{primitives::NetworkId, Serai, TemporalSerai, SeraiError}; use crate::{
primitives::{NetworkId, SeraiAddress},
Transaction, Serai, TemporalSerai, SeraiError,
};
const PALLET: &str = "ValidatorSets"; const PALLET: &str = "ValidatorSets";
pub type ValidatorSetsEvent = validator_sets::Event<Runtime>; pub type ValidatorSetsEvent = serai_abi::validator_sets::Event;
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
pub struct SeraiValidatorSets<'a>(pub(crate) TemporalSerai<'a>); pub struct SeraiValidatorSets<'a>(pub(crate) TemporalSerai<'a>);
@ -23,7 +26,7 @@ impl<'a> SeraiValidatorSets<'a> {
self self
.0 .0
.events(|event| { .events(|event| {
if let serai_runtime::RuntimeEvent::ValidatorSets(event) = event { if let serai_abi::Event::ValidatorSets(event) = event {
Some(event).filter(|event| matches!(event, ValidatorSetsEvent::NewSet { .. })) Some(event).filter(|event| matches!(event, ValidatorSetsEvent::NewSet { .. }))
} else { } else {
None None
@ -36,7 +39,7 @@ impl<'a> SeraiValidatorSets<'a> {
self self
.0 .0
.events(|event| { .events(|event| {
if let serai_runtime::RuntimeEvent::ValidatorSets(event) = event { if let serai_abi::Event::ValidatorSets(event) = event {
Some(event).filter(|event| matches!(event, ValidatorSetsEvent::KeyGen { .. })) Some(event).filter(|event| matches!(event, ValidatorSetsEvent::KeyGen { .. }))
} else { } else {
None None
@ -49,7 +52,7 @@ impl<'a> SeraiValidatorSets<'a> {
self self
.0 .0
.events(|event| { .events(|event| {
if let serai_runtime::RuntimeEvent::ValidatorSets(event) = event { if let serai_abi::Event::ValidatorSets(event) = event {
Some(event).filter(|event| matches!(event, ValidatorSetsEvent::SetRetired { .. })) Some(event).filter(|event| matches!(event, ValidatorSetsEvent::SetRetired { .. }))
} else { } else {
None None
@ -107,20 +110,22 @@ impl<'a> SeraiValidatorSets<'a> {
self.0.storage(PALLET, "Keys", (sp_core::hashing::twox_64(&set.encode()), set)).await self.0.storage(PALLET, "Keys", (sp_core::hashing::twox_64(&set.encode()), set)).await
} }
pub fn set_keys(network: NetworkId, key_pair: KeyPair, signature: Signature) -> Vec<u8> { pub fn set_keys(network: NetworkId, key_pair: KeyPair, signature: Signature) -> Transaction {
Serai::unsigned(&serai_runtime::RuntimeCall::ValidatorSets( Serai::unsigned(serai_abi::Call::ValidatorSets(serai_abi::validator_sets::Call::set_keys {
validator_sets::Call::<Runtime>::set_keys { network, key_pair, signature }, network,
)) key_pair,
signature,
}))
} }
pub fn remove_participant( pub fn remove_participant(
network: NetworkId, network: NetworkId,
to_remove: Public, to_remove: SeraiAddress,
signers: Vec<Public>, signers: Vec<SeraiAddress>,
signature: Signature, signature: Signature,
) -> Vec<u8> { ) -> Transaction {
Serai::unsigned(&serai_runtime::RuntimeCall::ValidatorSets( Serai::unsigned(serai_abi::Call::ValidatorSets(
validator_sets::Call::<Runtime>::remove_participant { serai_abi::validator_sets::Call::remove_participant {
network, network,
to_remove, to_remove,
signers, signers,

View file

@ -67,7 +67,7 @@ serai_test!(
let serai = serai.coins(); let serai = serai.coins();
assert_eq!( assert_eq!(
serai.mint_events().await.unwrap(), serai.mint_events().await.unwrap(),
vec![CoinsEvent::Mint { to: address.into(), balance }] vec![CoinsEvent::Mint { to: address, balance }]
); );
assert_eq!(serai.coin_supply(coin).await.unwrap(), amount); assert_eq!(serai.coin_supply(coin).await.unwrap(), amount);
assert_eq!(serai.coin_balance(coin, address).await.unwrap(), amount); assert_eq!(serai.coin_balance(coin, address).await.unwrap(), amount);

View file

@ -7,7 +7,7 @@ use blake2::{
use scale::Encode; use scale::Encode;
use serai_runtime::coins::primitives::OutInstructionWithBalance; use serai_abi::coins::primitives::OutInstructionWithBalance;
use sp_core::Pair; use sp_core::Pair;
use serai_client::{ use serai_client::{
@ -68,7 +68,7 @@ serai_test!(
assert_eq!( assert_eq!(
serai.coins().mint_events().await.unwrap(), serai.coins().mint_events().await.unwrap(),
vec![CoinsEvent::Mint { to: address.into(), balance }] vec![CoinsEvent::Mint { to: address, balance }]
); );
assert_eq!(serai.coins().coin_supply(coin).await.unwrap(), amount); assert_eq!(serai.coins().coin_supply(coin).await.unwrap(), amount);
assert_eq!(serai.coins().coin_balance(coin, address).await.unwrap(), amount); assert_eq!(serai.coins().coin_balance(coin, address).await.unwrap(), amount);
@ -86,22 +86,17 @@ serai_test!(
balance, balance,
instruction: OutInstruction { address: external_address, data: Some(data) }, instruction: OutInstruction { address: external_address, data: Some(data) },
}; };
let serai = serai.into_inner(); let serai = serai.into_inner();
let block = publish_tx( let block = publish_tx(
serai, serai,
&serai &serai.sign(&pair, SeraiCoins::burn_with_instruction(instruction.clone()), 0, 0),
.sign(
&pair,
&SeraiCoins::burn_with_instruction(instruction.clone()),
0,
0,
)
) )
.await; .await;
let serai = serai.as_of(block).coins(); let serai = serai.as_of(block).coins();
let events = serai.burn_with_instruction_events().await.unwrap(); let events = serai.burn_with_instruction_events().await.unwrap();
assert_eq!(events, vec![CoinsEvent::BurnWithInstruction { from: address.into(), instruction }]); assert_eq!(events, vec![CoinsEvent::BurnWithInstruction { from: address, instruction }]);
assert_eq!(serai.coin_supply(coin).await.unwrap(), Amount(0)); assert_eq!(serai.coin_supply(coin).await.unwrap(), Amount(0));
assert_eq!(serai.coin_balance(coin, address).await.unwrap(), Amount(0)); assert_eq!(serai.coin_balance(coin, address).await.unwrap(), Amount(0));
}) })

View file

@ -1,4 +1,4 @@
use serai_runtime::primitives::{Coin, Amount}; use serai_abi::primitives::{Coin, Amount};
use serai_client::{Serai, SeraiDex}; use serai_client::{Serai, SeraiDex};
use sp_core::{sr25519::Pair, Pair as PairTrait}; use sp_core::{sr25519::Pair, Pair as PairTrait};
@ -18,7 +18,7 @@ pub async fn add_liquidity(
let tx = serai.sign( let tx = serai.sign(
&pair, &pair,
&SeraiDex::add_liquidity(coin, coin_amount, sri_amount, Amount(1), Amount(1), address.into()), SeraiDex::add_liquidity(coin, coin_amount, sri_amount, Amount(1), Amount(1), address.into()),
nonce, nonce,
0, 0,
); );
@ -40,7 +40,7 @@ pub async fn swap(
let tx = serai.sign( let tx = serai.sign(
&pair, &pair,
&SeraiDex::swap(from_coin, to_coin, amount_in, amount_out_min, address.into()), SeraiDex::swap(from_coin, to_coin, amount_in, amount_out_min, address.into()),
nonce, nonce,
Default::default(), Default::default(),
); );

View file

@ -2,12 +2,10 @@ use core::time::Duration;
use tokio::time::sleep; use tokio::time::sleep;
use scale::Encode; use serai_client::{Transaction, Serai};
use serai_client::Serai;
#[allow(dead_code)] #[allow(dead_code)]
pub async fn publish_tx(serai: &Serai, tx: &[u8]) -> [u8; 32] { pub async fn publish_tx(serai: &Serai, tx: &Transaction) -> [u8; 32] {
let mut latest = serai let mut latest = serai
.block(serai.latest_finalized_block_hash().await.unwrap()) .block(serai.latest_finalized_block_hash().await.unwrap())
.await .await
@ -39,8 +37,8 @@ pub async fn publish_tx(serai: &Serai, tx: &[u8]) -> [u8; 32] {
block.unwrap() block.unwrap()
}; };
for transaction in block.transactions() { for transaction in &block.transactions {
if transaction.encode() == tx { if transaction == tx {
return block.hash(); return block.hash();
} }
} }

View file

@ -3,7 +3,7 @@ use scale::Encode;
use sp_core::{Pair as PairTrait, bounded_vec::BoundedVec, hashing::blake2_256}; use sp_core::{Pair as PairTrait, bounded_vec::BoundedVec, hashing::blake2_256};
use serai_runtime::in_instructions::primitives::DexCall; use serai_abi::in_instructions::primitives::DexCall;
use serai_client::{ use serai_client::{
primitives::{ primitives::{
@ -37,22 +37,22 @@ serai_test!(
vec![ vec![
DexEvent::PoolCreated { DexEvent::PoolCreated {
pool_id: Coin::Bitcoin, pool_id: Coin::Bitcoin,
pool_account: PublicKey::from_raw(blake2_256(&Coin::Bitcoin.encode())), pool_account: PublicKey::from_raw(blake2_256(&Coin::Bitcoin.encode())).into(),
lp_token: Coin::Bitcoin, lp_token: Coin::Bitcoin,
}, },
DexEvent::PoolCreated { DexEvent::PoolCreated {
pool_id: Coin::Ether, pool_id: Coin::Ether,
pool_account: PublicKey::from_raw(blake2_256(&Coin::Ether.encode())), pool_account: PublicKey::from_raw(blake2_256(&Coin::Ether.encode())).into(),
lp_token: Coin::Ether, lp_token: Coin::Ether,
}, },
DexEvent::PoolCreated { DexEvent::PoolCreated {
pool_id: Coin::Dai, pool_id: Coin::Dai,
pool_account: PublicKey::from_raw(blake2_256(&Coin::Dai.encode())), pool_account: PublicKey::from_raw(blake2_256(&Coin::Dai.encode())).into(),
lp_token: Coin::Dai, lp_token: Coin::Dai,
}, },
DexEvent::PoolCreated { DexEvent::PoolCreated {
pool_id: Coin::Monero, pool_id: Coin::Monero,
pool_account: PublicKey::from_raw(blake2_256(&Coin::Monero.encode())), pool_account: PublicKey::from_raw(blake2_256(&Coin::Monero.encode())).into(),
lp_token: Coin::Monero, lp_token: Coin::Monero,
}, },
] ]
@ -91,8 +91,8 @@ serai_test!(
assert_eq!( assert_eq!(
events, events,
vec![DexEvent::LiquidityAdded { vec![DexEvent::LiquidityAdded {
who: pair.public(), who: pair.public().into(),
mint_to: pair.public(), mint_to: pair.public().into(),
pool_id: Coin::Monero, pool_id: Coin::Monero,
coin_amount: coin_amount.0, coin_amount: coin_amount.0,
sri_amount: sri_amount.0, sri_amount: sri_amount.0,
@ -140,8 +140,8 @@ serai_test!(
assert_eq!( assert_eq!(
events, events,
vec![DexEvent::SwapExecuted { vec![DexEvent::SwapExecuted {
who: pair.clone().public(), who: pair.clone().public().into(),
send_to: pair.public(), send_to: pair.public().into(),
path, path,
amount_in: amount_in.0, amount_in: amount_in.0,
amount_out: 16633299966633 amount_out: 16633299966633
@ -160,8 +160,8 @@ serai_test!(
assert_eq!( assert_eq!(
events, events,
vec![DexEvent::SwapExecuted { vec![DexEvent::SwapExecuted {
who: pair.clone().public(), who: pair.clone().public().into(),
send_to: pair.public(), send_to: pair.public().into(),
path, path,
amount_in: amount_in.0, amount_in: amount_in.0,
amount_out: 17254428681101 amount_out: 17254428681101
@ -220,8 +220,8 @@ serai_test!(
assert_eq!( assert_eq!(
events, events,
vec![DexEvent::SwapExecuted { vec![DexEvent::SwapExecuted {
who: pair.clone().public(), who: pair.clone().public().into(),
send_to: pair.public(), send_to: pair.public().into(),
path, path,
amount_in: amount_in.0, amount_in: amount_in.0,
amount_out: 12453103964435, amount_out: 12453103964435,
@ -275,8 +275,8 @@ serai_test!(
assert_eq!( assert_eq!(
events, events,
vec![DexEvent::LiquidityAdded { vec![DexEvent::LiquidityAdded {
who: IN_INSTRUCTION_EXECUTOR.into(), who: IN_INSTRUCTION_EXECUTOR,
mint_to: pair.public(), mint_to: pair.public().into(),
pool_id: Coin::Bitcoin, pool_id: Coin::Bitcoin,
coin_amount: 10_000_000_000_000, // half of sent amount coin_amount: 10_000_000_000_000, // half of sent amount
sri_amount: 6_947_918_403_646, sri_amount: 6_947_918_403_646,
@ -363,8 +363,8 @@ serai_test!(
assert_eq!( assert_eq!(
events, events,
vec![DexEvent::SwapExecuted { vec![DexEvent::SwapExecuted {
who: IN_INSTRUCTION_EXECUTOR.into(), who: IN_INSTRUCTION_EXECUTOR,
send_to: IN_INSTRUCTION_EXECUTOR.into(), send_to: IN_INSTRUCTION_EXECUTOR,
path, path,
amount_in: 20_000_000_000_000, amount_in: 20_000_000_000_000,
amount_out: 11066655622377 amount_out: 11066655622377
@ -402,8 +402,8 @@ serai_test!(
assert_eq!( assert_eq!(
events, events,
vec![DexEvent::SwapExecuted { vec![DexEvent::SwapExecuted {
who: IN_INSTRUCTION_EXECUTOR.into(), who: IN_INSTRUCTION_EXECUTOR,
send_to: out_address.as_native().unwrap().into(), send_to: out_address.as_native().unwrap(),
path, path,
amount_in: 20_000_000_000_000, amount_in: 20_000_000_000_000,
amount_out: 26440798801319 amount_out: 26440798801319
@ -440,8 +440,8 @@ serai_test!(
assert_eq!( assert_eq!(
events, events,
vec![DexEvent::SwapExecuted { vec![DexEvent::SwapExecuted {
who: IN_INSTRUCTION_EXECUTOR.into(), who: IN_INSTRUCTION_EXECUTOR,
send_to: out_address.as_native().unwrap().into(), send_to: out_address.as_native().unwrap(),
path, path,
amount_in: 10_000_000_000_000, amount_in: 10_000_000_000_000,
amount_out: 10711005507065 amount_out: 10711005507065

View file

@ -25,8 +25,10 @@ sp-application-crypto = { git = "https://github.com/serai-dex/substrate", defaul
sp-core = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-core = { 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 }
frame-support = { git = "https://github.com/serai-dex/substrate", default-features = false }
[features] [features]
std = ["zeroize", "scale/std", "borsh?/std", "serde?/std", "scale-info/std", "sp-core/std", "sp-runtime/std"] std = ["zeroize", "scale/std", "borsh?/std", "serde?/std", "scale-info/std", "sp-core/std", "sp-runtime/std", "frame-support/std"]
borsh = ["dep:borsh"] borsh = ["dep:borsh"]
serde = ["dep:serde"] serde = ["dep:serde"]
default = ["std"] default = ["std"]

View file

@ -50,6 +50,7 @@ pub fn borsh_deserialize_signature<R: borsh::io::Read>(
Ok(Signature(signature)) Ok(Signature(signature))
} }
// TODO: Remove this for solely Public?
#[derive( #[derive(
Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Encode, Decode, MaxEncodedLen, TypeInfo, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Encode, Decode, MaxEncodedLen, TypeInfo,
)] )]

View file

@ -32,6 +32,9 @@ pub use balance::*;
mod account; mod account;
pub use account::*; pub use account::*;
mod tx;
pub use tx::*;
#[cfg(feature = "borsh")] #[cfg(feature = "borsh")]
pub fn borsh_serialize_bounded_vec<W: borsh::io::Write, T: BorshSerialize, const B: u32>( pub fn borsh_serialize_bounded_vec<W: borsh::io::Write, T: BorshSerialize, const B: u32>(
bounded: &BoundedVec<T, ConstU32<B>>, bounded: &BoundedVec<T, ConstU32<B>>,

View file

@ -0,0 +1,122 @@
use scale::Encode;
use sp_core::sr25519::{Public, Signature};
use sp_runtime::traits::Verify;
use crate::SeraiAddress;
trait TransactionMember:
Clone + PartialEq + Eq + core::fmt::Debug + scale::Encode + scale::Decode + scale_info::TypeInfo
{
}
impl<
T: Clone
+ PartialEq
+ Eq
+ core::fmt::Debug
+ scale::Encode
+ scale::Decode
+ scale_info::TypeInfo,
> TransactionMember for T
{
}
#[allow(private_bounds)]
#[derive(Clone, PartialEq, Eq, Debug, scale::Encode, scale::Decode, scale_info::TypeInfo)]
pub struct Transaction<Call: TransactionMember, Extra: TransactionMember> {
pub call: Call,
pub signature: Option<(SeraiAddress, Signature, Extra)>,
}
#[cfg(feature = "serde")]
mod _serde {
use scale::Encode;
use serde::{ser::*, de::*};
use super::*;
impl<Call: TransactionMember, Extra: TransactionMember> Serialize for Transaction<Call, Extra> {
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
let encoded = self.encode();
serializer.serialize_bytes(&encoded)
}
}
#[cfg(feature = "std")]
impl<'a, Call: TransactionMember, Extra: TransactionMember> Deserialize<'a>
for Transaction<Call, Extra>
{
fn deserialize<D: Deserializer<'a>>(de: D) -> Result<Self, D::Error> {
let bytes = sp_core::bytes::deserialize(de)?;
scale::Decode::decode(&mut &bytes[..])
.map_err(|e| serde::de::Error::custom(format!("invalid transaction: {}", e)))
}
}
}
impl<Call: TransactionMember, Extra: TransactionMember> sp_runtime::traits::Extrinsic
for Transaction<Call, Extra>
{
type Call = Call;
type SignaturePayload = (SeraiAddress, Signature, Extra);
fn is_signed(&self) -> Option<bool> {
Some(self.signature.is_some())
}
fn new(call: Call, signature: Option<Self::SignaturePayload>) -> Option<Self> {
Some(Self { call, signature })
}
}
impl<Call: TransactionMember, Extra: TransactionMember> frame_support::traits::ExtrinsicCall
for Transaction<Call, Extra>
{
fn call(&self) -> &Call {
&self.call
}
}
impl<Call: TransactionMember, Extra: TransactionMember> sp_runtime::traits::ExtrinsicMetadata
for Transaction<Call, Extra>
where
Extra: sp_runtime::traits::SignedExtension,
{
type SignedExtensions = Extra;
const VERSION: u8 = 0;
}
impl<Call: TransactionMember, Extra: TransactionMember> frame_support::dispatch::GetDispatchInfo
for Transaction<Call, Extra>
where
Call: frame_support::dispatch::GetDispatchInfo,
{
fn get_dispatch_info(&self) -> frame_support::dispatch::DispatchInfo {
self.call.get_dispatch_info()
}
}
impl<Call: TransactionMember, Extra: TransactionMember> sp_runtime::traits::BlindCheckable
for Transaction<Call, Extra>
where
Extra: sp_runtime::traits::SignedExtension,
{
type Checked = sp_runtime::generic::CheckedExtrinsic<Public, Call, Extra>;
fn check(
self,
) -> Result<Self::Checked, sp_runtime::transaction_validity::TransactionValidityError> {
Ok(match self.signature {
Some((signer, signature, extra)) => {
if !signature.verify(
(&self.call, &extra, extra.additional_signed()?).encode().as_slice(),
&signer.into(),
) {
Err(sp_runtime::transaction_validity::InvalidTransaction::BadProof)?
}
sp_runtime::generic::CheckedExtrinsic {
signed: Some((signer.into(), extra)),
function: self.call,
}
}
None => sp_runtime::generic::CheckedExtrinsic { signed: None, function: self.call },
})
}
}

View file

@ -44,7 +44,7 @@ use sp_runtime::{
Perbill, ApplyExtrinsicResult, Perbill, ApplyExtrinsicResult,
}; };
use primitives::{PublicKey, SeraiAddress, AccountLookup, Signature, SubstrateAmount}; use primitives::{PublicKey, AccountLookup, SubstrateAmount};
use support::{ use support::{
traits::{ConstU8, ConstU32, ConstU64, Contains}, traits::{ConstU8, ConstU32, ConstU64, Contains},
@ -75,10 +75,9 @@ pub type SignedExtra = (
system::CheckWeight<Runtime>, system::CheckWeight<Runtime>,
transaction_payment::ChargeTransactionPayment<Runtime>, transaction_payment::ChargeTransactionPayment<Runtime>,
); );
pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<SeraiAddress, RuntimeCall, Signature, SignedExtra>;
pub type Block = generic::Block<Header, UncheckedExtrinsic>; pub type Transaction = serai_primitives::Transaction<RuntimeCall, SignedExtra>;
pub type Block = generic::Block<Header, Transaction>;
pub type BlockId = generic::BlockId<Block>; pub type BlockId = generic::BlockId<Block>;
pub mod opaque { pub mod opaque {

View file

@ -207,7 +207,7 @@ async fn sign_test() {
serai serai
.publish(&serai.sign( .publish(&serai.sign(
&insecure_pair_from_name("Ferdie"), &insecure_pair_from_name("Ferdie"),
&SeraiCoins::transfer(address, balance), SeraiCoins::transfer(address, balance),
0, 0,
Default::default(), Default::default(),
)) ))
@ -252,7 +252,7 @@ async fn sign_test() {
// Verify the mint occurred as expected // Verify the mint occurred as expected
assert_eq!( assert_eq!(
serai.mint_events().await.unwrap(), serai.mint_events().await.unwrap(),
vec![CoinsEvent::Mint { to: serai_addr.into(), balance }] vec![CoinsEvent::Mint { to: serai_addr, balance }]
); );
assert_eq!(serai.coin_supply(Coin::Bitcoin).await.unwrap(), amount); assert_eq!(serai.coin_supply(Coin::Bitcoin).await.unwrap(), amount);
assert_eq!(serai.coin_balance(Coin::Bitcoin, serai_addr).await.unwrap(), amount); assert_eq!(serai.coin_balance(Coin::Bitcoin, serai_addr).await.unwrap(), amount);
@ -269,7 +269,7 @@ async fn sign_test() {
serai serai
.publish(&serai.sign( .publish(&serai.sign(
&serai_pair, &serai_pair,
&SeraiCoins::burn_with_instruction(out_instruction.clone()), SeraiCoins::burn_with_instruction(out_instruction.clone()),
0, 0,
Default::default(), Default::default(),
)) ))
@ -297,7 +297,7 @@ async fn sign_test() {
assert_eq!( assert_eq!(
burn_events[0], burn_events[0],
CoinsEvent::BurnWithInstruction { CoinsEvent::BurnWithInstruction {
from: serai_addr.into(), from: serai_addr,
instruction: out_instruction.clone() instruction: out_instruction.clone()
} }
); );

View file

@ -250,7 +250,7 @@ async fn mint_and_burn_test() {
serai serai
.publish(&serai.sign( .publish(&serai.sign(
&insecure_pair_from_name("Ferdie"), &insecure_pair_from_name("Ferdie"),
&SeraiCoins::transfer(address, balance), SeraiCoins::transfer(address, balance),
0, 0,
Default::default(), Default::default(),
)) ))
@ -504,7 +504,7 @@ async fn mint_and_burn_test() {
serai serai
.publish(&serai.sign( .publish(&serai.sign(
serai_pair, serai_pair,
&SeraiCoins::burn_with_instruction(out_instruction), SeraiCoins::burn_with_instruction(out_instruction),
nonce, nonce,
Default::default(), Default::default(),
)) ))