added uncompressed trust anchor pub key processing (#396)

* added uncompressed trust anchor pub key processing
* added a nother waiting block to pass CI test cases - these are a bit slower

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
Jürgen Eckel 2024-05-14 10:32:52 +02:00 committed by GitHub
parent af1483a8ec
commit ccf491d658
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 0 deletions

View File

@ -289,6 +289,8 @@ func (s *SelectionE2ETestSuite) TestTokenRedeemClaim() {
s.Require().NoError(err)
s.Require().NoError(s.network.WaitForNextBlock())
s.Require().NoError(s.network.WaitForNextBlock()) // added another waiting block to pass CI test cases (they are a bit slower)
_, err = clitestutil.GetRawLogFromTxOut(val, out)
s.Require().ErrorContains(err, "failed to execute message; message index: 0: expected: plmnt19cl05ztgt8ey6v86hjjjn3thfmpu6q2xtveehc; got: plmnt1kp93kns6hs2066d8qw0uz84fw3vlthewt2ck6p: invalid claim address")

View File

@ -35,6 +35,12 @@ func validatePublicKey(pubkey string) bool {
return false
}
// uncompressed key
if len(pubkeyBytes) == 64 {
return true
}
// compressed key
// Check if byte slice has correct length
if len(pubkeyBytes) != 33 {
return false

View File

@ -71,6 +71,18 @@ func TestMsgServerRegisterTrustAnchor(t *testing.T) {
}
}
func TestMsgServerRegisterTrustAnchorUncompressedKey(t *testing.T) {
t.Parallel()
pk := "6003d0ab9af4ec112629195a7266a244aecf1ac7691da0084be3e7ceea2ee71571b0963fffd9c80a640317509a681ac66c2ed70ecc9f317a0d2b1a9bff94ff74"
ta := moduleobject.TrustAnchor(pk)
msg := types.NewMsgRegisterTrustAnchor(pk, &ta)
msgServer, ctx := setupMsgServer(t)
res, err := msgServer.RegisterTrustAnchor(ctx, msg)
if assert.NoError(t, err) {
assert.Equal(t, &types.MsgRegisterTrustAnchorResponse{}, res)
}
}
func TestMsgServerRegisterTrustAnchorTwice(t *testing.T) {
t.Parallel()
_, pk := sample.KeyPair()