Supply a RecommendedTranscript type of DT<Blake2b512>

This commit is contained in:
Luke Parker
2022-06-24 18:58:24 -04:00
parent 963d9eab10
commit a46524f0ce
12 changed files with 40 additions and 31 deletions

View File

@@ -5,6 +5,7 @@ use async_trait::async_trait;
use curve25519_dalek::{constants::ED25519_BASEPOINT_TABLE, scalar::Scalar};
use dalek_ff_group as dfg;
use transcript::RecommendedTranscript;
use frost::MultisigKeys;
use monero::{PublicKey, network::Network, util::address::Address};
@@ -15,7 +16,7 @@ use monero_serai::{
wallet::{Fee, SpendableOutput, SignableTransaction as MSignableTransaction, TransactionMachine}
};
use crate::{Transcript, CoinError, Output as OutputTrait, Coin, view_key};
use crate::{CoinError, Output as OutputTrait, Coin, view_key};
#[derive(Clone, Debug)]
pub struct Output(SpendableOutput);
@@ -51,7 +52,7 @@ impl From<SpendableOutput> for Output {
#[derive(Debug)]
pub struct SignableTransaction(
Arc<MultisigKeys<Ed25519>>,
Transcript,
RecommendedTranscript,
usize,
MSignableTransaction
);
@@ -129,7 +130,7 @@ impl Coin for Monero {
async fn prepare_send(
&self,
keys: Arc<MultisigKeys<Ed25519>>,
transcript: Transcript,
transcript: RecommendedTranscript,
height: usize,
mut inputs: Vec<Output>,
payments: &[(Address, u64)],

View File

@@ -5,7 +5,7 @@ use thiserror::Error;
use frost::{Curve, FrostError, MultisigKeys, sign::PreprocessMachine};
pub(crate) use monero_serai::frost::Transcript;
use transcript::RecommendedTranscript;
mod coins;
mod wallet;
@@ -80,7 +80,7 @@ pub trait Coin {
async fn prepare_send(
&self,
keys: Arc<MultisigKeys<Self::Curve>>,
transcript: Transcript,
transcript: RecommendedTranscript,
height: usize,
inputs: Vec<Self::Output>,
payments: &[(Self::Address, u64)],

View File

@@ -2,11 +2,11 @@ use std::{sync::Arc, collections::HashMap};
use rand_core::OsRng;
use transcript::Transcript as TranscriptTrait;
use transcript::{Transcript, RecommendedTranscript};
use frost::{Curve, MultisigKeys, sign::{PreprocessMachine, SignMachine, SignatureMachine}};
use crate::{Transcript, CoinError, SignError, Output, Coin, Network};
use crate::{CoinError, SignError, Output, Coin, Network};
pub struct WalletKeys<C: Curve> {
keys: MultisigKeys<C>,
@@ -28,7 +28,7 @@ impl<C: Curve> WalletKeys<C> {
// function as well, although that degree of influence means key gen is broken already
fn bind(&self, chain: &[u8]) -> MultisigKeys<C> {
const DST: &[u8] = b"Serai Processor Wallet Chain Bind";
let mut transcript = Transcript::new(DST);
let mut transcript = RecommendedTranscript::new(DST);
transcript.append_message(b"chain", chain);
transcript.append_message(b"curve", C::ID);
transcript.append_message(b"group_key", &C::G_to_bytes(&self.keys.group_key()));
@@ -308,7 +308,7 @@ impl<D: CoinDb, C: Coin> Wallet<D, C> {
}
// Create the transcript for this transaction
let mut transcript = Transcript::new(b"Serai Processor Wallet Send");
let mut transcript = RecommendedTranscript::new(b"Serai Processor Wallet Send");
transcript.append_message(
b"canonical_height",
&u64::try_from(canonical).unwrap().to_le_bytes()