Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rpc-client): be able to decrpyt received Transfers by providing a secret key #908

Closed
wants to merge 6 commits into from

Conversation

bochaco
Copy link
Contributor

@bochaco bochaco commented Oct 26, 2023

Description

Summary generated by Reviewpad on 26 Oct 23 14:36 UTC

This pull request includes the following changes:

  1. The implementation of the cash_notes_from_payment function has been modified in the impl Node block. It now returns a tuple containing three values: NanoTokens, Vec<CashNote>, and Vec<Transfer>, instead of just Vec<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 the royalties_transfers vector. The code now handles the case where there are no network royalties payments by checking if the royalties_transfers vector is empty. A notification is published over the gossipsub topic TRANSFER_NOTIF_TOPIC for the network royalties payment, using the royalties_transfers vector for serialization.

  2. 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 and bls::SecretKey, and removing the eyre::Result import and replacing it with eyre::{eyre, Result}. Additionally, the sn_client::Client and sn_transfers::{LocalWallet, MainSecretKey, Transfer} dependencies have been added. The tracing::warn dependency has also been added. The signature of the node_events function has been updated to remove the only_transfers and log_cash_notes parameters. A new function transfers_events has been added to handle transfer events. The main function has been modified to use the transfers_events function when the Cmd::TransfersEvents variant is selected. The node_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.

  3. In the file error.rs, a new variant GossipsubConfigError has been added to the Error enum. Additionally, the GossipsubPublishError variant now includes a parameter of type PublishError.

  4. The file nodes_rewards.rs has a single change, which is a simple renaming of the variable cash_notes to transfers in the pattern matching arm of the function spawn_royalties_payment_listener.

  5. In the file event.rs, the usage of CashNote has been replaced with Transfer and associated variable names and types have been updated accordingly. The TransferNotif variant of the NodeEvent enum now contains a transfers field of type Vec<Transfer> instead of a cash_notes field of type Vec<CashNote>.

  6. In the file driver.rs, the default parameters for gossipsub have been modified using the ConfigBuilder. The message authenticity has been changed to Anonymous instead of being signed with the keypair.

  7. The file sn_node/src/node.rs has undergone changes including import statement changes and code changes. The import statement now includes the Transfer module from sn_transfers and excludes the CashNote module. Variable cash_notes has been renamed to transfers. The deserialization of msg[PK_SIZE..] has been changed from Vec<CashNote> to Vec<Transfer>. The NodeEvent::TransferNotif struct now contains the field transfers instead of cash_notes.

  8. The diff of the error.rs file includes the addition of an error variant called FailedToEncryptTransfer.

  9. The diff of the Cargo.toml file includes changes such as added and updated dependencies. These changes include adding a dependency on assert_fs version 1.0.0 and updating dependencies such as async-trait, bincode, bls, tiny_http, and color-eyre. Some dev-dependencies have also been updated or removed.

  10. The file api.rs has been modified with changes including importing various modules such as CashNote, LocalWallet, NanoTokens, SignedSpend, Transfer, and UniquePubkey from the sn_transfers module. A new function verify_and_unpack_transfer has been added to the Client struct. The existing function publish_on_topic has been modified to include a missing semicolon. A helper function get_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.

@reviewpad reviewpad bot added the Medium Medium sized PR label Oct 26, 2023
@bochaco bochaco force-pushed the DebugRoyaltySendTransfers branch from c764782 to 49e79c8 Compare October 26, 2023 14:36
@bochaco bochaco changed the title feat(rpc-client): eb able to decrpyt received Transfers by providing a secret key feat(rpc-client): be able to decrpyt received Transfers by providing a secret key Oct 26, 2023
@bochaco bochaco force-pushed the DebugRoyaltySendTransfers branch from 49e79c8 to e680108 Compare October 26, 2023 14:37
@bochaco bochaco force-pushed the DebugRoyaltySendTransfers branch 2 times, most recently from 8aa993a to c3bd1cd Compare October 26, 2023 18:15
@bochaco bochaco force-pushed the DebugRoyaltySendTransfers branch from c3bd1cd to 2b69724 Compare October 26, 2023 20:45
@bochaco
Copy link
Contributor Author

bochaco commented Oct 27, 2023

Superseded by PR #909

@bochaco bochaco closed this Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Medium Medium sized PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants