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

ICS07 follow ups #5631

Merged
merged 16 commits into from
Feb 18, 2020
Merged

Conversation

AdityaSripal
Copy link
Member

Addresses comments from #5485 (review)
Implements changes from cosmos/ibc#367

Description

Fixes to ICS7 to allow for safe updating/submitting misbehavior while ensuring the ICS2 package remains independent of tendermint specific client logic


For contributor use:

  • 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

For admin use:

  • Added appropriate labels to PR (ex. WIP, R4R, docs, etc)
  • Reviewers assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@AdityaSripal AdityaSripal changed the title Aditya/ics07 follow ups ICS07 follow ups Feb 10, 2020
x/ibc/02-client/keeper/client_test.go Outdated Show resolved Hide resolved
x/ibc/02-client/keeper/client_test.go Outdated Show resolved Hide resolved
x/ibc/04-channel/keeper/keeper_test.go Outdated Show resolved Hide resolved
x/ibc/03-connection/keeper/keeper_test.go Outdated Show resolved Hide resolved
x/ibc/03-connection/keeper/keeper_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

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

Thanks! Mostly looks good - a few remaining questions on abstraction boundaries, see comments.

x/ibc/02-client/handler.go Show resolved Hide resolved
x/ibc/02-client/handler.go Show resolved Hide resolved
x/ibc/02-client/keeper/client.go Outdated Show resolved Hide resolved
x/ibc/02-client/keeper/keeper.go Outdated Show resolved Hide resolved
@AdityaSripal
Copy link
Member Author

AdityaSripal commented Feb 14, 2020

Blocked on figuring out how to do cosmos/ibc#378 while maintaing current IBC abstractions. Plan to find a solution for this for IBC week

Will address this in separate PR as its not required for demo

Copy link
Collaborator

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

Looks good overall. I'm not sure what is the reasoning to move the messages to each specific client instead of ICS02.

Thanks @AdityaSripal

x/ibc/02-client/client/cli/cli.go Show resolved Hide resolved
x/ibc/02-client/client/rest/rest.go Show resolved Hide resolved
x/ibc/02-client/exported/exported.go Show resolved Hide resolved
x/ibc/02-client/handler.go Outdated Show resolved Hide resolved
func HandleMsgCreateClient(ctx sdk.Context, k Keeper, msg exported.MsgCreateClient) (*sdk.Result, error) {
clientType := exported.ClientTypeFromString(msg.GetClientType())
switch clientType {
case 0:
Copy link
Collaborator

Choose a reason for hiding this comment

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

no need for this case

Copy link
Member Author

Choose a reason for hiding this comment

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

need it in case the string in msg does not match any of the expected values

Copy link
Collaborator

Choose a reason for hiding this comment

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

it will fall under the default case

x/ibc/02-client/keeper/client_test.go Show resolved Hide resolved
x/ibc/02-client/keeper/keeper.go Outdated Show resolved Hide resolved
x/ibc/04-channel/keeper/keeper_test.go Outdated Show resolved Hide resolved
x/ibc/07-tendermint/misbehaviour_test.go Outdated Show resolved Hide resolved
x/ibc/07-tendermint/misbehaviour.go Outdated Show resolved Hide resolved
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
@cwgoes
Copy link
Contributor

cwgoes commented Feb 17, 2020

  • End to end test cases of the imported tendermint.Verify
  • See if we can initially import the sequential light client only

@cwgoes cwgoes mentioned this pull request Feb 17, 2020
13 tasks
Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

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

utACK

Copy link
Collaborator

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

Changes LGTM. Additions from #5586 are still pending

@cwgoes
Copy link
Contributor

cwgoes commented Feb 17, 2020

Changes LGTM. Additions from #5586 are still pending

@AdityaSripal Did you want to add those here or in a separate PR?

@cwgoes
Copy link
Contributor

cwgoes commented Feb 17, 2020

Also, we should make sure that this PR fixes cosmos/relayer#27.

Copy link
Collaborator

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

ACK pending minor comments

if !ok {
return nil, sdkerrors.Wrap(ErrInvalidClientType, "Msg is not a Tendermint CreateClient msg")
}
clientState, err := ibctmtypes.InitializeFromMsg(tmMsg)
Copy link
Collaborator

Choose a reason for hiding this comment

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

move out of the switch statement

Copy link
Collaborator

Choose a reason for hiding this comment

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

also, you can just use Initialize here

x/ibc/07-tendermint/types/client_state.go Outdated Show resolved Hide resolved
x/ibc/07-tendermint/types/msgs.go Outdated Show resolved Hide resolved
x/ibc/20-transfer/handler_test.go Show resolved Hide resolved
x/ibc/20-transfer/handler_test.go Show resolved Hide resolved
x/ibc/20-transfer/keeper/relay_test.go Show resolved Hide resolved
x/ibc/20-transfer/keeper/relay_test.go Show resolved Hide resolved
x/ibc/ante/ante_test.go Show resolved Hide resolved
x/ibc/ante/ante_test.go Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Feb 18, 2020

Codecov Report

Merging #5631 into fedekunze/ics07-follow-ups will increase coverage by <.01%.
The diff coverage is 63.63%.

Impacted file tree graph

@@                      Coverage Diff                       @@
##           fedekunze/ics07-follow-ups    #5631      +/-   ##
==============================================================
+ Coverage                       42.54%   42.55%   +<.01%     
==============================================================
  Files                             375      375              
  Lines                           29855    29861       +6     
==============================================================
+ Hits                            12702    12706       +4     
- Misses                          16040    16042       +2     
  Partials                         1113     1113
Impacted Files Coverage Δ
x/ibc/07-tendermint/update.go 52.27% <100%> (ø) ⬆️
x/ibc/07-tendermint/types/msgs.go 52.72% <100%> (+2.72%) ⬆️
x/ibc/02-client/keeper/client.go 95.55% <100%> (ø) ⬆️
x/ibc/07-tendermint/types/client_state.go 68.33% <20%> (-0.9%) ⬇️

@fedekunze fedekunze merged commit 535a493 into fedekunze/ics07-follow-ups Feb 18, 2020
@fedekunze fedekunze deleted the aditya/ics07-follow-ups branch February 18, 2020 13:00
fedekunze added a commit that referenced this pull request Feb 18, 2020
* ADR07 follow up changes

* add assertion checks

* update ICS02 tests

* update ICS07 tests

* add trusting and ubd period to msg

* tests

* more test updates

* ICS07 follow ups (#5631)

* refactor tendermint package to move msgs here

* fix rest of package to accomadate 07 refactor

* added GetHeight to ConsensusState and moved clientstate struct creation to 07-tendermint

* start work on making misbehavior retrieve consensusState LTE misbehavior

* allow misbehavior submission at height not equal to persisted consensusState

* optimize submitMisbehavior by erroring earlier

* cleanup misbehavior and propose lazy fix

* fix bug

* Update x/ibc/02-client/keeper/client.go

Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* address fede review

* add chain-id into clientstate

* address necessary fede review

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

Co-authored-by: Aditya <adityasripal@gmail.com>
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.

5 participants