Skip to content

Commit

Permalink
comments about what each validation function does
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffro256 committed Mar 11, 2024
1 parent 19a3fdc commit e915921
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/seraphis_main/txtype_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,28 @@ static bool validate_txs_impl(const std::vector<const SpTxType*> &txs, const TxV
if (!tx)
return false;

// Validate that the transaction's nominal version is allowed in the context
if (!validate_tx_version(*tx, tx_validation_context))
return false;

// Validate as many non-cryptographic static semantic rules against tx's nominal version as possible
if (!validate_tx_semantics(*tx))
return false;

// Validate non-cryptographic semantic rules for this tx which are dependent on the fork version (i.e. most
// Cryptonote/RingCT rules)
if (!validate_tx_semantics_fork_dependent(*tx, tx_validation_context))
return false;

// Validate that the key images do not exist in this validation context (and are otherwise valid)
if (!validate_tx_key_images(*tx, tx_validation_context))
return false;

// Validate amount balances: plaintext or confidential
if (!validate_tx_amount_balance(*tx))
return false;

// Validate membership proofs, ring sigs, etc against live data (unless done in validate_txs_batchable)
if (!validate_tx_input_proofs(*tx, tx_validation_context))
return false;
}
Expand Down
2 changes: 2 additions & 0 deletions src/seraphis_main/txtype_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ template <typename SpTxType>
unsigned char tx_structure_version();

/// transaction validators
/// For more information on what is expected from implementors in each validation function, see
/// definition of validate_txs_impl().
template <typename SpTxType>
bool validate_tx_version(const SpTxType &tx, const TxValidationContext &tx_validation_context);
template <typename SpTxType>
Expand Down

0 comments on commit e915921

Please sign in to comment.