-
Notifications
You must be signed in to change notification settings - Fork 122
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
fix: make HandleConsumerDoubleVoting
works with provider pubkeys
#1254
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,11 @@ import ( | |
"testing" | ||
"time" | ||
|
||
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" | ||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" | ||
testutil "github.com/cosmos/interchain-security/v2/testutil/crypto" | ||
testkeeper "github.com/cosmos/interchain-security/v2/testutil/keeper" | ||
"github.com/stretchr/testify/require" | ||
tmencoding "github.com/tendermint/tendermint/crypto/encoding" | ||
tmprotocrypto "github.com/tendermint/tendermint/proto/tendermint/crypto" | ||
tmtypes "github.com/tendermint/tendermint/types" | ||
) | ||
|
||
|
@@ -31,17 +31,17 @@ func TestVerifyDoubleVotingEvidence(t *testing.T) { | |
|
||
ctx = ctx.WithBlockTime(time.Now()) | ||
|
||
valPubkey1, err := tmencoding.PubKeyToProto(val1.PubKey) | ||
valPubkey1, err := cryptocodec.FromTmPubKeyInterface(val1.PubKey) | ||
require.NoError(t, err) | ||
|
||
valPubkey2, err := tmencoding.PubKeyToProto(val2.PubKey) | ||
valPubkey2, err := cryptocodec.FromTmPubKeyInterface(val2.PubKey) | ||
require.NoError(t, err) | ||
|
||
testCases := []struct { | ||
name string | ||
votes []*tmtypes.Vote | ||
chainID string | ||
pubkey tmprotocrypto.PublicKey | ||
pubkey cryptotypes.PubKey | ||
expPass bool | ||
}{ | ||
{ | ||
|
@@ -209,7 +209,7 @@ func TestVerifyDoubleVotingEvidence(t *testing.T) { | |
), | ||
}, | ||
chainID, | ||
tmprotocrypto.PublicKey{}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe still a valid negtive test with empty content. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a valid point when using concrete type! Now the SDK public key interface is used. |
||
nil, | ||
false, | ||
}, | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -210,8 +210,16 @@ func (msg MsgSubmitConsumerDoubleVoting) ValidateBasic() error { | |
return fmt.Errorf("double voting evidence cannot be nil") | ||
} | ||
|
||
if msg.InfractionBlockHeader.Header == nil { | ||
return fmt.Errorf("infraction header cannot be nil") | ||
if msg.InfractionBlockHeader == nil { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These missing validations were causing the handler to panic during E2E tests. This issue stemmed from the Hermes relayer, which used to let the |
||
return fmt.Errorf("infraction block header cannot be nil") | ||
} | ||
|
||
if msg.InfractionBlockHeader.SignedHeader == nil { | ||
return fmt.Errorf("signed header in infraction block header cannot be nil") | ||
} | ||
|
||
if msg.InfractionBlockHeader.SignedHeader.Header == nil { | ||
return fmt.Errorf("invalid signed header in infraction block header, 'SignedHeader.Header' is nil") | ||
} | ||
|
||
return nil | ||
|
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.
Changes from #1247 also appear here weirdly.