diff --git a/protocol/v1/status_message.go b/protocol/v1/status_message.go index a3b00ea3f..0ebbeecce 100644 --- a/protocol/v1/status_message.go +++ b/protocol/v1/status_message.go @@ -3,13 +3,14 @@ package protocol import ( "crypto/ecdsa" "encoding/json" - "log" "reflect" "github.com/golang/protobuf/proto" "github.com/jinzhu/copier" "github.com/pkg/errors" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/log" "github.com/status-im/status-go/eth-node/crypto" "github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/protocol/encryption" @@ -155,6 +156,8 @@ func (m *StatusMessage) HandleApplicationMetadata() error { m.ApplicationMetadataLayerSigPubKey = recoveredKey // Calculate ID using the wrapped record m.ID = MessageID(recoveredKey, m.DecryptedPayload) + log.Debug("calculated ID for envelope", "envelopeHash", hexutil.Encode(m.Hash), "messageId", hexutil.Encode(m.ID)) + m.UnwrappedPayload = message.Payload m.Type = message.Type return nil @@ -197,7 +200,7 @@ func (m *StatusMessage) HandleApplication() error { return m.unmarshalProtobufData(new(protobuf.SyncInstallation)) case protobuf.ApplicationMetadataMessage_SYNC_INSTALLATION_CONTACT: - log.Printf("Sync installation contact") + log.Debug("Sync installation contact") return m.unmarshalProtobufData(new(protobuf.SyncInstallationContactV2)) case protobuf.ApplicationMetadataMessage_SYNC_INSTALLATION_PUBLIC_CHAT: @@ -268,7 +271,7 @@ func (m *StatusMessage) unmarshalProtobufData(pb proto.Message) error { err := proto.Unmarshal(m.UnwrappedPayload, ptr) if err != nil { m.ParsedMessage = nil - log.Printf("[message::DecodeMessage] could not decode %T: %#x, err: %v", pb, m.Hash, err.Error()) + log.Error("[message::DecodeMessage] could not decode %T: %#x, err: %v", pb, m.Hash, err.Error()) } else { rv = reflect.ValueOf(ptr) elem := rv.Elem() diff --git a/services/wallet/api.go b/services/wallet/api.go index 82ed7611b..03570395b 100644 --- a/services/wallet/api.go +++ b/services/wallet/api.go @@ -39,12 +39,12 @@ func (api *API) CheckRecentHistoryForChainIDs(ctx context.Context, chainIDs []ui // GetTransfersByAddress returns transfers for a single address func (api *API) GetTransfersByAddress(ctx context.Context, address common.Address, toBlock, limit *hexutil.Big, fetchMore bool) ([]transfer.View, error) { - log.Debug("[WalletAPI:: GetTransfersByAddress] get transfers for an address", "address", address, "block", toBlock, "limit", limit) + log.Debug("[WalletAPI:: GetTransfersByAddress] get transfers for an address", "address") return api.s.transferController.GetTransfersByAddress(ctx, api.s.rpcClient.UpstreamChainID, address, toBlock, limit, fetchMore) } func (api *API) GetTransfersByAddressAndChainID(ctx context.Context, chainID uint64, address common.Address, toBlock, limit *hexutil.Big, fetchMore bool) ([]transfer.View, error) { - log.Debug("[WalletAPI:: GetTransfersByAddressAndChainID] get transfers for an address", "address", address, "block", toBlock, "limit", limit) + log.Debug("[WalletAPI:: GetTransfersByAddressAndChainID] get transfers for an address", "address", address) return api.s.transferController.GetTransfersByAddress(ctx, chainID, address, toBlock, limit, fetchMore) } diff --git a/services/wallet/transfer/controller.go b/services/wallet/transfer/controller.go index 416115558..1c0a18360 100644 --- a/services/wallet/transfer/controller.go +++ b/services/wallet/transfer/controller.go @@ -170,7 +170,7 @@ func mapToList(m map[common.Address]struct{}) []common.Address { } func (c *Controller) GetTransfersByAddress(ctx context.Context, chainID uint64, address common.Address, toBlock, limit *hexutil.Big, fetchMore bool) ([]View, error) { - log.Debug("[WalletAPI:: GetTransfersByAddress] get transfers for an address", "address", address, "block", toBlock, "limit", limit) + log.Debug("[WalletAPI:: GetTransfersByAddress] get transfers for an address", "address", address) var toBlockBN *big.Int if toBlock != nil { toBlockBN = toBlock.ToInt() diff --git a/wakuv2/common/message.go b/wakuv2/common/message.go index 0ac7b6548..272bf323e 100644 --- a/wakuv2/common/message.go +++ b/wakuv2/common/message.go @@ -149,8 +149,7 @@ func NewReceivedMessage(env *protocol.Envelope) *ReceivedMessage { // Hash returns the SHA3 hash of the envelope, calculating it if not yet done. func (msg *ReceivedMessage) Hash() common.Hash { if (msg.hash == common.Hash{}) { - envelopeHash := msg.Envelope.Hash() - msg.hash = crypto.Keccak256Hash(envelopeHash[:]) + msg.hash = common.BytesToHash(msg.Envelope.Hash()) } return msg.hash } diff --git a/wakuv2/waku.go b/wakuv2/waku.go index f48fa2f6e..6cc76d2b9 100644 --- a/wakuv2/waku.go +++ b/wakuv2/waku.go @@ -828,6 +828,7 @@ func (w *Waku) Query(topics []common.TopicType, from uint64, to uint64, opts []s for _, msg := range result.Messages { envelope := wakuprotocol.NewEnvelope(msg, string(relay.DefaultWakuTopic)) + w.logger.Debug("received waku2 store message", zap.Any("envelopeHash", hexutil.Encode(envelope.Hash()))) _, err = w.OnNewEnvelopes(envelope) if err != nil { return nil, err