Update node to latest sc_tendermint

This commit is contained in:
Luke Parker 2022-11-01 21:32:18 -04:00
parent 9a26ac6899
commit 86aaadaea0
No known key found for this signature in database
GPG key ID: F9F1386DB1E119B6
4 changed files with 5 additions and 10 deletions

View file

@ -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(),

View file

@ -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();

View file

@ -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.

View file

@ -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);
} }
} }