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

Added oneshot reply to outbound messaging #1703

Merged
merged 1 commit into from
Apr 16, 2020

Conversation

sdbondi
Copy link
Member

@sdbondi sdbondi commented Apr 15, 2020

Description

Each message sent using outbound messaging now has a oneshot attached.
A success or failure result is guaranteed to be sent back on the oneshot
for every message sent.

Convenience functions were added to allow callers to easily know the
state of each message sent.

let send_states =
outbound_messaging_requester.propagate(...).await?.reolve_ok().await?;

let num_queued = send_states.len();
println!("{} message queued for sending", num_queued);
let (success, failed) = send_states.wait_percentage_success(0.51).await;
println!("Message sent to a majority of nodes ({} succeeded, {} failed)",succeeded.len(), failed.len())
// or (wait_* consumes send_states)
let (success, failed) = send_states.wait_all().await;
println!("Result of the propagation: {} succeeded, {} failed", succeeded.len(), failed.len())

This was implemented with minimal breaking changes to the public
outbound messaging api.

  • Fixed bug where a repeated failure to connect to a peer did not
    result in the peer being marked as offline.
  • Limited the number of client peers propagated to when sending inital
    discovery to those within this node's region.

Motivation and Context

The only way to know that a message was actually sent or not was to listen on the messaging event stream and sift through until you find your message tags. This change provides a way to know if a message was sent or not with a MessageSendStates struct returned from the send call. To limit breaking changes, the api may not be as ergonomic as it could be. This is a TODO.

How Has This Been Tested?

Unit tested MessageSendStates and updated some existing tests that test the messaging protocol.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Feature refactor (No new feature or functional changes, but performance or technical debt improvements)
  • New Tests
  • Documentation

Checklist:

  • I'm merging against the development branch.
  • I ran cargo-fmt --all before pushing.
  • I have squashed my commits into a single commit.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@sdbondi sdbondi force-pushed the sb-comms-outbound-oneshot branch 3 times, most recently from 5e24247 to 7e83504 Compare April 15, 2020 12:52
Each message sent using outbound messaging now has a oneshot attached.
A success or failure result is guaranteed to be sent back on the oneshot
for every message sent.

Convinience functions were added to allow callers to easily know the
state of each message sent.

```rust
let send_states =
outbound_messaging_requester.propagate(...).await?.reolve_ok().await?;

let num_queued = send_states.len();
println!("{} message queued for sending", num_queued);
let (success, failed) = send_states.wait_percentage_success(0.51).await;
println!("Message sent to a majority of nodes ({} succeeded, {} failed)",succeeded.len(), failed.len())
// or (wait_* consumes send_states)
let (success, failed) = send_states.wait_all().await;
println!("Result of the propagation: {} succeeded, {} failed", succeeded.len(), failed.len())
```

This was implemented with minimal breaking changes to the public
outbound messaging api.

- Fixed bug where a repeated failure to connect to a peer did not
  result in the peer being marked as offline.
- Limited the number of client peers propagated to when sending inital
  discovery to those within this node's region.
@sdbondi sdbondi force-pushed the sb-comms-outbound-oneshot branch from 7e83504 to 1a87d6d Compare April 15, 2020 13:14
Copy link
Collaborator

@CjS77 CjS77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@CjS77 CjS77 merged commit b2d8d57 into development Apr 16, 2020
@CjS77 CjS77 deleted the sb-comms-outbound-oneshot branch April 17, 2020 08:10
CjS77 added a commit that referenced this pull request Apr 25, 2020
** Major Changes from 0.0.9

**** Store and forward

Peers will hold onto message for recipients that are not online and deliver the messages to them when they appear again.

**** OsX package installer

**** Many documentation improvements

**** Ephemeral keys for private messages

This is a big change that preserves privacy on the network but dramatically reduces the amount of traffic peers have to deal with.

**** Emoji Ids

*** Other changes

- The target difficulty for a specified PoW algorithm is included in the block header. This allows the target difficulty
  of any block height to be calculated by only processing the last set of target difficulty samples up to that height.
- Don't mark peers as offline if there are no existing connections (#1763)
- Add UTXO selection strategy for large txs
- Base node: Dynamically determine build version (#1760)
- Include random peers for liveness ping (#1753)
- RandomX - Version Update (#1754)
- Add generic debug log function to FFI (#1752)
- Lots of logging improvements
- Added list-transactions and cancel-transaction commands (#1746)
- ASCII table output for list-peers and list-connections (#1709)
- Improve Difficulty adjustment manager
- Modular configuration via ConfigLoader and ConfigPath traits
- Fix chain monitoring bug in Transaction Service (#1739)
- Empty Emoji String Bug Fix  (#1736)
- Coin-split base node cli command
- Complete the basic OSX pkg build
- Perform reorgs only on stronger tip accumulated difficulties
- Use filesystem storage for dht.db on libwallet (#1735)
- Fix duplicate message propagation (#1730)
- Introduced accumulated difficulty validators to allow different rules for testing and running running a base node. -
- Changes to peer offline handling (#1716)
- Update Transaction cancellation to work for Inbound and Outbound Txs
- Added oneshot reply to outbound messaging (#1703)
- Add transaction stress test command to CLI
- Implemented basic `make-it-rain` command
- Fix MmrCache rewind issue
- Use ephemeral key for private messages (e.g Discovery) (#1686)
- Limit orphan pool size
- Added a function to list UTXOs in the console (#1678)
- Prevent adding yourself as a peer (#1665)
- Update transaction weights (#1661)
- Fix block period calculation
- Validators will now check the weight of a block when doing validation (#1648)
- Cleaned up duplicate code from the Blockchain db
- The ban peer log will now supply n reason why the peer was banned (#1638)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants