feat(rpc-client): be able to decrpyt received Transfers by providing a secret key #908
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
Summary generated by Reviewpad on 26 Oct 23 14:36 UTC
This pull request includes the following changes:
The implementation of the
cash_notes_from_payment
function has been modified in theimpl Node
block. It now returns a tuple containing three values:NanoTokens
,Vec<CashNote>
, andVec<Transfer>
, instead of justVec<CashNote>
. The third value represents the transfers corresponding to network royalties payment. Variable names have been renamed and types have been updated accordingly. Royalty transfers are generated from cash notes and added to theroyalties_transfers
vector. The code now handles the case where there are no network royalties payments by checking if theroyalties_transfers
vector is empty. A notification is published over the gossipsub topicTRANSFER_NOTIF_TOPIC
for the network royalties payment, using theroyalties_transfers
vector for serialization.Several changes have been made to the dependencies in the file diff of a different file. The changes include adding dependencies such as
assert_fs::TempDir
andbls::SecretKey
, and removing theeyre::Result
import and replacing it witheyre::{eyre, Result}
. Additionally, thesn_client::Client
andsn_transfers::{LocalWallet, MainSecretKey, Transfer}
dependencies have been added. Thetracing::warn
dependency has also been added. The signature of thenode_events
function has been updated to remove theonly_transfers
andlog_cash_notes
parameters. A new functiontransfers_events
has been added to handle transfer events. Themain
function has been modified to use thetransfers_events
function when theCmd::TransfersEvents
variant is selected. Thenode_events
function has been modified to handle both node events and transfer notifications. Logic has been added to verify and unpack transfers, and store the resulting cash notes. Print statements have been updated to reflect the changes.In the file
error.rs
, a new variantGossipsubConfigError
has been added to theError
enum. Additionally, theGossipsubPublishError
variant now includes a parameter of typePublishError
.The file
nodes_rewards.rs
has a single change, which is a simple renaming of the variablecash_notes
totransfers
in the pattern matching arm of the functionspawn_royalties_payment_listener
.In the file
event.rs
, the usage ofCashNote
has been replaced withTransfer
and associated variable names and types have been updated accordingly. TheTransferNotif
variant of theNodeEvent
enum now contains atransfers
field of typeVec<Transfer>
instead of acash_notes
field of typeVec<CashNote>
.In the file
driver.rs
, the default parameters for gossipsub have been modified using theConfigBuilder
. The message authenticity has been changed toAnonymous
instead of being signed with the keypair.The file
sn_node/src/node.rs
has undergone changes including import statement changes and code changes. The import statement now includes theTransfer
module fromsn_transfers
and excludes theCashNote
module. Variablecash_notes
has been renamed totransfers
. The deserialization ofmsg[PK_SIZE..]
has been changed fromVec<CashNote>
toVec<Transfer>
. TheNodeEvent::TransferNotif
struct now contains the fieldtransfers
instead ofcash_notes
.The diff of the
error.rs
file includes the addition of an error variant calledFailedToEncryptTransfer
.The diff of the
Cargo.toml
file includes changes such as added and updated dependencies. These changes include adding a dependency onassert_fs
version 1.0.0 and updating dependencies such asasync-trait
,bincode
,bls
,tiny_http
, andcolor-eyre
. Some dev-dependencies have also been updated or removed.The file
api.rs
has been modified with changes including importing various modules such asCashNote
,LocalWallet
,NanoTokens
,SignedSpend
,Transfer
, andUniquePubkey
from thesn_transfers
module. A new functionverify_and_unpack_transfer
has been added to theClient
struct. The existing functionpublish_on_topic
has been modified to include a missing semicolon. A helper functionget_register_from_record
has been added.Please review these changes and ensure that they are correct and fulfill the requirements. Let me know if you need further clarification or assistance with anything else.