From 0dcf5ed5dac8c5ed6cc83bd3ed7b47ea0fc145c7 Mon Sep 17 00:00:00 2001 From: Kyle Date: Wed, 11 Oct 2023 21:44:24 -0400 Subject: [PATCH] Return empty announcements instead of error; go eth ecrecover lib compatibility --- interchaintest/tests/hyperlane_cfg.go | 2 +- x/announce/keeper/store.go | 2 +- x/announce/types/announcement.go | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/interchaintest/tests/hyperlane_cfg.go b/interchaintest/tests/hyperlane_cfg.go index f95edb3..901764e 100644 --- a/interchaintest/tests/hyperlane_cfg.go +++ b/interchaintest/tests/hyperlane_cfg.go @@ -43,7 +43,7 @@ func generateHyperlaneValidatorConfig(bech32, privKey, chainID, chainName, rpcUr "chains": { "%s": { "connection": { "rpc_url": "%s", "grpc_url": "%s", "chain_id": "%s" }, - "signer": { "type":"cosmosKey", "key": "%s", "prefix": "cosmos", "baseDenom": "stake"}, + "signer": { "type":"cosmosKey", "key": "%s", "prefix": "cosmos", "base_denom": "stake"}, "name": "%s", "domain": %d, "addresses": { diff --git a/x/announce/keeper/store.go b/x/announce/keeper/store.go index dd69a52..f3ffdd1 100644 --- a/x/announce/keeper/store.go +++ b/x/announce/keeper/store.go @@ -54,7 +54,7 @@ func (k Keeper) getAnnouncements(ctx sdk.Context, validator []byte) (*types.Stor announcements := &types.StoredAnnouncements{} if announceBytes == nil { - return nil, errors.New("No announcements stored for validator") + return announcements, nil } err := announcements.Unmarshal(announceBytes) diff --git a/x/announce/types/announcement.go b/x/announce/types/announcement.go index f7d768a..d721b18 100644 --- a/x/announce/types/announcement.go +++ b/x/announce/types/announcement.go @@ -61,6 +61,10 @@ func toEthSignedMessageHash(packedHash []byte) []byte { } func VerifyAnnouncementDigest(digest []byte, signature []byte, expectedSigner []byte) error { + if signature[64] >= 4 { + signature[64] = signature[64] - 27 + } + sigPublicKey, err := crypto.Ecrecover(digest, signature) if err != nil { return err