mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-13 06:29:25 +00:00
Finish documenting monero-serai
This commit is contained in:
@@ -419,7 +419,7 @@ impl Scanner {
|
||||
commitment.amount = amount;
|
||||
// Regular transaction
|
||||
} else {
|
||||
commitment = match tx.rct_signatures.base.encrypted_amounts.get(o) {
|
||||
commitment = match tx.proofs.base.encrypted_amounts.get(o) {
|
||||
Some(amount) => amount.decrypt(shared_key),
|
||||
// This should never happen, yet it may be possible with miner transactions?
|
||||
// Using get just decreases the possibility of a panic and lets us move on in that case
|
||||
@@ -428,7 +428,7 @@ impl Scanner {
|
||||
|
||||
// If this is a malicious commitment, move to the next output
|
||||
// Any other R value will calculate to a different spend key and are therefore ignorable
|
||||
if Some(&commitment.calculate()) != tx.rct_signatures.base.commitments.get(o) {
|
||||
if Some(&commitment.calculate()) != tx.proofs.base.commitments.get(o) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ use monero_serai::{
|
||||
hash_to_point,
|
||||
clsag::{ClsagError, ClsagContext, Clsag},
|
||||
bulletproofs::{MAX_COMMITMENTS, Bulletproof},
|
||||
RctBase, RctPrunable, RctSignatures,
|
||||
RctBase, RctPrunable, RctProofs,
|
||||
},
|
||||
transaction::{Input, Output, Timelock, TransactionPrefix, Transaction},
|
||||
};
|
||||
@@ -809,7 +809,7 @@ impl SignableTransaction {
|
||||
extra,
|
||||
},
|
||||
signatures: vec![],
|
||||
rct_signatures: RctSignatures {
|
||||
proofs: RctProofs {
|
||||
base: RctBase {
|
||||
fee,
|
||||
encrypted_amounts,
|
||||
@@ -855,7 +855,7 @@ impl SignableTransaction {
|
||||
|
||||
let clsag_pairs = Clsag::sign(rng, signable, mask_sum, tx.signature_hash())
|
||||
.map_err(|_| TransactionError::WrongPrivateKey)?;
|
||||
match tx.rct_signatures.prunable {
|
||||
match tx.proofs.prunable {
|
||||
RctPrunable::Null => panic!("Signing for RctPrunable::Null"),
|
||||
RctPrunable::Clsag { ref mut clsags, ref mut pseudo_outs, .. } => {
|
||||
clsags.append(&mut clsag_pairs.iter().map(|clsag| clsag.0.clone()).collect::<Vec<_>>());
|
||||
@@ -867,7 +867,7 @@ impl SignableTransaction {
|
||||
if self.has_change {
|
||||
debug_assert_eq!(
|
||||
self.fee_rate.calculate_fee_from_weight(tx.weight()),
|
||||
tx.rct_signatures.base.fee,
|
||||
tx.proofs.base.fee,
|
||||
"transaction used unexpected fee",
|
||||
);
|
||||
}
|
||||
@@ -917,7 +917,7 @@ impl Eventuality {
|
||||
uniqueness(&tx.prefix.inputs),
|
||||
);
|
||||
|
||||
let rct_type = tx.rct_signatures.rct_type();
|
||||
let rct_type = tx.proofs.rct_type();
|
||||
if rct_type != self.protocol.optimal_rct_type() {
|
||||
return false;
|
||||
}
|
||||
@@ -935,9 +935,9 @@ impl Eventuality {
|
||||
key: expected.dest.compress(),
|
||||
view_tag: Some(expected.view_tag).filter(|_| self.protocol.view_tags()),
|
||||
} != actual) ||
|
||||
(Some(&expected.commitment.calculate()) != tx.rct_signatures.base.commitments.get(o)) ||
|
||||
(Some(&expected.commitment.calculate()) != tx.proofs.base.commitments.get(o)) ||
|
||||
(Some(&EncryptedAmount::Compact { amount: expected.amount }) !=
|
||||
tx.rct_signatures.base.encrypted_amounts.get(o))
|
||||
tx.proofs.base.encrypted_amounts.get(o))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -390,7 +390,7 @@ impl SignatureMachine<Transaction> for TransactionSignatureMachine {
|
||||
shares: HashMap<Participant, Self::SignatureShare>,
|
||||
) -> Result<Transaction, FrostError> {
|
||||
let mut tx = self.tx;
|
||||
match tx.rct_signatures.prunable {
|
||||
match tx.proofs.prunable {
|
||||
RctPrunable::Null => panic!("Signing for RctPrunable::Null"),
|
||||
RctPrunable::Clsag { ref mut clsags, ref mut pseudo_outs, .. } => {
|
||||
for (c, clsag) in self.clsags.drain(..).enumerate() {
|
||||
|
||||
@@ -70,7 +70,7 @@ test!(
|
||||
assert!(eventuality.matches(&tx));
|
||||
|
||||
// Mutate the TX
|
||||
tx.rct_signatures.base.commitments[0] += ED25519_BASEPOINT_POINT;
|
||||
tx.proofs.base.commitments[0] += ED25519_BASEPOINT_POINT;
|
||||
// Verify it no longer matches
|
||||
assert!(!eventuality.matches(&tx));
|
||||
},
|
||||
|
||||
@@ -80,7 +80,7 @@ pub async fn get_miner_tx_output(rpc: &SimpleRequestRpc, view: &ViewPair) -> Spe
|
||||
|
||||
/// Make sure the weight and fee match the expected calculation.
|
||||
pub fn check_weight_and_fee(tx: &Transaction, fee_rate: FeeRate) {
|
||||
let fee = tx.rct_signatures.base.fee;
|
||||
let fee = tx.proofs.base.fee;
|
||||
|
||||
let weight = tx.weight();
|
||||
let expected_weight = fee_rate.calculate_weight_from_fee(fee);
|
||||
|
||||
@@ -306,7 +306,7 @@ test!(
|
||||
assert_eq!(outputs[1].commitment().amount, 50000);
|
||||
|
||||
// The remainder should get shunted to fee, which is fingerprintable
|
||||
assert_eq!(tx.rct_signatures.base.fee, 1000000000000 - 10000 - 50000);
|
||||
assert_eq!(tx.proofs.base.fee, 1000000000000 - 10000 - 50000);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user