mirror of
https://github.com/serai-dex/serai.git
synced 2025-03-15 16:12:44 +00:00
Update node to latest sc_tendermint
This commit is contained in:
parent
9a26ac6899
commit
86aaadaea0
4 changed files with 5 additions and 10 deletions
|
@ -223,6 +223,7 @@ pub async fn new_full(config: Configuration) -> Result<TaskManager, ServiceError
|
||||||
"tendermint",
|
"tendermint",
|
||||||
None,
|
None,
|
||||||
TendermintAuthority::new(authority).authority(
|
TendermintAuthority::new(authority).authority(
|
||||||
|
(0, keystore_container.keystore()),
|
||||||
Cidp,
|
Cidp,
|
||||||
sc_basic_authorship::ProposerFactory::new(
|
sc_basic_authorship::ProposerFactory::new(
|
||||||
task_manager.spawn_handle(),
|
task_manager.spawn_handle(),
|
||||||
|
|
|
@ -10,6 +10,7 @@ use log::warn;
|
||||||
use tokio::task::yield_now;
|
use tokio::task::yield_now;
|
||||||
|
|
||||||
use sp_core::{Encode, Decode};
|
use sp_core::{Encode, Decode};
|
||||||
|
use sp_keystore::CryptoStore;
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
traits::{Header, Block},
|
traits::{Header, Block},
|
||||||
Digest,
|
Digest,
|
||||||
|
@ -132,10 +133,10 @@ impl<T: TendermintValidator> TendermintAuthority<T> {
|
||||||
/// as it will not return until the P2P stack shuts down.
|
/// as it will not return until the P2P stack shuts down.
|
||||||
pub async fn authority(
|
pub async fn authority(
|
||||||
mut self,
|
mut self,
|
||||||
|
validator: (u16, Arc<dyn CryptoStore>),
|
||||||
providers: T::CIDP,
|
providers: T::CIDP,
|
||||||
env: T::Environment,
|
env: T::Environment,
|
||||||
network: T::Network,
|
network: T::Network,
|
||||||
validator: (u16, T::Keystore),
|
|
||||||
registry: Option<&Registry>,
|
registry: Option<&Registry>,
|
||||||
) {
|
) {
|
||||||
let (best_hash, last) = self.get_last();
|
let (best_hash, last) = self.get_last();
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use sp_core::crypto::KeyTypeId;
|
use sp_core::crypto::KeyTypeId;
|
||||||
use sp_keystore::CryptoStore;
|
|
||||||
use sp_inherents::CreateInherentDataProviders;
|
use sp_inherents::CreateInherentDataProviders;
|
||||||
use sp_runtime::traits::{Header, Block};
|
use sp_runtime::traits::{Header, Block};
|
||||||
use sp_blockchain::HeaderBackend;
|
use sp_blockchain::HeaderBackend;
|
||||||
|
@ -58,8 +57,6 @@ pub trait TendermintClient: Send + Sync + 'static {
|
||||||
+ Finalizer<Self::Block, Self::Backend>
|
+ Finalizer<Self::Block, Self::Backend>
|
||||||
+ ProvideRuntimeApi<Self::Block, Api = Self::Api>
|
+ ProvideRuntimeApi<Self::Block, Api = Self::Api>
|
||||||
+ 'static;
|
+ 'static;
|
||||||
|
|
||||||
type Keystore: CryptoStore;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Trait implementable on firm types to automatically provide a full TendermintClient impl.
|
/// Trait implementable on firm types to automatically provide a full TendermintClient impl.
|
||||||
|
@ -77,8 +74,6 @@ pub trait TendermintClientMinimal: Send + Sync + 'static {
|
||||||
+ Finalizer<Self::Block, Self::Backend>
|
+ Finalizer<Self::Block, Self::Backend>
|
||||||
+ ProvideRuntimeApi<Self::Block, Api = Self::Api>
|
+ ProvideRuntimeApi<Self::Block, Api = Self::Api>
|
||||||
+ 'static;
|
+ 'static;
|
||||||
|
|
||||||
type Keystore: CryptoStore;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: TendermintClientMinimal> TendermintClient for T
|
impl<T: TendermintClientMinimal> TendermintClient for T
|
||||||
|
@ -96,8 +91,6 @@ where
|
||||||
type StateBackend = StateBackendFor<T::Client, T::Block>;
|
type StateBackend = StateBackendFor<T::Client, T::Block>;
|
||||||
type Api = <T::Client as ProvideRuntimeApi<T::Block>>::Api;
|
type Api = <T::Client as ProvideRuntimeApi<T::Block>>::Api;
|
||||||
type Client = T::Client;
|
type Client = T::Client;
|
||||||
|
|
||||||
type Keystore = T::Keystore;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Trait consolidating additional generics required by sc_tendermint for authoring.
|
/// Trait consolidating additional generics required by sc_tendermint for authoring.
|
||||||
|
|
|
@ -85,7 +85,7 @@ impl<T: TendermintClient> Deref for Refresh<T> {
|
||||||
/// Tendermint validators observer, providing data on the active validators.
|
/// Tendermint validators observer, providing data on the active validators.
|
||||||
pub struct TendermintValidators<T: TendermintClient>(
|
pub struct TendermintValidators<T: TendermintClient>(
|
||||||
Refresh<T>,
|
Refresh<T>,
|
||||||
Arc<AsyncRwLock<Option<T::Keystore>>>,
|
Arc<AsyncRwLock<Option<Arc<dyn CryptoStore>>>>,
|
||||||
);
|
);
|
||||||
|
|
||||||
impl<T: TendermintClient> TendermintValidators<T> {
|
impl<T: TendermintClient> TendermintValidators<T> {
|
||||||
|
@ -99,7 +99,7 @@ impl<T: TendermintClient> TendermintValidators<T> {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) async fn set_keys(&self, keys: T::Keystore) {
|
pub(crate) async fn set_keys(&self, keys: Arc<dyn CryptoStore>) {
|
||||||
*self.1.write().await = Some(keys);
|
*self.1.write().await = Some(keys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue