Skip to content
Permalink
Browse files

Move to monorepo structure (#1684)

Move to a monorepo structure with submodules

- Rename status-protocol-go to status-go/protocol
  • Loading branch information
PombeirP committed Nov 21, 2019
1 parent 2dd74da commit ed5a5c154daf5362cdf0c35fd1bc204e6a6d49ae
Showing 2,443 changed files with 1,084,109 additions and 9,985 deletions.
@@ -9,3 +9,9 @@ update_configs:
default_assignees:
- "adambabik"
- "cammellos"
- package_manager: "go:modules"
directory: "/protocol"
update_schedule: "weekly"
default_assignees:
- "adambabik"
- "cammellos"
@@ -1,7 +1,6 @@
{
"recipients": [
"adambabik",
"mandrigin",
"corpetty"
]
}
}
@@ -19,7 +19,7 @@ import (

"github.com/status-im/status-go/account/generator"
"github.com/status-im/status-go/extkeys"
statusproto "github.com/status-im/status-protocol-go/types"
protocol "github.com/status-im/status-go/protocol/types"
)

// errors
@@ -325,7 +325,7 @@ func (m *Manager) ImportSingleExtendedKey(extKey *extkeys.ExtendedKey, password
return address, "", err
}

pubKey = statusproto.EncodeHex(crypto.FromECDSAPub(&key.PrivateKey.PublicKey))
pubKey = protocol.EncodeHex(crypto.FromECDSAPub(&key.PrivateKey.PublicKey))

return
}
@@ -349,7 +349,7 @@ func (m *Manager) importExtendedKey(keyPurpose extkeys.KeyPurpose, extKey *extke
if err != nil {
return address, "", err
}
pubKey = statusproto.EncodeHex(crypto.FromECDSAPub(&key.PrivateKey.PublicKey))
pubKey = protocol.EncodeHex(crypto.FromECDSAPub(&key.PrivateKey.PublicKey))

return
}
@@ -2,7 +2,7 @@ package account

import (
"github.com/ethereum/go-ethereum/crypto"
statusproto "github.com/status-im/status-protocol-go/types"
protocol "github.com/status-im/status-go/protocol/types"
)

func CreateAddress() (address, pubKey, privKey string, err error) {
@@ -15,8 +15,8 @@ func CreateAddress() (address, pubKey, privKey string, err error) {
pubKeyBytes := crypto.FromECDSAPub(&key.PublicKey)
addressBytes := crypto.PubkeyToAddress(key.PublicKey)

privKey = statusproto.EncodeHex(privKeyBytes)
pubKey = statusproto.EncodeHex(pubKeyBytes)
privKey = protocol.EncodeHex(privKeyBytes)
pubKey = protocol.EncodeHex(pubKeyBytes)
address = addressBytes.Hex()

return
@@ -5,7 +5,7 @@ import (

"github.com/ethereum/go-ethereum/crypto"
"github.com/status-im/status-go/extkeys"
statusproto "github.com/status-im/status-protocol-go/types"
protocol "github.com/status-im/status-go/protocol/types"
)

type account struct {
@@ -14,7 +14,7 @@ type account struct {
}

func (a *account) toAccountInfo() AccountInfo {
publicKeyHex := statusproto.EncodeHex(crypto.FromECDSAPub(&a.privateKey.PublicKey))
publicKeyHex := protocol.EncodeHex(crypto.FromECDSAPub(&a.privateKey.PublicKey))
addressHex := crypto.PubkeyToAddress(a.privateKey.PublicKey).Hex()

return AccountInfo{
@@ -7,7 +7,7 @@ import (
"github.com/pborman/uuid"
"github.com/status-im/status-go/account/generator"
"github.com/status-im/status-go/extkeys"
statusproto "github.com/status-im/status-protocol-go/types"
protocol "github.com/status-im/status-go/protocol/types"
)

// OnboardingAccount is returned during onboarding and contains its ID and the mnemonic to re-generate the same account Info keys.
@@ -107,7 +107,7 @@ func (o *Onboarding) deriveAccount(masterExtendedKey *extkeys.ExtendedKey, purpo

privateKeyECDSA := extendedKey.ToECDSA()
address := crypto.PubkeyToAddress(privateKeyECDSA.PublicKey)
publicKeyHex := statusproto.EncodeHex(crypto.FromECDSAPub(&privateKeyECDSA.PublicKey))
publicKeyHex := protocol.EncodeHex(crypto.FromECDSAPub(&privateKeyECDSA.PublicKey))

return address.Hex(), publicKeyHex, nil
}
@@ -28,6 +28,7 @@ import (
"github.com/status-im/status-go/multiaccounts/accounts"
"github.com/status-im/status-go/node"
"github.com/status-im/status-go/params"
protocol "github.com/status-im/status-go/protocol/types"
"github.com/status-im/status-go/rpc"
accountssvc "github.com/status-im/status-go/services/accounts"
"github.com/status-im/status-go/services/browsers"
@@ -40,7 +41,6 @@ import (
"github.com/status-im/status-go/services/wallet"
"github.com/status-im/status-go/signal"
"github.com/status-im/status-go/transactions"
statusproto "github.com/status-im/status-protocol-go/types"
)

const (
@@ -1022,6 +1022,6 @@ func (b *StatusBackend) SignHash(hexEncodedHash string) (string, error) {
return "", fmt.Errorf("SignHash: could not sign the hash: %v", err)
}

hexEncodedSignature := statusproto.EncodeHex(signature)
hexEncodedSignature := protocol.EncodeHex(signature)
return hexEncodedSignature, nil
}
@@ -18,15 +18,15 @@ import (
"github.com/status-im/status-go/api"
"github.com/status-im/status-go/logutils"
"github.com/status-im/status-go/params"
gethbridge "github.com/status-im/status-go/protocol/bridge/geth"
protocol "github.com/status-im/status-go/protocol/types"
"github.com/status-im/status-go/rpc"
"github.com/status-im/status-go/services/shhext"
"github.com/status-im/status-go/t/helpers"
gethbridge "github.com/status-im/status-protocol-go/bridge/geth"
statusproto "github.com/status-im/status-protocol-go/types"
"golang.org/x/crypto/sha3"
"golang.org/x/crypto/ssh/terminal"

whispertypes "github.com/status-im/status-protocol-go/transport/whisper/types"
whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types"
)

const (
@@ -182,7 +182,7 @@ func verifyMailserverBehavior(mailserverNode *enode.Node) {
logger.Error("Error requesting historic messages from mailserver", "error", err)
os.Exit(2)
}
requestID := statusproto.BytesToHash(requestIDBytes)
requestID := protocol.BytesToHash(requestIDBytes)

// wait for mailserver request sent event
err = waitForMailServerRequestSent(mailServerResponseWatcher, requestID, time.Duration(*timeout)*time.Second)
@@ -333,7 +333,7 @@ func joinPublicChat(w whispertypes.Whisper, rpcClient *rpc.Client, name string)
return keyID, topic, filterID, err
}

func waitForMailServerRequestSent(events chan whispertypes.EnvelopeEvent, requestID statusproto.Hash, timeout time.Duration) error {
func waitForMailServerRequestSent(events chan whispertypes.EnvelopeEvent, requestID protocol.Hash, timeout time.Duration) error {
timeoutTimer := time.NewTimer(timeout)
for {
select {
@@ -348,7 +348,7 @@ func waitForMailServerRequestSent(events chan whispertypes.EnvelopeEvent, reques
}
}

func waitForMailServerResponse(events chan whispertypes.EnvelopeEvent, requestID statusproto.Hash, timeout time.Duration) (*whispertypes.MailServerResponse, error) {
func waitForMailServerResponse(events chan whispertypes.EnvelopeEvent, requestID protocol.Hash, timeout time.Duration) (*whispertypes.MailServerResponse, error) {
timeoutTimer := time.NewTimer(timeout)
for {
select {
@@ -408,7 +408,7 @@ func waitForEnvelopeEvents(events chan whispertypes.EnvelopeEvent, hashes []stri
}

// helper for checking LastEnvelopeHash
func isEmptyEnvelope(hash statusproto.Hash) bool {
func isEmptyEnvelope(hash protocol.Hash) bool {
for _, b := range hash {
if b != 0 {
return false
@@ -6,8 +6,8 @@ import (
"errors"
"time"

whispertypes "github.com/status-im/status-protocol-go/transport/whisper/types"
statusproto "github.com/status-im/status-protocol-go/types"
whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types"
protocol "github.com/status-im/status-go/protocol/types"
"github.com/syndtr/goleveldb/leveldb/util"
)

@@ -57,7 +57,7 @@ type TopicHistory struct {
Current time.Time
End time.Time

RequestID statusproto.Hash
RequestID protocol.Hash
}

// Key returns unique identifier for this TopicHistory.
@@ -115,7 +115,7 @@ func (t TopicHistory) SameRange(other TopicHistory) bool {

// Pending returns true if this topic was requested from a mail server.
func (t TopicHistory) Pending() bool {
return t.RequestID != statusproto.Hash{}
return t.RequestID != protocol.Hash{}
}

// HistoryRequest is kept in the database while request is in the progress.
@@ -127,7 +127,7 @@ type HistoryRequest struct {
histories []TopicHistory

// Generated ID
ID statusproto.Hash
ID protocol.Hash
// List of the topics
TopicHistoryKeys []TopicHistoryKey
}
@@ -167,8 +167,8 @@ func (req HistoryRequest) Save() error {
}

// Replace saves request with new ID and all data attached to the old one.
func (req HistoryRequest) Replace(id statusproto.Hash) error {
if (req.ID != statusproto.Hash{}) {
func (req HistoryRequest) Replace(id protocol.Hash) error {
if (req.ID != protocol.Hash{}) {
if err := req.Delete(); err != nil {
return err
}
@@ -3,8 +3,8 @@ package db
import (
"time"

whispertypes "github.com/status-im/status-protocol-go/transport/whisper/types"
statusproto "github.com/status-im/status-protocol-go/types"
whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types"
protocol "github.com/status-im/status-go/protocol/types"
"github.com/syndtr/goleveldb/leveldb/errors"
)

@@ -44,7 +44,7 @@ func (h HistoryStore) NewHistory(topic whispertypes.TopicType, duration time.Dur
}

// GetRequest loads HistoryRequest from database.
func (h HistoryStore) GetRequest(id statusproto.Hash) (HistoryRequest, error) {
func (h HistoryStore) GetRequest(id protocol.Hash) (HistoryRequest, error) {
req := HistoryRequest{requestDB: h.requestDB, topicDB: h.topicDB, ID: id}
err := req.Load()
if err != nil {
@@ -4,8 +4,8 @@ import (
"testing"
"time"

whispertypes "github.com/status-im/status-protocol-go/transport/whisper/types"
statusproto "github.com/status-im/status-protocol-go/types"
whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types"
protocol "github.com/status-im/status-go/protocol/types"
"github.com/stretchr/testify/require"
)

@@ -43,7 +43,7 @@ func TestGetExistingHistory(t *testing.T) {

func TestNewHistoryRequest(t *testing.T) {
store := createInMemStore(t)
id := statusproto.Hash{1}
id := protocol.Hash{1}
req, err := store.GetRequest(id)
require.Error(t, err)
req = store.NewRequest()
@@ -61,8 +61,8 @@ func TestNewHistoryRequest(t *testing.T) {

func TestGetAllRequests(t *testing.T) {
store := createInMemStore(t)
idOne := statusproto.Hash{1}
idTwo := statusproto.Hash{2}
idOne := protocol.Hash{1}
idTwo := protocol.Hash{2}

req := store.NewRequest()
req.ID = idOne
@@ -4,8 +4,8 @@ import (
"testing"
"time"

whispertypes "github.com/status-im/status-protocol-go/transport/whisper/types"
statusproto "github.com/status-im/status-protocol-go/types"
whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types"
protocol "github.com/status-im/status-go/protocol/types"
"github.com/stretchr/testify/require"
)

@@ -80,7 +80,7 @@ func TestAddHistory(t *testing.T) {
require.NoError(t, err)

th := TopicHistory{db: topicdb, Topic: topic, Current: now}
id := statusproto.Hash{1}
id := protocol.Hash{1}

req := HistoryRequest{requestDB: requestdb, topicDB: topicdb, ID: id}
req.AddHistory(th)
4 go.mod
@@ -10,6 +10,8 @@ replace github.com/docker/docker => github.com/docker/engine v1.4.2-0.2019071716

replace github.com/gomarkdown/markdown => github.com/status-im/markdown v0.0.0-20191113114344-af599402d015

replace github.com/status-im/status-go/protocol => ./protocol

require (
github.com/beevik/ntp v0.2.0
github.com/btcsuite/btcd v0.0.0-20191011042131-c3151ef50de9
@@ -31,7 +33,7 @@ require (
github.com/russolsen/transit v0.0.0-20180705123435-0794b4c4505a
github.com/status-im/migrate/v4 v4.6.2-status.2
github.com/status-im/rendezvous v1.3.0
github.com/status-im/status-protocol-go v0.5.2
github.com/status-im/status-go/protocol v0.5.2
github.com/status-im/tcp-shaker v0.0.0-20191114194237-215893130501
github.com/status-im/whisper v1.6.1
github.com/stretchr/testify v1.4.0
2 go.sum
@@ -599,8 +599,6 @@ github.com/status-im/migrate/v4 v4.6.2-status.2 h1:SdC+sMDl/aI7vUlwD2qj2p7KsK4T6
github.com/status-im/migrate/v4 v4.6.2-status.2/go.mod h1:c/kc90n47GZu/58nnz1OMLTf7uE4Da4gZP5qmU+A/v8=
github.com/status-im/rendezvous v1.3.0 h1:7RK/MXXW+tlm0asKm1u7Qp7Yni6AO29a7j8+E4Lbjg4=
github.com/status-im/rendezvous v1.3.0/go.mod h1:+hzjuP+j/XzLPeF6E50b88pWOTLdTcwjvNYt+Gh1W1s=
github.com/status-im/status-protocol-go v0.5.2 h1:C6m6N6TLzJbuJmV4u8iNzs0cj+Q1CfBWdS0LZLtGkN8=
github.com/status-im/status-protocol-go v0.5.2/go.mod h1:L5/7fKnycEBOiLm3TuCHDUNcn0kNNhSNsYLkqbUQngg=
github.com/status-im/tcp-shaker v0.0.0-20191114194237-215893130501 h1:oa0KU5jJRNtXaM/P465MhvSFo/HM2O8qi2DDuPcd7ro=
github.com/status-im/tcp-shaker v0.0.0-20191114194237-215893130501/go.mod h1:RYo/itke1oU5k/6sj9DNM3QAwtE5rZSgg5JnkOv83hk=
github.com/status-im/whisper v1.5.2 h1:26NgiKusmPic38eQdtXnaY+iaQ/LuQ3Dh0kCGYT/Uxs=
@@ -18,11 +18,11 @@ import (
"github.com/status-im/status-go/multiaccounts/accounts"
"github.com/status-im/status-go/params"
"github.com/status-im/status-go/profiling"
protocol "github.com/status-im/status-go/protocol"
"github.com/status-im/status-go/services/personal"
"github.com/status-im/status-go/services/typeddata"
"github.com/status-im/status-go/signal"
"github.com/status-im/status-go/transactions"
protocol "github.com/status-im/status-protocol-go"
validator "gopkg.in/go-playground/validator.v9"
)

@@ -31,10 +31,10 @@ import (
"github.com/ethereum/go-ethereum/event"
"github.com/status-im/status-go/account"
"github.com/status-im/status-go/multiaccounts/accounts"
protocol "github.com/status-im/status-go/protocol/types"
"github.com/status-im/status-go/signal"
. "github.com/status-im/status-go/t/utils" //nolint: golint
"github.com/status-im/status-go/transactions"
statusproto "github.com/status-im/status-protocol-go/types"
"github.com/stretchr/testify/require"
)

@@ -461,7 +461,7 @@ func testLoginWithKeycard(t *testing.T, feed *event.Feed) bool { //nolint: gocyc
t.Errorf("whisper service not running: %v", err)
}

chatPubKeyHex := statusproto.EncodeHex(crypto.FromECDSAPub(&chatPrivKey.PublicKey))
chatPubKeyHex := protocol.EncodeHex(crypto.FromECDSAPub(&chatPrivKey.PublicKey))
if whisperService.HasKeyPair(chatPubKeyHex) {
t.Error("identity already present in whisper")
return false
@@ -9,7 +9,7 @@ import (
"sync"
"time"

"github.com/status-im/status-protocol-go/zaputil"
"github.com/status-im/status-go/protocol/zaputil"
)

type gethLoggerCore struct {
@@ -6,8 +6,8 @@ import (
"time"

"github.com/ethereum/go-ethereum/rlp"
whispertypes "github.com/status-im/status-protocol-go/transport/whisper/types"
statusproto "github.com/status-im/status-protocol-go/types"
whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types"
protocol "github.com/status-im/status-go/protocol/types"
whisper "github.com/status-im/whisper/whisperv6"
"github.com/stretchr/testify/require"
"github.com/syndtr/goleveldb/leveldb"
@@ -118,7 +118,7 @@ func testMessagesCount(t *testing.T, expected int, s *WMailServer) {
func countMessages(t *testing.T, db DB) int {
var (
count int
zero statusproto.Hash
zero protocol.Hash
emptyTopic whispertypes.TopicType
)

0 comments on commit ed5a5c1

Please sign in to comment.
You can’t perform that action at this time.