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

[RingCache] Invalidate Cache On Redelegation Events #239

Merged
merged 71 commits into from
Jan 10, 2024

Conversation

h5law
Copy link
Contributor

@h5law h5law commented Dec 3, 2023

Summary

Human Summary

This PR adds the DelegationClient into the RingCache and has it listen for EventRedelegation events from the application in order to invalidate cache entries.

It does this by listening to all events from the application module and filtering for the EventRedelegation event type, if it exists. This is because it seems you cannot directly subscribe to all of a specific event (custom events). They must be subscribed to based on their attributes (potential for a single delegation client that is specific for each app address). And as the subscription query supports AND but not OR logic we cannot directly subscribe to both pocket.application/MsgDelegateToGateway and pocket.application/MsgUndelegateFromGateway.

AI Summary

Summary generated by Reviewpad on 10 Jan 24 01:59 UTC

This pull request includes several file diffs with various changes.

In the file 'errors.go', there are changes to variable names and error messages to improve clarity and consistency.

In the file 'msg_server_delegate_to_gateway.go', logging statements and event emission for application redelegation are modified to improve functionality and error handling.

The 'go.mod' file has changes related to dependency additions and removals.

In the file 'accquerier.go', there is a change in error handling related to deserialization of an account.

The file 'pkg/sdk/sdk.go' adds new functionality to create a new SDK instance with the given configuration.

The 'replay_client.go' file modifies code related to handling transport errors and event notifications.

The diff in the file 'delegationEventQuery' updates the subscription to application module events.

The 'cache.go' file introduces various changes related to dependency injection, methods, and logging in the cache functionality.

The 'pkg/client/events/replay_client.go' file changes comment explanations for handling transport errors and event notifications.

In the file 'cache.go' in the 'pkg/crypto/rings' package, there are changes related to dependencies, constructors, functionality, and logging.

The diff in the file adds a comment and code related to simulating connection closing.

The file 'pkg/client/delegation' has changes related to dependencies and the creation and supply of a delegation client.

The 'accquerier.go' file modifies error handling related to deserialization of an account.

In the file 'client.go', there are changes related to subscribing to events, filtering, and overriding defaults.

The 'cache.go' file in the 'pkg/crypto/rings' package has changes related to dependencies, constructors, methods, and logging.

The file 'replay_client.go' modifies code related to transport errors and event notifications.

The file 'pkg/crypto/rings/cache.go' has changes related to dependencies, methods, and logging.

The 'event.proto' file includes changes to import statements, options, and message fields.

The 'msg_server_undelegate_from_gateway.go' file adds logging and error handling improvements.

The 'interface.go' file modifies the 'RingCache' interface by adding new methods.

The file 'testproxy/relayerproxy.go' has changes related to importing packages, modifying methods, and adding dependencies.

Let me know if you need any further assistance with this diff.

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 off-chain Off-chain business logic crypto Changes related to crypto and keys labels Dec 3, 2023
@h5law h5law added this to the Shannon TestNet milestone Dec 3, 2023
@h5law h5law self-assigned this Dec 3, 2023
Copy link
Member

@Olshansk Olshansk left a comment

Choose a reason for hiding this comment

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

Did a quick review of this having done a partial review of the upstream PR. Some minor comments but looks pretty straightforward!

pkg/appgateserver/server.go Outdated Show resolved Hide resolved
pkg/crypto/interface.go Show resolved Hide resolved
pkg/relayer/proxy/proxy.go Outdated Show resolved Hide resolved
pkg/deps/config/suppliers.go Outdated Show resolved Hide resolved
testutil/testclient/testdelegation/client.go Outdated Show resolved Hide resolved
x/application/keeper/msg_server_delegate_to_gateway.go Outdated Show resolved Hide resolved
Base automatically changed from feat/delegation-events to main December 7, 2023 21:57
Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
pkg/relayer/proxy/proxy.go Outdated Show resolved Hide resolved
pkg/appgateserver/server.go Outdated Show resolved Hide resolved
pkg/crypto/rings/cache.go Outdated Show resolved Hide resolved
@h5law h5law changed the base branch from main to feat/replay_client_remapping December 13, 2023 16:10
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)
@h5law
Copy link
Contributor Author

h5law commented Dec 22, 2023

@Olshansk I think this is good to go once e2e stuff is fixed I can add the label

@h5law h5law changed the base branch from feat/replay_client_remapping to main December 23, 2023 02:40
Copy link

The CI will now also run the e2e tests on devnet, which increases the time it takes to complete all CI checks.

@github-actions github-actions bot added devnet push-image CI related - pushes images to ghcr.io labels Dec 23, 2023
pkg/client/delegation/redelegation.go Show resolved Hide resolved
pkg/client/events/replay_client.go Show resolved Hide resolved
pkg/client/events/replay_client.go Outdated Show resolved Hide resolved
pkg/sdk/sdk.go Outdated Show resolved Hide resolved
pkg/crypto/rings/cache_test.go Outdated Show resolved Hide resolved
@h5law h5law requested a review from Olshansk January 8, 2024 17:57
Copy link
Member

@Olshansk Olshansk left a comment

Choose a reason for hiding this comment

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

Just two small NITs before its g2g

pkg/appgateserver/cmd/cmd.go Outdated Show resolved Hide resolved
pkg/relayer/cmd/cmd.go Outdated Show resolved Hide resolved
@h5law h5law merged commit f08c32a into main Jan 10, 2024
10 checks passed
@h5law h5law deleted the feat/invalidate-ring-cache branch January 10, 2024 02:14
bryanchriswhite added a commit that referenced this pull request Jan 10, 2024
…/in-memory-network

* issues/141/prep/in-memory-network:
  [Testing, Tooling] chore: in-memory network interface & config types (#289)
  trigger CI
  [Supplier] refactor: supplier module errors (#265)
  [Supplier] refactor: supplier module keys (#264)
  [Supplier] refactor: claim & proof protobufs + (#263)
  chore: review feedback improvements
  [Configs] feat: Add staking config parser of gateway staking (#302)
  chore: review feedback improvements
  fix: usage raw string literal
  chore: review feedback improvements
  [RingCache] Invalidate Cache On Redelegation Events (#239)
bryanchriswhite added a commit that referenced this pull request Jan 12, 2024
…ctor/in-memory-network

* issues/141/feat/in-memory-network:
  chore: review feedback improvements
  feat: update SMT to v0.9.2 (#311)
  fix: linter errors
  fixup! chore: review feedback improvements
  chore: review feedback improvements
  chore: review feedback improvements
  [Testing, Tooling] chore: in-memory network interface & config types (#289)
  trigger CI
  [Supplier] refactor: supplier module errors (#265)
  [Supplier] refactor: supplier module keys (#264)
  [Supplier] refactor: claim & proof protobufs + (#263)
  chore: review feedback improvements
  [Configs] feat: Add staking config parser of gateway staking (#302)
  chore: review feedback improvements
  fix: usage raw string literal
  chore: review feedback improvements
  [RingCache] Invalidate Cache On Redelegation Events (#239)
@bryanchriswhite bryanchriswhite removed push-image CI related - pushes images to ghcr.io devnet-test-e2e labels May 16, 2024
@github-actions github-actions bot removed the devnet label May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crypto Changes related to crypto and keys off-chain Off-chain business logic
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

4 participants