Skip to content

Commit

Permalink
Merge pull request #715 from bloxapp/stage
Browse files Browse the repository at this point in the history
stage to main (v0.3.2)
  • Loading branch information
amirylm authored Sep 21, 2022
2 parents e08fa2d + 6471cd9 commit d3ef412
Show file tree
Hide file tree
Showing 166 changed files with 8,865 additions and 6,227 deletions.
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Build stage Docker image:
- docker tag $IMAGE_NAME:$CI_BUILD_REF $DOCKER_REPO_INFRA_STAGE:$CI_BUILD_REF
- $DOCKER_LOGIN_TO_INFRA_STAGE_REPO && docker push $DOCKER_REPO_INFRA_STAGE:$CI_BUILD_REF
only:
- change-round-process
- stage

Deploy ssv exporter to blox-infra-stage cluster:
stage: deploy
Expand Down Expand Up @@ -68,7 +68,7 @@ Deploy ssv nodes to blox-infra-stage cluster:
- .k8/scripts/deploy-ssv-nodes-yamls-on-stage-k8s.sh $DOCKER_REPO_INFRA_STAGE $CI_BUILD_REF ssv $APP_REPLICAS_INFRA_STAGE blox-infra-stage kubernetes-admin@blox-infra stage.ssv.network $K8S_API_VERSION $STAGE_HEALTH_CHECK_IMAGE $SSV_NODES_CPU_LIMIT $SSV_NODES_MEM_LIMIT
- .k8/scripts/deploy-ssv-node-v1-yamls-on-stage-k8s.sh $DOCKER_REPO_INFRA_STAGE $CI_BUILD_REF ssv $APP_REPLICAS_INFRA_STAGE blox-infra-stage kubernetes-admin@blox-infra stage.ssv.network $K8S_API_VERSION $STAGE_HEALTH_CHECK_IMAGE $SSV_NODES_CPU_LIMIT_V1 $SSV_NODES_MEM_LIMIT_V1
only:
- change-round-process
- stage


#blox-infra-prod
Expand Down
4 changes: 2 additions & 2 deletions .k8/yamls-stage/ssv-node-v2-2-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ spec:
- name: DISCOVERY_TRACE
value: 'false'
- name: PUBSUB_TRACE
value: 'true'
value: 'false'
- name: P2P_LOG
value: "true"
value: "false"
- name: NETWORK_ID
value: "shifu-stage"
volumeMounts:
Expand Down
4 changes: 2 additions & 2 deletions .k8/yamls/ssv-exporter-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ spec:
imagePullPolicy: Always
resources:
limits:
cpu: 1000m
memory: 1024Mi
cpu: 3000m
memory: 4096Mi
command: ["make", "start-node"]
ports:
- containerPort: 12008
Expand Down
2 changes: 1 addition & 1 deletion .k8/yamls/ssv-node-10-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ spec:
key: abi_version_v2
optional: true
- name: LOG_LEVEL
value: "debug"
value: "info"
- name: DB_REPORTING
value: "false"
- name: PUBSUB_TRACE
Expand Down
2 changes: 1 addition & 1 deletion .k8/yamls/ssv-node-7-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ spec:
key: abi_version_v2
optional: true
- name: LOG_LEVEL
value: "debug"
value: "info"
- name: DB_REPORTING
value: "false"
- name: PUBSUB_TRACE
Expand Down
2 changes: 1 addition & 1 deletion .k8/yamls/ssv-node-8-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ spec:
key: abi_version_v2
optional: true
- name: LOG_LEVEL
value: "debug"
value: "info"
- name: DB_REPORTING
value: "false"
- name: PUBSUB_TRACE
Expand Down
2 changes: 1 addition & 1 deletion .k8/yamls/ssv-node-9-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ spec:
key: abi_version_v2
optional: true
- name: LOG_LEVEL
value: "debug"
value: "info"
- name: DB_REPORTING
value: "false"
- name: PUBSUB_TRACE
Expand Down
8 changes: 6 additions & 2 deletions .k8/yamls/ssv-node-paul-lh-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ spec:
secretKeyRef:
name: config-secrets
key: smart_contract_addr_key
- name: ETH_1_SYNC_OFFSET
valueFrom:
secretKeyRef:
name: config-secrets
key: eth_1_sync_offset
optional: true
- name: ABI_VERSION
valueFrom:
secretKeyRef:
Expand All @@ -114,8 +120,6 @@ spec:
value: "false"
- name: P2P_LOG
value: "false"
- name: DISCOVERY_TYPE_KEY
value: "discv5"
- name: NETWORK
value: "prater"
- name: CONSENSUS_TYPE
Expand Down
8 changes: 6 additions & 2 deletions .k8/yamls/ssv-node-v2-2-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ spec:
secretKeyRef:
name: config-secrets
key: smart_contract_addr_key
- name: ETH_1_SYNC_OFFSET
valueFrom:
secretKeyRef:
name: config-secrets
key: eth_1_sync_offset
optional: true
- name: ABI_VERSION
valueFrom:
secretKeyRef:
Expand All @@ -109,8 +115,6 @@ spec:
value: "false"
- name: P2P_LOG
value: "false"
- name: DISCOVERY_TYPE_KEY
value: "discv5"
- name: NETWORK
value: "prater"
- name: CONSENSUS_TYPE
Expand Down
8 changes: 6 additions & 2 deletions .k8/yamls/ssv-node-v2-6-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ spec:
secretKeyRef:
name: config-secrets
key: smart_contract_addr_key
- name: ETH_1_SYNC_OFFSET
valueFrom:
secretKeyRef:
name: config-secrets
key: eth_1_sync_offset
optional: true
- name: ABI_VERSION
valueFrom:
secretKeyRef:
Expand All @@ -109,8 +115,6 @@ spec:
value: "false"
- name: P2P_LOG
value: "false"
- name: DISCOVERY_TYPE_KEY
value: "discv5"
- name: NETWORK
value: "prater"
- name: CONSENSUS_TYPE
Expand Down
1 change: 1 addition & 0 deletions automation/commons/shares.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func CreateShareAndValidators(ctx context.Context, logger *zap.Logger, net *p2pv
DutyRoles: []spectypes.BeaconRole{spectypes.BNRoleAttester}, // TODO when implemented, need to add more types
SyncRateLimit: time.Millisecond * 10,
SignatureCollectionTimeout: time.Second * 5,
MinPeers: 2,
ReadMode: false,
})
validators = append(validators, val)
Expand Down
8 changes: 4 additions & 4 deletions automation/qbft/scenarios/change_round_speedup.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ func (r *changeRoundSpeedupScenario) startNode(val validator.IValidator, net net
}

res, err := ibftc.StartInstance(ibftinstance.ControllerStartInstanceOptions{
Logger: r.logger,
SeqNumber: 1,
Value: []byte("value"),
})
Logger: r.logger,
Height: 1,
Value: []byte("value"),
}, nil)

if err != nil {
r.logger.Error("instance returned error", zap.Error(err))
Expand Down
8 changes: 4 additions & 4 deletions automation/qbft/scenarios/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ func startNode(val validator.IValidator, h specqbft.Height, value []byte, logger

for _, ibftc := range ibftControllers {
res, err := ibftc.StartInstance(ibftinstance.ControllerStartInstanceOptions{
Logger: logger,
SeqNumber: h,
Value: value,
})
Logger: logger,
Height: h,
Value: value,
}, nil)

if err != nil {
return err
Expand Down
8 changes: 4 additions & 4 deletions automation/qbft/scenarios/f1_multi_round.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ func (r *f1MultiRoundScenario) startNode(val validator.IValidator, net network.P
}

res, err := ibftc.StartInstance(ibftinstance.ControllerStartInstanceOptions{
Logger: r.logger,
SeqNumber: 1,
Value: []byte("value"),
})
Logger: r.logger,
Height: 1,
Value: []byte("value"),
}, nil)

if err != nil {
r.logger.Error("instance returned error", zap.Error(err))
Expand Down
8 changes: 4 additions & 4 deletions automation/qbft/scenarios/f1_speedup.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ func (r *f1SpeedupScenario) startNode(val validator.IValidator) error {
ibftc := val.(*validator.Validator).Ibfts()[spectypes.BNRoleAttester]

res, err := ibftc.StartInstance(ibftinstance.ControllerStartInstanceOptions{
Logger: r.logger,
SeqNumber: 1,
Value: []byte("value"),
})
Logger: r.logger,
Height: 1,
Value: []byte("value"),
}, nil)

if err != nil {
return err
Expand Down
10 changes: 5 additions & 5 deletions automation/qbft/scenarios/far_future_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (r *farFutureSyncScenario) Execute(ctx *runner.ScenarioContext) error {
}

for i, ibftc := range r.validators[3].(*validator.Validator).Ibfts() {
nextSeq, err := ibftc.NextSeqNumber()
nextSeq, err := ibftc.NextHeightNumber()
if err != nil {
r.logger.Error("node #4 could not get state", zap.Int64("index", int64(i)))
return errors.New("node #4 could not get state")
Expand Down Expand Up @@ -179,10 +179,10 @@ func (r *farFutureSyncScenario) startNode(val validator.IValidator, seqNumber sp

for _, ibftc := range ibftControllers {
res, err := ibftc.StartInstance(ibftinstance.ControllerStartInstanceOptions{
Logger: r.logger,
SeqNumber: seqNumber,
Value: []byte("value"),
})
Logger: r.logger,
Height: seqNumber,
Value: []byte("value"),
}, nil)

if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions automation/qbft/scenarios/full_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ func createShareAndValidators(
Beacon: nil,
SyncRateLimit: time.Millisecond * 10,
SignatureCollectionTimeout: time.Second * 5,
MinPeers: 2,
ReadMode: i >= committeeNodes,
FullNode: i >= regularNodes,
DutyRoles: []spectypes.BeaconRole{spectypes.BNRoleAttester},
Expand Down
10 changes: 5 additions & 5 deletions automation/qbft/scenarios/sync_failover.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ loop:
}

ibftc := r.validators[3].(*validator.Validator).Ibfts()[spectypes.BNRoleAttester]
nextSeq, err := ibftc.NextSeqNumber()
nextSeq, err := ibftc.NextHeightNumber()
if err != nil {
r.logger.Error("node #4 could not get state", zap.Int64("highest decided", int64(nextSeq)-1))
return errors.New("node #4 could not get state")
Expand Down Expand Up @@ -195,10 +195,10 @@ func (r *syncFailoverScenario) startNode(val validator.IValidator, seqNumber spe
ibftc := val.(*validator.Validator).Ibfts()[spectypes.BNRoleAttester]

res, err := ibftc.StartInstance(ibftinstance.ControllerStartInstanceOptions{
Logger: r.logger,
SeqNumber: seqNumber,
Value: []byte("value"),
})
Logger: r.logger,
Height: seqNumber,
Value: []byte("value"),
}, nil)

if err != nil {
return nil, err
Expand Down
11 changes: 7 additions & 4 deletions cli/operator/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,8 @@ var StartNodeCmd = &cobra.Command{
cfg.P2pNetworkConfig.Logger = Logger
cfg.P2pNetworkConfig.ForkVersion = ssvForkVersion
cfg.P2pNetworkConfig.OperatorID = format.OperatorID(operatorPubKey)
//Logger.Info("xxx", zap.String("ua", cfg.P2pNetworkConfig.UserAgent), zap.String("oid", cfg.P2pNetworkConfig.OperatorID))

p2pNet := p2pv1.New(cmd.Context(), &cfg.P2pNetworkConfig)
if err := p2pNet.Setup(); err != nil {
Logger.Fatal("failed to setup network", zap.Error(err))
}

ctx := cmd.Context()
cfg.SSVOptions.ForkVersion = ssvForkVersion
Expand Down Expand Up @@ -237,6 +234,12 @@ var StartNodeCmd = &cobra.Command{
if err := operatorNode.StartEth1(eth1.HexStringToSyncOffset(cfg.ETH1Options.ETH1SyncOffset)); err != nil {
Logger.Fatal("failed to start eth1", zap.Error(err))
}
cfg.P2pNetworkConfig.GetValidatorStats = func() (uint64, uint64, uint64, error) {
return validatorCtrl.GetValidatorStats()
}
if err := p2pNet.Setup(); err != nil {
Logger.Fatal("failed to setup network", zap.Error(err))
}
if err := p2pNet.Start(); err != nil {
Logger.Fatal("failed to start network", zap.Error(err))
}
Expand Down
6 changes: 4 additions & 2 deletions docs/OPERATOR_GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ $ yq n db.Path "<db folder>" | tee config.yaml \
&& yq w -i config.yaml eth2.Network "prater" \
&& yq w -i config.yaml eth2.BeaconNodeAddr "<ETH 2.0 node>" \
&& yq w -i config.yaml eth1.ETH1Addr "<ETH1 node WebSocket address>" \
&& yq w -i config.yaml eth1.RegistryContractAddr "0x687fb596F3892904F879118e2113e1EEe8746C2E" \
&& yq w -i config.yaml OperatorPrivateKey "<private key of the operator>"
```

Expand All @@ -103,9 +104,10 @@ db:
Path: ./data/db/node_1
eth2:
Network: prater
BeaconNodeAddr: prater-4000.stage.bloxinfra.com:80
BeaconNodeAddr: prater-4000-ext.stage.bloxinfra.com:80
eth1:
ETH1Addr: ws://eth1-ws.stage.bloxinfra.com/ws
ETH1Addr: ws://eth1-ws-ext.stage.bloxinfra.com/ws
RegistryContractAddr: 0x687fb596F3892904F879118e2113e1EEe8746C2E
OperatorPrivateKey: LS0tLS...
```
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/cov-badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions ekm/signer_key_manager_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package ekm

import (
"github.com/bloxapp/ssv/protocol/v1/types"
"testing"

spec "github.com/attestantio/go-eth2-client/spec/phase0"
Expand All @@ -16,6 +15,7 @@ import (
"go.uber.org/zap/zapcore"

beacon2 "github.com/bloxapp/ssv/protocol/v1/blockchain/beacon"
"github.com/bloxapp/ssv/protocol/v1/types"
"github.com/bloxapp/ssv/utils/logex"
"github.com/bloxapp/ssv/utils/threshold"
)
Expand Down Expand Up @@ -143,7 +143,7 @@ func TestSignRoot(t *testing.T) {
MsgType: specqbft.CommitMsgType,
Height: specqbft.Height(3),
Round: specqbft.Round(2),
Identifier: []byte("lambda1"),
Identifier: []byte("identifier1"),
Data: commitData,
}

Expand All @@ -154,7 +154,7 @@ func TestSignRoot(t *testing.T) {
// verify
signed := &specqbft.SignedMessage{
Signature: sig,
Signers: []spectypes.OperatorID{spectypes.OperatorID(1)},
Signers: []spectypes.OperatorID{1},
Message: msg,
}

Expand All @@ -175,7 +175,7 @@ func TestSignRoot(t *testing.T) {
MsgType: specqbft.CommitMsgType,
Height: specqbft.Height(1),
Round: specqbft.Round(3),
Identifier: []byte("lambda2"),
Identifier: []byte("identifier2"),
Data: commitData,
}

Expand All @@ -186,7 +186,7 @@ func TestSignRoot(t *testing.T) {
// verify
signed := &specqbft.SignedMessage{
Signature: sig,
Signers: []spectypes.OperatorID{spectypes.OperatorID(1)},
Signers: []spectypes.OperatorID{1},
Message: msg,
}

Expand Down
2 changes: 1 addition & 1 deletion exporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ The following objects will be used by the API:
"message": {
"type": 3,
"round": 1,
"lambda": "...",
"identifier": "...",
"seq_number": 23,
"value": "..."
},
Expand Down
2 changes: 2 additions & 0 deletions exporter/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ func (ws *wsServer) Start(addr string) error {
zap.String("addr", addr),
zap.Strings("endPoints", []string{"/query", "/stream"}))

// TODO: enable lint (G114: Use of net/http serve function that has no support for setting timeouts (gosec))
// nolint: gosec
err := http.ListenAndServe(addr, ws.router)
if err != nil {
ws.logger.Warn("could not start http server", zap.Error(err))
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.17
require (
github.com/attestantio/go-eth2-client v0.11.3
github.com/bloxapp/eth2-key-manager v1.1.3-0.20211102055147-c66d220973fd
github.com/bloxapp/ssv-spec v0.1.2-0.20220719134225-f49e942ed4ee
github.com/bloxapp/ssv-spec v0.1.2-0.20220910060910-1f15a59e8d2d
github.com/btcsuite/btcd/btcec/v2 v2.2.0
github.com/dgraph-io/badger/v3 v3.2103.2
github.com/ethereum/go-ethereum v1.10.18
Expand Down
Loading

0 comments on commit d3ef412

Please sign in to comment.