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

refactor: simplify IBC redundant relay check in given restructure of SDK v0.46 #1288

Merged

Conversation

colin-axner
Copy link
Contributor

Description

  • moves the tx handler middleware from modules/core/sdk_middleware to modules/core/keeper
  • remove if statement IsCheckTx, IsSimulateTx and only calls the tx handler when it is a CheckTx or SimulateTx

closes: #XXXX


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

Instead of having the function checkRedundancy check if the call is on CheckTx or SimulateTx, only call the function on CheckTx or SimulateTx
@@ -0,0 +1,129 @@
package keeper
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't have a strong preference on
modules/core/sdk_middleware/sdk_middleware.go
vs
modules/core/keeper/sdk_middleware.go

but my primary concern is I want to clearly differentiate the difference between IBC middleware and a transaction handler added into the SDK middleware stack

Copy link
Contributor

Choose a reason for hiding this comment

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

Prefer this approach as well :)

Copy link
Member

@damiannolan damiannolan left a comment

Choose a reason for hiding this comment

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

Great idea on moving to core/keeper, I think this provides a nice separation between what we class as IBC middleware and the sdk middleware handlers! LGTM

Copy link
Contributor

@seantking seantking left a comment

Choose a reason for hiding this comment

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

Great job :)

Copy link
Contributor

@crodriguezvega crodriguezvega left a comment

Choose a reason for hiding this comment

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

Thanks a lot, @colin-axner!

@colin-axner colin-axner merged commit 2aa1ea8 into carlos/upgrade-pr-branch Apr 25, 2022
@colin-axner colin-axner deleted the colin/refactor-redundancy-checktx branch April 25, 2022 13:11
crodriguezvega added a commit that referenced this pull request May 17, 2022
* deps: upgrade of SDK to 0.46 and tendermint to 0.35

* some changes from review comments

* some review comments

* refactor: simplify IBC redundant relay check in given restructure of SDK v0.46 (#1288)

* refactor: simplify ibc redundancy check used as sdk middleware

Instead of having the function checkRedundancy check if the call is on CheckTx or SimulateTx, only call the function on CheckTx or SimulateTx

* add godoc

* more review comments.

* another review comment

* remove tests since legacy REST endpoints have been removed in SDK 0.46

* chore: update sdk to v0.46.0-beta2

* refactor: ics27 indicator tests of deterministic error codes and message responses (#1349)

* begin refactoring ack_test

* fix test due to delayed block execution

* refactor: switch ics27 response creation to use new SDK version, update tests

* fix import

* review comment

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* review comment.

* pass nil context

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* review comment

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* remove unused import

* remove unused import

* fix for race condition in tests

* remove replace directive to make it build in pre-monterrey mac OS X

Co-authored-by: Carlos Rodriguez <crodveg@gmail.com>
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: billy rennekamp <billy.rennekamp@gmail.com>
CosmosCar pushed a commit to caelus-labs/ibc-go that referenced this pull request Nov 6, 2023
<!--
Please read and fill out this form before submitting your PR.

Please make sure you have reviewed our contributors guide before
submitting your
first PR.
-->

## Overview

Resolves cosmos#1286.

<!-- 
Please provide an explanation of the PR, including the appropriate
context,
background, goal, and rationale. If there is an issue with this
information,
please provide a tl;dr and link the issue. 
-->

## Checklist

<!-- 
Please complete the checklist to ensure that the PR is ready to be
reviewed.

IMPORTANT:
PRs should be left in Draft until the below checklist is completed.
-->

- [x] New and updated code has appropriate documentation
- [x] New and updated code has new and/or updated testing
- [x] Required CI checks are passing
- [x] Visual proof for any user facing features like CLI or
documentation updates
- [x] Linked issues closed with keywords


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

# Refactor:
- Updated the way our system communicates securely with other services.
- Moved the import statement for "google.golang.org/grpc" below the
import statement for "github.com/ipfs/go-datastore".
- Added the import statement for
"google.golang.org/grpc/credentials/insecure".
- Replaced the "grpc.WithInsecure()" dial option with
"grpc.WithTransportCredentials(insecure.NewCredentials())".
- Replaced the "grpc.WithInsecure()" option with
"grpc.WithTransportCredentials(insecure.NewCredentials())" in the
"Start" function.

This change enhances the security of our data transmissions, providing a
safer environment for user data. Please note, this update is
under-the-hood and won't affect the user interface or experience.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.

4 participants