mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 12:49:23 +00:00
Define all coordinator transaction types
This commit is contained in:
2
coordinator/tributary/src/tests/mod.rs
Normal file
2
coordinator/tributary/src/tests/mod.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
mod transaction;
|
||||
pub use transaction::*;
|
||||
27
coordinator/tributary/src/tests/transaction.rs
Normal file
27
coordinator/tributary/src/tests/transaction.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
use rand_core::RngCore;
|
||||
|
||||
use ciphersuite::{
|
||||
group::{ff::Field, Group},
|
||||
Ciphersuite, Ristretto,
|
||||
};
|
||||
use schnorr::SchnorrSignature;
|
||||
|
||||
use crate::Signed;
|
||||
|
||||
pub fn random_signed<R: RngCore>(rng: &mut R) -> Signed {
|
||||
Signed {
|
||||
signer: <Ristretto as Ciphersuite>::G::random(&mut *rng),
|
||||
nonce: u32::try_from(rng.next_u64() >> 32).unwrap(),
|
||||
signature: SchnorrSignature::<Ristretto> {
|
||||
R: <Ristretto as Ciphersuite>::G::random(&mut *rng),
|
||||
s: <Ristretto as Ciphersuite>::F::random(rng),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn serialize_signed() {
|
||||
use crate::ReadWrite;
|
||||
let signed = signed(&mut rand_core::OsRng);
|
||||
assert_eq!(Signed::read::<&[u8]>(&mut signed.serialize().as_ref()).unwrap(), signed);
|
||||
}
|
||||
Reference in New Issue
Block a user