diff --git a/.gitignore b/.gitignore index 637e48aa1..ef45d8f11 100644 --- a/.gitignore +++ b/.gitignore @@ -69,3 +69,6 @@ Session.vim # created for running container _assets/compose/bootnode/keys + +# do not vendor nested vendor dirs +vendor/**/vendor diff --git a/Makefile b/Makefile index 7692d8d72..5379cdc99 100644 --- a/Makefile +++ b/Makefile @@ -216,7 +216,8 @@ xtools-install: modvendor-install: # a tool to vendor non-go files - go get -u github.com/goware/modvendor + # TODO: switch to original repo when https://github.com/goware/modvendor/pull/13 is merged + GO111MODULE=off go get -u github.com/adambabik/modvendor mock-install: ##@other Install mocking tools go get -u github.com/golang/mock/mockgen diff --git a/vendor/github.com/status-im/status-go/protocol/bridge/geth/envelope.go b/vendor/github.com/status-im/status-go/protocol/bridge/geth/envelope.go index 4621e8868..33322a35b 100644 --- a/vendor/github.com/status-im/status-go/protocol/bridge/geth/envelope.go +++ b/vendor/github.com/status-im/status-go/protocol/bridge/geth/envelope.go @@ -2,7 +2,7 @@ package gethbridge import ( whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types" - statusproto "github.com/status-im/status-go/protocol/types" + protocol "github.com/status-im/status-go/protocol/types" whisper "github.com/status-im/whisper/whisperv6" ) @@ -22,8 +22,8 @@ func GetGethEnvelopeFrom(f whispertypes.Envelope) *whisper.Envelope { return f.(*gethEnvelopeWrapper).envelope } -func (w *gethEnvelopeWrapper) Hash() statusproto.Hash { - return statusproto.Hash(w.envelope.Hash()) +func (w *gethEnvelopeWrapper) Hash() protocol.Hash { + return protocol.Hash(w.envelope.Hash()) } func (w *gethEnvelopeWrapper) Bloom() []byte { diff --git a/vendor/github.com/status-im/status-go/protocol/bridge/geth/envelope_error.go b/vendor/github.com/status-im/status-go/protocol/bridge/geth/envelope_error.go index 385e96794..1bfbfdbf1 100644 --- a/vendor/github.com/status-im/status-go/protocol/bridge/geth/envelope_error.go +++ b/vendor/github.com/status-im/status-go/protocol/bridge/geth/envelope_error.go @@ -2,7 +2,7 @@ package gethbridge import ( whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types" - statusproto "github.com/status-im/status-go/protocol/types" + protocol "github.com/status-im/status-go/protocol/types" whisper "github.com/status-im/whisper/whisperv6" ) @@ -13,7 +13,7 @@ func NewGethEnvelopeErrorWrapper(envelopeError *whisper.EnvelopeError) *whispert } return &whispertypes.EnvelopeError{ - Hash: statusproto.Hash(envelopeError.Hash), + Hash: protocol.Hash(envelopeError.Hash), Code: mapGethErrorCode(envelopeError.Code), Description: envelopeError.Description, } diff --git a/vendor/github.com/status-im/status-go/protocol/bridge/geth/envelope_event.go b/vendor/github.com/status-im/status-go/protocol/bridge/geth/envelope_event.go index 73031a5ae..f6ed9c658 100644 --- a/vendor/github.com/status-im/status-go/protocol/bridge/geth/envelope_event.go +++ b/vendor/github.com/status-im/status-go/protocol/bridge/geth/envelope_event.go @@ -2,7 +2,7 @@ package gethbridge import ( whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types" - statusproto "github.com/status-im/status-go/protocol/types" + protocol "github.com/status-im/status-go/protocol/types" whisper "github.com/status-im/whisper/whisperv6" ) @@ -26,8 +26,8 @@ func NewGethEnvelopeEventWrapper(envelopeEvent *whisper.EnvelopeEvent) *whispert } return &whispertypes.EnvelopeEvent{ Event: whispertypes.EventType(envelopeEvent.Event), - Hash: statusproto.Hash(envelopeEvent.Hash), - Batch: statusproto.Hash(envelopeEvent.Batch), + Hash: protocol.Hash(envelopeEvent.Hash), + Batch: protocol.Hash(envelopeEvent.Batch), Peer: whispertypes.EnodeID(envelopeEvent.Peer), Data: wrappedData, } diff --git a/vendor/github.com/status-im/status-go/protocol/bridge/geth/mailserver_response.go b/vendor/github.com/status-im/status-go/protocol/bridge/geth/mailserver_response.go index e89de686e..b95b4096e 100644 --- a/vendor/github.com/status-im/status-go/protocol/bridge/geth/mailserver_response.go +++ b/vendor/github.com/status-im/status-go/protocol/bridge/geth/mailserver_response.go @@ -2,7 +2,7 @@ package gethbridge import ( whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types" - statusproto "github.com/status-im/status-go/protocol/types" + protocol "github.com/status-im/status-go/protocol/types" whisper "github.com/status-im/whisper/whisperv6" ) @@ -13,7 +13,7 @@ func NewGethMailServerResponseWrapper(mailServerResponse *whisper.MailServerResp } return &whispertypes.MailServerResponse{ - LastEnvelopeHash: statusproto.Hash(mailServerResponse.LastEnvelopeHash), + LastEnvelopeHash: protocol.Hash(mailServerResponse.LastEnvelopeHash), Cursor: mailServerResponse.Cursor, Error: mailServerResponse.Error, } diff --git a/vendor/github.com/status-im/status-go/protocol/bridge/geth/public_whisper_api.go b/vendor/github.com/status-im/status-go/protocol/bridge/geth/public_whisper_api.go index c47756d0d..3dd043afc 100644 --- a/vendor/github.com/status-im/status-go/protocol/bridge/geth/public_whisper_api.go +++ b/vendor/github.com/status-im/status-go/protocol/bridge/geth/public_whisper_api.go @@ -5,7 +5,7 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types" - statusproto "github.com/status-im/status-go/protocol/types" + protocol "github.com/status-im/status-go/protocol/types" whisper "github.com/status-im/whisper/whisperv6" ) @@ -25,7 +25,7 @@ func NewGethPublicWhisperAPIWrapper(publicWhisperAPI *whisper.PublicWhisperAPI) } // AddPrivateKey imports the given private key. -func (w *gethPublicWhisperAPIWrapper) AddPrivateKey(ctx context.Context, privateKey statusproto.HexBytes) (string, error) { +func (w *gethPublicWhisperAPIWrapper) AddPrivateKey(ctx context.Context, privateKey protocol.HexBytes) (string, error) { return w.publicWhisperAPI.AddPrivateKey(ctx, hexutil.Bytes(privateKey)) } diff --git a/vendor/github.com/status-im/status-go/protocol/chat.go b/vendor/github.com/status-im/status-go/protocol/chat.go index d363c31ea..f244eeb2c 100644 --- a/vendor/github.com/status-im/status-go/protocol/chat.go +++ b/vendor/github.com/status-im/status-go/protocol/chat.go @@ -6,7 +6,7 @@ import ( "encoding/hex" "github.com/ethereum/go-ethereum/crypto" - statusproto "github.com/status-im/status-go/protocol/types" + protocol "github.com/status-im/status-go/protocol/types" v1protocol "github.com/status-im/status-go/protocol/v1" ) @@ -140,7 +140,7 @@ type ChatMember struct { } func (c ChatMember) PublicKey() (*ecdsa.PublicKey, error) { - b, err := statusproto.DecodeHex(c.ID) + b, err := protocol.DecodeHex(c.ID) if err != nil { return nil, err } @@ -148,7 +148,7 @@ func (c ChatMember) PublicKey() (*ecdsa.PublicKey, error) { } func oneToOneChatID(publicKey *ecdsa.PublicKey) string { - return statusproto.EncodeHex(crypto.FromECDSAPub(publicKey)) + return protocol.EncodeHex(crypto.FromECDSAPub(publicKey)) } func CreateOneToOneChat(name string, publicKey *ecdsa.PublicKey) Chat { @@ -194,7 +194,7 @@ func stringSliceToPublicKeys(slice []string, prefixed bool) ([]*ecdsa.PublicKey, err error ) if prefixed { - b, err = statusproto.DecodeHex(item) + b, err = protocol.DecodeHex(item) } else { b, err = hex.DecodeString(item) } diff --git a/vendor/github.com/status-im/status-go/protocol/contact.go b/vendor/github.com/status-im/status-go/protocol/contact.go index 5349600c9..fb0086a2a 100644 --- a/vendor/github.com/status-im/status-go/protocol/contact.go +++ b/vendor/github.com/status-im/status-go/protocol/contact.go @@ -8,7 +8,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/status-im/status-go/protocol/identity/alias" "github.com/status-im/status-go/protocol/identity/identicon" - statusproto "github.com/status-im/status-go/protocol/types" + protocol "github.com/status-im/status-go/protocol/types" ) const ( @@ -58,7 +58,7 @@ type Contact struct { } func (c Contact) PublicKey() (*ecdsa.PublicKey, error) { - b, err := statusproto.DecodeHex(c.ID) + b, err := protocol.DecodeHex(c.ID) if err != nil { return nil, err } diff --git a/vendor/github.com/status-im/status-go/protocol/encryption/migrations/migrations.go b/vendor/github.com/status-im/status-go/protocol/encryption/migrations/migrations.go index 73b41a285..ffcc844c2 100644 --- a/vendor/github.com/status-im/status-go/protocol/encryption/migrations/migrations.go +++ b/vendor/github.com/status-im/status-go/protocol/encryption/migrations/migrations.go @@ -592,23 +592,23 @@ type bintree struct { } var _bintree = &bintree{nil, map[string]*bintree{ - "1536754952_initial_schema.down.sql": &bintree{_1536754952_initial_schemaDownSql, map[string]*bintree{}}, - "1536754952_initial_schema.up.sql": &bintree{_1536754952_initial_schemaUpSql, map[string]*bintree{}}, - "1539249977_update_ratchet_info.down.sql": &bintree{_1539249977_update_ratchet_infoDownSql, map[string]*bintree{}}, - "1539249977_update_ratchet_info.up.sql": &bintree{_1539249977_update_ratchet_infoUpSql, map[string]*bintree{}}, - "1540715431_add_version.down.sql": &bintree{_1540715431_add_versionDownSql, map[string]*bintree{}}, - "1540715431_add_version.up.sql": &bintree{_1540715431_add_versionUpSql, map[string]*bintree{}}, - "1541164797_add_installations.down.sql": &bintree{_1541164797_add_installationsDownSql, map[string]*bintree{}}, - "1541164797_add_installations.up.sql": &bintree{_1541164797_add_installationsUpSql, map[string]*bintree{}}, - "1558084410_add_secret.down.sql": &bintree{_1558084410_add_secretDownSql, map[string]*bintree{}}, - "1558084410_add_secret.up.sql": &bintree{_1558084410_add_secretUpSql, map[string]*bintree{}}, - "1558588866_add_version.down.sql": &bintree{_1558588866_add_versionDownSql, map[string]*bintree{}}, - "1558588866_add_version.up.sql": &bintree{_1558588866_add_versionUpSql, map[string]*bintree{}}, - "1559627659_add_contact_code.down.sql": &bintree{_1559627659_add_contact_codeDownSql, map[string]*bintree{}}, - "1559627659_add_contact_code.up.sql": &bintree{_1559627659_add_contact_codeUpSql, map[string]*bintree{}}, - "1561368210_add_installation_metadata.down.sql": &bintree{_1561368210_add_installation_metadataDownSql, map[string]*bintree{}}, - "1561368210_add_installation_metadata.up.sql": &bintree{_1561368210_add_installation_metadataUpSql, map[string]*bintree{}}, - "doc.go": &bintree{docGo, map[string]*bintree{}}, + "1536754952_initial_schema.down.sql": {_1536754952_initial_schemaDownSql, map[string]*bintree{}}, + "1536754952_initial_schema.up.sql": {_1536754952_initial_schemaUpSql, map[string]*bintree{}}, + "1539249977_update_ratchet_info.down.sql": {_1539249977_update_ratchet_infoDownSql, map[string]*bintree{}}, + "1539249977_update_ratchet_info.up.sql": {_1539249977_update_ratchet_infoUpSql, map[string]*bintree{}}, + "1540715431_add_version.down.sql": {_1540715431_add_versionDownSql, map[string]*bintree{}}, + "1540715431_add_version.up.sql": {_1540715431_add_versionUpSql, map[string]*bintree{}}, + "1541164797_add_installations.down.sql": {_1541164797_add_installationsDownSql, map[string]*bintree{}}, + "1541164797_add_installations.up.sql": {_1541164797_add_installationsUpSql, map[string]*bintree{}}, + "1558084410_add_secret.down.sql": {_1558084410_add_secretDownSql, map[string]*bintree{}}, + "1558084410_add_secret.up.sql": {_1558084410_add_secretUpSql, map[string]*bintree{}}, + "1558588866_add_version.down.sql": {_1558588866_add_versionDownSql, map[string]*bintree{}}, + "1558588866_add_version.up.sql": {_1558588866_add_versionUpSql, map[string]*bintree{}}, + "1559627659_add_contact_code.down.sql": {_1559627659_add_contact_codeDownSql, map[string]*bintree{}}, + "1559627659_add_contact_code.up.sql": {_1559627659_add_contact_codeUpSql, map[string]*bintree{}}, + "1561368210_add_installation_metadata.down.sql": {_1561368210_add_installation_metadataDownSql, map[string]*bintree{}}, + "1561368210_add_installation_metadata.up.sql": {_1561368210_add_installation_metadataUpSql, map[string]*bintree{}}, + "doc.go": {docGo, map[string]*bintree{}}, }} // RestoreAsset restores an asset under the given directory. diff --git a/vendor/github.com/status-im/status-go/protocol/message.go b/vendor/github.com/status-im/status-go/protocol/message.go index efac86278..4c4a312c0 100644 --- a/vendor/github.com/status-im/status-go/protocol/message.go +++ b/vendor/github.com/status-im/status-go/protocol/message.go @@ -4,17 +4,17 @@ import ( "database/sql/driver" "github.com/pkg/errors" - statusproto "github.com/status-im/status-go/protocol/types" + protocol "github.com/status-im/status-go/protocol/types" ) -type hexutilSQL statusproto.HexBytes +type hexutilSQL protocol.HexBytes func (h hexutilSQL) Value() (driver.Value, error) { return []byte(h), nil } func (h hexutilSQL) String() string { - return statusproto.EncodeHex(h) + return protocol.EncodeHex(h) } func (h *hexutilSQL) Scan(value interface{}) error { diff --git a/vendor/github.com/status-im/status-go/protocol/messenger.go b/vendor/github.com/status-im/status-go/protocol/messenger.go index 728e4a9ff..ea18fc721 100644 --- a/vendor/github.com/status-im/status-go/protocol/messenger.go +++ b/vendor/github.com/status-im/status-go/protocol/messenger.go @@ -20,7 +20,7 @@ import ( "github.com/status-im/status-go/protocol/sqlite" transport "github.com/status-im/status-go/protocol/transport/whisper" whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types" - statusproto "github.com/status-im/status-go/protocol/types" + protocol "github.com/status-im/status-go/protocol/types" v1protocol "github.com/status-im/status-go/protocol/v1" ) @@ -497,7 +497,7 @@ func (m *Messenger) AddMembersToChat(ctx context.Context, chat *Chat, members [] } encodedMembers := make([]string, len(members)) for idx, member := range members { - encodedMembers[idx] = statusproto.EncodeHex(crypto.FromECDSAPub(member)) + encodedMembers[idx] = protocol.EncodeHex(crypto.FromECDSAPub(member)) } event := v1protocol.NewMembersAddedEvent(encodedMembers, group.NextClockValue()) err = group.ProcessEvent(&m.identity.PublicKey, event) @@ -517,7 +517,7 @@ func (m *Messenger) ConfirmJoiningGroup(ctx context.Context, chat *Chat) error { return err } event := v1protocol.NewMemberJoinedEvent( - statusproto.EncodeHex(crypto.FromECDSAPub(&m.identity.PublicKey)), + protocol.EncodeHex(crypto.FromECDSAPub(&m.identity.PublicKey)), group.NextClockValue(), ) err = group.ProcessEvent(&m.identity.PublicKey, event) @@ -1045,7 +1045,7 @@ func (p *postProcessor) matchMessage(message *v1protocol.Message, chats []*Chat) case message.MessageT == v1protocol.MessageTypePrivate: // It's an incoming private message. ChatID is calculated from the signature. // If a chat does not exist, a new one is created and saved. - chatID := statusproto.EncodeHex(crypto.FromECDSAPub(message.SigPubKey)) + chatID := protocol.EncodeHex(crypto.FromECDSAPub(message.SigPubKey)) chat := findChatByID(chatID, chats) if chat == nil { // TODO: this should be a three-word name used in the mobile client @@ -1065,7 +1065,7 @@ func (p *postProcessor) matchMessage(message *v1protocol.Message, chats []*Chat) return nil, errors.New("received group chat message for non-existing chat") } - sigPubKeyHex := statusproto.EncodeHex(crypto.FromECDSAPub(message.SigPubKey)) + sigPubKeyHex := protocol.EncodeHex(crypto.FromECDSAPub(message.SigPubKey)) for _, member := range chat.Members { if member.ID == sigPubKeyHex { return chat, nil diff --git a/vendor/github.com/status-im/status-go/protocol/migrations/migrations.go b/vendor/github.com/status-im/status-go/protocol/migrations/migrations.go index d15d3d7f5..394508d86 100644 --- a/vendor/github.com/status-im/status-go/protocol/migrations/migrations.go +++ b/vendor/github.com/status-im/status-go/protocol/migrations/migrations.go @@ -454,17 +454,17 @@ type bintree struct { } var _bintree = &bintree{nil, map[string]*bintree{ - "000001_init.down.db.sql": &bintree{_000001_initDownDbSql, map[string]*bintree{}}, - "000001_init.up.db.sql": &bintree{_000001_initUpDbSql, map[string]*bintree{}}, - "000002_add_chats.down.db.sql": &bintree{_000002_add_chatsDownDbSql, map[string]*bintree{}}, - "000002_add_chats.up.db.sql": &bintree{_000002_add_chatsUpDbSql, map[string]*bintree{}}, - "000003_add_contacts.down.db.sql": &bintree{_000003_add_contactsDownDbSql, map[string]*bintree{}}, - "000003_add_contacts.up.db.sql": &bintree{_000003_add_contactsUpDbSql, map[string]*bintree{}}, - "000004_user_messages_compatibility.down.sql": &bintree{_000004_user_messages_compatibilityDownSql, map[string]*bintree{}}, - "000004_user_messages_compatibility.up.sql": &bintree{_000004_user_messages_compatibilityUpSql, map[string]*bintree{}}, - "1567112142_user_messages.down.sql": &bintree{_1567112142_user_messagesDownSql, map[string]*bintree{}}, - "1567112142_user_messages.up.sql": &bintree{_1567112142_user_messagesUpSql, map[string]*bintree{}}, - "doc.go": &bintree{docGo, map[string]*bintree{}}, + "000001_init.down.db.sql": {_000001_initDownDbSql, map[string]*bintree{}}, + "000001_init.up.db.sql": {_000001_initUpDbSql, map[string]*bintree{}}, + "000002_add_chats.down.db.sql": {_000002_add_chatsDownDbSql, map[string]*bintree{}}, + "000002_add_chats.up.db.sql": {_000002_add_chatsUpDbSql, map[string]*bintree{}}, + "000003_add_contacts.down.db.sql": {_000003_add_contactsDownDbSql, map[string]*bintree{}}, + "000003_add_contacts.up.db.sql": {_000003_add_contactsUpDbSql, map[string]*bintree{}}, + "000004_user_messages_compatibility.down.sql": {_000004_user_messages_compatibilityDownSql, map[string]*bintree{}}, + "000004_user_messages_compatibility.up.sql": {_000004_user_messages_compatibilityUpSql, map[string]*bintree{}}, + "1567112142_user_messages.down.sql": {_1567112142_user_messagesDownSql, map[string]*bintree{}}, + "1567112142_user_messages.up.sql": {_1567112142_user_messagesUpSql, map[string]*bintree{}}, + "doc.go": {docGo, map[string]*bintree{}}, }} // RestoreAsset restores an asset under the given directory. diff --git a/vendor/github.com/status-im/status-go/protocol/transport/whisper/envelopes.go b/vendor/github.com/status-im/status-go/protocol/transport/whisper/envelopes.go index f3835c5d3..c8cb3180c 100644 --- a/vendor/github.com/status-im/status-go/protocol/transport/whisper/envelopes.go +++ b/vendor/github.com/status-im/status-go/protocol/transport/whisper/envelopes.go @@ -6,7 +6,7 @@ import ( "sync" whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types" - statusproto "github.com/status-im/status-go/protocol/types" + protocol "github.com/status-im/status-go/protocol/types" "go.uber.org/zap" ) @@ -34,8 +34,8 @@ type EnvelopesMonitorConfig struct { type EnvelopeEventsHandler interface { EnvelopeSent([][]byte) EnvelopeExpired([][]byte, error) - MailServerRequestCompleted(statusproto.Hash, statusproto.Hash, []byte, error) - MailServerRequestExpired(statusproto.Hash) + MailServerRequestCompleted(protocol.Hash, protocol.Hash, []byte, error) + MailServerRequestExpired(protocol.Hash) } // NewEnvelopesMonitor returns a pointer to an instance of the EnvelopesMonitor. @@ -61,13 +61,13 @@ func NewEnvelopesMonitor(w whispertypes.Whisper, config EnvelopesMonitorConfig) logger: logger.With(zap.Namespace("EnvelopesMonitor")), // key is envelope hash (event.Hash) - envelopes: map[statusproto.Hash]EnvelopeState{}, - messages: map[statusproto.Hash]*whispertypes.NewMessage{}, - attempts: map[statusproto.Hash]int{}, - identifiers: make(map[statusproto.Hash][][]byte), + envelopes: map[protocol.Hash]EnvelopeState{}, + messages: map[protocol.Hash]*whispertypes.NewMessage{}, + attempts: map[protocol.Hash]int{}, + identifiers: make(map[protocol.Hash][][]byte), // key is hash of the batch (event.Batch) - batches: map[statusproto.Hash]map[statusproto.Hash]struct{}{}, + batches: map[protocol.Hash]map[protocol.Hash]struct{}{}, } } @@ -80,12 +80,12 @@ type EnvelopesMonitor struct { maxAttempts int mu sync.Mutex - envelopes map[statusproto.Hash]EnvelopeState - batches map[statusproto.Hash]map[statusproto.Hash]struct{} + envelopes map[protocol.Hash]EnvelopeState + batches map[protocol.Hash]map[protocol.Hash]struct{} - messages map[statusproto.Hash]*whispertypes.NewMessage - attempts map[statusproto.Hash]int - identifiers map[statusproto.Hash][][]byte + messages map[protocol.Hash]*whispertypes.NewMessage + attempts map[protocol.Hash]int + identifiers map[protocol.Hash][][]byte wg sync.WaitGroup quit chan struct{} @@ -111,7 +111,7 @@ func (m *EnvelopesMonitor) Stop() { } // Add hash to a tracker. -func (m *EnvelopesMonitor) Add(identifiers [][]byte, envelopeHash statusproto.Hash, message whispertypes.NewMessage) { +func (m *EnvelopesMonitor) Add(identifiers [][]byte, envelopeHash protocol.Hash, message whispertypes.NewMessage) { m.mu.Lock() defer m.mu.Unlock() m.envelopes[envelopeHash] = EnvelopePosted @@ -120,7 +120,7 @@ func (m *EnvelopesMonitor) Add(identifiers [][]byte, envelopeHash statusproto.Ha m.attempts[envelopeHash] = 1 } -func (m *EnvelopesMonitor) GetState(hash statusproto.Hash) EnvelopeState { +func (m *EnvelopesMonitor) GetState(hash protocol.Hash) EnvelopeState { m.mu.Lock() defer m.mu.Unlock() state, exist := m.envelopes[hash] @@ -179,9 +179,9 @@ func (m *EnvelopesMonitor) handleEventEnvelopeSent(event whispertypes.EnvelopeEv return } m.logger.Debug("envelope is sent", zap.String("hash", event.Hash.String()), zap.String("peer", event.Peer.String())) - if event.Batch != (statusproto.Hash{}) { + if event.Batch != (protocol.Hash{}) { if _, ok := m.batches[event.Batch]; !ok { - m.batches[event.Batch] = map[statusproto.Hash]struct{}{} + m.batches[event.Batch] = map[protocol.Hash]struct{}{} } m.batches[event.Batch][event.Hash] = struct{}{} m.logger.Debug("waiting for a confirmation", zap.String("batch", event.Batch.String())) @@ -212,7 +212,7 @@ func (m *EnvelopesMonitor) handleAcknowledgedBatch(event whispertypes.EnvelopeEv if event.Data != nil && !ok { m.logger.Error("received unexpected data in the the confirmation event", zap.String("batch", event.Batch.String())) } - failedEnvelopes := map[statusproto.Hash]struct{}{} + failedEnvelopes := map[protocol.Hash]struct{}{} for i := range envelopeErrors { envelopeError := envelopeErrors[i] _, exist := m.envelopes[envelopeError.Hash] @@ -252,7 +252,7 @@ func (m *EnvelopesMonitor) handleEventEnvelopeExpired(event whispertypes.Envelop // handleEnvelopeFailure is a common code path for processing envelopes failures. not thread safe, lock // must be used on a higher level. -func (m *EnvelopesMonitor) handleEnvelopeFailure(hash statusproto.Hash, err error) { +func (m *EnvelopesMonitor) handleEnvelopeFailure(hash protocol.Hash, err error) { if state, ok := m.envelopes[hash]; ok { message, exist := m.messages[hash] if !exist { @@ -274,7 +274,7 @@ func (m *EnvelopesMonitor) handleEnvelopeFailure(hash statusproto.Hash, err erro } } - envelopeID := statusproto.BytesToHash(hex) + envelopeID := protocol.BytesToHash(hex) m.envelopes[envelopeID] = EnvelopePosted m.messages[envelopeID] = message m.attempts[envelopeID] = attempt + 1 @@ -309,7 +309,7 @@ func (m *EnvelopesMonitor) handleEventEnvelopeReceived(event whispertypes.Envelo // clearMessageState removes all message and envelope state. // not thread-safe, should be protected on a higher level. -func (m *EnvelopesMonitor) clearMessageState(envelopeID statusproto.Hash) { +func (m *EnvelopesMonitor) clearMessageState(envelopeID protocol.Hash) { delete(m.envelopes, envelopeID) delete(m.messages, envelopeID) delete(m.attempts, envelopeID) diff --git a/vendor/github.com/status-im/status-go/protocol/transport/whisper/migrations/migrations.go b/vendor/github.com/status-im/status-go/protocol/transport/whisper/migrations/migrations.go index e6edb9762..05940fcbf 100644 --- a/vendor/github.com/status-im/status-go/protocol/transport/whisper/migrations/migrations.go +++ b/vendor/github.com/status-im/status-go/protocol/transport/whisper/migrations/migrations.go @@ -270,9 +270,9 @@ type bintree struct { } var _bintree = &bintree{nil, map[string]*bintree{ - "1561059285_add_whisper_keys.down.sql": &bintree{_1561059285_add_whisper_keysDownSql, map[string]*bintree{}}, - "1561059285_add_whisper_keys.up.sql": &bintree{_1561059285_add_whisper_keysUpSql, map[string]*bintree{}}, - "doc.go": &bintree{docGo, map[string]*bintree{}}, + "1561059285_add_whisper_keys.down.sql": {_1561059285_add_whisper_keysDownSql, map[string]*bintree{}}, + "1561059285_add_whisper_keys.up.sql": {_1561059285_add_whisper_keysUpSql, map[string]*bintree{}}, + "doc.go": {docGo, map[string]*bintree{}}, }} // RestoreAsset restores an asset under the given directory. diff --git a/vendor/github.com/status-im/status-go/protocol/transport/whisper/types/envelopes.go b/vendor/github.com/status-im/status-go/protocol/transport/whisper/types/envelopes.go index 489ade77f..2510bf7b8 100644 --- a/vendor/github.com/status-im/status-go/protocol/transport/whisper/types/envelopes.go +++ b/vendor/github.com/status-im/status-go/protocol/transport/whisper/types/envelopes.go @@ -1,11 +1,11 @@ package whispertypes -import statusproto "github.com/status-im/status-go/protocol/types" +import protocol "github.com/status-im/status-go/protocol/types" // Envelope represents a clear-text data packet to transmit through the Whisper // network. Its contents may or may not be encrypted and signed. type Envelope interface { - Hash() statusproto.Hash // Cached hash of the envelope to avoid rehashing every time. + Hash() protocol.Hash // Cached hash of the envelope to avoid rehashing every time. Bloom() []byte } @@ -50,15 +50,15 @@ const ( // EnvelopeEvent used for envelopes events. type EnvelopeEvent struct { Event EventType - Hash statusproto.Hash - Batch statusproto.Hash + Hash protocol.Hash + Batch protocol.Hash Peer EnodeID Data interface{} } // EnvelopeError code and optional description of the error. type EnvelopeError struct { - Hash statusproto.Hash + Hash protocol.Hash Code uint Description string } diff --git a/vendor/github.com/status-im/status-go/protocol/transport/whisper/types/gen_message_json.go b/vendor/github.com/status-im/status-go/protocol/transport/whisper/types/gen_message_json.go index 63be37851..549e5a9e1 100644 --- a/vendor/github.com/status-im/status-go/protocol/transport/whisper/types/gen_message_json.go +++ b/vendor/github.com/status-im/status-go/protocol/transport/whisper/types/gen_message_json.go @@ -5,21 +5,21 @@ package whispertypes import ( "encoding/json" - statusproto "github.com/status-im/status-go/protocol/types" + protocol "github.com/status-im/status-go/protocol/types" ) // MarshalJSON marshals type Message to a json string func (m Message) MarshalJSON() ([]byte, error) { type Message struct { - Sig statusproto.HexBytes `json:"sig,omitempty"` - TTL uint32 `json:"ttl"` - Timestamp uint32 `json:"timestamp"` - Topic TopicType `json:"topic"` - Payload statusproto.HexBytes `json:"payload"` - Padding statusproto.HexBytes `json:"padding"` - PoW float64 `json:"pow"` - Hash statusproto.HexBytes `json:"hash"` - Dst statusproto.HexBytes `json:"recipientPublicKey,omitempty"` + Sig protocol.HexBytes `json:"sig,omitempty"` + TTL uint32 `json:"ttl"` + Timestamp uint32 `json:"timestamp"` + Topic TopicType `json:"topic"` + Payload protocol.HexBytes `json:"payload"` + Padding protocol.HexBytes `json:"padding"` + PoW float64 `json:"pow"` + Hash protocol.HexBytes `json:"hash"` + Dst protocol.HexBytes `json:"recipientPublicKey,omitempty"` } var enc Message enc.Sig = m.Sig @@ -37,15 +37,15 @@ func (m Message) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals type Message to a json string func (m *Message) UnmarshalJSON(input []byte) error { type Message struct { - Sig *statusproto.HexBytes `json:"sig,omitempty"` - TTL *uint32 `json:"ttl"` - Timestamp *uint32 `json:"timestamp"` - Topic *TopicType `json:"topic"` - Payload *statusproto.HexBytes `json:"payload"` - Padding *statusproto.HexBytes `json:"padding"` - PoW *float64 `json:"pow"` - Hash *statusproto.HexBytes `json:"hash"` - Dst *statusproto.HexBytes `json:"recipientPublicKey,omitempty"` + Sig *protocol.HexBytes `json:"sig,omitempty"` + TTL *uint32 `json:"ttl"` + Timestamp *uint32 `json:"timestamp"` + Topic *TopicType `json:"topic"` + Payload *protocol.HexBytes `json:"payload"` + Padding *protocol.HexBytes `json:"padding"` + PoW *float64 `json:"pow"` + Hash *protocol.HexBytes `json:"hash"` + Dst *protocol.HexBytes `json:"recipientPublicKey,omitempty"` } var dec Message if err := json.Unmarshal(input, &dec); err != nil { diff --git a/vendor/github.com/status-im/status-go/protocol/transport/whisper/types/mailserver.go b/vendor/github.com/status-im/status-go/protocol/transport/whisper/types/mailserver.go index 3d1300502..78d07b59d 100644 --- a/vendor/github.com/status-im/status-go/protocol/transport/whisper/types/mailserver.go +++ b/vendor/github.com/status-im/status-go/protocol/transport/whisper/types/mailserver.go @@ -3,7 +3,7 @@ package whispertypes import ( "time" - statusproto "github.com/status-im/status-go/protocol/types" + protocol "github.com/status-im/status-go/protocol/types" ) const ( @@ -49,7 +49,7 @@ func (r *MessagesRequest) SetDefaults(now time.Time) { // MailServerResponse is the response payload sent by the mailserver. type MailServerResponse struct { - LastEnvelopeHash statusproto.Hash + LastEnvelopeHash protocol.Hash Cursor []byte Error error } diff --git a/vendor/github.com/status-im/status-go/protocol/transport/whisper/types/rpc.go b/vendor/github.com/status-im/status-go/protocol/transport/whisper/types/rpc.go index d3c6d53e4..3ca4a6663 100644 --- a/vendor/github.com/status-im/status-go/protocol/transport/whisper/types/rpc.go +++ b/vendor/github.com/status-im/status-go/protocol/transport/whisper/types/rpc.go @@ -3,7 +3,7 @@ package whispertypes import ( "context" - statusproto "github.com/status-im/status-go/protocol/types" + protocol "github.com/status-im/status-go/protocol/types" ) // NewMessage represents a new whisper message that is posted through the RPC. @@ -48,7 +48,7 @@ type Criteria struct { // use publicly without security implications. type PublicWhisperAPI interface { // AddPrivateKey imports the given private key. - AddPrivateKey(ctx context.Context, privateKey statusproto.HexBytes) (string, error) + AddPrivateKey(ctx context.Context, privateKey protocol.HexBytes) (string, error) // GenerateSymKeyFromPassword derives a key from the given password, stores it, and returns its ID. GenerateSymKeyFromPassword(ctx context.Context, passwd string) (string, error) // DeleteKeyPair removes the key with the given key if it exists. diff --git a/vendor/github.com/status-im/status-go/protocol/transport/whisper/types/topic.go b/vendor/github.com/status-im/status-go/protocol/transport/whisper/types/topic.go index 0e6b98520..707a8d6d6 100644 --- a/vendor/github.com/status-im/status-go/protocol/transport/whisper/types/topic.go +++ b/vendor/github.com/status-im/status-go/protocol/transport/whisper/types/topic.go @@ -2,7 +2,7 @@ package whispertypes import ( "github.com/ethereum/go-ethereum/common/hexutil" - statusproto "github.com/status-im/status-go/protocol/types" + protocol "github.com/status-im/status-go/protocol/types" ) const ( @@ -32,12 +32,12 @@ func BytesToTopic(b []byte) (t TopicType) { // String converts a topic byte array to a string representation. func (t *TopicType) String() string { - return statusproto.EncodeHex(t[:]) + return protocol.EncodeHex(t[:]) } // MarshalText returns the hex representation of t. func (t TopicType) MarshalText() ([]byte, error) { - return statusproto.HexBytes(t[:]).MarshalText() + return protocol.HexBytes(t[:]).MarshalText() } // UnmarshalText parses a hex representation to a topic. diff --git a/vendor/github.com/status-im/status-go/protocol/transport/whisper/whisper_service.go b/vendor/github.com/status-im/status-go/protocol/transport/whisper/whisper_service.go index 189f91eb4..f291ece06 100644 --- a/vendor/github.com/status-im/status-go/protocol/transport/whisper/whisper_service.go +++ b/vendor/github.com/status-im/status-go/protocol/transport/whisper/whisper_service.go @@ -12,7 +12,7 @@ import ( "go.uber.org/zap" whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types" - statusproto "github.com/status-im/status-go/protocol/types" + protocol "github.com/status-im/status-go/protocol/types" ) var ( @@ -372,7 +372,7 @@ func (a *WhisperServiceTransport) addSig(newMessage *whispertypes.NewMessage) er func (a *WhisperServiceTransport) Track(identifiers [][]byte, hash []byte, newMessage *whispertypes.NewMessage) { if a.envelopesMonitor != nil { - a.envelopesMonitor.Add(identifiers, statusproto.BytesToHash(hash), *newMessage) + a.envelopesMonitor.Add(identifiers, protocol.BytesToHash(hash), *newMessage) } } diff --git a/vendor/github.com/status-im/status-go/protocol/v1/README.md b/vendor/github.com/status-im/status-go/protocol/v1/README.md index 695799574..7065c5604 100644 --- a/vendor/github.com/status-im/status-go/protocol/v1/README.md +++ b/vendor/github.com/status-im/status-go/protocol/v1/README.md @@ -1,3 +1,3 @@ -# v1 statusproto package folder +# v1 protocol package folder This folder contains only data types mentioned in the specification and required for its implementation. diff --git a/vendor/github.com/status-im/status-go/protocol/v1/membership_update_message.go b/vendor/github.com/status-im/status-go/protocol/v1/membership_update_message.go index 4fb964778..a874f52ca 100644 --- a/vendor/github.com/status-im/status-go/protocol/v1/membership_update_message.go +++ b/vendor/github.com/status-im/status-go/protocol/v1/membership_update_message.go @@ -15,7 +15,7 @@ import ( "github.com/google/uuid" "github.com/pkg/errors" "github.com/status-im/status-go/protocol/crypto" - statusproto "github.com/status-im/status-go/protocol/types" + protocol "github.com/status-im/status-go/protocol/types" ) const ( @@ -94,7 +94,7 @@ func (u *MembershipUpdate) extractFrom() error { if err != nil { return errors.Wrap(err, "failed to extract signature") } - u.From = statusproto.EncodeHex(gethcrypto.FromECDSAPub(publicKey)) + u.From = protocol.EncodeHex(gethcrypto.FromECDSAPub(publicKey)) return nil } @@ -282,7 +282,7 @@ type Group struct { } func groupChatID(creator *ecdsa.PublicKey) string { - return uuid.New().String() + "-" + statusproto.EncodeHex(gethcrypto.FromECDSAPub(creator)) + return uuid.New().String() + "-" + protocol.EncodeHex(gethcrypto.FromECDSAPub(creator)) } func NewGroupWithMembershipUpdates(chatID string, updates []MembershipUpdate) (*Group, error) { @@ -396,7 +396,7 @@ func (g *Group) ProcessEvents(from *ecdsa.PublicKey, events []MembershipUpdateEv } func (g *Group) ProcessEvent(from *ecdsa.PublicKey, event MembershipUpdateEvent) error { - fromHex := statusproto.EncodeHex(gethcrypto.FromECDSAPub(from)) + fromHex := protocol.EncodeHex(gethcrypto.FromECDSAPub(from)) if !g.validateEvent(fromHex, event) { return fmt.Errorf("invalid event %#+v from %s", event, from) } @@ -523,7 +523,7 @@ func stringSliceEquals(slice1, slice2 []string) bool { } func publicKeyToString(publicKey *ecdsa.PublicKey) string { - return statusproto.EncodeHex(gethcrypto.FromECDSAPub(publicKey)) + return protocol.EncodeHex(gethcrypto.FromECDSAPub(publicKey)) } type stringSet struct { diff --git a/vendor/github.com/status-im/status-go/protocol/v1/message.go b/vendor/github.com/status-im/status-go/protocol/v1/message.go index 815d5be4b..7245d40fe 100644 --- a/vendor/github.com/status-im/status-go/protocol/v1/message.go +++ b/vendor/github.com/status-im/status-go/protocol/v1/message.go @@ -11,7 +11,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/golang/protobuf/proto" "github.com/pkg/errors" - statusproto "github.com/status-im/status-go/protocol/types" + protocol "github.com/status-im/status-go/protocol/types" ) const ( @@ -146,7 +146,7 @@ func EncodeMessage(value Message) ([]byte, error) { // MessageID calculates the messageID from author's compressed public key // and not encrypted but encoded payload. -func MessageID(author *ecdsa.PublicKey, data []byte) statusproto.HexBytes { +func MessageID(author *ecdsa.PublicKey, data []byte) protocol.HexBytes { keyBytes := crypto.FromECDSAPub(author) return crypto.Keccak256(append(keyBytes, data...)) } diff --git a/vendor/github.com/status-im/status-go/protocol/v1/message.pb.go b/vendor/github.com/status-im/status-go/protocol/v1/message.pb.go index e94cda48a..773a448be 100644 --- a/vendor/github.com/status-im/status-go/protocol/v1/message.pb.go +++ b/vendor/github.com/status-im/status-go/protocol/v1/message.pb.go @@ -68,7 +68,7 @@ func (m *StatusProtocolMessage) GetPayload() []byte { } func init() { - proto.RegisterType((*StatusProtocolMessage)(nil), "statusproto.StatusProtocolMessage") + proto.RegisterType((*StatusProtocolMessage)(nil), "protocol.StatusProtocolMessage") } func init() { proto.RegisterFile("message.proto", fileDescriptor_33c57e4bae7b9afd) } diff --git a/vendor/github.com/status-im/status-go/protocol/v1/status_message.go b/vendor/github.com/status-im/status-go/protocol/v1/status_message.go index daa213a43..67fa4fb7f 100644 --- a/vendor/github.com/status-im/status-go/protocol/v1/status_message.go +++ b/vendor/github.com/status-im/status-go/protocol/v1/status_message.go @@ -12,7 +12,7 @@ import ( "github.com/status-im/status-go/protocol/datasync" "github.com/status-im/status-go/protocol/encryption" whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types" - statusproto "github.com/status-im/status-go/protocol/types" + protocol "github.com/status-im/status-go/protocol/types" ) type StatusMessageT int @@ -38,7 +38,7 @@ type StatusMessage struct { DecryptedPayload []byte // ID is the canonical ID of the message - ID statusproto.HexBytes + ID protocol.HexBytes // Hash is the transport layer hash Hash []byte