mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 12:49:23 +00:00
Get all processors to compile again
Requires splitting `serai-cosign` into `serai-cosign` and `serai-cosign-types` so the processor don't require `serai-client/serai` (not correct yet).
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
use serai_validator_sets_primitives::Session;
|
||||
use serai_in_instructions_primitives::{Batch, SignedBatch};
|
||||
use serai_primitives::{
|
||||
validator_sets::Session,
|
||||
instructions::{Batch, SignedBatch},
|
||||
};
|
||||
|
||||
use serai_db::{Get, DbTxn, create_db};
|
||||
|
||||
|
||||
@@ -6,10 +6,7 @@ use ciphersuite::group::GroupEncoding;
|
||||
use dalek_ff_group::Ristretto;
|
||||
use frost::dkg::ThresholdKeys;
|
||||
|
||||
use scale::Encode;
|
||||
|
||||
use serai_validator_sets_primitives::Session;
|
||||
use serai_in_instructions_primitives::{SignedBatch, batch_message};
|
||||
use serai_primitives::{validator_sets::Session, instructions::SignedBatch};
|
||||
|
||||
use serai_db::{Get, DbTxn, Db};
|
||||
|
||||
@@ -74,7 +71,7 @@ impl<D: Db, E: GroupEncoding> BatchSignerTask<D, E> {
|
||||
machines.push(WrappedSchnorrkelMachine::new(
|
||||
keys.clone(),
|
||||
b"substrate",
|
||||
batch_message(&batch),
|
||||
batch.publish_batch_message(),
|
||||
));
|
||||
}
|
||||
attempt_manager.register(VariantSignId::Batch(id), machines);
|
||||
@@ -100,14 +97,14 @@ impl<D: Db, E: Send + GroupEncoding> ContinuallyRan for BatchSignerTask<D, E> {
|
||||
iterated = true;
|
||||
|
||||
// Save this to the database as a transaction to sign
|
||||
let batch_hash = <[u8; 32]>::from(Blake2b::<U32>::digest(batch.encode()));
|
||||
let batch_hash = <[u8; 32]>::from(Blake2b::<U32>::digest(borsh::to_vec(&batch).unwrap()));
|
||||
self.active_signing_protocols.insert(batch_hash);
|
||||
ActiveSigningProtocols::set(
|
||||
&mut txn,
|
||||
self.session,
|
||||
&self.active_signing_protocols.iter().copied().collect(),
|
||||
);
|
||||
BatchHash::set(&mut txn, batch.id, &batch_hash);
|
||||
BatchHash::set(&mut txn, batch.id(), &batch_hash);
|
||||
Batches::set(&mut txn, batch_hash, &batch);
|
||||
|
||||
let mut machines = Vec::with_capacity(self.keys.len());
|
||||
@@ -116,7 +113,7 @@ impl<D: Db, E: Send + GroupEncoding> ContinuallyRan for BatchSignerTask<D, E> {
|
||||
machines.push(WrappedSchnorrkelMachine::new(
|
||||
keys.clone(),
|
||||
b"substrate",
|
||||
batch_message(&batch),
|
||||
batch.publish_batch_message(),
|
||||
));
|
||||
}
|
||||
for msg in self.attempt_manager.register(VariantSignId::Batch(batch_hash), machines) {
|
||||
@@ -160,8 +157,8 @@ impl<D: Db, E: Send + GroupEncoding> ContinuallyRan for BatchSignerTask<D, E> {
|
||||
// Update the last acknowledged Batch
|
||||
{
|
||||
let last_acknowledged = LastAcknowledgedBatch::get(&txn);
|
||||
if Some(batch.id) > last_acknowledged {
|
||||
LastAcknowledgedBatch::set(&mut txn, &batch.id);
|
||||
if Some(batch.id()) > last_acknowledged {
|
||||
LastAcknowledgedBatch::set(&mut txn, &batch.id());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +171,7 @@ impl<D: Db, E: Send + GroupEncoding> ContinuallyRan for BatchSignerTask<D, E> {
|
||||
);
|
||||
|
||||
// Clean up SignedBatches
|
||||
SignedBatches::del(&mut txn, batch.id);
|
||||
SignedBatches::del(&mut txn, batch.id());
|
||||
|
||||
// We retire with a txn so we either successfully flag this Batch as acknowledged, and
|
||||
// won't re-register it (making this retire safe), or we don't flag it, meaning we will
|
||||
@@ -203,7 +200,7 @@ impl<D: Db, E: Send + GroupEncoding> ContinuallyRan for BatchSignerTask<D, E> {
|
||||
let batch =
|
||||
Batches::get(&txn, id).expect("signed a Batch we didn't save to the database");
|
||||
let signed_batch = SignedBatch { batch, signature: signature.into() };
|
||||
SignedBatches::set(&mut txn, signed_batch.batch.id, &signed_batch);
|
||||
SignedBatches::set(&mut txn, signed_batch.batch.id(), &signed_batch);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use core::future::Future;
|
||||
|
||||
use serai_primitives::Signature;
|
||||
use serai_primitives::crypto::Signature;
|
||||
|
||||
use serai_db::{DbTxn, Db};
|
||||
|
||||
@@ -140,7 +140,7 @@ impl<D: Db, C: Coordinator> ContinuallyRan for CoordinatorTask<D, C> {
|
||||
let mut next_batch = last_batch.map(|id| id + 1).unwrap_or(0);
|
||||
while let Some(batch) = crate::batch::signed_batch(&txn, next_batch) {
|
||||
iterated = true;
|
||||
db::LastPublishedBatch::set(&mut txn, &batch.batch.id);
|
||||
db::LastPublishedBatch::set(&mut txn, &batch.batch.id());
|
||||
self
|
||||
.coordinator
|
||||
.publish_signed_batch(batch)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use serai_validator_sets_primitives::Session;
|
||||
use serai_primitives::validator_sets::Session;
|
||||
|
||||
use serai_db::{Get, DbTxn, create_db};
|
||||
|
||||
|
||||
@@ -3,9 +3,7 @@ use core::future::Future;
|
||||
use dalek_ff_group::Ristretto;
|
||||
use frost::dkg::ThresholdKeys;
|
||||
|
||||
use scale::Encode;
|
||||
use serai_primitives::Signature;
|
||||
use serai_validator_sets_primitives::Session;
|
||||
use serai_primitives::{crypto::Signature, validator_sets::Session};
|
||||
|
||||
use serai_db::{DbTxn, Db};
|
||||
|
||||
@@ -127,7 +125,7 @@ impl<D: Db> ContinuallyRan for CosignerTask<D> {
|
||||
LatestCosigned::set(&mut txn, self.session, &cosign.block_number);
|
||||
let cosign = SignedCosign {
|
||||
cosign,
|
||||
signature: Signature::from(signature).encode().try_into().unwrap(),
|
||||
signature: borsh::to_vec(&Signature::from(signature)).unwrap().try_into().unwrap(),
|
||||
};
|
||||
// Send the cosign
|
||||
Cosign::send(&mut txn, self.session, &cosign);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use serai_validator_sets_primitives::{Session, SlashReport as SlashReportStruct};
|
||||
use serai_primitives::validator_sets::{Session, SlashReport as SlashReportStruct};
|
||||
|
||||
use serai_db::{Get, DbTxn, create_db, db_channel};
|
||||
|
||||
|
||||
@@ -11,9 +11,11 @@ use ciphersuite::{group::GroupEncoding, Ciphersuite};
|
||||
use dalek_ff_group::Ristretto;
|
||||
use frost::dkg::ThresholdKeys;
|
||||
|
||||
use serai_primitives::Signature;
|
||||
use serai_validator_sets_primitives::{Session, SlashReport};
|
||||
use serai_in_instructions_primitives::SignedBatch;
|
||||
use serai_primitives::{
|
||||
crypto::Signature,
|
||||
validator_sets::{Session, SlashReport},
|
||||
instructions::SignedBatch,
|
||||
};
|
||||
|
||||
use serai_db::{DbTxn, Db};
|
||||
|
||||
|
||||
@@ -3,8 +3,7 @@ use core::{marker::PhantomData, future::Future};
|
||||
use dalek_ff_group::Ristretto;
|
||||
use frost::dkg::ThresholdKeys;
|
||||
|
||||
use serai_primitives::Signature;
|
||||
use serai_validator_sets_primitives::Session;
|
||||
use serai_primitives::{crypto::Signature, validator_sets::Session};
|
||||
|
||||
use serai_db::{DbTxn, Db};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use serai_validator_sets_primitives::Session;
|
||||
use serai_primitives::validator_sets::Session;
|
||||
|
||||
use serai_db::{Get, DbTxn, create_db};
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ use std::{
|
||||
|
||||
use frost::dkg::ThresholdKeys;
|
||||
|
||||
use serai_validator_sets_primitives::Session;
|
||||
use serai_primitives::validator_sets::Session;
|
||||
|
||||
use serai_db::{DbTxn, Db};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user