diff --git a/types/address_test.go b/types/address_test.go index 350b784ac0db..e7ddf02cf410 100644 --- a/types/address_test.go +++ b/types/address_test.go @@ -118,9 +118,11 @@ func (s *addressTestSuite) TestRandHexAccAddrConsistency() { s.Require().Equal(types.ErrEmptyHexAddress, err) } -// Test that the account address cache ignores the hex prefix setting, retrieving hex addresses from the cache. -// This will cause the AccAddress.String() to print out unexpected prefixes if the config was changed between hex lookups. +// This test is inherited from cosmos-sdk upstream +// It used to test that the account address cache ignores the bech32 prefix setting, retrieving addresses from the cache. // See https://github.com/cosmos/cosmos-sdk/issues/15317. +// In heimdall, the test just checks that two addresses generated from the same key are equal. +// Kept the test to reduce the diff with upstream. func (s *addressTestSuite) TestAddrCache() { // Use a random key pubBz := make([]byte, ed25519.PubKeySize) diff --git a/x/evidence/types/evidence_test.go b/x/evidence/types/evidence_test.go index 555ce3b66633..9c7eca679fd4 100644 --- a/x/evidence/types/evidence_test.go +++ b/x/evidence/types/evidence_test.go @@ -72,6 +72,16 @@ func TestEquivocationValidateBasic(t *testing.T) { } } +func TestEvidenceAddressConversion(t *testing.T) { + tmEvidence := NewCometMisbehavior(1, 100, time.Now(), comet.DuplicateVote, + validator{address: []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, power: 100}) + + evidence := types.FromABCIEvidence(tmEvidence, address.NewHexCodec()) + consAddr := evidence.GetConsensusAddress(address.NewHexCodec()) + // Check the address is the same after conversion + require.Equal(t, tmEvidence.Validator().Address(), consAddr.Bytes()) +} + type Misbehavior struct { height int64 time time.Time