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

remove IBC ante handler in favor of using handler #6793

Merged
merged 9 commits into from
Jul 20, 2020

Conversation

colin-axner
Copy link
Contributor

@colin-axner colin-axner commented Jul 20, 2020

Description

Moves the function calls in the ante handler to the handler level since no state changes occur within the ...Pakcet function calls. This design was previously motivated by ADR 15 which was only partially implemented. From what I can tell, the motivation for the existence packet verification and update client within the ante handler was:

Intuitive interface for developers - IBC handlers do not need to care about IBC authentication

and possibly to allow update client changes to be persisted despite IBC handler failures, though this is unmentioned in the ADR. The above pro is still applied as IBC application developers still do not handle IBC authentication.

The IBC Keeper and ante handler function are now removed from the x/auth ante which I think is a substantial benefit since I do not believe IBC should be a first class citizen in the SDK rather an extra module that the application may choose not to include.

The IBC authentication will no longer be susceptible to a griefing attack where an attacker could submit txs that fail in the ante handler without having to pay fees for it. UpdateClient could be a potential vector since it can be computationally expensive. (credit: @AdityaSripal).

The con for this change is UpdateClient processing will not be persisted if any message within a transaction fails. This is negligible and corresponds to existing SDK transaction processing logic. It is also more of a UI issue.

ref (undoing some proposed changes): #5230


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


attributes := make([]sdk.Attribute, len(msg.GetSigners()))

for i, signer := range msg.GetSigners() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this information useful? If so I can add it to the corresponding handlers

@codecov
Copy link

codecov bot commented Jul 20, 2020

Codecov Report

Merging #6793 into master will increase coverage by 0.12%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #6793      +/-   ##
==========================================
+ Coverage   60.68%   60.80%   +0.12%     
==========================================
  Files         511      412      -99     
  Lines       31542    25025    -6517     
==========================================
- Hits        19141    15217    -3924     
+ Misses      10951     8550    -2401     
+ Partials     1450     1258     -192     

@colin-axner colin-axner marked this pull request as ready for review July 20, 2020 14:30
@fedekunze fedekunze added the A:automerge Automatically merge PR once all prerequisites pass. label Jul 20, 2020
@mergify mergify bot merged commit 79fa06b into master Jul 20, 2020
@mergify mergify bot deleted the colin/move-ante-checks-to-handler branch July 20, 2020 15:25
Copy link
Member

@AdityaSripal AdityaSripal left a comment

Choose a reason for hiding this comment

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

post-merge ACK 👍

chengwenxi pushed a commit to irisnet/cosmos-sdk that referenced this pull request Jul 22, 2020
* remove IBC ante handler, add calls to handler

* move some events upstream to handler

* remove change log entry

* move ante handler tests to handler

* fix build

* update docs

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
larry0x pushed a commit to larry0x/cosmos-sdk that referenced this pull request May 22, 2023
* remove IBC ante handler, add calls to handler

* move some events upstream to handler

* remove change log entry

* move ante handler tests to handler

* fix build

* update docs

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
@@ -110,16 +110,6 @@ func (k Keeper) UpdateClient(ctx sdk.Context, clientID string, header exported.H
),
)

// localhost client is not updated though messages
if clientType != exported.Localhost {

Choose a reason for hiding this comment

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

Hey

@@ -4,15 +4,13 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/signing"
"github.com/cosmos/cosmos-sdk/x/auth/types"
ibcante "github.com/cosmos/cosmos-sdk/x/ibc/ante"
ibckeeper "github.com/cosmos/cosmos-sdk/x/ibc/keeper"
)

// NewAnteHandler returns an AnteHandler that checks and increments sequence
// numbers, checks signatures & account numbers, and deducts fees from the first
// signer.
func NewAnteHandler(

Choose a reason for hiding this comment

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

Creator

Copy link

@1408eduardo 1408eduardo left a comment

Choose a reason for hiding this comment

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

retire el controlador ante IBC a favor de usar el controlador #6793
Hecho

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass. C:x/auth
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants