mirror of
https://github.com/status-im/status-go.git
synced 2025-03-04 00:21:01 +00:00
Merge branch 'develop' into issue/allow-messages-without-subscription-#766
This commit is contained in:
commit
9ccd9b20e8
35
Makefile
35
Makefile
@ -12,7 +12,6 @@ endif
|
||||
CGO_CFLAGS=-I/$(JAVA_HOME)/include -I/$(JAVA_HOME)/include/darwin
|
||||
GOBIN=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))build/bin
|
||||
|
||||
BUILD_TAGS =
|
||||
BUILD_FLAGS := $(shell echo "-ldflags '-X main.buildStamp=`date -u '+%Y-%m-%d.%H:%M:%S'` -X main.gitCommit=$(git rev-parse HEAD)'")
|
||||
|
||||
GO ?= latest
|
||||
@ -21,11 +20,12 @@ XGOIMAGE = statusteam/xgo:$(XGOVERSION)
|
||||
XGOIMAGEIOSSIM = statusteam/xgo-ios-simulator:$(XGOVERSION)
|
||||
|
||||
networkid ?= StatusChain
|
||||
gotest_extraflags =
|
||||
|
||||
DOCKER_IMAGE_NAME ?= statusteam/status-go
|
||||
|
||||
DOCKER_TEST_WORKDIR = /go/src/github.com/status-im/status-go/
|
||||
DOCKER_TEST_IMAGE = golang:1.9
|
||||
DOCKER_TEST_IMAGE = golang:1.9
|
||||
|
||||
UNIT_TEST_PACKAGES := $(shell go list ./... | grep -v /vendor | grep -v /t/e2e | grep -v /t/destructive | grep -v /cmd | grep -v /lib)
|
||||
|
||||
@ -39,7 +39,7 @@ YELLOW := $(shell echo "\e[33m")
|
||||
RESET := $(shell echo "\e[0m")
|
||||
HELP_FUN = \
|
||||
%help; \
|
||||
while(<>) { push @{$$help{$$2 // 'options'}}, [$$1, $$3] if /^([a-zA-Z\-]+)\s*:.*\#\#(?:@([a-zA-Z\-]+))?\s(.*)$$/ }; \
|
||||
while(<>) { push @{$$help{$$2 // 'options'}}, [$$1, $$3] if /^([a-zA-Z0-9\-]+)\s*:.*\#\#(?:@([a-zA-Z\-]+))?\s(.*)$$/ }; \
|
||||
print "Usage: make [target]\n\n"; \
|
||||
for (sort keys %help) { \
|
||||
print "${WHITE}$$_:${RESET}\n"; \
|
||||
@ -84,6 +84,7 @@ statusgo-library: ##@cross-compile Build status-go as static library for current
|
||||
@echo "Static library built:"
|
||||
@ls -la $(GOBIN)/libstatus.*
|
||||
|
||||
docker-image: BUILD_TAGS ?= metrics prometheus
|
||||
docker-image: ##@docker Build docker image (use DOCKER_IMAGE_NAME to set the image name)
|
||||
@echo "Building docker image..."
|
||||
docker build --file _assets/build/Dockerfile --build-arg "build_tags=$(BUILD_TAGS)" . -t $(DOCKER_IMAGE_NAME):latest
|
||||
@ -101,6 +102,8 @@ xgo:
|
||||
docker pull $(XGOIMAGE)
|
||||
go get github.com/karalabe/xgo
|
||||
|
||||
setup: lint-install mock-install ##@other Prepare project for first build
|
||||
|
||||
generate: ##@other Regenerate assets and other auto-generated stuff
|
||||
cd _assets/static && npm install
|
||||
cp ./_assets/static/node_modules/web3/dist/web3.min.js ./static/scripts/web3.js
|
||||
@ -122,23 +125,29 @@ docker-test: ##@tests Run tests in a docker container with golang.
|
||||
test: test-unit-coverage ##@tests Run basic, short tests during development
|
||||
|
||||
test-unit: ##@tests Run unit and integration tests
|
||||
go test $(UNIT_TEST_PACKAGES)
|
||||
go test $(UNIT_TEST_PACKAGES) $(gotest_extraflags)
|
||||
|
||||
test-unit-coverage: ##@tests Run unit and integration tests with coverage
|
||||
go test -coverpkg= $(UNIT_TEST_PACKAGES)
|
||||
go test -coverpkg= $(UNIT_TEST_PACKAGES) $(gotest_extraflags)
|
||||
|
||||
test-unit-race: gotest_extraflags=-race
|
||||
test-unit-race: test-unit ##@tests Run unit and integration tests with -race flag
|
||||
|
||||
test-e2e: ##@tests Run e2e tests
|
||||
# order: reliability then alphabetical
|
||||
# TODO(tiabc): make a single command out of them adding `-p 1` flag.
|
||||
go test -timeout 5m ./t/e2e/accounts/... -network=$(networkid)
|
||||
go test -timeout 5m ./t/e2e/api/... -network=$(networkid)
|
||||
go test -timeout 5m ./t/e2e/node/... -network=$(networkid)
|
||||
go test -timeout 50m ./t/e2e/jail/... -network=$(networkid)
|
||||
go test -timeout 20m ./t/e2e/rpc/... -network=$(networkid)
|
||||
go test -timeout 20m ./t/e2e/whisper/... -network=$(networkid)
|
||||
go test -timeout 10m ./t/e2e/transactions/... -network=$(networkid)
|
||||
go test -timeout 5m ./t/e2e/accounts/... -network=$(networkid) $(gotest_extraflags)
|
||||
go test -timeout 5m ./t/e2e/api/... -network=$(networkid) $(gotest_extraflags)
|
||||
go test -timeout 5m ./t/e2e/node/... -network=$(networkid) $(gotest_extraflags)
|
||||
go test -timeout 50m ./t/e2e/jail/... -network=$(networkid) $(gotest_extraflags)
|
||||
go test -timeout 20m ./t/e2e/rpc/... -network=$(networkid) $(gotest_extraflags)
|
||||
go test -timeout 20m ./t/e2e/whisper/... -network=$(networkid) $(gotest_extraflags)
|
||||
go test -timeout 10m ./t/e2e/transactions/... -network=$(networkid) $(gotest_extraflags)
|
||||
# e2e_test tag is required to include some files from ./lib without _test suffix
|
||||
go test -timeout 40m -tags e2e_test ./lib -network=$(networkid)
|
||||
go test -timeout 40m -tags e2e_test ./lib -network=$(networkid) $(gotest_extraflags)
|
||||
|
||||
test-e2e-race: gotest_extraflags=-race
|
||||
test-e2e-race: test-e2e ##@tests Run e2e tests with -race flag
|
||||
|
||||
lint-install:
|
||||
go get -u github.com/alecthomas/gometalinter
|
||||
|
55
geth/params/cluster.go
Normal file
55
geth/params/cluster.go
Normal file
@ -0,0 +1,55 @@
|
||||
package params
|
||||
|
||||
type subClusterData struct {
|
||||
Number int `json:"number"`
|
||||
Hash string `json:"hash"`
|
||||
StaticNodes []string `json:"staticnodes"`
|
||||
}
|
||||
|
||||
type clusterData struct {
|
||||
NetworkID int `json:"networkID"`
|
||||
Prod subClusterData `json:"prod"`
|
||||
Dev subClusterData `json:"dev"`
|
||||
}
|
||||
|
||||
var ropstenCluster = clusterData{
|
||||
NetworkID: 3,
|
||||
Prod: subClusterData{StaticNodes: []string{
|
||||
"enode://dffef3874011709b12d1e540d83ddb19a9db8614ad9151d05bcf813585e45cbebba5aaea223fe315786c401d8cecb1ad2de9f179680c536ea30311fb21fa934b@188.166.100.178:30303",
|
||||
"enode://03f3661686d30509d621dbe5ee2e3082923f25e94fd41a2dd8dd34bb12a0c4e8fbde52247c6c55e86dc209a8e7c4a5ae56058c65f7b01734d3ab73818b44e2a3@188.166.33.47:30303",
|
||||
}},
|
||||
Dev: subClusterData{StaticNodes: []string{
|
||||
"enode://dffef3874011709b12d1e540d83ddb19a9db8614ad9151d05bcf813585e45cbebba5aaea223fe315786c401d8cecb1ad2de9f179680c536ea30311fb21fa934b@188.166.100.178:30303",
|
||||
"enode://03f3661686d30509d621dbe5ee2e3082923f25e94fd41a2dd8dd34bb12a0c4e8fbde52247c6c55e86dc209a8e7c4a5ae56058c65f7b01734d3ab73818b44e2a3@188.166.33.47:30303",
|
||||
}},
|
||||
}
|
||||
|
||||
var rinkebyCluster = clusterData{
|
||||
NetworkID: 4,
|
||||
Prod: subClusterData{StaticNodes: []string{
|
||||
"enode://fda3f6273a0f2da4ac5858d1f52e5afaf9def281121be3d37558c67d4d9ca26c6ad7a0520b2cd7454120fb770e86d5760487c9924b2166e65485f606e56d60fc@51.15.69.144:30303",
|
||||
"enode://ba41aa829287a0a9076d9bffed97c8ce2e491b99873288c9e886f16fd575306ac6c656db4fbf814f5a9021aec004ffa9c0ae8650f92fd10c12eeb7c364593eb3@51.15.69.147:30303",
|
||||
"enode://28ecf5272b560ca951f4cd7f1eb8bd62da5853b026b46db432c4b01797f5b0114819a090a72acd7f32685365ecd8e00450074fa0673039aefe10f3fb666e0f3f@51.15.76.249:30303",
|
||||
}},
|
||||
Dev: subClusterData{StaticNodes: []string{
|
||||
"enode://7512c8f6e7ffdcc723cf77e602a1de9d8cc2e8ad35db309464819122cd773857131aee390fec33894db13da730c8432bb248eed64039e3810e156e979b2847cb@51.15.78.243:30303",
|
||||
"enode://1cc27a5a41130a5c8b90db5b2273dc28f7b56f3edfc0dcc57b665d451274b26541e8de49ea7a074281906a82209b9600239c981163b6ff85c3038a8e2bc5d8b8@51.15.68.93:30303",
|
||||
"enode://798d17064141b8f88df718028a8272b943d1cb8e696b3dab56519c70b77b1d3469b56b6f4ce3788457646808f5c7299e9116626f2281f30b959527b969a71e4f@51.15.75.244:30303",
|
||||
}},
|
||||
}
|
||||
|
||||
var mainnetCluster = clusterData{
|
||||
NetworkID: 1,
|
||||
Prod: subClusterData{},
|
||||
Dev: subClusterData{StaticNodes: []string{
|
||||
"enode://3aeaff0868b19e03fabe33e6e0fcc821094e1601be44edd6f45e3f0171ed964e13623e49987bddd6c517304d2a45dfe66da51e47b2e11d59c4b30cd6094db43d@163.172.176.22:30303",
|
||||
"enode://687343483ca41132a16c9ab67b49e9997a34ec38ddb6dd60bf45f9a0ea4c50362f902553d813af44ab1cdb246fc384d4c74b4437c15cefe3bb0e87b399dbb5bb@163.172.176.22:30403",
|
||||
"enode://2a3d6c1c86546831e5bb2684ff0ed6d931bdacf3c6cd344706452a1e78c41442d38c62317096175dcea6517959f40ac789f76356348e0a17ee53563cbdf2db48@163.172.176.22:30503",
|
||||
"enode://71bb01b58165e3262aea2d3b06dbf9abb8d5512d96e5000e7e41ab2138b47be685935d3eb119fc25e1413db00d8db231fd9d59555a1cd75229821559b6a4eb51@51.15.85.243:30303",
|
||||
"enode://7afd119c549a7ab02b3f7bd77ef3490b6d660d5c49d0734a0c8bb23195ced4ace0bf5cde673cd5cfd07dd8d759277f3d8408eb73dc3c217bbe00f0027d06eee9@51.15.85.243:30403",
|
||||
"enode://da8af0869e4e8047f21c1ac016b94a7b7d8e935dddd28d4272f88a1ceaee7c15e7deec9b6fd195ed3bc43748893111ebf2b2479ff44a8025ab8d598f3c97b589@51.15.85.243:30503",
|
||||
"enode://7ebaa6a8ce2547f10e34fab9cc5626b86d67934a86e1fb36145c0b89fcc7b9315dd6d0a8cc5808d11a55bdc14c78ff675ca956dfec53837b4f1a97392b15ec23@51.15.35.110:30303",
|
||||
}},
|
||||
}
|
||||
|
||||
var defaultClusters = []clusterData{ropstenCluster, rinkebyCluster, mainnetCluster}
|
@ -555,42 +555,19 @@ func (c *NodeConfig) updateClusterConfig() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// TODO: Remove this thing as this is an ugly hack.
|
||||
// Once CHT sync sub-protocol is working in LES, we will rely on it, as it provides
|
||||
// decentralized solution. For now, in order to avoid forcing users to long sync times
|
||||
// we use central static resource
|
||||
type subClusterData struct {
|
||||
Number int `json:"number"`
|
||||
Hash string `json:"hash"`
|
||||
StaticNodes []string `json:"staticnodes"`
|
||||
}
|
||||
type clusterData struct {
|
||||
NetworkID int `json:"networkID"`
|
||||
Prod subClusterData `json:"prod"`
|
||||
Dev subClusterData `json:"dev"`
|
||||
}
|
||||
|
||||
var configFile []byte
|
||||
var err error
|
||||
|
||||
var clusters []clusterData
|
||||
if c.ClusterConfigFile != "" {
|
||||
// Load cluster configuration from external file.
|
||||
configFile, err = ioutil.ReadFile(c.ClusterConfigFile)
|
||||
configFile, err := ioutil.ReadFile(c.ClusterConfigFile)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cluster configuration file '%s' could not be loaded: %s", c.ClusterConfigFile, err)
|
||||
}
|
||||
} else {
|
||||
// Fallback to embedded file.
|
||||
configFile, err = static.Asset("config/cluster.json")
|
||||
err = json.Unmarshal(configFile, &clusters)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cluster.json could not be loaded: %s", err)
|
||||
return fmt.Errorf("failed to unmarshal cluster configuration file: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
var clusters []clusterData
|
||||
err = json.Unmarshal(configFile, &clusters)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to unmarshal cluster configuration file: %s", err)
|
||||
} else {
|
||||
clusters = defaultClusters
|
||||
}
|
||||
|
||||
for _, cluster := range clusters {
|
||||
|
@ -270,7 +270,7 @@ var loadConfigTestCases = []struct {
|
||||
require.True(t, nodeConfig.ClusterConfig.Enabled, "cluster configuration is expected to be enabled after loading file")
|
||||
|
||||
enodes := nodeConfig.ClusterConfig.StaticNodes
|
||||
require.True(t, len(enodes) == 2)
|
||||
require.Len(t, enodes, 2)
|
||||
},
|
||||
},
|
||||
{
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,51 +0,0 @@
|
||||
[
|
||||
{
|
||||
"networkID": 3,
|
||||
"prod": {
|
||||
"staticnodes": [
|
||||
"enode://dffef3874011709b12d1e540d83ddb19a9db8614ad9151d05bcf813585e45cbebba5aaea223fe315786c401d8cecb1ad2de9f179680c536ea30311fb21fa934b@188.166.100.178:30303",
|
||||
"enode://03f3661686d30509d621dbe5ee2e3082923f25e94fd41a2dd8dd34bb12a0c4e8fbde52247c6c55e86dc209a8e7c4a5ae56058c65f7b01734d3ab73818b44e2a3@188.166.33.47:30303"
|
||||
]
|
||||
},
|
||||
"dev": {
|
||||
"staticnodes": [
|
||||
"enode://dffef3874011709b12d1e540d83ddb19a9db8614ad9151d05bcf813585e45cbebba5aaea223fe315786c401d8cecb1ad2de9f179680c536ea30311fb21fa934b@188.166.100.178:30303",
|
||||
"enode://03f3661686d30509d621dbe5ee2e3082923f25e94fd41a2dd8dd34bb12a0c4e8fbde52247c6c55e86dc209a8e7c4a5ae56058c65f7b01734d3ab73818b44e2a3@188.166.33.47:30303"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"networkID": 4,
|
||||
"prod": {
|
||||
"staticnodes": [
|
||||
"enode://fda3f6273a0f2da4ac5858d1f52e5afaf9def281121be3d37558c67d4d9ca26c6ad7a0520b2cd7454120fb770e86d5760487c9924b2166e65485f606e56d60fc@51.15.69.144:30303",
|
||||
"enode://ba41aa829287a0a9076d9bffed97c8ce2e491b99873288c9e886f16fd575306ac6c656db4fbf814f5a9021aec004ffa9c0ae8650f92fd10c12eeb7c364593eb3@51.15.69.147:30303",
|
||||
"enode://28ecf5272b560ca951f4cd7f1eb8bd62da5853b026b46db432c4b01797f5b0114819a090a72acd7f32685365ecd8e00450074fa0673039aefe10f3fb666e0f3f@51.15.76.249:30303"
|
||||
]
|
||||
},
|
||||
"dev": {
|
||||
"staticnodes": [
|
||||
"enode://7512c8f6e7ffdcc723cf77e602a1de9d8cc2e8ad35db309464819122cd773857131aee390fec33894db13da730c8432bb248eed64039e3810e156e979b2847cb@51.15.78.243:30303",
|
||||
"enode://1cc27a5a41130a5c8b90db5b2273dc28f7b56f3edfc0dcc57b665d451274b26541e8de49ea7a074281906a82209b9600239c981163b6ff85c3038a8e2bc5d8b8@51.15.68.93:30303",
|
||||
"enode://798d17064141b8f88df718028a8272b943d1cb8e696b3dab56519c70b77b1d3469b56b6f4ce3788457646808f5c7299e9116626f2281f30b959527b969a71e4f@51.15.75.244:30303"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"networkID": 1,
|
||||
"prod": {
|
||||
"staticnodes": []
|
||||
},
|
||||
"dev": {
|
||||
"staticnodes": [
|
||||
"enode://3aeaff0868b19e03fabe33e6e0fcc821094e1601be44edd6f45e3f0171ed964e13623e49987bddd6c517304d2a45dfe66da51e47b2e11d59c4b30cd6094db43d@163.172.176.22:30303",
|
||||
"enode://687343483ca41132a16c9ab67b49e9997a34ec38ddb6dd60bf45f9a0ea4c50362f902553d813af44ab1cdb246fc384d4c74b4437c15cefe3bb0e87b399dbb5bb@163.172.176.22:30403",
|
||||
"enode://2a3d6c1c86546831e5bb2684ff0ed6d931bdacf3c6cd344706452a1e78c41442d38c62317096175dcea6517959f40ac789f76356348e0a17ee53563cbdf2db48@163.172.176.22:30503",
|
||||
"enode://71bb01b58165e3262aea2d3b06dbf9abb8d5512d96e5000e7e41ab2138b47be685935d3eb119fc25e1413db00d8db231fd9d59555a1cd75229821559b6a4eb51@51.15.85.243:30303",
|
||||
"enode://7afd119c549a7ab02b3f7bd77ef3490b6d660d5c49d0734a0c8bb23195ced4ace0bf5cde673cd5cfd07dd8d759277f3d8408eb73dc3c217bbe00f0027d06eee9@51.15.85.243:30403",
|
||||
"enode://da8af0869e4e8047f21c1ac016b94a7b7d8e935dddd28d4272f88a1ceaee7c15e7deec9b6fd195ed3bc43748893111ebf2b2479ff44a8025ab8d598f3c97b589@51.15.85.243:30503",
|
||||
"enode://7ebaa6a8ce2547f10e34fab9cc5626b86d67934a86e1fb36145c0b89fcc7b9315dd6d0a8cc5808d11a55bdc14c78ff675ca956dfec53837b4f1a97392b15ec23@51.15.35.110:30303"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
@ -83,7 +83,7 @@ func (s *WhisperMailboxSuite) TestRequestMessageFromMailboxAsync() {
|
||||
messages := s.getMessagesByMessageFilterID(rpcClient, messageFilterID)
|
||||
s.Require().Equal(0, len(messages))
|
||||
|
||||
// Post message matching with filter (key and token).
|
||||
// Post message matching with filter (key and topic).
|
||||
s.postMessageToPrivate(rpcClient, pubkey.String(), topic.String(), hexutil.Encode([]byte("Hello world!")))
|
||||
|
||||
// Get message to make sure that it will come from the mailbox later.
|
||||
|
@ -63,7 +63,7 @@ func init() {
|
||||
const pathSeparator = string(os.PathSeparator)
|
||||
RootDir = filepath.Dir(pwd)
|
||||
pathDirs := strings.Split(RootDir, pathSeparator)
|
||||
for i := range pathDirs {
|
||||
for i := len(pathDirs) - 1; i >= 0; i-- {
|
||||
if pathDirs[i] == "status-go" {
|
||||
RootDir = filepath.Join(pathDirs[:i+1]...)
|
||||
RootDir = filepath.Join(pathSeparator, RootDir)
|
||||
|
Loading…
x
Reference in New Issue
Block a user