Move to polkadot-sdk

Still a WIP, and using an experimental branch with 2 not-yet-merged PRs merged.
This commit is contained in:
Luke Parker 2023-11-27 06:01:47 -05:00
parent 008da698bc
commit d038aa95fd
No known key found for this signature in database
21 changed files with 673 additions and 812 deletions

1222
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -94,8 +94,13 @@ panic = "unwind"
lazy_static = { git = "https://github.com/rust-lang-nursery/lazy-static.rs", rev = "5735630d46572f1e5377c8f2ba0f79d18f53b10c" } lazy_static = { git = "https://github.com/rust-lang-nursery/lazy-static.rs", rev = "5735630d46572f1e5377c8f2ba0f79d18f53b10c" }
# subxt *can* pull these off crates.io yet there's no benefit to this # subxt *can* pull these off crates.io yet there's no benefit to this
sp-core-hashing = { git = "https://github.com/serai-dex/substrate" } sp-core-hashing = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
sp-std = { git = "https://github.com/serai-dex/substrate" } sp-std = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
# The external arkworks-substrate repo refers back to the paritytech
# polkadot-sdk repo, hence patching it to point to serai-dex's
[patch."https://github.com/paritytech/polkadot-sdk"]
sp-crypto-ec-utils = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
[workspace.lints.clippy] [workspace.lints.clippy]
unwrap_or_default = "allow" unwrap_or_default = "allow"

View file

@ -39,7 +39,7 @@ processor-messages = { package = "serai-processor-messages", path = "../processo
message-queue = { package = "serai-message-queue", path = "../message-queue" } message-queue = { package = "serai-message-queue", path = "../message-queue" }
tributary = { package = "tributary-chain", path = "./tributary" } tributary = { package = "tributary-chain", path = "./tributary" }
sp-application-crypto = { git = "https://github.com/serai-dex/substrate", default-features = false, features = ["std"] } sp-application-crypto = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false, features = ["std"] }
serai-client = { path = "../substrate/client", default-features = false, features = ["serai", "borsh"] } serai-client = { path = "../substrate/client", default-features = false, features = ["serai", "borsh"] }
hex = { version = "0.4", default-features = false, features = ["std"] } hex = { version = "0.4", default-features = false, features = ["std"] }
@ -54,8 +54,8 @@ libp2p = { version = "0.52", default-features = false, features = ["tokio", "tcp
[dev-dependencies] [dev-dependencies]
futures-util = { version = "0.3", default-features = false, features = ["std"] } futures-util = { version = "0.3", default-features = false, features = ["std"] }
tributary = { package = "tributary-chain", path = "./tributary", features = ["tests"] } tributary = { package = "tributary-chain", path = "./tributary", features = ["tests"] }
sp-application-crypto = { git = "https://github.com/serai-dex/substrate", default-features = false, features = ["std"] } sp-application-crypto = { git = "https://github.com/serai-dex/substrate", branch = "experimental", default-features = false, features = ["std"] }
sp-runtime = { git = "https://github.com/serai-dex/substrate", default-features = false, features = ["std"] } sp-runtime = { git = "https://github.com/serai-dex/substrate", branch = "experimental", default-features = false, features = ["std"] }
[features] [features]
parity-db = ["serai-db/parity-db"] parity-db = ["serai-db/parity-db"]

View file

@ -98,6 +98,6 @@ allow-registry = ["https://github.com/rust-lang/crates.io-index"]
allow-git = [ allow-git = [
"https://github.com/rust-lang-nursery/lazy-static.rs", "https://github.com/rust-lang-nursery/lazy-static.rs",
"https://github.com/serai-dex/substrate-bip39", "https://github.com/serai-dex/substrate-bip39",
"https://github.com/serai-dex/substrate", "https://github.com/serai-dex/polkadot-sdk",
"https://github.com/monero-rs/base58-monero", "https://github.com/monero-rs/base58-monero",
] ]

View file

@ -66,7 +66,7 @@ message-queue = { package = "serai-message-queue", path = "../message-queue", op
[dev-dependencies] [dev-dependencies]
frost = { package = "modular-frost", path = "../crypto/frost", features = ["tests"] } frost = { package = "modular-frost", path = "../crypto/frost", features = ["tests"] }
sp-application-crypto = { git = "https://github.com/serai-dex/substrate", default-features = false, features = ["std"] } sp-application-crypto = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false, features = ["std"] }
dockertest = "0.4" dockertest = "0.4"
serai-docker-tests = { path = "../tests/docker" } serai-docker-tests = { path = "../tests/docker" }

View file

@ -22,14 +22,14 @@ workspace = true
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"] }
frame-system = { git = "https://github.com/serai-dex/substrate", default-features = false } frame-system = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
frame-support = { git = "https://github.com/serai-dex/substrate", default-features = false } frame-support = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-core = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-core = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-std = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-std = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-runtime = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-runtime = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
pallet-transaction-payment = { git = "https://github.com/serai-dex/substrate", default-features = false } pallet-transaction-payment = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
serai-primitives = { path = "../../primitives", default-features = false, features = ["serde"] } serai-primitives = { path = "../../primitives", default-features = false, features = ["serde"] }
coins-primitives = { package = "serai-coins-primitives", path = "../primitives", default-features = false } coins-primitives = { package = "serai-coins-primitives", path = "../primitives", default-features = false }

View file

@ -26,7 +26,7 @@ scale-info = { version = "2", default-features = false, features = ["derive"] }
serai-primitives = { path = "../../primitives", default-features = false } serai-primitives = { path = "../../primitives", default-features = false }
[dev-dependencies] [dev-dependencies]
sp-runtime = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-runtime = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
[features] [features]
std = ["zeroize", "borsh?/std", "serde?/std", "scale/std", "scale-info/std", "sp-runtime/std", "serai-primitives/std"] std = ["zeroize", "borsh?/std", "serde?/std", "scale/std", "scale-info/std", "sp-runtime/std", "serai-primitives/std"]

View file

@ -22,15 +22,15 @@ workspace = true
scale = { package = "parity-scale-codec", version = "3.6.1", default-features = false } scale = { package = "parity-scale-codec", version = "3.6.1", default-features = false }
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
sp-std = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-std = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-io = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-io = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-api = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-api = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-runtime = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-runtime = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-core = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-core = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
frame-system = { git = "https://github.com/serai-dex/substrate", default-features = false } frame-system = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
frame-support = { git = "https://github.com/serai-dex/substrate", default-features = false } frame-support = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
frame-benchmarking = { git = "https://github.com/serai-dex/substrate", default-features = false, optional = true } frame-benchmarking = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false, optional = true }
coins-pallet = { package = "serai-coins-pallet", path = "../../coins/pallet", default-features = false } coins-pallet = { package = "serai-coins-pallet", path = "../../coins/pallet", default-features = false }

View file

@ -68,11 +68,7 @@ impl frame_system::Config for Test {
type Version = (); type Version = ();
type PalletInfo = PalletInfo; type PalletInfo = PalletInfo;
type AccountData = (); type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = (); type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<16>; type MaxConsumers = ConstU32<16>;
} }

View file

@ -22,14 +22,14 @@ workspace = true
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"] }
scale-info = { version = "2", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"] }
sp-std = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-std = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-application-crypto = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-application-crypto = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-io = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-io = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-runtime = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-runtime = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-core = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-core = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
frame-system = { git = "https://github.com/serai-dex/substrate", default-features = false } frame-system = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
frame-support = { git = "https://github.com/serai-dex/substrate", default-features = false } frame-support = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
serai-primitives = { path = "../../primitives", default-features = false } serai-primitives = { path = "../../primitives", default-features = false }
in-instructions-primitives = { package = "serai-in-instructions-primitives", path = "../primitives", default-features = false } in-instructions-primitives = { package = "serai-in-instructions-primitives", path = "../primitives", default-features = false }

View file

@ -23,9 +23,9 @@ serde = { version = "1", default-features = false, features = ["derive", "alloc"
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"] }
sp-std = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-std = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-application-crypto = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-application-crypto = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-runtime = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-runtime = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
serai-primitives = { path = "../../primitives", default-features = false } serai-primitives = { path = "../../primitives", default-features = false }
coins-primitives = { package = "serai-coins-primitives", path = "../../coins/primitives", default-features = false } coins-primitives = { package = "serai-coins-primitives", path = "../../coins/primitives", default-features = false }

View file

@ -23,45 +23,45 @@ name = "serai-node"
clap = { version = "4", features = ["derive"] } clap = { version = "4", features = ["derive"] }
futures = "0.3" futures = "0.3"
jsonrpsee = { version = "0.16", features = ["server"] } jsonrpsee = { version = "0.20", features = ["server"] }
sp-core = { git = "https://github.com/serai-dex/substrate" } sp-core = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
sp-timestamp = { git = "https://github.com/serai-dex/substrate" } sp-timestamp = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
sp-io = { git = "https://github.com/serai-dex/substrate" } sp-io = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
sp-blockchain = { git = "https://github.com/serai-dex/substrate" } sp-blockchain = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
sp-api = { git = "https://github.com/serai-dex/substrate" } sp-api = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
sp-block-builder = { git = "https://github.com/serai-dex/substrate" } sp-block-builder = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
sp-consensus-babe = { git = "https://github.com/serai-dex/substrate" } sp-consensus-babe = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
frame-benchmarking = { git = "https://github.com/serai-dex/substrate" } frame-benchmarking = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
serai-runtime = { path = "../runtime", features = ["std"] } serai-runtime = { path = "../runtime", features = ["std"] }
sc-offchain = { git = "https://github.com/serai-dex/substrate" } sc-offchain = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
sc-transaction-pool = { git = "https://github.com/serai-dex/substrate" } sc-transaction-pool = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
sc-transaction-pool-api = { git = "https://github.com/serai-dex/substrate" } sc-transaction-pool-api = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
sc-basic-authorship = { git = "https://github.com/serai-dex/substrate" } sc-basic-authorship = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
sc-executor = { git = "https://github.com/serai-dex/substrate" } sc-executor = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
sc-service = { git = "https://github.com/serai-dex/substrate" } sc-service = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
sc-client-api = { git = "https://github.com/serai-dex/substrate" } sc-client-api = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
sc-network-common = { git = "https://github.com/serai-dex/substrate" } sc-network-sync = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
sc-network = { git = "https://github.com/serai-dex/substrate" } sc-network = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
sc-consensus = { git = "https://github.com/serai-dex/substrate" } sc-consensus = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
sc-consensus-babe = { git = "https://github.com/serai-dex/substrate" } sc-consensus-babe = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
sc-consensus-grandpa = { git = "https://github.com/serai-dex/substrate" } sc-consensus-grandpa = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
sc-authority-discovery = { git = "https://github.com/serai-dex/substrate" } sc-authority-discovery = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
sc-telemetry = { git = "https://github.com/serai-dex/substrate" } sc-telemetry = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
sc-cli = { git = "https://github.com/serai-dex/substrate" } sc-cli = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
sc-rpc-api = { git = "https://github.com/serai-dex/substrate" } sc-rpc-api = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
substrate-frame-rpc-system = { git = "https://github.com/serai-dex/substrate" } substrate-frame-rpc-system = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
pallet-transaction-payment-rpc = { git = "https://github.com/serai-dex/substrate" } pallet-transaction-payment-rpc = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
[build-dependencies] [build-dependencies]
substrate-build-script-utils = { git = "https://github.com/serai-dex/substrate" } substrate-build-script-utils = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
[features] [features]
default = [] default = []

View file

@ -16,13 +16,12 @@ fn account_from_name(name: &'static str) -> PublicKey {
} }
fn testnet_genesis( fn testnet_genesis(
wasm_binary: &[u8],
validators: &[&'static str], validators: &[&'static str],
endowed_accounts: Vec<PublicKey>, endowed_accounts: Vec<PublicKey>,
) -> RuntimeGenesisConfig { ) -> RuntimeGenesisConfig {
let validators = validators.iter().map(|name| account_from_name(name)).collect::<Vec<_>>(); let validators = validators.iter().map(|name| account_from_name(name)).collect::<Vec<_>>();
RuntimeGenesisConfig { RuntimeGenesisConfig {
system: SystemConfig { code: wasm_binary.to_vec(), _config: PhantomData }, system: SystemConfig { _config: PhantomData },
transaction_payment: Default::default(), transaction_payment: Default::default(),
@ -67,6 +66,7 @@ fn testnet_genesis(
pub fn development_config() -> Result<ChainSpec, &'static str> { pub fn development_config() -> Result<ChainSpec, &'static str> {
let wasm_binary = WASM_BINARY.ok_or("Development wasm not available")?; let wasm_binary = WASM_BINARY.ok_or("Development wasm not available")?;
#[allow(deprecated)]
Ok(ChainSpec::from_genesis( Ok(ChainSpec::from_genesis(
// Name // Name
"Development Network", "Development Network",
@ -75,7 +75,6 @@ pub fn development_config() -> Result<ChainSpec, &'static str> {
ChainType::Development, ChainType::Development,
|| { || {
testnet_genesis( testnet_genesis(
wasm_binary,
&["Alice"], &["Alice"],
vec![ vec![
account_from_name("Alice"), account_from_name("Alice"),
@ -99,12 +98,15 @@ pub fn development_config() -> Result<ChainSpec, &'static str> {
None, None,
// Extensions // Extensions
None, None,
// Code
wasm_binary,
)) ))
} }
pub fn testnet_config() -> Result<ChainSpec, &'static str> { pub fn testnet_config() -> Result<ChainSpec, &'static str> {
let wasm_binary = WASM_BINARY.ok_or("Testnet wasm not available")?; let wasm_binary = WASM_BINARY.ok_or("Testnet wasm not available")?;
#[allow(deprecated)]
Ok(ChainSpec::from_genesis( Ok(ChainSpec::from_genesis(
// Name // Name
"Local Test Network", "Local Test Network",
@ -113,7 +115,6 @@ pub fn testnet_config() -> Result<ChainSpec, &'static str> {
ChainType::Local, ChainType::Local,
|| { || {
testnet_genesis( testnet_genesis(
wasm_binary,
&["Alice", "Bob", "Charlie", "Dave"], &["Alice", "Bob", "Charlie", "Dave"],
vec![ vec![
account_from_name("Alice"), account_from_name("Alice"),
@ -137,5 +138,7 @@ pub fn testnet_config() -> Result<ChainSpec, &'static str> {
None, None,
// Extensions // Extensions
None, None,
// Code
wasm_binary,
)) ))
} }

View file

@ -8,7 +8,7 @@ use sp_consensus_babe::{SlotDuration, inherents::InherentDataProvider as BabeInh
use sp_io::SubstrateHostFunctions; use sp_io::SubstrateHostFunctions;
use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, WasmExecutor}; use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, WasmExecutor};
use sc_network_common::sync::warp::WarpSyncParams; use sc_network_sync::warp::WarpSyncParams;
use sc_network::{Event, NetworkEventStream}; use sc_network::{Event, NetworkEventStream};
use sc_service::{error::Error as ServiceError, Configuration, TaskManager, TFullClient}; use sc_service::{error::Error as ServiceError, Configuration, TaskManager, TFullClient};
@ -40,7 +40,7 @@ type PartialComponents = sc_service::PartialComponents<
FullClient, FullClient,
FullBackend, FullBackend,
SelectChain, SelectChain,
sc_consensus::DefaultImportQueue<Block, FullClient>, sc_consensus::DefaultImportQueue<Block>,
sc_transaction_pool::FullPool<Block, FullClient>, sc_transaction_pool::FullPool<Block, FullClient>,
( (
BabeBlockImport, BabeBlockImport,
@ -104,6 +104,7 @@ pub fn new_partial(config: &Configuration) -> Result<PartialComponents, ServiceE
let (grandpa_block_import, grandpa_link) = grandpa::block_import( let (grandpa_block_import, grandpa_link) = grandpa::block_import(
client.clone(), client.clone(),
512,
&client, &client,
select_chain.clone(), select_chain.clone(),
telemetry.as_ref().map(Telemetry::handle), telemetry.as_ref().map(Telemetry::handle),
@ -186,6 +187,8 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
import_queue, import_queue,
block_announce_validator_builder: None, block_announce_validator_builder: None,
warp_sync_params: Some(WarpSyncParams::WithProvider(warp_sync)), warp_sync_params: Some(WarpSyncParams::WithProvider(warp_sync)),
// TODO: Add a BlockRequestHandler here
block_relay: None,
})?; })?;
if config.offchain_worker.enabled { if config.offchain_worker.enabled {
@ -199,7 +202,6 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
offchain_db: backend.offchain_storage(), offchain_db: backend.offchain_storage(),
transaction_pool: Some(OffchainTransactionPoolFactory::new(transaction_pool.clone())), transaction_pool: Some(OffchainTransactionPoolFactory::new(transaction_pool.clone())),
network_provider: network.clone(), network_provider: network.clone(),
enable_http_requests: true,
custom_extensions: |_| vec![], custom_extensions: |_| vec![],
}) })
.run(client.clone(), task_manager.spawn_handle()), .run(client.clone(), task_manager.spawn_handle()),
@ -311,7 +313,7 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
grandpa::run_grandpa_voter(grandpa::GrandpaParams { grandpa::run_grandpa_voter(grandpa::GrandpaParams {
config: grandpa::Config { config: grandpa::Config {
gossip_duration: std::time::Duration::from_millis(333), gossip_duration: std::time::Duration::from_millis(333),
justification_period: 512, justification_generation_period: 10,
name: Some(name), name: Some(name),
observer_enabled: false, observer_enabled: false,
keystore: if role.is_authority() { Some(keystore) } else { None }, keystore: if role.is_authority() { Some(keystore) } else { None },

View file

@ -24,9 +24,9 @@ scale-info = { version = "2", default-features = false, features = ["derive"] }
borsh = { version = "1", default-features = false, features = ["derive", "de_strict_order"], optional = true } borsh = { version = "1", default-features = false, features = ["derive", "de_strict_order"], optional = true }
serde = { version = "1", default-features = false, features = ["derive", "alloc"], optional = true } serde = { version = "1", default-features = false, features = ["derive", "alloc"], optional = true }
sp-application-crypto = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-application-crypto = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-core = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-core = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-runtime = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-runtime = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
frame-support = { git = "https://github.com/serai-dex/substrate", default-features = false } frame-support = { git = "https://github.com/serai-dex/substrate", default-features = false }

View file

@ -22,36 +22,36 @@ workspace = true
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"] }
sp-core = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-core = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-std = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-std = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-offchain = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-offchain = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-version = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-version = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-inherents = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-inherents = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-session = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-session = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-consensus-babe = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-consensus-babe = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-consensus-grandpa = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-consensus-grandpa = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-authority-discovery = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-authority-discovery = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-transaction-pool = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-transaction-pool = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-block-builder = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-block-builder = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-runtime = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-runtime = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-api = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-api = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
frame-system = { git = "https://github.com/serai-dex/substrate", default-features = false } frame-system = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
frame-support = { git = "https://github.com/serai-dex/substrate", default-features = false } frame-support = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
frame-executive = { git = "https://github.com/serai-dex/substrate", default-features = false } frame-executive = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
frame-benchmarking = { git = "https://github.com/serai-dex/substrate", default-features = false, optional = true } frame-benchmarking = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false, optional = true }
serai-primitives = { path = "../primitives", default-features = false } serai-primitives = { path = "../primitives", default-features = false }
pallet-timestamp = { git = "https://github.com/serai-dex/substrate", default-features = false } pallet-timestamp = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
pallet-authorship = { git = "https://github.com/serai-dex/substrate", default-features = false } pallet-authorship = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
pallet-transaction-payment = { git = "https://github.com/serai-dex/substrate", default-features = false } pallet-transaction-payment = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
coins-pallet = { package = "serai-coins-pallet", path = "../coins/pallet", default-features = false } coins-pallet = { package = "serai-coins-pallet", path = "../coins/pallet", default-features = false }
dex-pallet = { package = "serai-dex-pallet", path = "../dex/pallet", default-features = false } dex-pallet = { package = "serai-dex-pallet", path = "../dex/pallet", default-features = false }
@ -62,14 +62,14 @@ in-instructions-pallet = { package = "serai-in-instructions-pallet", path = "../
signals-pallet = { package = "serai-signals-pallet", path = "../signals/pallet", default-features = false } signals-pallet = { package = "serai-signals-pallet", path = "../signals/pallet", default-features = false }
pallet-babe = { git = "https://github.com/serai-dex/substrate", default-features = false } pallet-babe = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
pallet-grandpa = { git = "https://github.com/serai-dex/substrate", default-features = false } pallet-grandpa = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
frame-system-rpc-runtime-api = { git = "https://github.com/serai-dex/substrate", default-features = false } frame-system-rpc-runtime-api = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/serai-dex/substrate", default-features = false } pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
[build-dependencies] [build-dependencies]
substrate-wasm-builder = { git = "https://github.com/serai-dex/substrate" } substrate-wasm-builder = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" }
[features] [features]
std = [ std = [

View file

@ -36,8 +36,6 @@ use sp_core::OpaqueMetadata;
use sp_std::prelude::*; use sp_std::prelude::*;
use sp_version::RuntimeVersion; use sp_version::RuntimeVersion;
#[cfg(feature = "std")]
use sp_version::NativeVersion;
use sp_runtime::{ use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys, KeyTypeId, create_runtime_str, generic, impl_opaque_keys, KeyTypeId,
@ -100,17 +98,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("serai"), spec_name: create_runtime_str!("serai"),
impl_name: create_runtime_str!("core"), impl_name: create_runtime_str!("core"),
spec_version: 1, spec_version: 1,
impl_version: 1,
apis: RUNTIME_API_VERSIONS, apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
state_version: 1, state_version: 1,
}; };
#[cfg(feature = "std")]
pub fn native_version() -> NativeVersion {
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
}
// 1 MB // 1 MB
pub const BLOCK_SIZE: u32 = 1024 * 1024; pub const BLOCK_SIZE: u32 = 1024 * 1024;
// 6 seconds // 6 seconds
@ -170,13 +161,13 @@ impl Contains<RuntimeCall> for CallFilter {
RuntimeCall::Babe(call) => match call { RuntimeCall::Babe(call) => match call {
babe::Call::report_equivocation { .. } | babe::Call::report_equivocation { .. } |
babe::Call::report_equivocation_unsigned { .. } => true, babe::Call::report_equivocation_unsigned { .. } => true,
babe::Call::plan_config_change { .. } | babe::Call::__Ignore(_, _) => false, babe::Call::__Ignore(_, _) => false,
}, },
RuntimeCall::Grandpa(call) => match call { RuntimeCall::Grandpa(call) => match call {
grandpa::Call::report_equivocation { .. } | grandpa::Call::report_equivocation { .. } |
grandpa::Call::report_equivocation_unsigned { .. } => true, grandpa::Call::report_equivocation_unsigned { .. } => true,
grandpa::Call::note_stalled { .. } | grandpa::Call::__Ignore(_, _) => false, grandpa::Call::__Ignore(_, _) => false,
}, },
} }
} }
@ -200,13 +191,8 @@ impl system::Config for Runtime {
type Version = Version; type Version = Version;
type PalletInfo = PalletInfo; type PalletInfo = PalletInfo;
type OnNewAccount = ();
type OnKilledAccount = ();
type OnSetCode = ();
type AccountData = (); type AccountData = ();
type SystemWeightInfo = (); type SystemWeightInfo = ();
type SS58Prefix = SS58Prefix; // TODO: Remove for Bech32m
type MaxConsumers = support::traits::ConstU32<16>; type MaxConsumers = support::traits::ConstU32<16>;
} }
@ -308,6 +294,7 @@ impl babe::Config for Runtime {
type WeightInfo = (); type WeightInfo = ();
type MaxAuthorities = MaxAuthorities; type MaxAuthorities = MaxAuthorities;
type MaxNominators = ConstU32<1>;
type KeyOwnerProof = MembershipProof<Self>; type KeyOwnerProof = MembershipProof<Self>;
type EquivocationReportSystem = type EquivocationReportSystem =
@ -318,7 +305,9 @@ impl grandpa::Config for Runtime {
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
type WeightInfo = (); type WeightInfo = ();
type MaxAuthorities = MaxAuthorities; type MaxAuthorities = MaxAuthorities;
type MaxNominators = ConstU32<1>;
type MaxSetIdSessionEntries = ConstU64<0>; type MaxSetIdSessionEntries = ConstU64<0>;
type KeyOwnerProof = MembershipProof<Self>; type KeyOwnerProof = MembershipProof<Self>;

View file

@ -22,11 +22,11 @@ workspace = true
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"] }
sp-core = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-core = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-io = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-io = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
frame-system = { git = "https://github.com/serai-dex/substrate", default-features = false } frame-system = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
frame-support = { git = "https://github.com/serai-dex/substrate", default-features = false } frame-support = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
serai-primitives = { path = "../../primitives", default-features = false } serai-primitives = { path = "../../primitives", default-features = false }
serai-signals-primitives = { path = "../primitives", default-features = false } serai-signals-primitives = { path = "../primitives", default-features = false }

View file

@ -14,7 +14,7 @@ pub mod pallet {
use sp_io::hashing::blake2_256; use sp_io::hashing::blake2_256;
use frame_system::pallet_prelude::*; use frame_system::pallet_prelude::*;
use frame_support::{pallet_prelude::*, sp_runtime}; use frame_support::pallet_prelude::*;
use serai_primitives::*; use serai_primitives::*;
use serai_signals_primitives::SignalId; use serai_signals_primitives::SignalId;

View file

@ -24,19 +24,19 @@ hashbrown = { version = "0.14", default-features = false, features = ["ahash", "
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"] }
sp-core = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-core = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-io = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-io = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-std = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-std = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-application-crypto = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-application-crypto = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-runtime = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-runtime = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-session = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-session = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-staking = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-staking = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
frame-system = { git = "https://github.com/serai-dex/substrate", default-features = false } frame-system = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
frame-support = { git = "https://github.com/serai-dex/substrate", default-features = false } frame-support = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
pallet-babe = { git = "https://github.com/serai-dex/substrate", default-features = false } pallet-babe = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
pallet-grandpa = { git = "https://github.com/serai-dex/substrate", default-features = false } pallet-grandpa = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
serai-primitives = { path = "../../primitives", default-features = false } serai-primitives = { path = "../../primitives", default-features = false }
validator-sets-primitives = { package = "serai-validator-sets-primitives", path = "../primitives", default-features = false } validator-sets-primitives = { package = "serai-validator-sets-primitives", path = "../primitives", default-features = false }

View file

@ -27,8 +27,8 @@ serde = { version = "1", default-features = false, features = ["derive", "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"] }
scale-info = { version = "2", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"] }
sp-core = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-core = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
sp-std = { git = "https://github.com/serai-dex/substrate", default-features = false } sp-std = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental", default-features = false }
serai-primitives = { path = "../../primitives", default-features = false } serai-primitives = { path = "../../primitives", default-features = false }