Skip to content

Commit

Permalink
Merge branch 'mardizzone/POS-1956-auth' into mardizzone/POS-2511-auth
Browse files Browse the repository at this point in the history
  • Loading branch information
marcello33 committed Feb 27, 2024
2 parents c49d478 + d083758 commit 7509eb1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 4 additions & 2 deletions types/address_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions x/evidence/types/evidence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7509eb1

Please sign in to comment.