mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Get serai-node to compile again
This commit is contained in:
@@ -22,12 +22,12 @@ workspace = true
|
|||||||
borsh = { version = "1", default-features = false, features = ["derive", "de_strict_order"] }
|
borsh = { version = "1", default-features = false, features = ["derive", "de_strict_order"] }
|
||||||
|
|
||||||
bitvec = { version = "1", default-features = false, features = ["alloc"] }
|
bitvec = { version = "1", default-features = false, features = ["alloc"] }
|
||||||
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
serde = { version = "1", default-features = false, features = ["derive"], optional = true }
|
serde = { version = "1", default-features = false, features = ["derive"], optional = true }
|
||||||
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"], optional = true }
|
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"], optional = true }
|
||||||
sp-runtime = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false, features = ["serde"], optional = true }
|
sp-runtime = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false, features = ["serde"], optional = true }
|
||||||
frame-support = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false, optional = true }
|
frame-support = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false, optional = true }
|
||||||
|
|
||||||
serai-primitives = { path = "../primitives", version = "0.1", default-features = false }
|
serai-primitives = { path = "../primitives", version = "0.1", default-features = false }
|
||||||
|
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ serde_json = { version = "1", optional = true }
|
|||||||
serai-abi = { path = "../abi", version = "0.1" }
|
serai-abi = { path = "../abi", version = "0.1" }
|
||||||
|
|
||||||
multiaddr = { version = "0.18", optional = true }
|
multiaddr = { version = "0.18", optional = true }
|
||||||
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", optional = true }
|
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", optional = true }
|
||||||
sp-runtime = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", optional = true }
|
sp-runtime = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", optional = true }
|
||||||
frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", optional = true }
|
frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", optional = true }
|
||||||
|
|
||||||
async-lock = "3"
|
async-lock = "3"
|
||||||
|
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ workspace = true
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
|
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
|
||||||
|
|
||||||
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
frame-support = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
frame-support = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
serai-abi = { path = "../abi", default-features = false, features = ["substrate"] }
|
serai-abi = { path = "../abi", default-features = false, features = ["substrate"] }
|
||||||
serai-core-pallet = { path = "../core", default-features = false }
|
serai-core-pallet = { path = "../core", default-features = false }
|
||||||
@@ -29,7 +29,7 @@ serai-core-pallet = { path = "../core", default-features = false }
|
|||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
borsh = { version = "1", default-features = false, features = ["std", "derive", "de_strict_order"] }
|
borsh = { version = "1", default-features = false, features = ["std", "derive", "de_strict_order"] }
|
||||||
|
|
||||||
sp-io = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false, features = ["std"] }
|
sp-io = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false, features = ["std"] }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
std = [
|
std = [
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ borsh = { version = "1", default-features = false, features = ["derive", "de_str
|
|||||||
|
|
||||||
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
|
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
|
||||||
|
|
||||||
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
frame-support = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
frame-support = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
serai-abi = { path = "../abi", default-features = false, features = ["substrate"] }
|
serai-abi = { path = "../abi", default-features = false, features = ["substrate"] }
|
||||||
|
|
||||||
|
|||||||
@@ -21,15 +21,15 @@ workspace = true
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
scale = { package = "parity-scale-codec", version = "3.6.1", default-features = false }
|
scale = { package = "parity-scale-codec", version = "3.6.1", default-features = false }
|
||||||
|
|
||||||
sp-std = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-std = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
sp-io = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-io = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
sp-api = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-api = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
sp-runtime = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-runtime = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
frame-support = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
frame-support = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
frame-benchmarking = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false, optional = true }
|
frame-benchmarking = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false, optional = true }
|
||||||
|
|
||||||
coins-pallet = { package = "serai-coins-pallet", path = "../coins", default-features = false }
|
coins-pallet = { package = "serai-coins-pallet", path = "../coins", default-features = false }
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ workspace = true
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
|
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
|
||||||
|
|
||||||
frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
frame-support = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
frame-support = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
dex-pallet = { package = "serai-dex-pallet", path = "../dex", default-features = false }
|
dex-pallet = { package = "serai-dex-pallet", path = "../dex", default-features = false }
|
||||||
coins-pallet = { package = "serai-coins-pallet", path = "../coins", default-features = false }
|
coins-pallet = { package = "serai-coins-pallet", path = "../coins", default-features = false }
|
||||||
@@ -30,16 +30,16 @@ coins-pallet = { package = "serai-coins-pallet", path = "../coins", default-feat
|
|||||||
serai-primitives = { path = "../primitives", default-features = false }
|
serai-primitives = { path = "../primitives", default-features = false }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
pallet-babe = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
pallet-babe = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
pallet-grandpa = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
pallet-grandpa = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
pallet-timestamp = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
pallet-timestamp = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
validator-sets-pallet = { package = "serai-validator-sets-pallet", path = "../validator-sets", default-features = false }
|
validator-sets-pallet = { package = "serai-validator-sets-pallet", path = "../validator-sets", default-features = false }
|
||||||
|
|
||||||
sp-io = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-io = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
sp-runtime = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-runtime = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
sp-consensus-babe = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-consensus-babe = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
std = [
|
std = [
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ workspace = true
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
|
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
|
||||||
|
|
||||||
frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
frame-support = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
frame-support = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
sp-std = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-std = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
sp-runtime = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-runtime = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
coins-pallet = { package = "serai-coins-pallet", path = "../coins", default-features = false }
|
coins-pallet = { package = "serai-coins-pallet", path = "../coins", default-features = false }
|
||||||
validator-sets-pallet = { package = "serai-validator-sets-pallet", path = "../validator-sets", default-features = false }
|
validator-sets-pallet = { package = "serai-validator-sets-pallet", path = "../validator-sets", default-features = false }
|
||||||
|
|||||||
@@ -21,12 +21,12 @@ workspace = true
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
|
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
|
||||||
|
|
||||||
frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
frame-support = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
frame-support = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
sp-std = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-std = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
sp-application-crypto = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-application-crypto = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
dex-pallet = { package = "serai-dex-pallet", path = "../dex", default-features = false }
|
dex-pallet = { package = "serai-dex-pallet", path = "../dex", default-features = false }
|
||||||
coins-pallet = { package = "serai-coins-pallet", path = "../coins", default-features = false }
|
coins-pallet = { package = "serai-coins-pallet", path = "../coins", default-features = false }
|
||||||
|
|||||||
@@ -24,14 +24,14 @@ bitvec = { version = "1", default-features = false, features = ["alloc"] }
|
|||||||
|
|
||||||
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "max-encoded-len"] }
|
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "max-encoded-len"] }
|
||||||
|
|
||||||
sp-std = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-std = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
sp-application-crypto = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-application-crypto = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
sp-io = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-io = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
sp-runtime = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-runtime = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
frame-support = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
frame-support = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
serai-primitives = { path = "../primitives", default-features = false }
|
serai-primitives = { path = "../primitives", default-features = false }
|
||||||
|
|
||||||
@@ -42,9 +42,9 @@ genesis-liquidity-pallet = { package = "serai-genesis-liquidity-pallet", path =
|
|||||||
emissions-pallet = { package = "serai-emissions-pallet", path = "../emissions", default-features = false }
|
emissions-pallet = { package = "serai-emissions-pallet", path = "../emissions", default-features = false }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
pallet-babe = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
pallet-babe = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
pallet-grandpa = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
pallet-grandpa = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
pallet-timestamp = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
pallet-timestamp = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
economic-security-pallet = { package = "serai-economic-security-pallet", path = "../economic-security", default-features = false }
|
economic-security-pallet = { package = "serai-economic-security-pallet", path = "../economic-security", default-features = false }
|
||||||
|
|
||||||
|
|||||||
@@ -34,19 +34,20 @@ secq256k1 = { path = "../../crypto/secq256k1" }
|
|||||||
|
|
||||||
libp2p = "0.56"
|
libp2p = "0.56"
|
||||||
|
|
||||||
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
sp-keystore = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sp-keystore = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
sp-timestamp = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sp-timestamp = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
sp-state-machine = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sp-state-machine = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
sp-io = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sp-io = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
sp-blockchain = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sp-blockchain = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
sp-runtime = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sp-runtime = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
sp-api = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sp-api = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
sp-block-builder = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sp-block-builder = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
sp-consensus-babe = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sp-consensus-babe = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
|
|
||||||
frame-benchmarking = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
frame-benchmarking = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
|
|
||||||
|
serai-abi = { path = "../abi", features = ["std", "substrate"] }
|
||||||
serai-runtime = { path = "../runtime", features = ["std"] }
|
serai-runtime = { path = "../runtime", features = ["std"] }
|
||||||
|
|
||||||
clap = { version = "4", features = ["derive"] }
|
clap = { version = "4", features = ["derive"] }
|
||||||
@@ -55,24 +56,22 @@ futures-util = "0.3"
|
|||||||
tokio = { version = "1", features = ["sync", "rt-multi-thread"] }
|
tokio = { version = "1", features = ["sync", "rt-multi-thread"] }
|
||||||
jsonrpsee = { version = "0.24", features = ["server"] }
|
jsonrpsee = { version = "0.24", features = ["server"] }
|
||||||
|
|
||||||
sc-transaction-pool = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sc-transaction-pool = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
sc-transaction-pool-api = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sc-transaction-pool-api = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
sc-basic-authorship = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sc-basic-authorship = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
sc-executor = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sc-executor = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
sc-service = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sc-service = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
sc-client-api = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sc-client-api = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
sc-network = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sc-network = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
|
|
||||||
sc-consensus = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sc-consensus = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
sc-consensus-babe = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sc-consensus-babe = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
sc-consensus-grandpa = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sc-consensus-grandpa = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
sc-authority-discovery = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sc-authority-discovery = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
|
|
||||||
sc-telemetry = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sc-telemetry = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
sc-chain-spec = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sc-chain-spec = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
sc-cli = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
sc-cli = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
|
|
||||||
frame-system-rpc-runtime-api = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
|
||||||
|
|
||||||
serai-env = { path = "../../common/env" }
|
serai-env = { path = "../../common/env" }
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
use substrate_build_script_utils::generate_cargo_keys;
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
generate_cargo_keys();
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#![expect(unused_imports, dead_code, redundant_closure_call)]
|
#![expect(unused_imports, dead_code)]
|
||||||
|
|
||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
|
|
||||||
@@ -10,103 +10,94 @@ use ciphersuite::{group::GroupEncoding, Ciphersuite};
|
|||||||
use embedwards25519::Embedwards25519;
|
use embedwards25519::Embedwards25519;
|
||||||
use secq256k1::Secq256k1;
|
use secq256k1::Secq256k1;
|
||||||
|
|
||||||
use serai_runtime::{
|
use serai_abi::{
|
||||||
primitives::*, validator_sets::AllEmbeddedEllipticCurveKeysAtGenesis, WASM_BINARY,
|
primitives::{
|
||||||
BABE_GENESIS_EPOCH_CONFIG, RuntimeGenesisConfig, SystemConfig, CoinsConfig, ValidatorSetsConfig,
|
prelude::*,
|
||||||
SignalsConfig, BabeConfig, GrandpaConfig, EmissionsConfig,
|
crypto::{Public, SignedEmbeddedEllipticCurveKeys},
|
||||||
|
},
|
||||||
|
SubstrateBlock as Block,
|
||||||
};
|
};
|
||||||
|
use serai_runtime::*;
|
||||||
|
|
||||||
pub type ChainSpec = sc_service::GenericChainSpec;
|
pub type ChainSpec = sc_service::GenericChainSpec;
|
||||||
|
|
||||||
fn account_from_name(name: &'static str) -> PublicKey {
|
fn insecure_account_from_name(name: &'static str) -> Public {
|
||||||
insecure_pair_from_name(name).public()
|
sp_core::sr25519::Pair::from_string(&format!("//{name}"), None).unwrap().public().into()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn insecure_arbitrary_public_key_from_name<C: Ciphersuite>(name: &'static str) -> Vec<u8> {
|
fn insecure_arbitrary_public_key_from_name<C: Ciphersuite>(name: &'static str) -> Vec<u8> {
|
||||||
let key = insecure_arbitrary_key_from_name::<C>(name);
|
let key = C::hash_to_F(name.as_bytes());
|
||||||
(C::generator() * key).to_bytes().as_ref().to_vec()
|
(C::generator() * key).to_bytes().as_ref().to_vec()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn insecure_embedded_elliptic_curve_keys_from_name(
|
||||||
|
name: &'static str,
|
||||||
|
) -> Vec<SignedEmbeddedEllipticCurveKeys> {
|
||||||
|
vec![] // TODO
|
||||||
|
}
|
||||||
|
|
||||||
fn wasm_binary() -> Vec<u8> {
|
fn wasm_binary() -> Vec<u8> {
|
||||||
// TODO: Accept a config of runtime path
|
// TODO: Accept a config of runtime path
|
||||||
const WASM_PATH: &str = "/runtime/serai.wasm";
|
const DEFAULT_WASM_PATH: &str = "/runtime/serai.wasm";
|
||||||
if let Ok(binary) = std::fs::read(WASM_PATH) {
|
let path = serai_env::var("SERAI_WASM").unwrap_or(DEFAULT_WASM_PATH.to_string());
|
||||||
log::info!("using {WASM_PATH}");
|
if let Ok(binary) = std::fs::read(&path) {
|
||||||
|
log::info!("using {path} for the WASM");
|
||||||
return binary;
|
return binary;
|
||||||
}
|
}
|
||||||
log::info!("using built-in wasm");
|
log::info!("using built-in wasm");
|
||||||
WASM_BINARY.ok_or("compiled in wasm not available").unwrap().to_vec()
|
WASM_BINARY.ok_or("compiled in wasm not available").unwrap().to_vec()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
fn devnet_genesis(
|
fn devnet_genesis(
|
||||||
validators: &[&'static str],
|
validators: &[&'static str],
|
||||||
endowed_accounts: Vec<PublicKey>,
|
endowed_accounts: Vec<Public>,
|
||||||
) -> RuntimeGenesisConfig {
|
) -> RuntimeGenesisConfig {
|
||||||
let validators = validators
|
let validators = validators
|
||||||
.iter()
|
.iter()
|
||||||
.map(|name| {
|
.map(|name| {
|
||||||
(
|
(insecure_account_from_name(name), insecure_embedded_elliptic_curve_keys_from_name(name))
|
||||||
account_from_name(name),
|
|
||||||
AllEmbeddedEllipticCurveKeysAtGenesis {
|
|
||||||
embedwards25519: insecure_arbitrary_public_key_from_name::<Embedwards25519>(name)
|
|
||||||
.try_into()
|
|
||||||
.unwrap(),
|
|
||||||
secq256k1: insecure_arbitrary_public_key_from_name::<Secq256k1>(name).try_into().unwrap(),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
let key_shares = NETWORKS
|
|
||||||
.iter()
|
|
||||||
.map(|network| match network {
|
|
||||||
NetworkId::Serai => (NetworkId::Serai, Amount(50_000 * 10_u64.pow(8))),
|
|
||||||
NetworkId::External(ExternalNetworkId::Bitcoin) => {
|
|
||||||
(NetworkId::External(ExternalNetworkId::Bitcoin), Amount(1_000_000 * 10_u64.pow(8)))
|
|
||||||
}
|
|
||||||
NetworkId::External(ExternalNetworkId::Ethereum) => {
|
|
||||||
(NetworkId::External(ExternalNetworkId::Ethereum), Amount(1_000_000 * 10_u64.pow(8)))
|
|
||||||
}
|
|
||||||
NetworkId::External(ExternalNetworkId::Monero) => {
|
|
||||||
(NetworkId::External(ExternalNetworkId::Monero), Amount(100_000 * 10_u64.pow(8)))
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
RuntimeGenesisConfig {
|
RuntimeGenesisConfig {
|
||||||
system: SystemConfig { _config: PhantomData },
|
system: SystemConfig { _config: PhantomData },
|
||||||
|
|
||||||
transaction_payment: Default::default(),
|
|
||||||
|
|
||||||
coins: CoinsConfig {
|
coins: CoinsConfig {
|
||||||
accounts: endowed_accounts
|
accounts: endowed_accounts
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|a| (a, Balance { coin: Coin::Serai, amount: Amount(1 << 60) }))
|
.map(|address| (address.into(), Balance { coin: Coin::Serai, amount: Amount(1 << 60) }))
|
||||||
.collect(),
|
.collect(),
|
||||||
_ignore: Default::default(),
|
_instance: PhantomData,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
liquidity_tokens: LiquidityTokensConfig { accounts: vec![], _instance: PhantomData },
|
||||||
|
|
||||||
validator_sets: ValidatorSetsConfig {
|
validator_sets: ValidatorSetsConfig {
|
||||||
networks: key_shares.clone(),
|
participants: validators
|
||||||
participants: validators.clone(),
|
.iter()
|
||||||
},
|
.map(|validator| (validator.0.into(), validator.1.clone()))
|
||||||
emissions: EmissionsConfig {
|
.collect(),
|
||||||
networks: key_shares,
|
|
||||||
participants: validators.iter().map(|(validator, _)| *validator).collect(),
|
|
||||||
},
|
},
|
||||||
signals: SignalsConfig::default(),
|
signals: SignalsConfig::default(),
|
||||||
babe: BabeConfig {
|
babe: BabeConfig {
|
||||||
authorities: validators.iter().map(|validator| ((*validator).into(), 1)).collect(),
|
authorities: validators
|
||||||
|
.iter()
|
||||||
|
.map(|validator| (sp_core::sr25519::Public::from(validator.0).into(), 1))
|
||||||
|
.collect(),
|
||||||
epoch_config: BABE_GENESIS_EPOCH_CONFIG,
|
epoch_config: BABE_GENESIS_EPOCH_CONFIG,
|
||||||
_config: PhantomData,
|
_config: PhantomData,
|
||||||
},
|
},
|
||||||
grandpa: GrandpaConfig {
|
grandpa: GrandpaConfig {
|
||||||
authorities: validators.into_iter().map(|validator| (validator.0.into(), 1)).collect(),
|
authorities: validators
|
||||||
|
.into_iter()
|
||||||
|
.map(|validator| (sp_core::sr25519::Public::from(validator.0).into(), 1))
|
||||||
|
.collect(),
|
||||||
_config: PhantomData,
|
_config: PhantomData,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
fn testnet_genesis(validators: Vec<&'static str>) -> RuntimeGenesisConfig {
|
fn testnet_genesis(validators: Vec<&'static str>) -> RuntimeGenesisConfig {
|
||||||
let validators = validators
|
let validators = validators
|
||||||
.into_iter()
|
.into_iter()
|
||||||
@@ -133,21 +124,16 @@ fn testnet_genesis(validators: Vec<&'static str>) -> RuntimeGenesisConfig {
|
|||||||
RuntimeGenesisConfig {
|
RuntimeGenesisConfig {
|
||||||
system: SystemConfig { _config: PhantomData },
|
system: SystemConfig { _config: PhantomData },
|
||||||
|
|
||||||
transaction_payment: Default::default(),
|
|
||||||
|
|
||||||
coins: CoinsConfig {
|
coins: CoinsConfig {
|
||||||
accounts: validators
|
accounts: validators
|
||||||
.iter()
|
.iter()
|
||||||
.map(|a| (*a, Balance { coin: Coin::Serai, amount: Amount(5_000_000 * 10_u64.pow(8)) }))
|
.map(|a| (*a, Balance { coin: Coin::Serai, amount: Amount(5_000_000 * 10_u64.pow(8)) }))
|
||||||
.collect(),
|
.collect(),
|
||||||
_ignore: Default::default(),
|
|
||||||
},
|
},
|
||||||
|
|
||||||
validator_sets: ValidatorSetsConfig {
|
validator_sets: ValidatorSetsConfig {
|
||||||
networks: key_shares.clone(),
|
|
||||||
participants: validators.clone(),
|
participants: validators.clone(),
|
||||||
},
|
},
|
||||||
emissions: EmissionsConfig { networks: key_shares, participants: validators.clone() },
|
|
||||||
signals: SignalsConfig::default(),
|
signals: SignalsConfig::default(),
|
||||||
babe: BabeConfig {
|
babe: BabeConfig {
|
||||||
authorities: validators.iter().map(|validator| ((*validator).into(), 1)).collect(),
|
authorities: validators.iter().map(|validator| ((*validator).into(), 1)).collect(),
|
||||||
@@ -212,22 +198,17 @@ pub fn development_config() -> ChainSpec {
|
|||||||
"devnet",
|
"devnet",
|
||||||
ChainType::Development,
|
ChainType::Development,
|
||||||
"serai-devnet",
|
"serai-devnet",
|
||||||
&(move || {
|
&devnet_genesis(
|
||||||
/*
|
&["Alice"],
|
||||||
let _ = devnet_genesis(
|
vec![
|
||||||
&["Alice"],
|
insecure_account_from_name("Alice"),
|
||||||
vec![
|
insecure_account_from_name("Bob"),
|
||||||
account_from_name("Alice"),
|
insecure_account_from_name("Charlie"),
|
||||||
account_from_name("Bob"),
|
insecure_account_from_name("Dave"),
|
||||||
account_from_name("Charlie"),
|
insecure_account_from_name("Eve"),
|
||||||
account_from_name("Dave"),
|
insecure_account_from_name("Ferdie"),
|
||||||
account_from_name("Eve"),
|
],
|
||||||
account_from_name("Ferdie"),
|
),
|
||||||
],
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
todo!("TODO")
|
|
||||||
})(),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,22 +218,17 @@ pub fn local_config() -> ChainSpec {
|
|||||||
"local",
|
"local",
|
||||||
ChainType::Local,
|
ChainType::Local,
|
||||||
"serai-local",
|
"serai-local",
|
||||||
&(move || {
|
&devnet_genesis(
|
||||||
/*
|
&["Alice", "Bob", "Charlie", "Dave"],
|
||||||
let _ = devnet_genesis(
|
vec![
|
||||||
&["Alice", "Bob", "Charlie", "Dave"],
|
insecure_account_from_name("Alice"),
|
||||||
vec![
|
insecure_account_from_name("Bob"),
|
||||||
account_from_name("Alice"),
|
insecure_account_from_name("Charlie"),
|
||||||
account_from_name("Bob"),
|
insecure_account_from_name("Dave"),
|
||||||
account_from_name("Charlie"),
|
insecure_account_from_name("Eve"),
|
||||||
account_from_name("Dave"),
|
insecure_account_from_name("Ferdie"),
|
||||||
account_from_name("Eve"),
|
],
|
||||||
account_from_name("Ferdie"),
|
),
|
||||||
],
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
todo!("TODO")
|
|
||||||
})(),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use serai_runtime::Block;
|
use serai_abi::SubstrateBlock as Block;
|
||||||
|
|
||||||
use sc_service::{PruningMode, PartialComponents};
|
use sc_service::{PruningMode, PartialComponents};
|
||||||
|
|
||||||
@@ -18,15 +18,15 @@ impl SubstrateCli for Cli {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn impl_version() -> String {
|
fn impl_version() -> String {
|
||||||
env!("SUBSTRATE_CLI_IMPL_VERSION").to_string()
|
String::new()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn description() -> String {
|
fn description() -> String {
|
||||||
env!("CARGO_PKG_DESCRIPTION").to_string()
|
String::new()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn author() -> String {
|
fn author() -> String {
|
||||||
env!("CARGO_PKG_AUTHORS").to_string()
|
String::new()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn support_url() -> String {
|
fn support_url() -> String {
|
||||||
|
|||||||
@@ -9,20 +9,12 @@ use sp_blockchain::{Error as BlockchainError, HeaderBackend, HeaderMetadata};
|
|||||||
use sp_block_builder::BlockBuilder;
|
use sp_block_builder::BlockBuilder;
|
||||||
use sp_api::ProvideRuntimeApi;
|
use sp_api::ProvideRuntimeApi;
|
||||||
|
|
||||||
use serai_runtime::{
|
use serai_abi::{primitives::prelude::*, SubstrateBlock as Block};
|
||||||
in_instructions::primitives::Shorthand,
|
use serai_runtime::*;
|
||||||
primitives::{ExternalNetworkId, NetworkId, PublicKey, SubstrateAmount, QuotePriceParams},
|
|
||||||
// validator_sets::ValidatorSetsApi,
|
|
||||||
dex::DexApi,
|
|
||||||
Block,
|
|
||||||
Nonce,
|
|
||||||
SeraiRuntimeApi,
|
|
||||||
};
|
|
||||||
|
|
||||||
use tokio::sync::RwLock;
|
use tokio::sync::RwLock;
|
||||||
|
|
||||||
use jsonrpsee::RpcModule;
|
use jsonrpsee::RpcModule;
|
||||||
// use scale::Encode;
|
|
||||||
|
|
||||||
use sc_client_api::BlockBackend;
|
use sc_client_api::BlockBackend;
|
||||||
use sc_transaction_pool_api::TransactionPool;
|
use sc_transaction_pool_api::TransactionPool;
|
||||||
@@ -35,50 +27,44 @@ pub struct FullDeps<C, P> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_full<
|
pub fn create_full<
|
||||||
C: ProvideRuntimeApi<Block>
|
C: 'static
|
||||||
+ HeaderBackend<Block>
|
|
||||||
+ HeaderMetadata<Block, Error = BlockchainError>
|
|
||||||
+ BlockBackend<Block>
|
|
||||||
+ Send
|
+ Send
|
||||||
+ Sync
|
+ Sync
|
||||||
+ 'static,
|
+ ProvideRuntimeApi<Block, Api: BlockBuilder<Block> + serai_runtime::SeraiApi<Block>>
|
||||||
P: TransactionPool + 'static,
|
+ HeaderBackend<Block>
|
||||||
|
+ HeaderMetadata<Block, Error = BlockchainError>
|
||||||
|
+ BlockBackend<Block>,
|
||||||
|
P: 'static + TransactionPool,
|
||||||
>(
|
>(
|
||||||
deps: FullDeps<C, P>,
|
deps: FullDeps<C, P>,
|
||||||
) -> Result<RpcModule<()>, Box<dyn std::error::Error + Send + Sync>>
|
) -> Result<RpcModule<()>, Box<dyn std::error::Error + Send + Sync>> {
|
||||||
where
|
|
||||||
C::Api: frame_system_rpc_runtime_api::AccountNonceApi<Block, PublicKey, Nonce>
|
|
||||||
+ pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, SubstrateAmount>
|
|
||||||
+ SeraiRuntimeApi<Block>
|
|
||||||
+ DexApi<Block>
|
|
||||||
+ BlockBuilder<Block>,
|
|
||||||
{
|
|
||||||
use substrate_frame_rpc_system::{System, SystemApiServer};
|
|
||||||
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
|
|
||||||
use ciphersuite::{GroupIo, WithPreferredHash};
|
|
||||||
use ciphersuite_kp256::{k256::elliptic_curve::point::AffineCoordinates, Secp256k1};
|
|
||||||
use dalek_ff_group::Ed25519;
|
|
||||||
use bitcoin_serai::bitcoin;
|
|
||||||
|
|
||||||
let mut module = RpcModule::new(());
|
let mut module = RpcModule::new(());
|
||||||
let FullDeps { id, client, pool, authority_discovery } = deps;
|
let FullDeps { id, client, pool, authority_discovery } = deps;
|
||||||
|
|
||||||
module.merge(System::new(client.clone(), pool).into_rpc())?;
|
|
||||||
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
|
|
||||||
|
|
||||||
if let Some(authority_discovery) = authority_discovery {
|
if let Some(authority_discovery) = authority_discovery {
|
||||||
let mut authority_discovery_module =
|
let mut authority_discovery_module =
|
||||||
RpcModule::new((id, client.clone(), RwLock::new(authority_discovery)));
|
RpcModule::new((id, client.clone(), RwLock::new(authority_discovery)));
|
||||||
authority_discovery_module.register_async_method(
|
authority_discovery_module.register_async_method(
|
||||||
"p2p_validators",
|
"p2p_validators",
|
||||||
|params, context, _ext| async move {
|
|params, context, _ext| async move {
|
||||||
let [network]: [NetworkId; 1] = params.parse()?;
|
let [network]: [String; 1] = params.parse()?;
|
||||||
|
let network = match network.to_lowercase().as_str() {
|
||||||
|
"serai" => NetworkId::Serai,
|
||||||
|
"bitcoin" => ExternalNetworkId::Bitcoin.into(),
|
||||||
|
"ethereum" => ExternalNetworkId::Ethereum.into(),
|
||||||
|
"monero" => ExternalNetworkId::Monero.into(),
|
||||||
|
_ => Err(jsonrpsee::types::error::ErrorObjectOwned::owned(
|
||||||
|
-1,
|
||||||
|
"network to fetch the `p2p_validators` of was unrecognized".to_string(),
|
||||||
|
Option::<()>::None,
|
||||||
|
))?,
|
||||||
|
};
|
||||||
let (id, client, authority_discovery) = &*context;
|
let (id, client, authority_discovery) = &*context;
|
||||||
let latest_block = client.info().best_hash;
|
let latest_block = client.info().best_hash;
|
||||||
|
|
||||||
let validators = client.runtime_api().validators(latest_block, network).map_err(|_| {
|
let validators = client.runtime_api().validators(latest_block, network).map_err(|_| {
|
||||||
jsonrpsee::types::error::ErrorObjectOwned::owned(
|
jsonrpsee::types::error::ErrorObjectOwned::owned(
|
||||||
-1,
|
-2,
|
||||||
format!(
|
format!(
|
||||||
"couldn't get validators from the latest block, which is likely a fatal bug. {}",
|
"couldn't get validators from the latest block, which is likely a fatal bug. {}",
|
||||||
"please report this at https://github.com/serai-dex/serai",
|
"please report this at https://github.com/serai-dex/serai",
|
||||||
@@ -122,6 +108,11 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* TODO
|
/* TODO
|
||||||
|
use ciphersuite::{GroupIo, WithPreferredHash};
|
||||||
|
use ciphersuite_kp256::{k256::elliptic_curve::point::AffineCoordinates, Secp256k1};
|
||||||
|
use dalek_ff_group::Ed25519;
|
||||||
|
use bitcoin_serai::bitcoin;
|
||||||
|
|
||||||
let mut serai_json_module = RpcModule::new(client);
|
let mut serai_json_module = RpcModule::new(client);
|
||||||
|
|
||||||
// add network address rpc
|
// add network address rpc
|
||||||
@@ -216,31 +207,28 @@ where
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
let mut block_bin_module = RpcModule::new(client);
|
let mut block_bin_module = RpcModule::new(client);
|
||||||
block_bin_module.register_async_method(
|
block_bin_module.register_async_method("serai_block", |params, client, _ext| async move {
|
||||||
"chain_getBlockBin",
|
let [block_hash]: [String; 1] = params.parse()?;
|
||||||
|params, client, _ext| async move {
|
let Some(block_hash) = hex::decode(&block_hash).ok().and_then(|bytes| {
|
||||||
let [block_hash]: [String; 1] = params.parse()?;
|
<[u8; 32]>::try_from(bytes.as_slice())
|
||||||
let Some(block_hash) = hex::decode(&block_hash).ok().and_then(|bytes| {
|
.map(<Block as sp_runtime::traits::Block>::Hash::from)
|
||||||
<[u8; 32]>::try_from(bytes.as_slice())
|
.ok()
|
||||||
.map(<Block as sp_runtime::traits::Block>::Hash::from)
|
}) else {
|
||||||
.ok()
|
return Err(jsonrpsee::types::error::ErrorObjectOwned::owned(
|
||||||
}) else {
|
-1,
|
||||||
return Err(jsonrpsee::types::error::ErrorObjectOwned::owned(
|
"requested block hash wasn't a valid hash",
|
||||||
-1,
|
Option::<()>::None,
|
||||||
"requested block hash wasn't a valid hash",
|
));
|
||||||
Option::<()>::None,
|
};
|
||||||
));
|
let Some(block) = client.block(block_hash).ok().flatten() else {
|
||||||
};
|
return Err(jsonrpsee::types::error::ErrorObjectOwned::owned(
|
||||||
let Some(block) = client.block(block_hash).ok().flatten() else {
|
-1,
|
||||||
return Err(jsonrpsee::types::error::ErrorObjectOwned::owned(
|
"couldn't find requested block",
|
||||||
-1,
|
Option::<()>::None,
|
||||||
"couldn't find requested block",
|
));
|
||||||
Option::<()>::None,
|
};
|
||||||
));
|
Ok(hex::encode(block.block.encode()))
|
||||||
};
|
})?;
|
||||||
Ok(hex::encode(block.block.encode()))
|
|
||||||
},
|
|
||||||
)?;
|
|
||||||
module.merge(block_bin_module)?;
|
module.merge(block_bin_module)?;
|
||||||
|
|
||||||
Ok(module)
|
Ok(module)
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ use sc_client_api::BlockBackend;
|
|||||||
|
|
||||||
use sc_telemetry::{Telemetry, TelemetryWorker};
|
use sc_telemetry::{Telemetry, TelemetryWorker};
|
||||||
|
|
||||||
use serai_runtime::{Block, RuntimeApi};
|
use serai_abi::SubstrateBlock as Block;
|
||||||
|
use serai_runtime::RuntimeApi;
|
||||||
|
|
||||||
use sc_consensus_babe::{self, SlotProportion};
|
use sc_consensus_babe::{self, SlotProportion};
|
||||||
use sc_consensus_grandpa as grandpa;
|
use sc_consensus_grandpa as grandpa;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ borsh = { version = "1", default-features = false, features = ["derive", "de_str
|
|||||||
|
|
||||||
bitvec = { version = "1", default-features = false, features = ["alloc"] }
|
bitvec = { version = "1", default-features = false, features = ["alloc"] }
|
||||||
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"], optional = true }
|
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"], optional = true }
|
||||||
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["alloc"] }
|
ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["alloc"] }
|
||||||
schnorr-signatures = { path = "../../crypto/schnorr", default-features = false }
|
schnorr-signatures = { path = "../../crypto/schnorr", default-features = false }
|
||||||
|
|||||||
@@ -20,22 +20,28 @@ workspace = true
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
|
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
|
||||||
|
|
||||||
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
sp-session = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-session = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
sp-version = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-inherents = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
sp-runtime = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-version = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
sp-api = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-runtime = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
sp-api = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
sp-consensus-babe = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
sp-consensus-grandpa = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
sp-block-builder = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
sp-transaction-pool = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
sp-authority-discovery = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
serai-abi = { path = "../abi", default-features = false, features = ["substrate"] }
|
serai-abi = { path = "../abi", default-features = false, features = ["substrate"] }
|
||||||
|
|
||||||
frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
frame-support = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
frame-support = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
frame-executive = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
frame-executive = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
pallet-timestamp = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
pallet-timestamp = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
pallet-session = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
pallet-session = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
pallet-babe = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
pallet-babe = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
pallet-grandpa = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
pallet-grandpa = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
serai-core-pallet = { path = "../core", default-features = false }
|
serai-core-pallet = { path = "../core", default-features = false }
|
||||||
serai-coins-pallet = { path = "../coins", default-features = false }
|
serai-coins-pallet = { path = "../coins", default-features = false }
|
||||||
@@ -43,7 +49,7 @@ serai-validator-sets-pallet = { path = "../validator-sets", default-features = f
|
|||||||
serai-signals-pallet = { path = "../signals", default-features = false }
|
serai-signals-pallet = { path = "../signals", default-features = false }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
substrate-wasm-builder = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4" }
|
substrate-wasm-builder = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
std = [
|
std = [
|
||||||
@@ -54,6 +60,11 @@ std = [
|
|||||||
"sp-version/std",
|
"sp-version/std",
|
||||||
"sp-runtime/std",
|
"sp-runtime/std",
|
||||||
"sp-api/std",
|
"sp-api/std",
|
||||||
|
"sp-consensus-babe/std",
|
||||||
|
"sp-consensus-grandpa/std",
|
||||||
|
"sp-block-builder/std",
|
||||||
|
"sp-transaction-pool/std",
|
||||||
|
"sp-authority-discovery/std",
|
||||||
|
|
||||||
"serai-abi/std",
|
"serai-abi/std",
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
|||||||
|
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
|
||||||
use alloc::borrow::Cow;
|
use alloc::{borrow::Cow, vec::Vec};
|
||||||
|
|
||||||
use sp_core::{ConstU32, ConstU64, sr25519::Public};
|
use sp_core::{ConstU32, ConstU64, sr25519::Public};
|
||||||
use sp_runtime::{Perbill, Weight};
|
use sp_runtime::{Perbill, Weight};
|
||||||
@@ -16,6 +16,7 @@ use serai_abi::{
|
|||||||
primitives::{
|
primitives::{
|
||||||
network_id::{ExternalNetworkId, NetworkId},
|
network_id::{ExternalNetworkId, NetworkId},
|
||||||
balance::{Amount, ExternalBalance},
|
balance::{Amount, ExternalBalance},
|
||||||
|
validator_sets::ValidatorSet,
|
||||||
address::SeraiAddress,
|
address::SeraiAddress,
|
||||||
},
|
},
|
||||||
SubstrateHeader as Header, SubstrateBlock,
|
SubstrateHeader as Header, SubstrateBlock,
|
||||||
@@ -319,7 +320,31 @@ impl From<serai_abi::Call> for RuntimeCall {
|
|||||||
|
|
||||||
type Executive = frame_executive::Executive<Runtime, Block, Context, Runtime, AllPalletsWithSystem>;
|
type Executive = frame_executive::Executive<Runtime, Block, Context, Runtime, AllPalletsWithSystem>;
|
||||||
|
|
||||||
|
sp_api::decl_runtime_apis! {
|
||||||
|
#[api_version(1)]
|
||||||
|
pub trait GenesisApi {
|
||||||
|
fn build(genesis: RuntimeGenesisConfig);
|
||||||
|
}
|
||||||
|
#[api_version(1)]
|
||||||
|
pub trait SeraiApi {
|
||||||
|
fn validators(network_id: NetworkId) -> Vec<Public>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const PRIMARY_PROBABILITY: (u64, u64) = (1, 4);
|
||||||
|
pub const BABE_GENESIS_EPOCH_CONFIG: sp_consensus_babe::BabeEpochConfiguration =
|
||||||
|
sp_consensus_babe::BabeEpochConfiguration {
|
||||||
|
c: PRIMARY_PROBABILITY,
|
||||||
|
allowed_slots: sp_consensus_babe::AllowedSlots::PrimaryAndSecondaryPlainSlots,
|
||||||
|
};
|
||||||
|
|
||||||
sp_api::impl_runtime_apis! {
|
sp_api::impl_runtime_apis! {
|
||||||
|
impl crate::GenesisApi<Block> for Runtime {
|
||||||
|
fn build(genesis: RuntimeGenesisConfig) {
|
||||||
|
<RuntimeGenesisConfig as frame_support::traits::BuildGenesisConfig>::build(&genesis)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl sp_api::Core<Block> for Runtime {
|
impl sp_api::Core<Block> for Runtime {
|
||||||
fn version() -> RuntimeVersion {
|
fn version() -> RuntimeVersion {
|
||||||
VERSION
|
VERSION
|
||||||
@@ -331,6 +356,148 @@ sp_api::impl_runtime_apis! {
|
|||||||
Executive::execute_block(block);
|
Executive::execute_block(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl sp_block_builder::BlockBuilder<Block> for Runtime {
|
||||||
|
fn apply_extrinsic(
|
||||||
|
extrinsic: <Block as sp_runtime::traits::Block>::Extrinsic,
|
||||||
|
) -> sp_runtime::ApplyExtrinsicResult {
|
||||||
|
Executive::apply_extrinsic(extrinsic)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn finalize_block() -> Header {
|
||||||
|
Executive::finalize_block()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn inherent_extrinsics(
|
||||||
|
data: sp_inherents::InherentData,
|
||||||
|
) -> Vec<<Block as sp_runtime::traits::Block>::Extrinsic> {
|
||||||
|
data.create_extrinsics()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn check_inherents(
|
||||||
|
block: Block,
|
||||||
|
data: sp_inherents::InherentData,
|
||||||
|
) -> sp_inherents::CheckInherentsResult {
|
||||||
|
data.check_extrinsics(&block)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
|
||||||
|
fn validate_transaction(
|
||||||
|
source: sp_runtime::transaction_validity::TransactionSource,
|
||||||
|
tx: <Block as sp_runtime::traits::Block>::Extrinsic,
|
||||||
|
block_hash: <Block as sp_runtime::traits::Block>::Hash,
|
||||||
|
) -> sp_runtime::transaction_validity::TransactionValidity {
|
||||||
|
Executive::validate_transaction(source, tx, block_hash)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl sp_consensus_babe::BabeApi<Block> for Runtime {
|
||||||
|
fn configuration() -> sp_consensus_babe::BabeConfiguration {
|
||||||
|
use frame_support::traits::Get;
|
||||||
|
|
||||||
|
let epoch_config = Babe::epoch_config().unwrap_or(BABE_GENESIS_EPOCH_CONFIG);
|
||||||
|
sp_consensus_babe::BabeConfiguration {
|
||||||
|
slot_duration: Babe::slot_duration(),
|
||||||
|
epoch_length: <Runtime as pallet_babe::Config>::EpochDuration::get(),
|
||||||
|
c: epoch_config.c,
|
||||||
|
authorities: Babe::authorities().to_vec(),
|
||||||
|
randomness: Babe::randomness(),
|
||||||
|
allowed_slots: epoch_config.allowed_slots,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn current_epoch_start() -> sp_consensus_babe::Slot {
|
||||||
|
Babe::current_epoch_start()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn current_epoch() -> sp_consensus_babe::Epoch {
|
||||||
|
Babe::current_epoch()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn next_epoch() -> sp_consensus_babe::Epoch {
|
||||||
|
Babe::next_epoch()
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Revisit
|
||||||
|
fn generate_key_ownership_proof(
|
||||||
|
_slot: sp_consensus_babe::Slot,
|
||||||
|
_authority_id: pallet_babe::AuthorityId,
|
||||||
|
) -> Option<sp_consensus_babe::OpaqueKeyOwnershipProof> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Revisit
|
||||||
|
fn submit_report_equivocation_unsigned_extrinsic(
|
||||||
|
equivocation_proof: sp_consensus_babe::EquivocationProof<Header>,
|
||||||
|
_: sp_consensus_babe::OpaqueKeyOwnershipProof,
|
||||||
|
) -> Option<()> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl sp_consensus_grandpa::GrandpaApi<Block> for Runtime {
|
||||||
|
fn grandpa_authorities() -> sp_consensus_grandpa::AuthorityList {
|
||||||
|
Grandpa::grandpa_authorities()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn current_set_id() -> sp_consensus_grandpa::SetId {
|
||||||
|
Grandpa::current_set_id()
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Revisit
|
||||||
|
fn generate_key_ownership_proof(
|
||||||
|
_set_id: sp_consensus_grandpa::SetId,
|
||||||
|
_authority_id: pallet_grandpa::AuthorityId,
|
||||||
|
) -> Option<sp_consensus_grandpa::OpaqueKeyOwnershipProof> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Revisit
|
||||||
|
fn submit_report_equivocation_unsigned_extrinsic(
|
||||||
|
equivocation_proof: sp_consensus_grandpa::EquivocationProof<
|
||||||
|
<Block as sp_runtime::traits::Block>::Hash,
|
||||||
|
u64,
|
||||||
|
>,
|
||||||
|
_: sp_consensus_grandpa::OpaqueKeyOwnershipProof,
|
||||||
|
) -> Option<()> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl sp_authority_discovery::AuthorityDiscoveryApi<Block> for Runtime {
|
||||||
|
fn authorities() -> Vec<sp_authority_discovery::AuthorityId> {
|
||||||
|
// Converts to `[u8; 32]` so it can be hashed
|
||||||
|
let mut all = alloc::collections::BTreeSet::<[u8; 32]>::new();
|
||||||
|
for network in NetworkId::all() {
|
||||||
|
for participant in
|
||||||
|
<Self as crate::runtime_decl_for_serai_api::SeraiApi<Block>>::validators(network) {
|
||||||
|
all.insert(participant.into());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
all
|
||||||
|
.into_iter()
|
||||||
|
.map(|id| sp_authority_discovery::AuthorityId::from(sp_core::sr25519::Public::from(id)))
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl crate::SeraiApi<Block> for Runtime {
|
||||||
|
fn validators(network: NetworkId) -> Vec<Public> {
|
||||||
|
// Returning the latest-decided, not latest and active, means the active set
|
||||||
|
// may fail to peer find if there isn't sufficient overlap. If a large amount reboot,
|
||||||
|
// forcing some validators to successfully peer find in order for the threshold to become
|
||||||
|
// online again, this may cause a liveness failure.
|
||||||
|
//
|
||||||
|
// This is assumed not to matter in real life, yet an interesting note.
|
||||||
|
let Some(session) = ValidatorSets::latest_decided_session(network) else {
|
||||||
|
return alloc::vec![]
|
||||||
|
};
|
||||||
|
ValidatorSets::selected_validators(ValidatorSet { network, session })
|
||||||
|
.map(|validator| validator.0)
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Default, PartialEq, Eq, Debug)]
|
#[derive(Clone, Default, PartialEq, Eq, Debug)]
|
||||||
@@ -406,96 +573,8 @@ impl serai_abi::TransactionContext for Context {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* TODO
|
/* TODO
|
||||||
use core::marker::PhantomData;
|
|
||||||
|
|
||||||
// Re-export all components
|
|
||||||
pub use serai_primitives as primitives;
|
|
||||||
pub use primitives::{BlockNumber, Header};
|
|
||||||
|
|
||||||
pub use frame_system as system;
|
|
||||||
pub use frame_support as support;
|
|
||||||
|
|
||||||
pub use pallet_timestamp as timestamp;
|
|
||||||
|
|
||||||
pub use pallet_transaction_payment as transaction_payment;
|
|
||||||
|
|
||||||
pub use coins_pallet as coins;
|
|
||||||
pub use dex_pallet as dex;
|
|
||||||
|
|
||||||
pub use validator_sets_pallet as validator_sets;
|
|
||||||
|
|
||||||
pub use in_instructions_pallet as in_instructions;
|
|
||||||
|
|
||||||
pub use signals_pallet as signals;
|
|
||||||
|
|
||||||
pub use genesis_liquidity_pallet as genesis_liquidity;
|
|
||||||
pub use emissions_pallet as emissions;
|
|
||||||
|
|
||||||
pub use economic_security_pallet as economic_security;
|
|
||||||
|
|
||||||
// Actually used by the runtime
|
|
||||||
use sp_core::OpaqueMetadata;
|
|
||||||
use sp_std::prelude::*;
|
|
||||||
|
|
||||||
use sp_version::RuntimeVersion;
|
|
||||||
#[cfg(feature = "std")]
|
|
||||||
use sp_version::NativeVersion;
|
|
||||||
|
|
||||||
use sp_runtime::{
|
|
||||||
create_runtime_str, generic, impl_opaque_keys, KeyTypeId,
|
|
||||||
traits::{Convert, BlakeTwo256, Block as BlockT},
|
|
||||||
transaction_validity::{TransactionSource, TransactionValidity},
|
|
||||||
BoundedVec, Perbill, ApplyExtrinsicResult,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[allow(unused_imports)]
|
|
||||||
use primitives::{
|
|
||||||
NetworkId, ExternalNetworkId, PublicKey, AccountLookup, SubstrateAmount, Coin, EXTERNAL_NETWORKS,
|
|
||||||
MEDIAN_PRICE_WINDOW_LENGTH, HOURS, DAYS, MINUTES, TARGET_BLOCK_TIME, BLOCK_SIZE,
|
|
||||||
FAST_EPOCH_DURATION,
|
|
||||||
};
|
|
||||||
|
|
||||||
use support::{
|
|
||||||
traits::{ConstU8, ConstU16, ConstU32, ConstU64, Contains},
|
|
||||||
weights::{
|
|
||||||
constants::{RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND},
|
|
||||||
IdentityFee, Weight,
|
|
||||||
},
|
|
||||||
parameter_types, construct_runtime,
|
|
||||||
};
|
|
||||||
|
|
||||||
use validator_sets::MembershipProof;
|
use validator_sets::MembershipProof;
|
||||||
|
|
||||||
use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
|
|
||||||
use babe::AuthorityId as BabeId;
|
|
||||||
use grandpa::AuthorityId as GrandpaId;
|
|
||||||
|
|
||||||
/// A hash of some data used by the chain.
|
|
||||||
pub type Hash = sp_core::H256;
|
|
||||||
|
|
||||||
pub type SignedExtra = (
|
|
||||||
system::CheckNonZeroSender<Runtime>,
|
|
||||||
system::CheckWeight<Runtime>, TODO
|
|
||||||
);
|
|
||||||
|
|
||||||
pub mod opaque {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
impl_opaque_keys! {
|
|
||||||
pub struct SessionKeys {
|
|
||||||
pub babe: Babe,
|
|
||||||
pub grandpa: Grandpa,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4);
|
|
||||||
pub const BABE_GENESIS_EPOCH_CONFIG: sp_consensus_babe::BabeEpochConfiguration =
|
|
||||||
sp_consensus_babe::BabeEpochConfiguration {
|
|
||||||
c: PRIMARY_PROBABILITY,
|
|
||||||
allowed_slots: sp_consensus_babe::AllowedSlots::PrimaryAndSecondaryPlainSlots,
|
|
||||||
};
|
|
||||||
|
|
||||||
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
@@ -589,33 +668,6 @@ impl pallet_authorship::Config for Runtime {
|
|||||||
/// Longevity of an offence report.
|
/// Longevity of an offence report.
|
||||||
pub type ReportLongevity = <Runtime as pallet_babe::Config>::EpochDuration;
|
pub type ReportLongevity = <Runtime as pallet_babe::Config>::EpochDuration;
|
||||||
|
|
||||||
construct_runtime!(
|
|
||||||
pub enum Runtime {
|
|
||||||
System: system exclude_parts { Call },
|
|
||||||
|
|
||||||
Timestamp: timestamp,
|
|
||||||
|
|
||||||
TransactionPayment: transaction_payment,
|
|
||||||
|
|
||||||
Coins: coins,
|
|
||||||
LiquidityTokens: coins::<Instance1>::{Pallet, Call, Storage, Event<T>},
|
|
||||||
Dex: dex,
|
|
||||||
|
|
||||||
ValidatorSets: validator_sets,
|
|
||||||
GenesisLiquidity: genesis_liquidity,
|
|
||||||
Emissions: emissions,
|
|
||||||
|
|
||||||
EconomicSecurity: economic_security,
|
|
||||||
|
|
||||||
InInstructions: in_instructions,
|
|
||||||
|
|
||||||
Signals: signals,
|
|
||||||
|
|
||||||
Babe: babe,
|
|
||||||
Grandpa: grandpa,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
#[cfg(feature = "runtime-benchmarks")]
|
#[cfg(feature = "runtime-benchmarks")]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate frame_benchmarking;
|
extern crate frame_benchmarking;
|
||||||
@@ -637,229 +689,7 @@ mod benches {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sp_api::impl_runtime_apis! {
|
sp_api::impl_runtime_apis! {
|
||||||
impl sp_api::Core<Block> for Runtime {
|
|
||||||
fn version() -> RuntimeVersion {
|
|
||||||
VERSION
|
|
||||||
}
|
|
||||||
|
|
||||||
fn execute_block(block: Block) {
|
|
||||||
Executive::execute_block(block);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn initialize_block(header: &Header) {
|
|
||||||
Executive::initialize_block(header)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl sp_api::Metadata<Block> for Runtime {
|
|
||||||
fn metadata() -> OpaqueMetadata {
|
|
||||||
OpaqueMetadata::new(Runtime::metadata().into())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn metadata_at_version(version: u32) -> Option<OpaqueMetadata> {
|
|
||||||
Runtime::metadata_at_version(version)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn metadata_versions() -> sp_std::vec::Vec<u32> {
|
|
||||||
Runtime::metadata_versions()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl sp_block_builder::BlockBuilder<Block> for Runtime {
|
|
||||||
fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
|
|
||||||
Executive::apply_extrinsic(extrinsic)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn finalize_block() -> Header {
|
|
||||||
Executive::finalize_block()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
|
|
||||||
data.create_extrinsics()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn check_inherents(
|
|
||||||
block: Block,
|
|
||||||
data: sp_inherents::InherentData,
|
|
||||||
) -> sp_inherents::CheckInherentsResult {
|
|
||||||
data.check_extrinsics(&block)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
|
|
||||||
fn validate_transaction(
|
|
||||||
source: TransactionSource,
|
|
||||||
tx: <Block as BlockT>::Extrinsic,
|
|
||||||
block_hash: <Block as BlockT>::Hash,
|
|
||||||
) -> TransactionValidity {
|
|
||||||
Executive::validate_transaction(source, tx, block_hash)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
|
|
||||||
fn offchain_worker(header: &Header) {
|
|
||||||
Executive::offchain_worker(header)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl sp_session::SessionKeys<Block> for Runtime {
|
|
||||||
fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
|
|
||||||
opaque::SessionKeys::generate(seed)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn decode_session_keys(
|
|
||||||
encoded: Vec<u8>,
|
|
||||||
) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
|
|
||||||
opaque::SessionKeys::decode_into_raw_public_keys(&encoded)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl sp_consensus_babe::BabeApi<Block> for Runtime {
|
|
||||||
fn configuration() -> sp_consensus_babe::BabeConfiguration {
|
|
||||||
use support::traits::Get;
|
|
||||||
|
|
||||||
let epoch_config = Babe::epoch_config().unwrap_or(BABE_GENESIS_EPOCH_CONFIG);
|
|
||||||
sp_consensus_babe::BabeConfiguration {
|
|
||||||
slot_duration: Babe::slot_duration(),
|
|
||||||
epoch_length: <Runtime as babe::Config>::EpochDuration::get(),
|
|
||||||
c: epoch_config.c,
|
|
||||||
authorities: Babe::authorities().to_vec(),
|
|
||||||
randomness: Babe::randomness(),
|
|
||||||
allowed_slots: epoch_config.allowed_slots,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn current_epoch_start() -> sp_consensus_babe::Slot {
|
|
||||||
Babe::current_epoch_start()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn current_epoch() -> sp_consensus_babe::Epoch {
|
|
||||||
Babe::current_epoch()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn next_epoch() -> sp_consensus_babe::Epoch {
|
|
||||||
Babe::next_epoch()
|
|
||||||
}
|
|
||||||
|
|
||||||
// This refers to a key being 'owned' by an authority in a system with multiple keys per
|
|
||||||
// validator
|
|
||||||
// Since we do not have such an infrastructure, we do not need this
|
|
||||||
fn generate_key_ownership_proof(
|
|
||||||
_slot: sp_consensus_babe::Slot,
|
|
||||||
_authority_id: BabeId,
|
|
||||||
) -> Option<sp_consensus_babe::OpaqueKeyOwnershipProof> {
|
|
||||||
Some(sp_consensus_babe::OpaqueKeyOwnershipProof::new(vec![]))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn submit_report_equivocation_unsigned_extrinsic(
|
|
||||||
equivocation_proof: sp_consensus_babe::EquivocationProof<Header>,
|
|
||||||
_: sp_consensus_babe::OpaqueKeyOwnershipProof,
|
|
||||||
) -> Option<()> {
|
|
||||||
let proof = MembershipProof(equivocation_proof.offender.clone().into(), PhantomData);
|
|
||||||
Babe::submit_unsigned_equivocation_report(equivocation_proof, proof)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl sp_consensus_grandpa::GrandpaApi<Block> for Runtime {
|
|
||||||
fn grandpa_authorities() -> sp_consensus_grandpa::AuthorityList {
|
|
||||||
Grandpa::grandpa_authorities()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn current_set_id() -> sp_consensus_grandpa::SetId {
|
|
||||||
Grandpa::current_set_id()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn generate_key_ownership_proof(
|
|
||||||
_set_id: sp_consensus_grandpa::SetId,
|
|
||||||
_authority_id: GrandpaId,
|
|
||||||
) -> Option<sp_consensus_grandpa::OpaqueKeyOwnershipProof> {
|
|
||||||
Some(sp_consensus_grandpa::OpaqueKeyOwnershipProof::new(vec![]))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn submit_report_equivocation_unsigned_extrinsic(
|
|
||||||
equivocation_proof: sp_consensus_grandpa::EquivocationProof<<Block as BlockT>::Hash, u64>,
|
|
||||||
_: sp_consensus_grandpa::OpaqueKeyOwnershipProof,
|
|
||||||
) -> Option<()> {
|
|
||||||
let proof = MembershipProof(equivocation_proof.offender().clone().into(), PhantomData);
|
|
||||||
Grandpa::submit_unsigned_equivocation_report(equivocation_proof, proof)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl frame_system_rpc_runtime_api::AccountNonceApi<Block, PublicKey, Nonce> for Runtime {
|
|
||||||
fn account_nonce(account: PublicKey) -> Nonce {
|
|
||||||
System::account_nonce(account)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<
|
|
||||||
Block,
|
|
||||||
SubstrateAmount
|
|
||||||
> for Runtime {
|
|
||||||
fn query_info(
|
|
||||||
uxt: <Block as BlockT>::Extrinsic,
|
|
||||||
len: u32,
|
|
||||||
) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo<SubstrateAmount> {
|
|
||||||
TransactionPayment::query_info(uxt, len)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn query_fee_details(
|
|
||||||
uxt: <Block as BlockT>::Extrinsic,
|
|
||||||
len: u32,
|
|
||||||
) -> transaction_payment::FeeDetails<SubstrateAmount> {
|
|
||||||
TransactionPayment::query_fee_details(uxt, len)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn query_weight_to_fee(weight: Weight) -> SubstrateAmount {
|
|
||||||
TransactionPayment::weight_to_fee(weight)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn query_length_to_fee(length: u32) -> SubstrateAmount {
|
|
||||||
TransactionPayment::length_to_fee(length)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl sp_authority_discovery::AuthorityDiscoveryApi<Block> for Runtime {
|
|
||||||
fn authorities() -> Vec<AuthorityDiscoveryId> {
|
|
||||||
// Converts to `[u8; 32]` so it can be hashed
|
|
||||||
let serai_validators = Babe::authorities()
|
|
||||||
.into_iter()
|
|
||||||
.map(|(id, _)| id.into_inner().0)
|
|
||||||
.collect::<hashbrown::HashSet<_>>();
|
|
||||||
let mut all = serai_validators;
|
|
||||||
for network in EXTERNAL_NETWORKS {
|
|
||||||
// Returning the latest-decided, not latest and active, means the active set
|
|
||||||
// may fail to peer find if there isn't sufficient overlap. If a large amount reboot,
|
|
||||||
// forcing some validators to successfully peer find in order for the threshold to become
|
|
||||||
// online again, this may cause a liveness failure.
|
|
||||||
//
|
|
||||||
// This is assumed not to matter in real life, yet an interesting note.
|
|
||||||
let participants =
|
|
||||||
ValidatorSets::participants_for_latest_decided_set(NetworkId::from(network))
|
|
||||||
.map_or(vec![], BoundedVec::into_inner);
|
|
||||||
for (participant, _) in participants {
|
|
||||||
all.insert(participant.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
all.into_iter().map(|id| AuthorityDiscoveryId::from(PublicKey::from_raw(id))).collect()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl validator_sets::ValidatorSetsApi<Block> for Runtime {
|
impl validator_sets::ValidatorSetsApi<Block> for Runtime {
|
||||||
fn validators(network_id: NetworkId) -> Vec<PublicKey> {
|
|
||||||
if network_id == NetworkId::Serai {
|
|
||||||
Babe::authorities()
|
|
||||||
.into_iter()
|
|
||||||
.map(|(id, _)| id.into_inner())
|
|
||||||
.collect()
|
|
||||||
} else {
|
|
||||||
ValidatorSets::participants_for_latest_decided_set(network_id)
|
|
||||||
.map_or(
|
|
||||||
vec![],
|
|
||||||
|vec| vec.into_inner().into_iter().map(|(validator, _)| validator).collect()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn external_network_key(network: ExternalNetworkId) -> Option<Vec<u8>> {
|
fn external_network_key(network: ExternalNetworkId) -> Option<Vec<u8>> {
|
||||||
ValidatorSets::external_network_key(network)
|
ValidatorSets::external_network_key(network)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,10 +21,10 @@ workspace = true
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
|
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
|
||||||
|
|
||||||
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
frame-support = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
frame-support = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
serai-abi = { path = "../abi", default-features = false, features = ["substrate"] }
|
serai-abi = { path = "../abi", default-features = false, features = ["substrate"] }
|
||||||
|
|
||||||
|
|||||||
@@ -20,17 +20,17 @@ bitvec = { version = "1", default-features = false, features = ["alloc", "serde"
|
|||||||
|
|
||||||
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "bit-vec"] }
|
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "bit-vec"] }
|
||||||
|
|
||||||
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
sp-application-crypto = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-application-crypto = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
sp-io = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-io = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
sp-api = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
sp-api = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
frame-system = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
frame-support = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
frame-support = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
pallet-session = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
pallet-session = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
pallet-babe = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
pallet-babe = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
pallet-grandpa = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "5dfddc95c32994c1c09bd0c7a9e3633f1e5c7cc4", default-features = false }
|
pallet-grandpa = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "dd8f2ab6c80c609f15714f554194529116b717ef", default-features = false }
|
||||||
|
|
||||||
serai-abi = { path = "../abi", default-features = false, features = ["substrate"] }
|
serai-abi = { path = "../abi", default-features = false, features = ["substrate"] }
|
||||||
|
|
||||||
|
|||||||
@@ -301,6 +301,12 @@ mod pallet {
|
|||||||
requirement
|
requirement
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn selected_validators(
|
||||||
|
set: ValidatorSet,
|
||||||
|
) -> impl Iterator<Item = (Public, KeySharesStruct)> {
|
||||||
|
Abstractions::<T>::selected_validators(set)
|
||||||
|
}
|
||||||
|
|
||||||
/* TODO
|
/* TODO
|
||||||
pub fn distribute_block_rewards(
|
pub fn distribute_block_rewards(
|
||||||
network: NetworkId,
|
network: NetworkId,
|
||||||
|
|||||||
Reference in New Issue
Block a user