From e80321923c547201bd5a87d6c87313ebfc0fe361 Mon Sep 17 00:00:00 2001 From: Patryk Osmaczko Date: Thu, 6 Feb 2025 09:09:25 +0100 Subject: [PATCH] fix_: remove go-ethereum's `UnmarshalPubkey` usage fixes: #6330 --- appdatabase/database.go | 2 +- wakuv1/api.go | 16 ++++++++-------- wakuv2/api.go | 18 +++++++++--------- wakuv2/persistence/signed_messages.go | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/appdatabase/database.go b/appdatabase/database.go index b84cbde5ded..9221eff57a5 100644 --- a/appdatabase/database.go +++ b/appdatabase/database.go @@ -14,10 +14,10 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" "github.com/status-im/status-go/appdatabase/migrations" migrationsprevnodecfg "github.com/status-im/status-go/appdatabase/migrationsprevnodecfg" + "github.com/status-im/status-go/eth-node/crypto" "github.com/status-im/status-go/nodecfg" "github.com/status-im/status-go/services/wallet/bigint" w_common "github.com/status-im/status-go/services/wallet/common" diff --git a/wakuv1/api.go b/wakuv1/api.go index 8503d7fb200..dadfadf5ef2 100644 --- a/wakuv1/api.go +++ b/wakuv1/api.go @@ -28,17 +28,17 @@ import ( "go.uber.org/zap" - "github.com/status-im/status-go/logutils" - - ethtypes "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/waku/types" - "github.com/status-im/status-go/wakuv1/common" - + ethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/p2p/enode" "github.com/ethereum/go-ethereum/rpc" + gocommon "github.com/status-im/status-go/common" + "github.com/status-im/status-go/eth-node/crypto" + ethtypes "github.com/status-im/status-go/eth-node/types" + "github.com/status-im/status-go/logutils" + "github.com/status-im/status-go/waku/types" + "github.com/status-im/status-go/wakuv1/common" ) // List of errors @@ -362,7 +362,7 @@ func (api *PublicWakuAPI) Messages(ctx context.Context, crit types.Criteria) (*r return nil, ErrInvalidSymmetricKey } filter.KeySym = key - filter.SymKeyHash = crypto.Keccak256Hash(filter.KeySym) + filter.SymKeyHash = ethcommon.Hash(crypto.Keccak256Hash(filter.KeySym)) } // listen for messages that are encrypted with the given public key diff --git a/wakuv2/api.go b/wakuv2/api.go index 37119fd30c1..17aef01695b 100644 --- a/wakuv2/api.go +++ b/wakuv2/api.go @@ -28,21 +28,21 @@ import ( "go.uber.org/zap" + "google.golang.org/protobuf/proto" + "github.com/waku-org/go-waku/waku/v2/payload" "github.com/waku-org/go-waku/waku/v2/protocol/pb" - ethtypes "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/logutils" - "github.com/status-im/status-go/waku/types" - "github.com/status-im/status-go/wakuv2/common" - + ethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/rpc" - "google.golang.org/protobuf/proto" - gocommon "github.com/status-im/status-go/common" + "github.com/status-im/status-go/eth-node/crypto" + ethtypes "github.com/status-im/status-go/eth-node/types" + "github.com/status-im/status-go/logutils" + "github.com/status-im/status-go/waku/types" + "github.com/status-im/status-go/wakuv2/common" ) // List of errors @@ -320,7 +320,7 @@ func (api *PublicWakuAPI) Messages(ctx context.Context, crit types.Criteria) (*r return nil, ErrInvalidSymmetricKey } filter.KeySym = key - filter.SymKeyHash = crypto.Keccak256Hash(filter.KeySym) + filter.SymKeyHash = ethcommon.Hash(crypto.Keccak256Hash(filter.KeySym)) } // listen for messages that are encrypted with the given public key diff --git a/wakuv2/persistence/signed_messages.go b/wakuv2/persistence/signed_messages.go index aad6d812a44..b6b2130c3fe 100644 --- a/wakuv2/persistence/signed_messages.go +++ b/wakuv2/persistence/signed_messages.go @@ -7,7 +7,7 @@ import ( "go.uber.org/zap" - "github.com/ethereum/go-ethereum/crypto" + "github.com/status-im/status-go/eth-node/crypto" ) // DBStore is a MessageProvider that has a *sql.DB connection