From e83da29998f023612edc88aa5628aab0f6dddc56 Mon Sep 17 00:00:00 2001 From: frank Date: Mon, 10 Feb 2025 15:40:28 +0800 Subject: [PATCH] chore: truncate sensitive information in error messages This commit adds a utility function from the common package to truncate sensitive information (like addresses, IDs, etc.) in error messages across multiple files. This helps prevent accidentally exposing full sensitive data in logs and error messages while maintaining readability. --- abi-spec/utils.go | 3 ++- account/accounts.go | 3 ++- api/geth_backend.go | 2 +- protocol/identity/utils.go | 8 +++++--- protocol/linkpreview_unfurler_status.go | 11 ++++++----- protocol/messenger.go | 10 +++++----- protocol/messenger_handler.go | 2 +- protocol/messenger_mention.go | 6 +++--- protocol/messenger_share_urls.go | 9 +++++---- protocol/messenger_store_node_request_manager.go | 2 +- protocol/storenodes/database.go | 4 +++- protocol/v1/membership_update_message.go | 9 +++++---- server/pairing/client.go | 6 ++---- server/pairing/connection.go | 6 +++--- services/communitytokens/service.go | 15 ++++++++------- services/wallet/transfer/helpers.go | 3 ++- 16 files changed, 54 insertions(+), 45 deletions(-) diff --git a/abi-spec/utils.go b/abi-spec/utils.go index 5584770abba..770fd8a6913 100644 --- a/abi-spec/utils.go +++ b/abi-spec/utils.go @@ -11,6 +11,7 @@ import ( "go.uber.org/zap" "github.com/ethereum/go-ethereum/common" + gocommon "github.com/status-im/status-go/common" "github.com/status-im/status-go/eth-node/crypto" "github.com/status-im/status-go/logutils" ) @@ -183,7 +184,7 @@ func ToChecksumAddress(address string) (string, error) { return "", nil } if !addressBasicPattern.MatchString(address) { - return "", fmt.Errorf("given address '%s' is not a valid Ethereum address", address) + return "", fmt.Errorf("given address '%s' is not a valid Ethereum address", gocommon.TruncateWithDot(address)) } address = strings.ToLower(address) diff --git a/account/accounts.go b/account/accounts.go index ad16f7dc345..b8ccc00ae35 100644 --- a/account/accounts.go +++ b/account/accounts.go @@ -20,6 +20,7 @@ import ( gethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/status-im/status-go/account/generator" + gocommon "github.com/status-im/status-go/common" "github.com/status-im/status-go/eth-node/crypto" "github.com/status-im/status-go/eth-node/keystore" "github.com/status-im/status-go/eth-node/types" @@ -230,7 +231,7 @@ func (m *DefaultManager) VerifyAccountPassword(keyStoreDir, address, password st // avoid swap attack if key.Address != addressObj { - return nil, fmt.Errorf("account mismatch: have %s, want %s", key.Address.Hex(), addressObj.Hex()) + return nil, fmt.Errorf("account mismatch: have %s, want %s", gocommon.TruncateWithDot(key.Address.Hex()), gocommon.TruncateWithDot(addressObj.Hex())) } return key, nil diff --git a/api/geth_backend.go b/api/geth_backend.go index 2c9fe8cebe8..4633237329d 100644 --- a/api/geth_backend.go +++ b/api/geth_backend.go @@ -283,7 +283,7 @@ func (b *GethStatusBackend) getAccountByKeyUID(keyUID string) (*multiaccounts.Ac return &acc, nil } } - return nil, fmt.Errorf("account with keyUID %s not found", keyUID) + return nil, fmt.Errorf("account with keyUID %s not found", gocommon.TruncateWithDot(keyUID)) } func (b *GethStatusBackend) SaveAccount(account multiaccounts.Account) error { diff --git a/protocol/identity/utils.go b/protocol/identity/utils.go index a957538193d..66b6376057c 100644 --- a/protocol/identity/utils.go +++ b/protocol/identity/utils.go @@ -7,6 +7,8 @@ import ( "testing" "github.com/ethereum/go-ethereum/crypto/secp256k1" + + gocommon "github.com/status-im/status-go/common" ) func ToColorID(pubkey string) (int64, error) { @@ -14,7 +16,7 @@ func ToColorID(pubkey string) (int64, error) { pubkeyValue, ok := new(big.Int).SetString(pubkey, 0) if !ok { - return 0, fmt.Errorf("invalid pubkey: %s", pubkey) + return 0, fmt.Errorf("invalid pubkey: %s", gocommon.TruncateWithDot(pubkey)) } colorID := new(big.Int).Mod(pubkeyValue, new(big.Int).SetInt64(colorPalletLength-1)).Int64() @@ -61,12 +63,12 @@ func Slices(compressedPubkey []byte) (res [4][]byte, err error) { func ToCompressedKey(pubkey string) ([]byte, error) { pubkeyValue, ok := new(big.Int).SetString(pubkey, 0) if !ok { - return nil, fmt.Errorf("invalid pubkey: %s", pubkey) + return nil, fmt.Errorf("invalid pubkey: %s", gocommon.TruncateWithDot(pubkey)) } x, y := secp256k1.S256().Unmarshal(pubkeyValue.Bytes()) if x == nil || !secp256k1.S256().IsOnCurve(x, y) { - return nil, fmt.Errorf("invalid pubkey: %s", pubkey) + return nil, fmt.Errorf("invalid pubkey: %s", gocommon.TruncateWithDot(pubkey)) } return secp256k1.CompressPubkey(x, y), nil diff --git a/protocol/linkpreview_unfurler_status.go b/protocol/linkpreview_unfurler_status.go index d4e6e8e4dd9..8bc256fbbb0 100644 --- a/protocol/linkpreview_unfurler_status.go +++ b/protocol/linkpreview_unfurler_status.go @@ -6,6 +6,7 @@ import ( "go.uber.org/zap" "github.com/status-im/status-go/api/multiformat" + gocommon "github.com/status-im/status-go/common" "github.com/status-im/status-go/images" "github.com/status-im/status-go/protocol/common" "github.com/status-im/status-go/protocol/common/shard" @@ -61,10 +62,10 @@ func (u *StatusUnfurler) buildContactData(publicKey string) (*common.StatusConta if contact == nil { contact, err = u.m.FetchContact(contactID, true) if err != nil { - return nil, fmt.Errorf("failed to request contact info from mailserver for public key '%s': %w", publicKey, err) + return nil, fmt.Errorf("failed to request contact info from mailserver for public key '%s': %w", gocommon.TruncateWithDot(publicKey), err) } if contact == nil { - return nil, fmt.Errorf("contact wasn't found at the store node %s", publicKey) + return nil, fmt.Errorf("contact wasn't found at the store node %s", gocommon.TruncateWithDot(publicKey)) } } @@ -93,7 +94,7 @@ func (u *StatusUnfurler) buildCommunityData(communityID string, shard *shard.Sha }) if err != nil { - return nil, nil, fmt.Errorf("failed to get community info for communityID '%s': %w", communityID, err) + return nil, nil, fmt.Errorf("failed to get community info for communityID '%s': %w", gocommon.TruncateWithDot(communityID), err) } if community == nil { @@ -102,7 +103,7 @@ func (u *StatusUnfurler) buildCommunityData(communityID string, shard *shard.Sha statusCommunityLinkPreviews, err := community.ToStatusLinkPreview() if err != nil { - return nil, nil, fmt.Errorf("failed to get status community link preview for communityID '%s': %w", communityID, err) + return nil, nil, fmt.Errorf("failed to get status community link preview for communityID '%s': %w", gocommon.TruncateWithDot(communityID), err) } return community, statusCommunityLinkPreviews, nil @@ -116,7 +117,7 @@ func (u *StatusUnfurler) buildChannelData(channelUUID string, communityID string channel, ok := community.Chats()[channelUUID] if !ok { - return nil, fmt.Errorf("channel with channelID '%s' not found in community '%s'", channelUUID, communityID) + return nil, fmt.Errorf("channel with channelID '%s' not found in community '%s'", gocommon.TruncateWithDot(channelUUID), gocommon.TruncateWithDot(communityID)) } return &common.StatusCommunityChannelLinkPreview{ diff --git a/protocol/messenger.go b/protocol/messenger.go index d36cb1c8765..f9fd4ea7347 100644 --- a/protocol/messenger.go +++ b/protocol/messenger.go @@ -2038,7 +2038,7 @@ func (m *Messenger) dispatchMessage(ctx context.Context, rawMessage common.RawMe zap.String("chatName", chat.Name), zap.Any("messageType", rawMessage.MessageType), ) - return rawMessage, fmt.Errorf("can't post message type '%d' on chat '%s'", rawMessage.MessageType, chat.ID) + return rawMessage, fmt.Errorf("can't post message type '%d' on chat '%s'", rawMessage.MessageType, gocommon.TruncateWithDot(chat.ID)) } logger.Debug("sending community chat message", zap.String("chatName", chat.Name)) @@ -3023,12 +3023,12 @@ func (r *ReceivedMessageState) addNewMessageNotification(publicKey ecdsa.PublicK chat, ok := r.AllChats.Load(m.LocalChatID) if !ok { - return fmt.Errorf("chat ID '%s' not present", m.LocalChatID) + return fmt.Errorf("chat ID '%s' not present", gocommon.TruncateWithDot(m.LocalChatID)) } contact, ok := r.AllContacts.Load(contactID) if !ok { - return fmt.Errorf("contact ID '%s' not present", contactID) + return fmt.Errorf("contact ID '%s' not present", gocommon.TruncateWithDot(contactID)) } if !chat.Muted { @@ -3098,7 +3098,7 @@ func (r *ReceivedMessageState) addNewActivityCenterNotification(publicKey ecdsa. chat, ok := r.AllChats.Load(message.LocalChatID) if !ok { - return fmt.Errorf("chat ID '%s' not present", message.LocalChatID) + return fmt.Errorf("chat ID '%s' not present", gocommon.TruncateWithDot(message.LocalChatID)) } isNotification, notificationType := showMentionOrReplyActivityCenterNotification(publicKey, message, chat, responseTo) @@ -4283,7 +4283,7 @@ func (m *Messenger) MarkAllReadInCommunity(ctx context.Context, communityID stri m.allChats.Store(chat.ID, chat) response.AddChat(chat) } else { - err = fmt.Errorf("chat with chatID %s not found", chatID) + err = fmt.Errorf("chat with chatID %s not found", gocommon.TruncateWithDot(chatID)) } } return response, err diff --git a/protocol/messenger_handler.go b/protocol/messenger_handler.go index 322390473c5..41911e105e7 100644 --- a/protocol/messenger_handler.go +++ b/protocol/messenger_handler.go @@ -486,7 +486,7 @@ func (m *Messenger) syncContactRequestForInstallationContact(contact *Contact, s } if chat == nil { - return fmt.Errorf("no chat restored during the contact synchronisation, contact.ID = %s", contact.ID) + return fmt.Errorf("no chat restored during the contact synchronisation, contact.ID = %s", gocommon.TruncateWithDot(contact.ID)) } contactRequestID, err := m.persistence.LatestPendingContactRequestIDForContact(contact.ID) diff --git a/protocol/messenger_mention.go b/protocol/messenger_mention.go index 99369e12330..1fbed2248e8 100644 --- a/protocol/messenger_mention.go +++ b/protocol/messenger_mention.go @@ -222,7 +222,7 @@ func (m *MentionManager) getMentionableUser(chatID string, pk string) (*Mentiona } user, ok := mentionableUsers[pk] if !ok { - return nil, fmt.Errorf("user not found when getting mentionable user, pk: %s", pk) + return nil, fmt.Errorf("user not found when getting mentionable user, pk: %s", gocommon.TruncateWithDot(pk)) } return user, nil } @@ -231,7 +231,7 @@ func (m *MentionManager) getMentionableUsers(chatID string) (map[string]*Mention mentionableUsers := make(map[string]*MentionableUser) chat, _ := m.allChats.Load(chatID) if chat == nil { - return nil, fmt.Errorf("chat not found when getting mentionable users, chatID: %s", chatID) + return nil, fmt.Errorf("chat not found when getting mentionable users, chatID: %s", gocommon.TruncateWithDot(chatID)) } var publicKeys []string @@ -291,7 +291,7 @@ func (m *MentionManager) addMentionableUser(mentionableUsers map[string]*Mention func (m *MentionManager) ReplaceWithPublicKey(chatID, text string) (string, error) { chat, _ := m.allChats.Load(chatID) if chat == nil { - return "", fmt.Errorf("chat not found when check mentions, chatID: %s", chatID) + return "", fmt.Errorf("chat not found when check mentions, chatID: %s", gocommon.TruncateWithDot(chatID)) } mentionableUsers, err := m.mentionableUserGetter.getMentionableUsers(chatID) if err != nil { diff --git a/protocol/messenger_share_urls.go b/protocol/messenger_share_urls.go index 238f06dbdc3..714fb7bbc16 100644 --- a/protocol/messenger_share_urls.go +++ b/protocol/messenger_share_urls.go @@ -12,6 +12,7 @@ import ( "github.com/andybalholm/brotli" "github.com/status-im/status-go/api/multiformat" + gocommon "github.com/status-im/status-go/common" "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/common" @@ -224,7 +225,7 @@ func (m *Messenger) ShareCommunityChannelURLWithChatKey(request *requests.Commun } if !valid { - return "", fmt.Errorf("channelID should be UUID, got %s", request.ChannelID) + return "", fmt.Errorf("channelID should be UUID, got %s", gocommon.TruncateWithDot(request.ChannelID)) } return fmt.Sprintf("%s/cc/%s#%s", baseShareURL, request.ChannelID, shortKey), nil @@ -237,7 +238,7 @@ func parseCommunityChannelURLWithChatKey(channelID string, publicKey string) (*U } if !valid { - return nil, fmt.Errorf("channelID should be UUID, got %s", channelID) + return nil, fmt.Errorf("channelID should be UUID, got %s", gocommon.TruncateWithDot(channelID)) } communityID, err := decodeCommunityID(publicKey) @@ -313,7 +314,7 @@ func (m *Messenger) ShareCommunityChannelURLWithData(request *requests.Community } if !valid { - return "nil", fmt.Errorf("channelID should be UUID, got %s", request.ChannelID) + return "", fmt.Errorf("channelID should be UUID, got %s", gocommon.TruncateWithDot(request.ChannelID)) } community, err := m.GetCommunityByID(request.CommunityID) @@ -323,7 +324,7 @@ func (m *Messenger) ShareCommunityChannelURLWithData(request *requests.Community channel := community.Chats()[request.ChannelID] if channel == nil { - return "", fmt.Errorf("channel with channelID %s not found", request.ChannelID) + return "", fmt.Errorf("channel with channelID %s not found", gocommon.TruncateWithDot(request.ChannelID)) } data, shortKey, err := m.prepareEncodedCommunityChannelData(community, channel, request.ChannelID) diff --git a/protocol/messenger_store_node_request_manager.go b/protocol/messenger_store_node_request_manager.go index b406ba6d230..27086b2be35 100644 --- a/protocol/messenger_store_node_request_manager.go +++ b/protocol/messenger_store_node_request_manager.go @@ -149,7 +149,7 @@ func (m *StoreNodeRequestManager) FetchCommunities(ctx context.Context, communit for _, community := range communities { _, _, err := m.FetchCommunity(ctx, community, opts) if err != nil { - outErr = fmt.Errorf("%sfailed to create a request for community %s: %w", outErr, community.CommunityID, err) + outErr = fmt.Errorf("%sfailed to create a request for community %s: %w", outErr, gocommon.TruncateWithDot(community.CommunityID), err) } } diff --git a/protocol/storenodes/database.go b/protocol/storenodes/database.go index e5f3d13a657..dadbb82d1af 100644 --- a/protocol/storenodes/database.go +++ b/protocol/storenodes/database.go @@ -9,6 +9,8 @@ import ( "github.com/multiformats/go-multiaddr" "github.com/status-im/status-go/eth-node/types" + + gocommon "github.com/status-im/status-go/common" ) type Database struct { @@ -58,7 +60,7 @@ func (d *Database) syncSave(communityID types.HexBytes, snode []Storenode, clock for _, n := range snode { // defensively validate the communityID if len(n.CommunityID) == 0 || !bytes.Equal(communityID, n.CommunityID) { - err = fmt.Errorf("communityID mismatch %v != %v", communityID, n.CommunityID) + err = fmt.Errorf("communityID mismatch") return err } dbN := find(n, dbNodes) diff --git a/protocol/v1/membership_update_message.go b/protocol/v1/membership_update_message.go index 80c8c1a41a7..4834c85c0ae 100644 --- a/protocol/v1/membership_update_message.go +++ b/protocol/v1/membership_update_message.go @@ -11,6 +11,7 @@ import ( "github.com/google/uuid" "github.com/pkg/errors" + gocommon "github.com/status-im/status-go/common" "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/protobuf" @@ -309,17 +310,17 @@ func (g *Group) init() error { } valid := g.validateEvent(event) if !valid { - return fmt.Errorf("invalid event %#+v from %s", event, event.From) + return fmt.Errorf("invalid event, type: %s, from: %s, chatID: %s, name: %s", event.Type, gocommon.TruncateWithDot(event.From), gocommon.TruncateWithDot(event.ChatID), event.Name) } g.processEvent(event) } valid := g.validateChatID(g.chatID) if !valid { - return fmt.Errorf("invalid chat ID: %s", g.chatID) + return fmt.Errorf("invalid chat ID: %s", gocommon.TruncateWithDot(g.chatID)) } if chatID != g.chatID { - return fmt.Errorf("expected chat ID equal %s, got %s", g.chatID, chatID) + return fmt.Errorf("expected chat ID equal %s, got %s", gocommon.TruncateWithDot(g.chatID), gocommon.TruncateWithDot(chatID)) } return nil @@ -484,7 +485,7 @@ func (g *Group) ProcessEvents(events []MembershipUpdateEvent) error { func (g *Group) ProcessEvent(event MembershipUpdateEvent) error { if !g.validateEvent(event) { - return fmt.Errorf("invalid event %#+v", event) + return fmt.Errorf("invalid event when processing, type: %s, from: %s, chatID: %s, name: %s", event.Type, gocommon.TruncateWithDot(event.From), gocommon.TruncateWithDot(event.ChatID), event.Name) } // Check if exists g.events = append(g.events, event) diff --git a/server/pairing/client.go b/server/pairing/client.go index ebadbd15e43..8b187bc072d 100644 --- a/server/pairing/client.go +++ b/server/pairing/client.go @@ -72,18 +72,16 @@ func findServerCert(c *ConnectionParams, reachableIPs []net.IP) (*url.URL, *x509 // Keep track of error counts errorCount := 0 - var combinedErrors string for { select { case success := <-successCh: baseAddress = success.u serverCert = success.cert return baseAddress, serverCert, nil - case ipErr := <-errCh: + case <-errCh: errorCount++ - combinedErrors += fmt.Sprintf("IP %s: %s; ", ipErr.ip, ipErr.err) if errorCount == len(reachableIPs) { - return nil, nil, fmt.Errorf(combinedErrors) + return nil, nil, fmt.Errorf("failed to connect to any of given ip addresses.") } } } diff --git a/server/pairing/connection.go b/server/pairing/connection.go index 1d5cbc57b57..16166f65a05 100644 --- a/server/pairing/connection.go +++ b/server/pairing/connection.go @@ -154,11 +154,11 @@ func ParseNetIps(in []byte) ([]net.IP, error) { func (cp *ConnectionParams) FromString(s string) error { if len(s) < 2 { - return fmt.Errorf("connection string is too short: '%s'", s) + return fmt.Errorf("connection string is too short") } if s[:2] != connectionStringID { - return fmt.Errorf("connection string doesn't begin with identifier '%s'", connectionStringID) + return fmt.Errorf("connection string doesn't begin with identifier") } requiredParams := 5 @@ -166,7 +166,7 @@ func (cp *ConnectionParams) FromString(s string) error { sData := strings.Split(s[2:], ":") // NOTE: always allow extra parameters for forward compatibility, error on not enough required parameters or failing to parse if len(sData) < requiredParams { - return fmt.Errorf("expected data '%s' to have length of '%d', received '%d'", s, requiredParams, len(sData)) + return fmt.Errorf("expected connection string to have length of '%d', received '%d'", requiredParams, len(sData)) } netIpsBytes := base58.Decode(sData[1]) diff --git a/services/communitytokens/service.go b/services/communitytokens/service.go index 3351f1c3c83..fa9f626e4ec 100644 --- a/services/communitytokens/service.go +++ b/services/communitytokens/service.go @@ -15,6 +15,7 @@ import ( "github.com/ethereum/go-ethereum/p2p" ethRpc "github.com/ethereum/go-ethereum/rpc" "github.com/status-im/status-go/account" + gocommon "github.com/status-im/status-go/common" "github.com/status-im/status-go/eth-node/crypto" "github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/logutils" @@ -147,7 +148,7 @@ func (s *Service) handleWalletEvent(event walletevent.Event) { func (s *Service) handleAirdropCommunityToken(status string, toAddress common.Address, chainID walletCommon.ChainID) (*token.CommunityToken, error) { communityToken, err := s.Messenger.GetCommunityTokenByChainAndAddress(int(chainID), toAddress.String()) if communityToken == nil { - return nil, fmt.Errorf("token does not exist in database: chainId=%v, address=%v", chainID, toAddress.String()) + return nil, fmt.Errorf("token does not exist in database: chainId=%v, address=%v", chainID, gocommon.TruncateWithDot(toAddress.String())) } else { publishErr := s.publishTokenActionToPrivilegedMembers(communityToken.CommunityID, uint64(communityToken.ChainID), communityToken.Address, protobuf.CommunityTokenAction_AIRDROP) @@ -161,7 +162,7 @@ func (s *Service) handleAirdropCommunityToken(status string, toAddress common.Ad func (s *Service) handleRemoteDestructCollectible(status string, toAddress common.Address, chainID walletCommon.ChainID) (*token.CommunityToken, error) { communityToken, err := s.Messenger.GetCommunityTokenByChainAndAddress(int(chainID), toAddress.String()) if communityToken == nil { - return nil, fmt.Errorf("token does not exist in database: chainId=%v, address=%v", chainID, toAddress.String()) + return nil, fmt.Errorf("token does not exist in database: chainId=%v, address=%v", chainID, gocommon.TruncateWithDot(toAddress.String())) } else { publishErr := s.publishTokenActionToPrivilegedMembers(communityToken.CommunityID, uint64(communityToken.ChainID), communityToken.Address, protobuf.CommunityTokenAction_REMOTE_DESTRUCT) @@ -188,7 +189,7 @@ func (s *Service) handleBurnCommunityToken(status string, toAddress common.Addre communityToken, err := s.Messenger.GetCommunityTokenByChainAndAddress(int(chainID), toAddress.String()) if communityToken == nil { - return nil, fmt.Errorf("token does not exist in database: chainId=%v, address=%v", chainID, toAddress.String()) + return nil, fmt.Errorf("token does not exist in database: chainId=%v, address=%v", chainID, gocommon.TruncateWithDot(toAddress.String())) } else { publishErr := s.publishTokenActionToPrivilegedMembers(communityToken.CommunityID, uint64(communityToken.ChainID), communityToken.Address, protobuf.CommunityTokenAction_BURN) @@ -237,7 +238,7 @@ func (s *Service) updateStateAndAddTokenToCommunityDescription(status string, ch return nil, err } if tokenToUpdate == nil { - return nil, fmt.Errorf("token does not exist in database: chainID=%v, address=%v", chainID, address) + return nil, fmt.Errorf("token does not exist in database: chainID=%v, address=%v", chainID, gocommon.TruncateWithDot(address)) } if status == transactions.Success { @@ -269,7 +270,7 @@ func (s *Service) handleSetSignerPubKey(status string, toAddress common.Address, return nil, err } if communityToken == nil { - return nil, fmt.Errorf("token does not exist in database: chainId=%v, address=%v", chainID, toAddress.String()) + return nil, fmt.Errorf("token does not exist in database: chainId=%v, address=%v", chainID, gocommon.TruncateWithDot(toAddress.String())) } if status == transactions.Success { @@ -550,7 +551,7 @@ func (s *Service) GetMasterTokenContractAddressFromHash(ctx context.Context, cha return event.Arg0.Hex(), nil } } - return "", fmt.Errorf("can't find master token address in transaction: %v", txHash) + return "", fmt.Errorf("can't find master token address in transaction: %s", gocommon.TruncateWithDot(txHash)) } func (s *Service) GetOwnerTokenContractAddressFromHash(ctx context.Context, chainID uint64, txHash string) (string, error) { @@ -581,7 +582,7 @@ func (s *Service) GetOwnerTokenContractAddressFromHash(ctx context.Context, chai return event.Arg0.Hex(), nil } } - return "", fmt.Errorf("can't find owner token address in transaction: %v", txHash) + return "", fmt.Errorf("can't find owner token address in transaction: %s", gocommon.TruncateWithDot(txHash)) } func (s *Service) publishTokenActionToPrivilegedMembers(communityID string, chainID uint64, contractAddress string, actionType protobuf.CommunityTokenAction_ActionType) error { diff --git a/services/wallet/transfer/helpers.go b/services/wallet/transfer/helpers.go index 96c2c7d5e84..9c459558866 100644 --- a/services/wallet/transfer/helpers.go +++ b/services/wallet/transfer/helpers.go @@ -13,6 +13,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/status-im/status-go/account" + gocommon "github.com/status-im/status-go/common" "github.com/status-im/status-go/eth-node/crypto" "github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/logutils" @@ -85,7 +86,7 @@ func addSignaturesToTransactions(transactions map[common.Hash]*TransactionDescri for hash, desc := range transactions { sigDetails, ok := signatures[hash.String()] if !ok { - return fmt.Errorf("missing signature for transaction %s", hash) + return fmt.Errorf("missing signature for transaction %s", gocommon.TruncateWithDot(hash.String())) } rBytes, _ := hex.DecodeString(sigDetails.R)