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

rpc: event subscription management for RPC client #516

Merged
merged 61 commits into from
Sep 16, 2020
Merged

Commits on Aug 10, 2020

  1. Create basic request/response transport abstraction

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 10, 2020
    Configuration menu
    Copy the full SHA
    9df13ed View commit details
    Browse the repository at this point in the history
  2. Add fixture-based transport with failing test

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 10, 2020
    Configuration menu
    Copy the full SHA
    a01883d View commit details
    Browse the repository at this point in the history

Commits on Aug 11, 2020

  1. Refactor mock transport

    This version of the transport provides a request matching interface,
    along with an implementation of a request method-based matcher (produces
    specific fixed responses according to the request's method).
    
    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 11, 2020
    Configuration menu
    Copy the full SHA
    a03d0ab View commit details
    Browse the repository at this point in the history
  2. Take client creation interface change into account

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 11, 2020
    Configuration menu
    Copy the full SHA
    73c2626 View commit details
    Browse the repository at this point in the history
  3. Reword docstring for Transport

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 11, 2020
    Configuration menu
    Copy the full SHA
    8650db1 View commit details
    Browse the repository at this point in the history

Commits on Aug 12, 2020

  1. Add initial subscription management mechanism

    This commit adds the bulk of the subscription management machinery as
    well as a rudimentary integration test (which should be marked as
    `#[ignore]` ASAP) just to demonstrate obtaining new block events from a
    Tendermint instance running locally with default settings.
    
    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 12, 2020
    Configuration menu
    Copy the full SHA
    cf67215 View commit details
    Browse the repository at this point in the history
  2. Ignore integration test

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 12, 2020
    Configuration menu
    Copy the full SHA
    20cce0a View commit details
    Browse the repository at this point in the history
  3. Update rpc/Cargo.toml

    Co-authored-by: Alexander Simmerl <a.simmerl@gmail.com>
    thanethomson and xla authored Aug 12, 2020
    Configuration menu
    Copy the full SHA
    92cae5f View commit details
    Browse the repository at this point in the history
  4. Update rpc/src/client.rs

    Co-authored-by: Alexander Simmerl <a.simmerl@gmail.com>
    thanethomson and xla authored Aug 12, 2020
    Configuration menu
    Copy the full SHA
    40e7de2 View commit details
    Browse the repository at this point in the history
  5. Update rpc/src/client/subscription.rs

    Co-authored-by: Alexander Simmerl <a.simmerl@gmail.com>
    thanethomson and xla authored Aug 12, 2020
    Configuration menu
    Copy the full SHA
    4634e48 View commit details
    Browse the repository at this point in the history
  6. Update rpc/src/client/subscription.rs

    Co-authored-by: Alexander Simmerl <a.simmerl@gmail.com>
    thanethomson and xla authored Aug 12, 2020
    Configuration menu
    Copy the full SHA
    82cf571 View commit details
    Browse the repository at this point in the history
  7. Update rpc/src/client/subscription.rs

    Co-authored-by: Alexander Simmerl <a.simmerl@gmail.com>
    thanethomson and xla authored Aug 12, 2020
    Configuration menu
    Copy the full SHA
    52c36d0 View commit details
    Browse the repository at this point in the history
  8. Update rpc/src/client/transport.rs

    Co-authored-by: Alexander Simmerl <a.simmerl@gmail.com>
    thanethomson and xla authored Aug 12, 2020
    Configuration menu
    Copy the full SHA
    1089e8d View commit details
    Browse the repository at this point in the history
  9. Simplify submodule naming

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 12, 2020
    Configuration menu
    Copy the full SHA
    5994999 View commit details
    Browse the repository at this point in the history
  10. Reorder optional dependencies alphabetically

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 12, 2020
    Configuration menu
    Copy the full SHA
    1ef2305 View commit details
    Browse the repository at this point in the history
  11. Rename module to singular

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 12, 2020
    Configuration menu
    Copy the full SHA
    a364187 View commit details
    Browse the repository at this point in the history
  12. Destructure and reformat imports

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 12, 2020
    Configuration menu
    Copy the full SHA
    15d5765 View commit details
    Browse the repository at this point in the history

Commits on Aug 13, 2020

  1. Refactor subscription mechanism to simplify

    The previous iteration of the subscription mechanism relied on two
    asynchronous tasks to manage subscriptions and route events from the
    WebSockets connection to their relevant subscribers.
    
    This version only uses one async task (the WebSocket driver, which must
    interact asynchronously with the connection).
    
    In addition to this, I tried experimenting with using generics instead
    of trait objects for the transport layer for the `Client`. This works,
    but the downside of using generics is that, if you want generalizability
    at layers higher up, it comes at the cost of decreased readability of
    the code.
    
    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 13, 2020
    Configuration menu
    Copy the full SHA
    7e6d15d View commit details
    Browse the repository at this point in the history
  2. Add note for myself on TODO

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 13, 2020
    Configuration menu
    Copy the full SHA
    da0247a View commit details
    Browse the repository at this point in the history
  3. Move mod declarations before use statements

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 13, 2020
    Configuration menu
    Copy the full SHA
    cafa8d7 View commit details
    Browse the repository at this point in the history
  4. Fix clippy warnings

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 13, 2020
    Configuration menu
    Copy the full SHA
    9ad109b View commit details
    Browse the repository at this point in the history

Commits on Aug 14, 2020

  1. Refactor interface entirely

    After much consideration, I decided to do away with the `Transport` and
    related traits entirely. It makes more sense, and results in better
    ability to test, if we abstract the `Client` interface instead. This
    also allows for greater flexibility when implementing different kinds of
    transports, while still allowing for lazy/optional instantiation of the
    subscription mechanism.
    
    Additional integration tests are included here, as well as additional
    documentation.
    
    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 14, 2020
    Configuration menu
    Copy the full SHA
    ecb099f View commit details
    Browse the repository at this point in the history
  2. Reduce number of blocks grabbed to speed up test

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 14, 2020
    Configuration menu
    Copy the full SHA
    cf56f7b View commit details
    Browse the repository at this point in the history
  3. Improve documentation for RPC client

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 14, 2020
    Configuration menu
    Copy the full SHA
    ae66f90 View commit details
    Browse the repository at this point in the history
  4. Fix links in method docs

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 14, 2020
    Configuration menu
    Copy the full SHA
    d3d2c32 View commit details
    Browse the repository at this point in the history
  5. Expose client docs in base RPC package

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 14, 2020
    Configuration menu
    Copy the full SHA
    f01d13d View commit details
    Browse the repository at this point in the history

Commits on Aug 16, 2020

  1. Refactor to allow for remote errors

    The code at the previous commit causes our current integration test on
    GitHub to hang because it doesn't know how to handle errors from the
    remote WebSocket endpoint, and also doesn't know how to handle
    deserialization failures (caused by protocol/serialization format
    changes).
    
    This commit introduces code that allows us to track pending
    subscribe/unsubscribe requests asynchronously, handling errors better at
    that stage of the process, as well as handle subscription format
    problems more effectively without hanging the client process.
    
    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    279913b View commit details
    Browse the repository at this point in the history
  2. Correctly produce a subscription error for possible RPC protocol mism…

    …atch
    
    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    6d35180 View commit details
    Browse the repository at this point in the history
  3. Remove unnecessary field

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    2228b71 View commit details
    Browse the repository at this point in the history
  4. Fix unsubscribe mechanism

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    8bc9f7f View commit details
    Browse the repository at this point in the history
  5. Fix failing doctest

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    f017d27 View commit details
    Browse the repository at this point in the history
  6. Allow for PartialEq comparisons (to aid in testing)

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    233fd62 View commit details
    Browse the repository at this point in the history
  7. Add tests for SubscriptionRouter

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    36e2969 View commit details
    Browse the repository at this point in the history
  8. Remove code no longer used

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    83d4835 View commit details
    Browse the repository at this point in the history

Commits on Aug 19, 2020

  1. result module need not be public

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 19, 2020
    Configuration menu
    Copy the full SHA
    ab4ba9b View commit details
    Browse the repository at this point in the history
  2. Clean up docs

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 19, 2020
    Configuration menu
    Copy the full SHA
    b160e65 View commit details
    Browse the repository at this point in the history
  3. Rename ClientError to ClientInternalError and update docs

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 19, 2020
    Configuration menu
    Copy the full SHA
    86ed3d9 View commit details
    Browse the repository at this point in the history
  4. Fix typo

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 19, 2020
    Configuration menu
    Copy the full SHA
    fd01278 View commit details
    Browse the repository at this point in the history
  5. Not using nightly docsrs features yet

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 19, 2020
    Configuration menu
    Copy the full SHA
    3eadccd View commit details
    Browse the repository at this point in the history

Commits on Aug 26, 2020

  1. Refactor and restructure interface

    As per the comments on #516, I've tried to restructure the public API
    for the client in a bit of a simpler way. I don't, unfortunately, think
    it's possible to simplify this API any further at this point in time.
    
    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 26, 2020
    Configuration menu
    Copy the full SHA
    a4c5a4d View commit details
    Browse the repository at this point in the history
  2. Minor documentation fixes

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 26, 2020
    Configuration menu
    Copy the full SHA
    1c82638 View commit details
    Browse the repository at this point in the history
  3. Add newline at end of JSON fixtures

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 26, 2020
    Configuration menu
    Copy the full SHA
    772bcd0 View commit details
    Browse the repository at this point in the history
  4. Remove request::Wrapper::new_with_id() method

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 26, 2020
    Configuration menu
    Copy the full SHA
    1d08a7d View commit details
    Browse the repository at this point in the history

Commits on Aug 27, 2020

  1. Refactor interface for subscription client

    The interface now no longer provides an option to subscribe using a
    specific buffer size and we assume unbounded buffers everywhere. This
    may or may not be a safe assumption going forward and we'll need to
    re-evaluate in future.
    
    As such, I could remove all code relating to bounded buffers.
    
    Additionally, this commit adds something of an integration test for the
    WebSocket-based subscription client (with a full WebSocket server,
    effectively).
    
    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 27, 2020
    Configuration menu
    Copy the full SHA
    3048155 View commit details
    Browse the repository at this point in the history
  2. Fix broken link in documentation

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 27, 2020
    Configuration menu
    Copy the full SHA
    5e9e351 View commit details
    Browse the repository at this point in the history
  3. Rename all "JSONRPC" references to "JSON-RPC"

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 27, 2020
    Configuration menu
    Copy the full SHA
    99dae2a View commit details
    Browse the repository at this point in the history
  4. Reword docs for SubscriptionClient

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 27, 2020
    Configuration menu
    Copy the full SHA
    ba2ca31 View commit details
    Browse the repository at this point in the history
  5. TODO is no longer necessary since we are using unbounded channels

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 27, 2020
    Configuration menu
    Copy the full SHA
    b4253c6 View commit details
    Browse the repository at this point in the history
  6. Update CHANGELOG

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 27, 2020
    Configuration menu
    Copy the full SHA
    b9e240e View commit details
    Browse the repository at this point in the history
  7. Clarify docs for Subscription::terminate

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Aug 27, 2020
    Configuration menu
    Copy the full SHA
    99a321f View commit details
    Browse the repository at this point in the history

Commits on Sep 14, 2020

  1. Merge branch 'master' into rpc/subscription

    Merges the latest changes from `master` while adjusting for Tendermint
    v0.34 compatibility.
    
    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Sep 14, 2020
    Configuration menu
    Copy the full SHA
    3e38b0b View commit details
    Browse the repository at this point in the history

Commits on Sep 15, 2020

  1. Fix features for tendermint-rpc dependency in light client

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Sep 15, 2020
    Configuration menu
    Copy the full SHA
    58d52ef View commit details
    Browse the repository at this point in the history
  2. Fix clippy warnings

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Sep 15, 2020
    Configuration menu
    Copy the full SHA
    e218dd6 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ee70331 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e7bb6a1 View commit details
    Browse the repository at this point in the history
  5. Refactor subscription state modelling

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Sep 15, 2020
    Configuration menu
    Copy the full SHA
    a891c21 View commit details
    Browse the repository at this point in the history
  6. Replace SubscriptionId AsRef implementation with as_str() method for …

    …clarity
    
    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Sep 15, 2020
    Configuration menu
    Copy the full SHA
    c22a5da View commit details
    Browse the repository at this point in the history
  7. Rename TxResult and TxResultResult for clarity

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Sep 15, 2020
    Configuration menu
    Copy the full SHA
    1753566 View commit details
    Browse the repository at this point in the history
  8. Add explanation of SubscriptionRouter subscriptions field

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Sep 15, 2020
    Configuration menu
    Copy the full SHA
    4db8d9e View commit details
    Browse the repository at this point in the history
  9. Comment on assumption regarding handling of event publishing failure

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Sep 15, 2020
    Configuration menu
    Copy the full SHA
    e293693 View commit details
    Browse the repository at this point in the history
  10. Add comment explaining redeclaration and obtaining of local var

    Signed-off-by: Thane Thomson <connect@thanethomson.com>
    thanethomson committed Sep 15, 2020
    Configuration menu
    Copy the full SHA
    e7403a6 View commit details
    Browse the repository at this point in the history