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

Use Tendermint lite client verification #5666

Merged
merged 28 commits into from
Feb 21, 2020
Merged

Use Tendermint lite client verification #5666

merged 28 commits into from
Feb 21, 2020

Conversation

AdityaSripal
Copy link
Member

Closes: #XXX

Description


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)

Copy link
Member

@jackzampolin jackzampolin left a comment

Choose a reason for hiding this comment

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

Like moving over to just headers. Simplifies things greatly and will reduce confusion ++

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.

  • Do we check the consensus state timestamp when checking misbehaviour?
  • Is the chain ID field duplicated by the chain ID in the stored header?

Otherwise LGTM.

x/ibc/07-tendermint/misbehaviour.go Outdated Show resolved Hide resolved
}

func (suite *KeeperTestSuite) SetupTest() {
isCheckTx := false
app := simapp.Setup(isCheckTx)

suite.now = time.Date(2020, 1, 2, 0, 0, 0, 0, time.UTC)
now2 := suite.now.Add(time.Duration(time.Hour * 1))
Copy link
Contributor

Choose a reason for hiding this comment

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

unnecessary conversion (from unconvert)

testConnection = "testconnection"

testChannelVersion = "1.0"

height = 10
Copy link
Contributor

Choose a reason for hiding this comment

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

const height is unused (from unused)

}

clientState, found := suite.keeper.GetClientState(suite.ctx, testClientID)
suite.Require().True(found, "valid test case %d failed: %s", i, tc.name)

consensusState, found := suite.keeper.GetClientConsensusState(suite.ctx, testClientID, uint64(suite.header.GetHeight()))
consensusState, found := suite.keeper.GetClientConsensusState(suite.ctx, testClientID, uint64(updateHeader.GetHeight()))
Copy link
Contributor

Choose a reason for hiding this comment

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

unnecessary conversion (from unconvert)

@@ -24,6 +25,7 @@ const (
testChainID = "test-chain-id"
testClient = "test-client"
testClientType = clientexported.Tendermint
height = 10
Copy link
Contributor

Choose a reason for hiding this comment

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

height is unused (from deadcode)

@@ -37,6 +37,9 @@ const (
testChannel1 = "firstchannel"
testChannel2 = "secondchannel"

height = 10
Copy link
Contributor

Choose a reason for hiding this comment

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

height is unused (from deadcode)

return connection
}

func (suite *KeeperTestSuite) createChannel(
func (chain *TestChain) createChannel(
Copy link
Contributor

Choose a reason for hiding this comment

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

func (*TestChain).createChannel is unused (from unused)

_, err = suite.app.IBCKeeper.ClientKeeper.CreateClient(suite.ctx, clientState, consensusState)
suite.Require().NoError(err)
// createClient will create a client for clientChain on targetChain
func (target *TestChain) CreateClient(client *TestChain) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

receiver name target should be consistent with previous receiver name chain for TestChain (from golint)

@@ -140,28 +185,32 @@ func (suite *KeeperTestSuite) createClient(clientID string) {
// )
}

func (suite *KeeperTestSuite) updateClient(clientID string) {
func (target *TestChain) updateClient(client *TestChain) {
Copy link
Contributor

Choose a reason for hiding this comment

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

receiver name target should be consistent with previous receiver name chain for TestChain (from golint)

@@ -19,9 +19,10 @@ func (k Keeper) VerifyClientConsensusState(
proof commitment.ProofI,
consensusState clientexported.ConsensusState,
) error {
clientState, found := k.clientKeeper.GetClientState(ctx, connection.GetClientID())
clientID := connection.GetCounterparty().GetClientID()
Copy link
Contributor

Choose a reason for hiding this comment

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

This line seems wrong to me - we should never be fetching the local client state by looking up the counterparty's client identifier. The only thing we need the counterparty's client identifier for is to check whether the correct client state is stored under it (for this chain's consensus algorithm).

@@ -37,6 +40,9 @@ const (
testChannel1 = "firstchannel"
testChannel2 = "secondchannel"

height = 10
chainID = "gaia"
Copy link
Contributor

Choose a reason for hiding this comment

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

chainID is unused (from varcheck)

@@ -39,6 +43,8 @@ const (
testChannelOrder = channelexported.UNORDERED
testChannelVersion = "1.0"

chainID = "gaia"
Copy link
Contributor

Choose a reason for hiding this comment

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

chainID is unused (from varcheck)

@@ -45,6 +46,7 @@ const (
testChannelOrder = exported.ORDERED
testChannelVersion = "1.0"

chainID = "gaia"
Copy link
Contributor

Choose a reason for hiding this comment

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

chainID is unused (from varcheck)

}

// createClient will create a client for clientChain on targetChain
func (target *TestChain) CreateClient(client *TestChain) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

receiver name target should be consistent with previous receiver name chain for TestChain (from golint)

// )
}

func (target *TestChain) updateClient(client *TestChain) {
Copy link
Contributor

Choose a reason for hiding this comment

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

receiver name target should be consistent with previous receiver name chain for TestChain (from golint)

ConnectionID: testConnection,
Prefix: suite.app.IBCKeeper.ConnectionKeeper.GetCommitmentPrefix(),
// createClient will create a client for clientChain on targetChain
func (target *TestChain) CreateClient(client *TestChain) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

receiver name target should be consistent with previous receiver name chain for TestChain (from golint)

Data: key,
Prove: true,
})
func (target *TestChain) updateClient(client *TestChain) {
Copy link
Contributor

Choose a reason for hiding this comment

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

func (*TestChain).updateClient is unused (from unused)

testClientType = clientexported.Tendermint

chainID = "gaia"
Copy link
Contributor

Choose a reason for hiding this comment

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

chainID is unused (from deadcode)

}

// createClient will create a client for clientChain on targetChain
func (target *TestChain) CreateClient(client *TestChain) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

receiver name target should be consistent with previous receiver name chain for TestChain (from golint)

// )
}

func (target *TestChain) updateClient(client *TestChain) {
Copy link
Contributor

Choose a reason for hiding this comment

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

receiver name target should be consistent with previous receiver name chain for TestChain (from golint)

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 modulo @fedekunze comment

@cwgoes
Copy link
Contributor

cwgoes commented Feb 21, 2020

Also tested locally 👍 .

@cwgoes cwgoes merged commit c3bb696 into ibc-alpha Feb 21, 2020
@cwgoes cwgoes deleted the aditya/lite-verify branch February 21, 2020 17:25
// )
}

func (chain *TestChain) updateClient(client *TestChain) {
Copy link
Contributor

Choose a reason for hiding this comment

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

func (*TestChain).updateClient is unused (from unused)

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