feat: verify spend in cli and auditing all the way to genesis #1014
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
safe wallet verify <spend_address/unique_pubkey>
safe wallet verify --genesis <spend_address/unique_pubkey>
Summary generated by Reviewpad on 28 Nov 23 11:45 UTC
This pull request includes the following changes:
In the
client.rs
file, the functionverify()
has been replaced withverify_cashnote()
. This change improves the clarity and accuracy of the code.In the
address.rs
file, several changes have been made:Error
andResult
have been added.to_hex()
andfrom_hex()
have been added to theSpendAddress
struct.Debug
trait has been implemented for theSpendAddress
struct.SpendAddress
has been added.In the
wallet.rs
file, the following changes have been made:SpendAddress
have been added.verify()
function has been renamed toverify_cashnote()
and its documentation has been updated.verify_spend()
has been added to verify a spend and its ancestors on the network.In the
sn_cli/src/subcommands/wallet.rs
file, the following changes have been made:MainPubkey
,SpendAddress
, andUniquePubkey
.Verify
has been added, which can be used to verify a spend on the network.parse_pubkey_address
has been added to parse a spend address or a unique pubkey address.verify
function has been implemented to verify a spend on the network.parse_pubkey_address
function.In the
sn_cli/src/networking/api.rs
file, the following changes have been made:UniquePubkey
has been removed.get_spend_from_network
now takes an argument of typeSpendAddress
instead ofunique_pubkey
.cash_note_addr
has been renamed toaddress
in theput_spend_to_network
function.get_spend_from_network
now takes an argument of typeSpendAddress
instead ofunique_pubkey
.address
instead ofunique_pubkey
.In the
sn_network/src/transfers.rs
file, the following change has been made:from_cash_note_address
has been changed tofrom_spend_address
when obtaining a key from aNetworkAddress
.In the
common/mod.rs
file, the following change has been made:client.verify
has been replaced withclient.verify_cashnote
.In the
sn_transfers/src/cashnotes/signed_spend.rs
file, the following changes have been made:GENESIS_CASHNOTE
has been imported from the crate.cashnote_creation_tx_hash
has been renamed toparent_tx_hash
.verify
method has been modified to handle cases where thespent_tx_hash
does not matchself.spent_tx_hash()
.In the
unique_keys.rs
file, the following changes have been made:Error
andResult
have been added.to_hex()
andfrom_hex()
have been added to theUniquePubkey
andMainPubkey
structs.Debug
trait has been implemented for both structs.bls_public_from_hex()
has been added.In the
sn_node/src/spends.rs
file, the following changes have been made:signed_spend.spend.parent_tx
instead ofsigned_spend.spend.cashnote_creation_tx
.signed_spend.spend.parent_tx.outputs
instead ofsigned_spend.spend.cashnote_creation_tx.outputs
.tx_our_cash_note_was_created_in
now gets the value ofsigned_spend.parent_tx_hash()
instead ofsigned_spend.cashnote_creation_tx_hash()
.tx_our_cash_note_was_created_in
withtx_its_parents_where_spent_in
instead oftx_our_cash_note_was_created_in
withtx_its_parents_where_spent_in
.signed_spend.parent_tx.verify_against_inputs_spent(parent_spends)
instead ofsigned_spend.cashnote_creation_tx.verify_against_inputs_spent(parent_spends)
.The
Cargo.lock
file has been modified to add theeyre
dependency.The
Cargo.toml
file has been modified to add theeyre
crate as a development dependency with version 0.6.8.In the
data_with_churn.rs
file, theverify()
method call has been changed toverify_cashnote()
on theclient
object. The exact intention behind this change is unclear from the diff alone.In the
sequential_transfers.rs
file, the method callverify()
has been replaced withverify_cashnote()
in thecash_note_transfer_multiple_sequential_succeed()
andcash_note_transfer_double_spend_fail()
functions.In the
wallet/mod.rs
file, the import of theparse_main_pubkey
function has been removed, and the import of thebls_secret_from_hex
function has been modified.In the
main.rs
file, the import of theparse_main_pubkey
function has