-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Conversation
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.
Like moving over to just headers. Simplifies things greatly and will reduce confusion ++
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.
- 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.
} | ||
|
||
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)) |
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.
unnecessary conversion (from unconvert
)
testConnection = "testconnection" | ||
|
||
testChannelVersion = "1.0" | ||
|
||
height = 10 |
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.
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())) |
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.
unnecessary conversion (from unconvert
)
@@ -24,6 +25,7 @@ const ( | |||
testChainID = "test-chain-id" | |||
testClient = "test-client" | |||
testClientType = clientexported.Tendermint | |||
height = 10 |
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.
height
is unused (from deadcode
)
x/ibc/20-transfer/handler_test.go
Outdated
@@ -37,6 +37,9 @@ const ( | |||
testChannel1 = "firstchannel" | |||
testChannel2 = "secondchannel" | |||
|
|||
height = 10 |
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.
height
is unused (from deadcode
)
return connection | ||
} | ||
|
||
func (suite *KeeperTestSuite) createChannel( | ||
func (chain *TestChain) createChannel( |
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.
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 { |
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.
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) { |
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.
receiver name target should be consistent with previous receiver name chain for TestChain (from golint
)
x/ibc/03-connection/keeper/verify.go
Outdated
@@ -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() |
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 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).
x/ibc/20-transfer/handler_test.go
Outdated
@@ -37,6 +40,9 @@ const ( | |||
testChannel1 = "firstchannel" | |||
testChannel2 = "secondchannel" | |||
|
|||
height = 10 | |||
chainID = "gaia" |
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.
chainID
is unused (from varcheck
)
@@ -39,6 +43,8 @@ const ( | |||
testChannelOrder = channelexported.UNORDERED | |||
testChannelVersion = "1.0" | |||
|
|||
chainID = "gaia" |
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.
chainID
is unused (from varcheck
)
@@ -45,6 +46,7 @@ const ( | |||
testChannelOrder = exported.ORDERED | |||
testChannelVersion = "1.0" | |||
|
|||
chainID = "gaia" |
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.
chainID
is unused (from varcheck
)
x/ibc/20-transfer/handler_test.go
Outdated
} | ||
|
||
// createClient will create a client for clientChain on targetChain | ||
func (target *TestChain) CreateClient(client *TestChain) error { |
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.
receiver name target should be consistent with previous receiver name chain for TestChain (from golint
)
x/ibc/20-transfer/handler_test.go
Outdated
// ) | ||
} | ||
|
||
func (target *TestChain) updateClient(client *TestChain) { |
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.
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 { |
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.
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) { |
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.
func (*TestChain).updateClient
is unused (from unused
)
x/ibc/ante/ante_test.go
Outdated
testClientType = clientexported.Tendermint | ||
|
||
chainID = "gaia" |
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.
chainID
is unused (from deadcode
)
x/ibc/ante/ante_test.go
Outdated
} | ||
|
||
// createClient will create a client for clientChain on targetChain | ||
func (target *TestChain) CreateClient(client *TestChain) error { |
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.
receiver name target should be consistent with previous receiver name chain for TestChain (from golint
)
x/ibc/ante/ante_test.go
Outdated
// ) | ||
} | ||
|
||
func (target *TestChain) updateClient(client *TestChain) { |
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.
receiver name target should be consistent with previous receiver name chain for TestChain (from golint
)
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.
utACK modulo @fedekunze comment
Also tested locally 👍 . |
// ) | ||
} | ||
|
||
func (chain *TestChain) updateClient(client *TestChain) { |
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.
func (*TestChain).updateClient
is unused (from unused
)
Closes: #XXX
Description
For contributor use:
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerFor admin use:
WIP
,R4R
,docs
, etc)