Add additional documentation
Some checks are pending
coins/ Tests / test-coins (push) Waiting to run
Coordinator Tests / build (push) Waiting to run
Full Stack Tests / build (push) Waiting to run
Lint / clippy (macos-13) (push) Waiting to run
Lint / clippy (macos-14) (push) Waiting to run
Lint / clippy (ubuntu-latest) (push) Waiting to run
Lint / clippy (windows-latest) (push) Waiting to run
Lint / deny (push) Waiting to run
Lint / fmt (push) Waiting to run
Lint / machete (push) Waiting to run
Monero Tests / unit-tests (push) Waiting to run
Monero Tests / integration-tests (v0.17.3.2) (push) Waiting to run
Monero Tests / integration-tests (v0.18.2.0) (push) Waiting to run
no-std build / build (push) Waiting to run
Processor Tests / build (push) Waiting to run
Tests / test-infra (push) Waiting to run
Tests / test-substrate (push) Waiting to run
Tests / test-serai-client (push) Waiting to run

This commit is contained in:
Luke Parker 2024-07-08 20:33:00 -04:00
parent 5bb3256d1f
commit 84f0e6c26e
No known key found for this signature in database
5 changed files with 20 additions and 13 deletions

View file

@ -94,7 +94,8 @@ async fn select_n(
let mut candidates = Vec::with_capacity(remaining); let mut candidates = Vec::with_capacity(remaining);
while candidates.len() != remaining { while candidates.len() != remaining {
// Use a gamma distribution, as Monero does // Use a gamma distribution, as Monero does
// TODO: Cite these constants // https://github.com/monero-project/monero/blob/cc73fe71162d564ffda8e549b79a350bca53c45
// /src/wallet/wallet2.cpp#L142-L143
let mut age = Gamma::<f64>::new(19.28, 1.0 / 1.61).unwrap().sample(rng).exp(); let mut age = Gamma::<f64>::new(19.28, 1.0 / 1.61).unwrap().sample(rng).exp();
#[allow(clippy::cast_precision_loss)] #[allow(clippy::cast_precision_loss)]
if age > TIP_APPLICATION { if age > TIP_APPLICATION {

View file

@ -226,7 +226,9 @@ impl Extra {
} }
/// The payment ID embedded within this extra. /// The payment ID embedded within this extra.
// TODO: Monero distinguishes encrypted/unencrypted payment ID retrieval // Monero finds the first nonce field and reads the payment ID from it:
// https://github.com/monero-project/monero/blob/ac02af92867590ca80b2779a7bbeafa99ff94dcb/
// src/wallet/wallet2.cpp#L2709-L2752
pub fn payment_id(&self) -> Option<PaymentId> { pub fn payment_id(&self) -> Option<PaymentId> {
for field in &self.0 { for field in &self.0 {
if let ExtraField::Nonce(data) = field { if let ExtraField::Nonce(data) = field {

View file

@ -301,7 +301,7 @@ impl WalletOutput {
/// The payment ID included with this output. /// The payment ID included with this output.
/// ///
/// This field may be `Some` even if wallet would not return a payment ID. This will happen if /// This field may be `Some` even if wallet2 would not return a payment ID. This will happen if
/// the scanned output belongs to the subaddress which spent Monero within the transaction which /// the scanned output belongs to the subaddress which spent Monero within the transaction which
/// created the output. If multiple subaddresses spent Monero within this transactions, the key /// created the output. If multiple subaddresses spent Monero within this transactions, the key
/// image with the highest index is determined to be the subaddress considered as the one /// image with the highest index is determined to be the subaddress considered as the one

View file

@ -336,8 +336,8 @@ impl InternalScanner {
} }
// If the block's version is >= 12, drop all unencrypted payment IDs // If the block's version is >= 12, drop all unencrypted payment IDs
// TODO: Cite rule // https://github.com/monero-project/monero/blob/ac02af92867590ca80b2779a7bbeafa99ff94dcb/
// TODO: What if TX extra had multiple payment IDs embedded? // src/wallet/wallet2.cpp#L2739-L2744
if block.header.hardfork_version >= 12 { if block.header.hardfork_version >= 12 {
for output in &mut res.0 { for output in &mut res.0 {
if matches!(output.metadata.payment_id, Some(PaymentId::Unencrypted(_))) { if matches!(output.metadata.payment_id, Some(PaymentId::Unencrypted(_))) {
@ -354,8 +354,10 @@ impl InternalScanner {
/// ///
/// When an output is successfully scanned, the output key MUST be checked against the local /// When an output is successfully scanned, the output key MUST be checked against the local
/// database for lack of prior observation. If it was prior observed, that output is an instance /// database for lack of prior observation. If it was prior observed, that output is an instance
/// of the burning bug (TODO: cite) and MAY be unspendable. Only the prior received output(s) or /// of the
/// the newly received output will be spendable (as spending one will burn all of them). /// [burning bug](https://web.getmonero.org/2018/09/25/a-post-mortum-of-the-burning-bug.html) and
/// MAY be unspendable. Only the prior received output(s) or the newly received output will be
/// spendable (as spending one will burn all of them).
/// ///
/// Once checked, the output key MUST be saved to the local database so future checks can be /// Once checked, the output key MUST be saved to the local database so future checks can be
/// performed. /// performed.

View file

@ -238,7 +238,6 @@ impl SignableTransaction {
Err(SendError::NoInputs)?; Err(SendError::NoInputs)?;
} }
for input in &self.inputs { for input in &self.inputs {
// TODO: Add a function for the ring length
if input.decoys().len() != if input.decoys().len() !=
match self.rct_type { match self.rct_type {
RctType::ClsagBulletproof => 11, RctType::ClsagBulletproof => 11,
@ -317,11 +316,14 @@ impl SignableTransaction {
})?; })?;
} }
// The actual limit is half the block size, and for the minimum block size of 300k, that'd be // The limit is half the no-penalty block size
// 150k // https://github.com/monero-project/monero/blob/cc73fe71162d564ffda8e549b79a350bca53c454
// wallet2 will only create transactions up to 100k bytes however // /src/wallet/wallet2.cpp#L110766-L11085
// TODO: Cite // https://github.com/monero-project/monero/blob/cc73fe71162d564ffda8e549b79a350bca53c454
const MAX_TX_SIZE: usize = 100_000; // /src/cryptonote_config.h#L61
// https://github.com/monero-project/monero/blob/cc73fe71162d564ffda8e549b79a350bca53c454
// /src/cryptonote_config.h#L64
const MAX_TX_SIZE: usize = (300_000 / 2) - 600;
if weight >= MAX_TX_SIZE { if weight >= MAX_TX_SIZE {
Err(SendError::TooLargeTransaction)?; Err(SendError::TooLargeTransaction)?;
} }