Minor work on the transaction signing task

This commit is contained in:
Luke Parker
2024-09-05 14:42:06 -04:00
parent 8380653855
commit b62fc3a1fa
14 changed files with 169 additions and 2 deletions

View File

@@ -10,11 +10,26 @@ use group::GroupEncoding;
use serai_db::DbTxn;
/// A signable transaction.
pub trait SignableTransaction: 'static + Sized + Send + Sync {
pub trait SignableTransaction: 'static + Sized + Send + Sync + Clone {
/// The ciphersuite used to sign this transaction.
type Ciphersuite: Cuphersuite;
/// The preprocess machine for the signing protocol for this transaction.
type PreprocessMachine: PreprocessMachine;
/// Read a `SignableTransaction`.
fn read(reader: &mut impl io::Read) -> io::Result<Self>;
/// Write a `SignableTransaction`.
fn write(&self, writer: &mut impl io::Write) -> io::Result<()>;
/// The ID for this transaction.
///
/// This is an internal ID arbitrarily definable so long as it's unique.
///
/// This same ID MUST be returned by the Eventuality for this transaction.
fn id(&self) -> [u8; 32];
/// Sign this transaction.
fn sign(self, keys: ThresholdKeys<Self::Ciphersuite>) -> Self::PreprocessMachine;
}
mod db {