Most of coordinator Tributary retiry

Adds Event::SetRetired to validator-sets.

Emit TributaryRetired.

Replaces is_active_set, which made multiple network requests, with
is_retired_tributary, a DB read.

Performs most of the removals necessary upon TributaryRetired.

Still needs to clean up the actual Tributary/Tendermint tasks.
This commit is contained in:
Luke Parker
2023-10-14 16:47:25 -04:00
parent 5897efd7c7
commit 3b3fdd104b
10 changed files with 145 additions and 110 deletions

View File

@@ -426,7 +426,7 @@ pub(crate) async fn handle_application_tx<
// Because this Batch has achieved synchrony, its batch ID should be authorized
TributaryDb::<D>::recognize_topic(txn, genesis, Topic::Batch(batch));
let nonce = NonceDecider::<D>::handle_batch(txn, genesis, batch);
recognized_id(spec.set().network, genesis, RecognizedIdType::Batch, batch, nonce).await;
recognized_id(spec.set(), genesis, RecognizedIdType::Batch, batch, nonce).await;
}
Transaction::SubstrateBlock(block) => {
@@ -438,7 +438,7 @@ pub(crate) async fn handle_application_tx<
let nonces = NonceDecider::<D>::handle_substrate_block(txn, genesis, &plan_ids);
for (nonce, id) in nonces.into_iter().zip(plan_ids.into_iter()) {
TributaryDb::<D>::recognize_topic(txn, genesis, Topic::Sign(id));
recognized_id(spec.set().network, genesis, RecognizedIdType::Plan, id, nonce).await;
recognized_id(spec.set(), genesis, RecognizedIdType::Plan, id, nonce).await;
}
}

View File

@@ -7,9 +7,7 @@ use ciphersuite::{Ciphersuite, Ristretto};
use tokio::sync::broadcast;
use serai_client::{
primitives::NetworkId, validator_sets::primitives::ValidatorSet, subxt::utils::Encoded, Serai,
};
use serai_client::{validator_sets::primitives::ValidatorSet, subxt::utils::Encoded, Serai};
use tributary::{
TransactionKind, Transaction as TributaryTransaction, Block, TributaryReader,
@@ -36,10 +34,10 @@ pub enum RecognizedIdType {
}
pub(crate) trait RIDTrait<FRid>:
Clone + Fn(NetworkId, [u8; 32], RecognizedIdType, [u8; 32], u32) -> FRid
Clone + Fn(ValidatorSet, [u8; 32], RecognizedIdType, [u8; 32], u32) -> FRid
{
}
impl<FRid, F: Clone + Fn(NetworkId, [u8; 32], RecognizedIdType, [u8; 32], u32) -> FRid>
impl<FRid, F: Clone + Fn(ValidatorSet, [u8; 32], RecognizedIdType, [u8; 32], u32) -> FRid>
RIDTrait<FRid> for F
{
}