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

imp: remove height from header and merge header with misbehaviour #4049

Conversation

crodriguezvega
Copy link
Contributor

Description

Work in progress. Still needs new versions of contracts for tests to pass.

closes: #3958

Commit Message / Changelog Entry

type: commit message

see the guidelines for commit messages. (view raw markdown for examples)


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 and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/).
  • Added relevant godoc comments.
  • Provide a commit message to be used for the changelog entry in the PR description for review.
  • Re-reviewed Files changed in the Github PR explorer.
  • Review Codecov Report in the comment section below once CI passes.

Comment on lines 43 to 51
type checkForMisbehaviourExecuteResult struct {
contractResult
FoundMisbehaviour bool `json:"found_misbehaviour"`
}

type updateStateExecuteResult struct {
contractResult
Heights []exported.Height `json:"heights"`
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added these types for the different results.

Copy link
Member

Choose a reason for hiding this comment

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

same comment from other PR about response vs result naming :)

clientMessage struct {
Header *Header `json:"header,omitempty"`
Misbehaviour *Misbehaviour `json:"misbehaviour,omitempty"`
ClientMessage *ClientMessage `json:"client_message"`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is how the payload to the contract call looks after merging Header and Misbehaviour.

…header-and-merge-header-with-misbehaviour

# Conflicts:
#	modules/light-clients/08-wasm/types/header_test.go
#	modules/light-clients/08-wasm/types/misbehaviour.go
#	modules/light-clients/08-wasm/types/misbehaviour_test.go
#	modules/light-clients/08-wasm/types/upgrade.go
#	modules/light-clients/08-wasm/types/wasm.pb.go
crodriguezvega added a commit that referenced this pull request Jul 21, 2023
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.

left some comments / minor suggestions! :) nice work on all these!

modules/light-clients/08-wasm/types/client_message.go Outdated Show resolved Hide resolved
modules/light-clients/08-wasm/types/client_message.go Outdated Show resolved Hide resolved

for _, tc := range testCases {
suite.Run(tc.name, func() {
clientMessage := tc.clientMessage
Copy link
Member

Choose a reason for hiding this comment

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

nit: redundant var, but feel free to ignore, its probably fine

modules/light-clients/08-wasm/types/update.go Outdated Show resolved Hide resolved
if !ok {
panic(fmt.Errorf("expected type %T, got %T", &Header{}, clientMsg))
panic(fmt.Errorf("expected type %T, got %T", &ClientMessage{}, clientMsg))
Copy link
Member

Choose a reason for hiding this comment

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

if we're going to panic here, then we should also panic in CheckForMisbehaviour and UpdateStateOnMisbehaviour if clientMsg is not *ClientMessage, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this mostly followed what is done for tendermint. For CheckForMisbehaviour, returning false would call UpdateState and result in that panic being hit. I guess panicking could be done here but it wouldn't save us much right?

Copy link
Member

Choose a reason for hiding this comment

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

Agree!

Comment on lines 43 to 51
type checkForMisbehaviourExecuteResult struct {
contractResult
FoundMisbehaviour bool `json:"found_misbehaviour"`
}

type updateStateExecuteResult struct {
contractResult
Heights []exported.Height `json:"heights"`
}
Copy link
Member

Choose a reason for hiding this comment

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

same comment from other PR about response vs result naming :)

…header-and-merge-header-with-misbehaviour

# Conflicts:
#	modules/light-clients/08-wasm/types/misbehaviour_handle.go
#	modules/light-clients/08-wasm/types/vm.go
#	modules/light-clients/08-wasm/types/wasm.pb.go
@crodriguezvega crodriguezvega merged commit 20d4d7e into feat/wasm-clients Aug 1, 2023
51 of 52 checks passed
@crodriguezvega crodriguezvega deleted the carlos/3958-remove-height-from-header-and-merge-header-with-misbehaviour branch August 1, 2023 13:51
crodriguezvega added a commit that referenced this pull request Aug 1, 2023
…calls (#4133)

* defined query and sudo message types to encapsulate all variants for calls

* pass client message

* add ClientMessage from #4049

* address review comments

* linter

* gofumpt

* review comment

* more gofumpt
@faddat faddat mentioned this pull request Sep 10, 2023
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants