diff --git a/Cargo.lock b/Cargo.lock index cc72ce40..d5adcdbf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7589,6 +7589,7 @@ dependencies = [ "frame-benchmarking-cli", "frame-system", "jsonrpsee", + "log", "pallet-tendermint", "pallet-transaction-payment", "pallet-transaction-payment-rpc", @@ -7616,7 +7617,9 @@ dependencies = [ "sp-core", "sp-inherents", "sp-keyring", + "sp-keystore", "sp-runtime", + "sp-tendermint", "sp-timestamp", "substrate-build-script-utils", "substrate-frame-rpc-system", diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml index 6f1e4855..232d0a2c 100644 --- a/deploy/docker-compose.yml +++ b/deploy/docker-compose.yml @@ -25,7 +25,6 @@ volumes: services: - _serai: &serai_defaults restart: unless-stopped @@ -61,7 +60,7 @@ services: - cluster-coins-lg environment: CHAIN: dev - NAME: Alice + NAME: alice VALIDATOR: true serai-bob: @@ -75,7 +74,8 @@ services: - cluster-coins-lg environment: CHAIN: dev - NAME: Bob + NAME: bob + VALIDATOR: true serai-charlie: <<: *serai_defaults @@ -88,7 +88,8 @@ services: - cluster-coins-lg environment: CHAIN: dev - NAME: Charlie + NAME: charlie + VALIDATOR: true serai-dave: <<: *serai_defaults @@ -122,6 +123,7 @@ services: environment: CHAIN: dev NAME: Ferdie + # Processor Services # Coin Services diff --git a/deploy/serai/Dockerfile b/deploy/serai/Dockerfile index b46543cd..9c7f1370 100644 --- a/deploy/serai/Dockerfile +++ b/deploy/serai/Dockerfile @@ -26,12 +26,11 @@ RUN --mount=type=cache,target=/usr/local/cargo/git \ --mount=type=cache,target=/serai/target/release/build \ --mount=type=cache,target=/serai/target/release/deps \ --mount=type=cache,target=/serai/target/release/.fingerprint \ - --mount=type=cache,target=/serai/target/release/incremental \ + --mount=type=cache,target=/serai/target/release/incremental \ --mount=type=cache,target=/serai/target/release/wbuild \ --mount=type=cache,target=/serai/target/release/lib* \ cargo build --release - # Prepare Image FROM ubuntu:latest as image LABEL description="STAGE 2: Copy and Run" diff --git a/deploy/serai/scripts/entry-dev.sh b/deploy/serai/scripts/entry-dev.sh index 5e8353b9..911da8f5 100755 --- a/deploy/serai/scripts/entry-dev.sh +++ b/deploy/serai/scripts/entry-dev.sh @@ -1,6 +1,6 @@ #!/bin/bash if [[ -z $VALIDATOR ]]; then - serai-node --chain $CHAIN --name $NAME + serai-node --chain $CHAIN --$NAME else - serai-node --chain $CHAIN --name $NAME --validator + serai-node --chain $CHAIN --$NAME --validator fi diff --git a/substrate/node/Cargo.toml b/substrate/node/Cargo.toml index a6b74b5e..50394c7f 100644 --- a/substrate/node/Cargo.toml +++ b/substrate/node/Cargo.toml @@ -14,11 +14,14 @@ name = "serai-node" [dependencies] async-trait = "0.1" +log = "0.4" + clap = { version = "4", features = ["derive"] } jsonrpsee = { version = "0.15", features = ["server"] } sp-core = { git = "https://github.com/serai-dex/substrate" } sp-application-crypto = { git = "https://github.com/serai-dex/substrate" } +sp-keystore = { git = "https://github.com/serai-dex/substrate" } sp-keyring = { git = "https://github.com/serai-dex/substrate" } sp-inherents = { git = "https://github.com/serai-dex/substrate" } sp-timestamp = { git = "https://github.com/serai-dex/substrate" } @@ -53,6 +56,7 @@ sc-rpc-api = { git = "https://github.com/serai-dex/substrate" } substrate-frame-rpc-system = { git = "https://github.com/serai-dex/substrate" } pallet-transaction-payment-rpc = { git = "https://github.com/serai-dex/substrate" } +sp-tendermint = { path = "../tendermint/primitives" } pallet-tendermint = { path = "../tendermint/pallet", default-features = false } serai-runtime = { path = "../runtime" } sc_tendermint = { path = "../tendermint/client" } diff --git a/substrate/node/src/chain_spec.rs b/substrate/node/src/chain_spec.rs index ab0d1f56..aac15e50 100644 --- a/substrate/node/src/chain_spec.rs +++ b/substrate/node/src/chain_spec.rs @@ -19,7 +19,11 @@ fn account_id_from_name(name: &'static str) -> AccountId { } fn testnet_genesis(wasm_binary: &[u8], endowed_accounts: Vec) -> GenesisConfig { - let alice = account_id_from_name("Alice"); + let session_key = |name| { + let key = account_id_from_name(name); + (key, key, SessionKeys { tendermint: Public::from(key) }) + }; + GenesisConfig { system: SystemConfig { code: wasm_binary.to_vec() }, balances: BalancesConfig { @@ -27,7 +31,7 @@ fn testnet_genesis(wasm_binary: &[u8], endowed_accounts: Vec) -> Gene }, transaction_payment: Default::default(), session: SessionConfig { - keys: vec![(alice, alice, SessionKeys { tendermint: Public::from(alice) })], + keys: vec![session_key("Alice"), session_key("Bob"), session_key("Charlie")], }, } } diff --git a/substrate/node/src/service.rs b/substrate/node/src/service.rs index 88610c51..5a122df1 100644 --- a/substrate/node/src/service.rs +++ b/substrate/node/src/service.rs @@ -1,9 +1,11 @@ use std::{boxed::Box, sync::Arc, error::Error}; +use sp_keystore::SyncCryptoStore; use sp_runtime::traits::{Block as BlockTrait}; use sp_inherents::CreateInherentDataProviders; use sp_consensus::DisableProofRecording; -use sp_api::ProvideRuntimeApi; +use sp_api::{BlockId, ProvideRuntimeApi}; +use sp_tendermint::TendermintApi; use sc_executor::{NativeVersion, NativeExecutionDispatch, NativeElseWasmExecutor}; use sc_transaction_pool::FullPool; @@ -219,23 +221,44 @@ pub async fn new_full(config: Configuration) -> Result