Skip to content
Snippets Groups Projects
Unverified Commit b1b78a60 authored by Jonas Theis's avatar Jonas Theis Committed by GitHub
Browse files

Integrate sync beacon (#670)

* Use sync beacon follower plugin instead of sync plugin

* Remove sync and bootstrap plugin

* Refactor sync beacon stuff

* Update Docker network to use sync beacon plugins

* :lipstick: Add detailed sync status to dashboard

* :sparkles: Add detailed sync status to info API

* :rotating_light: Fix linter warning

* :lipstick: Add Explorer support for sync beacon messages

* Initial integration test support for sync beacon plugins

* Fix consensus integration test

* Disable sync beacon follower plugin according to config

* :white_check_mark: Fix dRNG integration-test

* Fix sync beacon test

* :white_check_mark:

 Fix common integration test

* Clean up and add some comments

Co-authored-by: default avatarcapossele <angelocapossele@gmail.com>
parent 7ba94158
Branches
Tags
No related merge requests found
Showing
with 188 additions and 68 deletions
......@@ -8,7 +8,7 @@ import (
"github.com/iotaledger/goshimmer/plugins/autopeering/local"
"github.com/iotaledger/goshimmer/plugins/banner"
"github.com/iotaledger/goshimmer/plugins/metrics"
"github.com/iotaledger/goshimmer/plugins/sync"
"github.com/iotaledger/goshimmer/plugins/syncbeaconfollower"
"github.com/iotaledger/goshimmer/plugins/webapi"
"github.com/iotaledger/hive.go/node"
"github.com/labstack/echo"
......@@ -40,6 +40,12 @@ func configure(_ *node.Plugin) {
// {
// "version":"v0.2.0",
// "synchronized": true,
// "beacons":[{
// "public_key":"EYsaGXnUVA9aTYL9FwYEvoQ8d1HCJveQVL7vogu6pqCP",
// "msg_id":"24Uq4UFQ7p5oLyjuXX32jHhNreo5hY9eo8Awh36RhdTHCwFMtct3SE2rhe3ceYz6rjKDjBs3usoHS3ujFEabP5ri",
// "sent_time":1595528075204868900,
// "synced":true
// }]
// "identityID":"5bf4aa1d6c47e4ce",
// "publickey":"CjUsn86jpFHWnSCx3NhWfU4Lk16mDdy1Hr7ERSTv3xn9",
// "enabledplugins":[
......@@ -84,9 +90,21 @@ func getInfo(c echo.Context) error {
sort.Strings(enabledPlugins)
sort.Strings(disabledPlugins)
synced, beacons := syncbeaconfollower.SyncStatus()
var beaconsStatus []Beacon
for publicKey, s := range beacons {
beaconsStatus = append(beaconsStatus, Beacon{
PublicKey: publicKey.String(),
MsgID: s.MsgID.String(),
SentTime: s.SentTime,
Synced: s.Synced,
})
}
return c.JSON(http.StatusOK, Response{
Version: banner.AppVersion,
Synced: sync.Synced(),
Synced: synced,
Beacons: beaconsStatus,
IdentityID: local.GetInstance().Identity.ID().String(),
PublicKey: local.GetInstance().PublicKey().String(),
MessageRequestQueueSize: int(metrics.MessageRequestQueueSize()),
......@@ -103,6 +121,8 @@ type Response struct {
Version string `json:"version,omitempty"`
// whether the node is synchronized
Synced bool `json:"synced"`
// sync beacons status
Beacons []Beacon `json:"beacons"`
// identity ID of the node encoded in base58 and truncated to its first 8 bytes
IdentityID string `json:"identityID,omitempty"`
// public key of the node encoded in base58
......@@ -120,3 +140,11 @@ type Response struct {
// error of the response
Error string `json:"error,omitempty"`
}
// Beacon contains a sync beacons detailed status.
type Beacon struct {
PublicKey string `json:"public_key"`
MsgID string `json:"msg_id"`
SentTime int64 `json:"sent_time"`
Synced bool `json:"synced"`
}
......@@ -29,7 +29,7 @@ services:
--metrics.global=true
--prometheus.bindAddress=0.0.0.0:9312
--node.enablePlugins=analysis-server,analysis-dashboard,prometheus
--node.disablePlugins=portcheck,dashboard,analysis-client,gossip,drng,issuer,sync,messagelayer,pow,valuetransfers,webapi,webapibroadcastdataendpoint,webapifindtransactionhashesendpoint,webapigetneighborsendpoint,webapigettransactionobjectsbyhashendpoint,webapigettransactiontrytesbyhashendpoint
--node.disablePlugins=portcheck,dashboard,analysis-client,gossip,drng,issuer,syncbeaconfollower,messagelayer,pow,valuetransfers,webapi,webapibroadcastdataendpoint,webapifindtransactionhashesendpoint,webapigetneighborsendpoint,webapigettransactionobjectsbyhashendpoint,webapigettransactiontrytesbyhashendpoint
volumes:
- ./config.docker.json:/tmp/config.json:ro
- goshimmer-cache:/go
......@@ -46,9 +46,13 @@ services:
command: >
--config-dir=/tmp
--database.directory=/tmp/mainnetdb
--node.enablePlugins=bootstrap,prometheus,spammer,faucet
--autopeering.seed=base58:8q491c3YWjbPwLmF2WD95YmCgh61j2kenCKHfGfByoWi
--node.enablePlugins=prometheus,spammer,faucet,syncbeacon
--node.disablePlugins=syncbeaconfollower
--faucet.seed=7R1itJx5hVuo9w9hjg5cwKFmek4HMSoBDgJZN8hKGxih
--valueLayer.snapshot.file=/tmp/assets/7R1itJx5hVuo9w9hjg5cwKFmek4HMSoBDgJZN8hKGxih.bin
--syncbeacon.broadcastInterval=5
--syncbeacon.startSynced=true
volumes:
- ./config.docker.json:/tmp/config.json:ro
- goshimmer-cache:/go
......@@ -68,7 +72,8 @@ services:
--database.directory=/tmp/mainnetdb
--node.enablePlugins=bootstrap
--valueLayer.snapshot.file=/tmp/assets/7R1itJx5hVuo9w9hjg5cwKFmek4HMSoBDgJZN8hKGxih.bin
--node.disablePlugins=dashboard,portcheck
--node.disablePlugins=portcheck
--syncbeaconfollower.followNodes=EYsaGXnUVA9aTYL9FwYEvoQ8d1HCJveQVL7vogu6pqCP
volumes:
- ./config.docker.json:/tmp/config.json:ro
- goshimmer-cache:/go
......
......@@ -89,17 +89,14 @@ func (d *DockerContainer) CreateGoShimmerPeer(config GoShimmerConfig) error {
fmt.Sprintf("--gracefulshutdown.waitToKillTime=%d", ParaWaitToKill),
fmt.Sprintf("--node.enablePlugins=%s", func() string {
var plugins []string
if config.Bootstrap {
plugins = append(plugins, "Bootstrap")
}
if config.Faucet {
plugins = append(plugins, "faucet")
}
if config.SyncBeacon {
plugins = append(plugins, "Sync Beacon")
plugins = append(plugins, "SyncBeacon")
}
if config.SyncBeaconFollower {
plugins = append(plugins, "Sync Beacon Follower")
plugins = append(plugins, "SyncBeaconFollower")
}
return strings.Join(plugins[:], ",")
}()),
......@@ -112,7 +109,6 @@ func (d *DockerContainer) CreateGoShimmerPeer(config GoShimmerConfig) error {
}(),
fmt.Sprintf("--faucet.tokensPerRequest=%d", ParaFaucetTokensPerRequest),
fmt.Sprintf("--valueLayer.snapshot.file=%s", config.SnapshotFilePath),
fmt.Sprintf("--bootstrap.initialIssuance.timePeriodSec=%d", config.BootstrapInitialIssuanceTimePeriodSec),
"--webapi.bindAddress=0.0.0.0:8080",
fmt.Sprintf("--autopeering.seed=base58:%s", config.Seed),
fmt.Sprintf("--autopeering.entryNodes=%s@%s:14626", config.EntryNodePublicKey, config.EntryNodeHost),
......@@ -122,6 +118,7 @@ func (d *DockerContainer) CreateGoShimmerPeer(config GoShimmerConfig) error {
fmt.Sprintf("--drng.distributedPubKey=%s", config.DRNGDistKey),
fmt.Sprintf("--syncbeaconfollower.followNodes=%s", config.SyncBeaconFollowNodes),
fmt.Sprintf("--syncbeacon.broadcastInterval=%d", config.SyncBeaconBroadcastInterval),
"--syncbeacon.startSynced=true",
},
}
......
......@@ -38,7 +38,18 @@ func (n *DRNGNetwork) CreatePeer(c GoShimmerConfig, publicKey ed25519.PublicKey)
config.Name = name
config.EntryNodeHost = n.network.namePrefix(containerNameEntryNode)
config.EntryNodePublicKey = n.network.entryNodePublicKey()
config.DisabledPlugins = disabledPluginsPeer
config.DisabledPlugins = func() string {
if !config.SyncBeaconFollower {
return disabledPluginsPeer + ",SyncBeaconFollower"
}
return disabledPluginsPeer
}()
if config.SyncBeaconFollowNodes == "" {
config.SyncBeaconFollowNodes = syncBeaconPublicKey
}
if config.SyncBeaconBroadcastInterval == 0 {
config.SyncBeaconBroadcastInterval = 5
}
// create Docker container
container := NewDockerContainer(n.network.dockerClient)
......
......@@ -13,6 +13,7 @@ import (
"github.com/docker/docker/api/types/strslice"
"github.com/docker/docker/client"
"github.com/iotaledger/hive.go/crypto/ed25519"
"github.com/mr-tron/base58"
)
var (
......@@ -60,7 +61,7 @@ func newFramework() (*Framework, error) {
// CreateNetwork creates and returns a (Docker) Network that contains `peers` GoShimmer nodes.
// It waits for the peers to autopeer until the minimum neighbors criteria is met for every peer.
// The first peer automatically starts with the bootstrap plugin enabled.
func (f *Framework) CreateNetwork(name string, peers int, minimumNeighbors int, networkConfig ...NetworkConfig) (*Network, error) {
func (f *Framework) CreateNetwork(name string, peers int, minimumNeighbors int) (*Network, error) {
network, err := newNetwork(f.dockerClient, strings.ToLower(name), f.tester)
if err != nil {
return nil, err
......@@ -71,23 +72,29 @@ func (f *Framework) CreateNetwork(name string, peers int, minimumNeighbors int,
return nil, err
}
// configuration of bootstrap plugin
bootstrapInitialIssuanceTimePeriodSec := -1
if len(networkConfig) > 0 {
bootstrapInitialIssuanceTimePeriodSec = networkConfig[0].BootstrapInitialIssuanceTimePeriodSec
}
// create peers/GoShimmer nodes
for i := 0; i < peers; i++ {
config := GoShimmerConfig{
Bootstrap: func(i int) bool {
if ParaBootstrapOnEveryNode {
SyncBeacon: func(i int) bool {
if ParaSyncBeaconOnEveryNode {
return true
}
return i == 0
}(i),
BootstrapInitialIssuanceTimePeriodSec: bootstrapInitialIssuanceTimePeriodSec,
Faucet: i == 0,
SyncBeaconFollower: func(i int) bool {
if ParaSyncBeaconOnEveryNode {
return false
}
return i > 0
}(i),
Seed: func(i int) string {
if i == 0 {
return syncBeaconSeed
}
return ""
}(i),
Faucet: i == 0,
}
if _, err = network.CreatePeer(config); err != nil {
return nil, err
......@@ -133,12 +140,27 @@ func (f *Framework) CreateNetworkWithPartitions(name string, peers, partitions,
// create peers/GoShimmer nodes
for i := 0; i < peers; i++ {
config := GoShimmerConfig{Bootstrap: func(i int) bool {
if ParaBootstrapOnEveryNode {
return true
}
return i == 0
}(i)}
config := GoShimmerConfig{
SyncBeacon: func(i int) bool {
if ParaSyncBeaconOnEveryNode {
return true
}
return i == 0
}(i),
SyncBeaconFollower: func(i int) bool {
if ParaSyncBeaconOnEveryNode {
return false
}
return i > 0
}(i),
Seed: func(i int) string {
if i == 0 {
return syncBeaconSeed
}
return ""
}(i),
Faucet: i == 0,
}
if _, err = network.CreatePeer(config); err != nil {
return nil, err
}
......@@ -236,26 +258,35 @@ func (f *Framework) CreateDRNGNetwork(name string, members, peers, minimumNeighb
}
config := GoShimmerConfig{
DRNGInstance: 1,
DRNGThreshold: 3,
DRNGDistKey: hex.EncodeToString(drng.distKey),
DRNGCommittee: drngCommittee,
DRNGInstance: 1,
DRNGThreshold: 3,
DRNGDistKey: hex.EncodeToString(drng.distKey),
DRNGCommittee: drngCommittee,
SyncBeaconFollower: true,
}
// create peers/GoShimmer nodes
for i := 0; i < peers; i++ {
config.Bootstrap = func(i int) bool {
if ParaBootstrapOnEveryNode {
return true
}
return i == 0
}(i)
config.Seed = privKeys[i].Seed().String()
if _, err = drng.CreatePeer(config, pubKeys[i]); err != nil {
return nil, err
}
}
// create extra sync beacon node
config = GoShimmerConfig{
SyncBeacon: true,
SyncBeaconFollower: false,
Seed: syncBeaconSeed,
}
bytes, err := base58.Decode(config.Seed)
if err != nil {
return nil, err
}
if _, err = drng.CreatePeer(config, ed25519.PrivateKeyFromSeed(bytes).Public()); err != nil {
return nil, err
}
// wait until peers are fully started and connected
time.Sleep(1 * time.Second)
err = drng.network.WaitForAutopeering(minimumNeighbors)
......
......@@ -12,6 +12,7 @@ import (
walletseed "github.com/iotaledger/goshimmer/client/wallet/packages/seed"
"github.com/iotaledger/hive.go/crypto/ed25519"
"github.com/iotaledger/hive.go/identity"
"github.com/mr-tron/base58"
)
// Network represents a complete GoShimmer network within Docker.
......@@ -86,21 +87,43 @@ func (n *Network) createEntryNode() error {
// Passing bootstrap true enables the bootstrap plugin on the given peer.
func (n *Network) CreatePeer(c GoShimmerConfig) (*Peer, error) {
name := n.namePrefix(fmt.Sprintf("%s%d", containerNameReplica, len(n.peers)))
config := c
// create identity
publicKey, privateKey, err := ed25519.GenerateKey()
if err != nil {
return nil, err
var publicKey ed25519.PublicKey
var privateKey ed25519.PrivateKey
var err error
if config.Seed == "" {
publicKey, privateKey, err = ed25519.GenerateKey()
if err != nil {
return nil, err
}
seed := privateKey.Seed().String()
config.Seed = seed
} else {
bytes, encodeErr := base58.Decode(config.Seed)
if encodeErr != nil {
return nil, encodeErr
}
publicKey = ed25519.PrivateKeyFromSeed(bytes).Public()
}
seed := privateKey.Seed().String()
config := c
config.Name = name
config.Seed = seed
config.EntryNodeHost = n.namePrefix(containerNameEntryNode)
config.EntryNodePublicKey = n.entryNodePublicKey()
config.DisabledPlugins = disabledPluginsPeer
config.DisabledPlugins = func() string {
if !config.SyncBeaconFollower {
return disabledPluginsPeer + ",SyncBeaconFollower"
}
return disabledPluginsPeer
}()
config.SnapshotFilePath = snapshotFilePath
if config.SyncBeaconFollowNodes == "" {
config.SyncBeaconFollowNodes = syncBeaconPublicKey
}
if config.SyncBeaconBroadcastInterval == 0 {
config.SyncBeaconBroadcastInterval = 5
}
// create wallet
var nodeSeed *walletseed.Seed
......
......@@ -13,7 +13,7 @@ const (
logsDir = "/tmp/logs/"
disabledPluginsEntryNode = "portcheck,dashboard,analysis-client,profiling,gossip,drng,issuer,sync,metrics,valuetransfers,messagelayer,pow,webapi,webapibroadcastdataendpoint,webapifindtransactionhashesendpoint,webapigetneighborsendpoint,webapigettransactionobjectsbyhashendpoint,webapigettransactiontrytesbyhashendpoint"
disabledPluginsEntryNode = "portcheck,dashboard,analysis-client,profiling,gossip,drng,issuer,syncbeaconfollower,metrics,valuetransfers,messagelayer,pow,webapi,webapibroadcastdataendpoint,webapifindtransactionhashesendpoint,webapigetneighborsendpoint,webapigettransactionobjectsbyhashendpoint,webapigettransactiontrytesbyhashendpoint"
disabledPluginsPeer = "portcheck,dashboard,analysis-client,profiling"
snapshotFilePath = "/assets/7R1itJx5hVuo9w9hjg5cwKFmek4HMSoBDgJZN8hKGxih.bin"
dockerLogsPrefixLen = 8
......@@ -21,6 +21,9 @@ const (
dkgMaxTries = 50
exitStatusSuccessful = 0
syncBeaconSeed = "Dw6dKWvQGbcijpib6A8t1vSiuDU1XWsnT71xhLSzXUGc"
syncBeaconPublicKey = "6wuo4zNP4MXzojmj2EXGsPEHPkWJNnbKZ9e17ufdTmp"
)
// Parameters to override before calling any peer creation function.
......@@ -29,8 +32,6 @@ var (
ParaFCoBAverageNetworkDelay = 5
// ParaOutboundUpdateIntervalMs the autopeering outbound update interval in milliseconds.
ParaOutboundUpdateIntervalMs = 100
// ParaBootstrapOnEveryNode whether to enable the bootstrap plugin on every node.
ParaBootstrapOnEveryNode = false
// ParaFaucetTokensPerRequest defines the tokens to send up on each faucet request message.
ParaFaucetTokensPerRequest int64 = 1337
// ParaPoWDifficulty defines the PoW difficulty.
......@@ -39,6 +40,8 @@ var (
ParaWaitToKill = 60
// ParaPoWFaucetDifficulty defines the PoW difficulty for faucet payloads.
ParaPoWFaucetDifficulty = 2
// ParaSyncBeaconOnEveryNode defines whether all nodes should be sync beacons.
ParaSyncBeaconOnEveryNode = false
)
var (
......@@ -56,17 +59,15 @@ type GoShimmerConfig struct {
DisabledPlugins string
SnapshotFilePath string
Bootstrap bool
BootstrapInitialIssuanceTimePeriodSec int
DRNGCommittee string
DRNGDistKey string
DRNGInstance int
DRNGThreshold int
Faucet bool
Faucet bool
SyncBeacon bool
SyncBeaconFollower bool
SyncBeaconFollower bool
SyncBeaconFollowNodes string
SyncBeaconBroadcastInterval int
}
......
......@@ -23,6 +23,7 @@ github.com/Microsoft/go-winio v0.4.14 h1:+hMXMk01us9KgxGb7ftKQt2Xpf5hH/yky+TDA+q
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk=
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs=
......@@ -143,6 +144,7 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI=
github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
......@@ -167,14 +169,17 @@ github.com/gobuffalo/gogen v0.0.0-20190315121717-8f38393713f5/go.mod h1:V9QVDIxs
github.com/gobuffalo/gogen v0.1.0/go.mod h1:8NTelM5qd8RZ15VjQTFkAW6qOMx5wBbW4dSCS3BY8gg=
github.com/gobuffalo/gogen v0.1.1/go.mod h1:y8iBtmHmGc4qa3urIyo1shvOD8JftTtfcKi+71xfDNE=
github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2/go.mod h1:QdxcLw541hSGtBnhUc4gaNIXRjiDppFGaDqzbrBd3v8=
github.com/gobuffalo/logger v1.0.3 h1:YaXOTHNPCvkqqA7w05A4v0k2tCdpr+sgFlgINbQ6gqc=
github.com/gobuffalo/logger v1.0.3/go.mod h1:SoeejUwldiS7ZsyCBphOGURmWdwUFXs0J7TCjEhjKxM=
github.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc=
github.com/gobuffalo/mapi v1.0.2/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc=
github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4=
github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4=
github.com/gobuffalo/packd v1.0.0 h1:6ERZvJHfe24rfFmA9OaoKBdC7+c9sydrytMg8SdFGBM=
github.com/gobuffalo/packd v1.0.0/go.mod h1:6VTc4htmJRFB7u1m/4LeMTWjFoYrUiBkU9Fdec9hrhI=
github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ=
github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0=
github.com/gobuffalo/packr/v2 v2.8.0 h1:IULGd15bQL59ijXLxEvA5wlMxsmx/ZkQv9T282zNVIY=
github.com/gobuffalo/packr/v2 v2.8.0/go.mod h1:PDk2k3vGevNE3SwVyVRgQCCXETC9SaONCNSXT1Q8M1g=
github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
......@@ -224,6 +229,7 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR
github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho=
......@@ -321,14 +327,17 @@ github.com/kabukky/httpscerts v0.0.0-20150320125433-617593d7dcb3/go.mod h1:BYpt4
github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d/go.mod h1:P2viExyCEfeWGU259JnaQ34Inuec4R38JCyBx2edgD0=
github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4=
github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA=
github.com/karrick/godirwalk v1.15.3 h1:0a2pXOgtB16CqIqXTiT7+K9L73f74n/aNQUnH6Ortew=
github.com/karrick/godirwalk v1.15.3/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk=
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
github.com/klauspost/compress v1.9.5 h1:U+CaK85mrNNb4k8BNOfgJtJ/gr6kswUCFj6miSzVC6M=
github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
......@@ -452,9 +461,12 @@ github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czP
github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/markbates/errx v1.1.0 h1:QDFeR+UP95dO12JgW+tgi2UVfo0V8YBHiUIOaeBPiEI=
github.com/markbates/errx v1.1.0/go.mod h1:PLa46Oex9KNbVDZhKel8v1OT7hD5JZ2eI7AHhA0wswc=
github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE=
github.com/markbates/oncer v1.0.0 h1:E83IaVAHygyndzPimgUYJjbshhDTALZyXxvk9FOlQRY=
github.com/markbates/oncer v1.0.0/go.mod h1:Z59JA581E9GP6w96jai+TGqafHPW+cPfRxz2aSZ0mcI=
github.com/markbates/safe v1.0.1 h1:yjZkbvRM6IzKj9tlu/zMJLS0n/V351OZWRnF3QfaUxI=
github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
......@@ -597,6 +609,7 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L
github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.5.2 h1:qLvObTrvO/XRCqmkKxUlOBc48bI3efyDuAZe25QiF0w=
github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
......@@ -605,12 +618,14 @@ github.com/sasha-s/go-deadlock v0.2.0 h1:lMqc+fUb7RrFS3gQLtoQsJ7/6TV/pAIFvBsqX73
github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/shirou/gopsutil v2.20.5+incompatible h1:tYH07UPoQt0OCQdgWWMgYHy3/a9bcxNpBIysykNIP7I=
github.com/shirou/gopsutil v2.20.5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/simia-tech/env v0.1.0/go.mod h1:eVRQ7W5NXXHifpPAcTJ3r5EmoGgMn++dXfSVbZv3Opo=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
......@@ -655,6 +670,7 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
......@@ -676,8 +692,10 @@ github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.
github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee/go.mod h1:m2aV4LZI4Aez7dP5PMyVKEHhUyEJ/RjmPEDOpDvudHg=
github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE=
github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4=
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c h1:u40Z8hqBAAQyv+vATcGgV0YCnDjqSL7/q/JyPhhJSPk=
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
github.com/xdg/stringprep v1.0.0 h1:d9X0esnoa3dFsV0FG35rAT0RIhYFlPq7MiP+DW89La0=
github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
......@@ -698,6 +716,7 @@ go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0=
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
go.mongodb.org/mongo-driver v1.0.0/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
go.mongodb.org/mongo-driver v1.3.4 h1:zs/dKNwX0gYUtzwrN9lLiR15hCO0nDwQj5xXx+vjCdE=
go.mongodb.org/mongo-driver v1.3.4/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
......@@ -804,6 +823,7 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
......
......@@ -31,7 +31,9 @@ func TestSynchronization(t *testing.T) {
time.Sleep(10 * time.Second)
// 2. spawn peer without knowledge of previous messages
newPeer, err := n.CreatePeer(framework.GoShimmerConfig{})
newPeer, err := n.CreatePeer(framework.GoShimmerConfig{
SyncBeaconFollower: true,
})
require.NoError(t, err)
err = n.WaitForAutopeering(3)
require.NoError(t, err)
......
......@@ -26,16 +26,16 @@ func TestConsensusFiftyFiftyOpinionSplit(t *testing.T) {
// override avg. network delay to accustom integration test slowness
backupFCoBAvgNetworkDelay := framework.ParaFCoBAverageNetworkDelay
backupBootstrapOnEveryNode := framework.ParaBootstrapOnEveryNode
backupBootstrapOnEveryNode := framework.ParaSyncBeaconOnEveryNode
backupParaWaitToKill := framework.ParaWaitToKill
framework.ParaFCoBAverageNetworkDelay = 90
framework.ParaBootstrapOnEveryNode = true
framework.ParaSyncBeaconOnEveryNode = true
framework.ParaWaitToKill = 2 * framework.ParaFCoBAverageNetworkDelay
// reset framework paras
defer func() {
framework.ParaFCoBAverageNetworkDelay = backupFCoBAvgNetworkDelay
framework.ParaBootstrapOnEveryNode = backupBootstrapOnEveryNode
framework.ParaSyncBeaconOnEveryNode = backupBootstrapOnEveryNode
framework.ParaWaitToKill = backupParaWaitToKill
}()
......
......@@ -47,7 +47,8 @@ func TestDRNG(t *testing.T) {
ticker.Reset(10 * time.Second)
// check for randomness on every peer
for _, peer := range drng.Peers() {
// ignore last peer as that is only sync beacon node and does not have drng information
for _, peer := range drng.Peers()[:len(drng.Peers())-1] {
wg.Add(1)
go func(peer *framework.Peer) {
defer wg.Done()
......
package syncbeacon
import (
"github.com/iotaledger/goshimmer/tools/integration-tests/tester/framework"
"github.com/iotaledger/goshimmer/tools/integration-tests/tester/tests"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"log"
"strings"
"testing"
"time"
"github.com/iotaledger/goshimmer/tools/integration-tests/tester/framework"
"github.com/iotaledger/goshimmer/tools/integration-tests/tester/tests"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
// TestSyncBeacon checks that beacon nodes broadcast sync beacons
......@@ -24,7 +25,8 @@ func TestSyncBeacon(t *testing.T) {
for i := 0; i < initialPeers; i++ {
peer, err := n.CreatePeer(framework.GoShimmerConfig{
SyncBeacon: true,
SyncBeaconBroadcastInterval: 20,
SyncBeaconBroadcastInterval: 5,
SyncBeaconFollower: false,
})
require.NoError(t, err)
beaconPublicKeys = append(beaconPublicKeys, peer.PublicKey().String())
......@@ -33,7 +35,6 @@ func TestSyncBeacon(t *testing.T) {
err = n.WaitForAutopeering(3)
require.NoError(t, err)
// beacon follower node to follow all previous nodes
peer, err := n.CreatePeer(framework.GoShimmerConfig{
SyncBeaconFollower: true,
......@@ -52,14 +53,14 @@ func TestSyncBeacon(t *testing.T) {
require.NoError(t, err)
assert.Truef(t, resp.Synced, "Peer %s should be synced but is desynced!", peer.String())
// 2. shutdown all but 2 beacon peers.
for _, p := range peers[:len(peers)-2] {
// 2. shutdown all but 1 beacon peers.
for _, p := range peers[:initialPeers-1] {
_ = p.Stop()
}
// wait for peers to sync and broadcast
log.Println("Waiting...2/2")
time.Sleep(40 * time.Second)
time.Sleep(60 * time.Second)
log.Println("done waiting.")
// expect majority of nodes to not have broadcasted beacons. Hence should be desynced due to cleanup.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment