-
Notifications
You must be signed in to change notification settings - Fork 580
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
Update wasm light client unit tests and tendermint/grandpa cw contract #4306
Update wasm light client unit tests and tendermint/grandpa cw contract #4306
Conversation
TestInitializeTendermint(), remove unnecessary test from TestConsensusStateValidateBasic(), change the update state result's height type.
@@ -120,5 +120,5 @@ type checkForMisbehaviourResult struct { | |||
|
|||
type updateStateResult struct { | |||
contractResult | |||
Heights []exported.Height `json:"heights"` | |||
Heights []clienttypes.Height `json:"heights"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I think this is right, I guess we could keep it as an interface and define structs for each different response type we could have and define a custom unmarshaller. It's not entirely clear to me if that would be needed though.
Also noting that Status
can also be directly set to string
instead of exported.Status
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think better to use the concrete types when serialising json across the vm with std lib.
Not sure how well encoding/json
plays with interfaces in general, its not quite like the proto3 json and the interface support with sdk codec
ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" | ||
ibctesting "github.com/cosmos/ibc-go/v7/testing" | ||
) | ||
|
||
func (suite *TypesTestSuite) TestExportGenesisGrandpa() { | ||
/*func (suite *TypesTestSuite) TestExportGenesisGrandpa() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: We're waiting for the contract update for Grandpa, right? I'm guessing this is a temp commenting out for that eventuality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, we need updates for grandpa contract and hyperspace supporting the new wasm client changes. Then interchaintest support for any hyperspace cli/config changes (I'm pretty sure there are some). And then, finally, run interchaintest using compatible polkadot and parachain images. Once the e2e test is successful, we can harvest the test data for the wasm client's grandpa tests for the tests that require new test data.
TestStatusGrandpa, and TestExportGenesisGrandpa working again
TestUpdateStateGrandpa, TestVerifyUpgradeGrandpa working again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for this PR, @misko9. I had a quick look and left just one question for now. Will review more later.
@@ -365,7 +384,7 @@ func (suite *TypesTestSuite) TestVerifyMembershipGrandpa() { | |||
ConnectionId: connectionID, | |||
Prefix: suite.chainA.GetPrefix(), | |||
}, | |||
DelayPeriod: 0, | |||
DelayPeriod: 1000000000, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious: why this needed to be changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the last test data was generated, a requirement was added to Hyperspace for a non-zero delay in seconds. For generating the new test data using the e2e test, I used 1 second, 1_000_000_000, for that input to fulfill that requirement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation, @misko9. I will add a comment in a follow-up PR, so that we don't lose this information.
@@ -0,0 +1,59 @@ | |||
How to regenerate grandpa test data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tysm for the README, haven't tried to run these atm but really great idea you decided to add this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 thanks for this doc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, @misko9. Thanks a lot for regenerating the test data and updating the tests.
I am happy to work on my comments in a follow-up PR. I will also open an issue to track the work for fixing the misbehaviour tests.
@@ -173,17 +173,17 @@ func (suite *TypesTestSuite) TestValidate() { | |||
}{ | |||
{ | |||
name: "valid client", | |||
clientState: types.NewClientState([]byte{0}, []byte{0}, clienttypes.ZeroHeight()), | |||
clientState: types.NewClientState([]byte{0}, []byte("01234567012345670123456701234567"), clienttypes.ZeroHeight()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can make this magic 01234567012345670123456701234567
string a constant somewhere. I am happy to do it in a follow-up PR to speed up merging this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where does this magic string come from?
Would be nice to move away from hardcoded values in testing in the long term, but I think we can also work on that post-release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This magic string just needs to be any 32 bytes to pass ClientState's Validate() function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, makes sense, thanks @misko9
@@ -365,7 +384,7 @@ func (suite *TypesTestSuite) TestVerifyMembershipGrandpa() { | |||
ConnectionId: connectionID, | |||
Prefix: suite.chainA.GetPrefix(), | |||
}, | |||
DelayPeriod: 0, | |||
DelayPeriod: 1000000000, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation, @misko9. I will add a comment in a follow-up PR, so that we don't lose this information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @misko9! Much appreciated.
@@ -0,0 +1,59 @@ | |||
How to regenerate grandpa test data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 thanks for this doc
@@ -120,5 +120,5 @@ type checkForMisbehaviourResult struct { | |||
|
|||
type updateStateResult struct { | |||
contractResult | |||
Heights []exported.Height `json:"heights"` | |||
Heights []clienttypes.Height `json:"heights"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think better to use the concrete types when serialising json across the vm with std lib.
Not sure how well encoding/json
plays with interfaces in general, its not quite like the proto3 json and the interface support with sdk codec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we create an issue for these commented out tests?
@@ -173,17 +173,17 @@ func (suite *TypesTestSuite) TestValidate() { | |||
}{ | |||
{ | |||
name: "valid client", | |||
clientState: types.NewClientState([]byte{0}, []byte{0}, clienttypes.ZeroHeight()), | |||
clientState: types.NewClientState([]byte{0}, []byte("01234567012345670123456701234567"), clienttypes.ZeroHeight()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where does this magic string come from?
Would be nice to move away from hardcoded values in testing in the long term, but I think we can also work on that post-release.
update grandpa testing, update TestInitializeTendermint(), remove unnecessary test from TestConsensusStateValidateBasic(), change the update state result's height type.
Description
closes: #XXXX
Commit Message / Changelog Entry
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.
docs/
) or specification (x/<module>/spec/
).godoc
comments.Files changed
in the Github PR explorer.Codecov Report
in the comment section below once CI passes.