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

[Off-Chain] Add EventsReplayClient Generic Event Listener for BlockClient and DelegationClient #220

Merged
merged 38 commits into from
Dec 7, 2023

Conversation

h5law
Copy link
Contributor

@h5law h5law commented Nov 23, 2023

Summary

Human Summary

This PR converts the existing BlockClient into an implenentation of the generic EventsReplayClient which subscribes to and listens for on chain events and maps them into the desired type of the implemented EventsReplayClient

BlockClient -> EventsReplayClient[Block]
DelegationClient -> EventsReplayClient[DelegateeChange]

These new client interfaces have their own methods which wrap those exposed by the EventsReplayClient

AI Summary

Summary generated by Reviewpad on 07 Dec 23 20:34 UTC

This pull request:

  • Modifies the ring_signer.go file in the pkg/signer package by updating the comments for the NewRingSigner function and the Sign method.
  • Introduces a new client_integration_test.go file in the pkg/client/delegation package, which contains a test function for the DelegationClient redelegation functionality. However, the test is currently skipped and needs further investigation and fixing.
  • Adds a new file replay_client.go in the pkg/client/events package, which implements a replay client for handling events and provides various functions for interacting with the client.
  • Contains changes in the claim.go file under the pkg/relayer/session package, involving refactoring and optimization of code.
  • Removes an empty line in the SupplierAll function in a certain file.
  • Deletes the errors.go file, which contained a package named websocket and imported another package named errorsmod, as well as defined an error variable and a codespace variable.
  • Adds a new file godoc.go in the pkg/client/block package, which is a wrapper for the EventsReplayClient[Block] generic and listens for committed block events on the chain.
  • Introduces a new file event.proto in the pocket/application directory, defining a protocol buffer message EventRedelegation for application delegatee gateway changes on the chain.
  • Includes changes in a certain file related to table formatting, addition of new interfaces and components, and import statements.
  • Adds a new file errors.go with error handling functionality specific to event handling in the client package.
  • Modifies the flag descriptions and import statements in a certain file.
  • Changes import statements and the file structure in a certain file.
  • Updates comments, including changes from "serialised" to "serialized" in various files.
  • Adds a new file client_test.go with test cases for the DelegationClient struct.
  • Introduces a new file websocket that provides a websocket client for connecting to a cosmos-sdk based chain node.
  • Adds a new file godoc.go that contains documentation for the delegation package and its functionalities.
  • Adds a new file redelegation.go that defines a struct and a factory function for deserializing data into the struct.
  • Adds a new file that provides a generic client for subscribing to on-chain events with the usage of ReplayObservables.
  • Renames and modifies import statements in a file.
  • Modifies a file by adding assertions for events in test functions.
  • Renames and modifies the client_integration_test.go file, including changes in the package name and import statements.
  • Modifies a file by adding new lines, formatting, and emission of events.
  • Deletes the events_query.md file that provided an overview of the package.
  • Changes the URL in the Makefile for accessing the generated documentation.
  • Modifies the import statement in a file.
  • Adds a new method to a struct in a file.

Please let me know if you need further assistance or have any questions.

Issue

  • Fixes N/A

Type of change

Select one or more:

  • New feature, functionality or library
  • Bug fix
  • Code health or cleanup
  • Documentation
  • Other (specify)

Testing

  • Run all unit tests: make go_develop_and_test
  • Verify Localnet manually: See the instructions [here](TODO: add link to instructions)

Sanity Checklist

  • I have tested my changes using the available tooling
  • I have performed a self-review of my own code
  • I have commented my code, updated documentation and left TODOs throughout the codebase

@h5law h5law added application Changes related to the Application actor off-chain Off-chain business logic on-chain On-chain business logic crypto Changes related to crypto and keys labels Nov 23, 2023
@h5law h5law added this to the Shannon TestNet milestone Nov 23, 2023
@h5law h5law self-assigned this Nov 23, 2023
@h5law h5law changed the title [RingCache] Add EventDelegateeChange event emission and cache invalidation [Off-Chain] Add MappedClient Generic Event Listener for BlockClient and DelegationClient Nov 24, 2023
pkg/client/interface.go Outdated Show resolved Hide resolved
@Olshansk
Copy link
Member

@h5law Skipping this over for now but please request a review when we should take look.

@h5law h5law changed the base branch from feat/symmetric_protocols to feat/ring-cache November 25, 2023 00:45
@h5law h5law changed the title [Off-Chain] Add MappedClient Generic Event Listener for BlockClient and DelegationClient [Off-Chain] Add EventsReplayClient Generic Event Listener for BlockClient and DelegationClient Nov 25, 2023
@h5law h5law force-pushed the feat/delegation-events branch 2 times, most recently from 5fad821 to 5e2f32d Compare November 29, 2023 22:32
Copy link
Contributor

@bryanchriswhite bryanchriswhite left a comment

Choose a reason for hiding this comment

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

I finally got through it! 😅🎉

This PR is in great shape, especially for its size. I have one more round of comments and then I think it'll be good to go.

I also wanted to call out #220 (comment) and #220 (comment) to make sure that we don't loose track of them.

@h5law
Copy link
Contributor Author

h5law commented Dec 7, 2023

@Olshansk @bryanchriswhite Should be good to go now <3

Copy link
Contributor

@bryanchriswhite bryanchriswhite left a comment

Choose a reason for hiding this comment

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

Preemptively approving but I have one last change request regarding the sequence diagram.

Thanks for all your patience! 🙈

docs/pkg/client/events.md Outdated Show resolved Hide resolved
@h5law h5law dismissed Olshansk’s stale review December 7, 2023 21:57

All comments addressed, discussed offline

@h5law h5law merged commit b732815 into main Dec 7, 2023
9 checks passed
@h5law h5law deleted the feat/delegation-events branch December 7, 2023 21:57
Olshansk added a commit that referenced this pull request Dec 10, 2023
Olshansk added a commit that referenced this pull request Dec 13, 2023
…#253)

This is aiming to fix multiple issues in E2E tests and just general QoL improvements:

1. Adding a comment in `relay.feature` about the need to run `make supplier1_stake && make app1_stake` until we fix #180 (known issue)
2. Replacing the reference to host `sequencer-poktroll-sequencer` with `localhost` (see first screenshot below)
3. Fixed a bug leading us to assert against a `MsgSubmitProof` event instead of a `MsgCreateClaim` event (see second screenshot below)
4. Fixed on-chain logging under `x/*` by replacing `logger\.(Info|Error)\("([^"]+)"(?:, (.*))?\)` with `logger.$1(fmt.Sprintf("$2", $3))` so it works as expected
5. Some quality-of-life comments & TODOs
6. Minor additions to unit tests from #220
h5law added a commit that referenced this pull request Dec 14, 2023
commit df73cfa
Author: Bryan White <[email protected]>
Date:   Thu Dec 14 01:06:03 2023 +0100

    refactor: `NewMinedRelay` to shared testutil (#262)

commit 410965a
Author: Bryan White <[email protected]>
Date:   Thu Dec 14 01:05:52 2023 +0100

    fix: PR template typo 2 (#269)

commit dd7df68
Author: Daniel Olshansky <[email protected]>
Date:   Wed Dec 13 13:45:26 2023 -0800

    [Testing] Unit tests, E2E tests, logging and other Fixes / "Touchups" (#253)

    This is aiming to fix multiple issues in E2E tests and just general QoL improvements:

    1. Adding a comment in `relay.feature` about the need to run `make supplier1_stake && make app1_stake` until we fix #180 (known issue)
    2. Replacing the reference to host `sequencer-poktroll-sequencer` with `localhost` (see first screenshot below)
    3. Fixed a bug leading us to assert against a `MsgSubmitProof` event instead of a `MsgCreateClaim` event (see second screenshot below)
    4. Fixed on-chain logging under `x/*` by replacing `logger\.(Info|Error)\("([^"]+)"(?:, (.*))?\)` with `logger.$1(fmt.Sprintf("$2", $3))` so it works as expected
    5. Some quality-of-life comments & TODOs
    6. Minor additions to unit tests from #220

commit d621631
Author: Redouane Lakrache <[email protected]>
Date:   Wed Dec 13 16:24:34 2023 +0100

    [SDK] feat: Have distinct JSON-RPC and gRPC urls (#261)

    * feat: Have distinct JSON-RPC and gRPC urls

    * chore: Trigger e2e tests

    * chore: Fix import groups

commit 4e30e27
Author: Bryan White <[email protected]>
Date:   Wed Dec 13 14:28:36 2023 +0100

    fix PR template testing checklist item (#268)
okdas pushed a commit that referenced this pull request Dec 19, 2023
…#253)

This is aiming to fix multiple issues in E2E tests and just general QoL improvements:

1. Adding a comment in `relay.feature` about the need to run `make supplier1_stake && make app1_stake` until we fix #180 (known issue)
2. Replacing the reference to host `sequencer-poktroll-sequencer` with `localhost` (see first screenshot below)
3. Fixed a bug leading us to assert against a `MsgSubmitProof` event instead of a `MsgCreateClaim` event (see second screenshot below)
4. Fixed on-chain logging under `x/*` by replacing `logger\.(Info|Error)\("([^"]+)"(?:, (.*))?\)` with `logger.$1(fmt.Sprintf("$2", $3))` so it works as expected
5. Some quality-of-life comments & TODOs
6. Minor additions to unit tests from #220
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
application Changes related to the Application actor crypto Changes related to crypto and keys off-chain Off-chain business logic on-chain On-chain business logic
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

3 participants