diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f296289e6e..2faf940701 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -42,52 +42,6 @@ Build stage Docker image: only: - stage -Deploy nodes to stage: - stage: deploy - tags: - - blox-infra-stage - script: - - apk add bash - - export K8S_API_VERSION=$INFRA_STAGE_K8_API_VERSION - - export SSV_NODES_CPU_LIMIT=$STAGE_SSV_NODES_CPU_LIMIT - - export SSV_NODES_MEM_LIMIT=$STAGE_SSV_NODES_MEM_LIMIT - - curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.17.0/bin/linux/amd64/kubectl - - chmod 755 kubectl - - mv kubectl /usr/bin/ - # - # +--------------------+ - # | Deploy SSV nodes | - # +--------------------+ - - .k8/stage/scripts/deploy-cluster-1--4.sh $DOCKER_REPO_INFRA_STAGE $CI_COMMIT_SHA 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/stage/scripts/deploy-cluster-5--8.sh $DOCKER_REPO_INFRA_STAGE $CI_COMMIT_SHA 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/stage/scripts/deploy-cluster-9--12.sh $DOCKER_REPO_INFRA_STAGE $CI_COMMIT_SHA 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/stage/scripts/deploy-cluster-13--16.sh $DOCKER_REPO_INFRA_STAGE $CI_COMMIT_SHA 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 - # - # +-------------------+ - # │ Deploy Bootnode | - # +-------------------+ - # █▓▒░ Keep commented unless you're testing the bootnode ░▒▓█ - # - .k8/stage/scripts/deploy-boot-nodes.sh $DOCKER_REPO_INFRA_STAGE $CI_COMMIT_SHA ssv $APP_REPLICAS_INFRA_STAGE blox-infra-stage kubernetes-admin@blox-infra stage.ssv.network $K8S_API_VERSION $STAGE_HEALTH_CHECK_IMAGE 1000m 1000m - only: - - stage - -Deploy exporter to stage: - stage: deploy - tags: - - blox-infra-stage - script: - - apk add bash - - export K8S_API_VERSION=$INFRA_STAGE_K8_API_VERSION - - export SSV_EXPORTER_CPU_LIMIT=$STAGE_SSV_EXPORTER_CPU_LIMIT - - export SSV_EXPORTER_MEM_LIMIT=$STAGE_SSV_EXPORTER_MEM_LIMIT - - curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.17.0/bin/linux/amd64/kubectl - - chmod 755 kubectl - - mv kubectl /usr/bin/ - - .k8/stage/scripts/deploy-exporters.sh $DOCKER_REPO_INFRA_STAGE $CI_COMMIT_SHA ssv $APP_REPLICAS_INFRA_STAGE blox-infra-stage kubernetes-admin@blox-infra stage.ssv.network $K8S_API_VERSION $SSV_EXPORTER_CPU_LIMIT $SSV_EXPORTER_MEM_LIMIT - only: - - stage - - # +---------------------+ # | STAGE HETZNER NODES | # +---------------------+ diff --git a/go.mod b/go.mod index b39d5e0cc9..dd15d92b49 100644 --- a/go.mod +++ b/go.mod @@ -223,5 +223,8 @@ replace github.com/google/flatbuffers => github.com/google/flatbuffers v1.11.0 replace github.com/dgraph-io/ristretto => github.com/dgraph-io/ristretto v0.1.1-0.20211108053508-297c39e6640f -//TODO remove this replace when the following PR is merged https://github.com/bloxapp/eth2-key-manager/pull/100 +// TODO: remove this replace when the following PR is merged https://github.com/bloxapp/eth2-key-manager/pull/100 replace github.com/bloxapp/eth2-key-manager => github.com/bloxapp/eth2-key-manager v1.3.2-0.20231022162227-e2b8264a29a5 + +// TODO: remove this replace when the following PR is merged https://github.com/bloxapp/ssv-spec/pull +replace github.com/bloxapp/ssv-spec => github.com/moshe-blox/ssv-spec v0.0.0-20231105135956-a64e63f6e35a diff --git a/go.sum b/go.sum index cf4040a7be..4aabd85bc6 100644 --- a/go.sum +++ b/go.sum @@ -56,8 +56,6 @@ github.com/bits-and-blooms/bitset v1.7.0 h1:YjAGVd3XmtK9ktAbX8Zg2g2PwLIMjGREZJHl github.com/bits-and-blooms/bitset v1.7.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/bloxapp/eth2-key-manager v1.3.2-0.20231022162227-e2b8264a29a5 h1:vjrMmMH15Bo0QF+228CuEZvCI+OuPyJRco82Gj/WyTI= github.com/bloxapp/eth2-key-manager v1.3.2-0.20231022162227-e2b8264a29a5/go.mod h1:cT+qAJfnAzNz9StFoHQ8xAkyU2eyEukd6xfxvcBWuZA= -github.com/bloxapp/ssv-spec v0.3.3 h1:iNomqWQjxDDQouHMjl27PmH1hUolJ4u8QQ+HX/TQQcg= -github.com/bloxapp/ssv-spec v0.3.3/go.mod h1:zPJR7YnG5iZ6I0h6EzfVly8bTBXaZwcx4TyJ8pzYVd8= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= @@ -521,6 +519,8 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= +github.com/moshe-blox/ssv-spec v0.0.0-20231105135956-a64e63f6e35a h1:I9d5JgkAFj3twwA3D7KkMxvp1wvMnkScmSGDvlf8J7o= +github.com/moshe-blox/ssv-spec v0.0.0-20231105135956-a64e63f6e35a/go.mod h1:zPJR7YnG5iZ6I0h6EzfVly8bTBXaZwcx4TyJ8pzYVd8= github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= diff --git a/protocol/v2/ssv/runner/runner.go b/protocol/v2/ssv/runner/runner.go index 1fc2225e15..1a06df1e28 100644 --- a/protocol/v2/ssv/runner/runner.go +++ b/protocol/v2/ssv/runner/runner.go @@ -271,9 +271,10 @@ func (b *BaseRunner) hasRunningDuty() bool { } func (b *BaseRunner) ShouldProcessDuty(duty *spectypes.Duty) error { - if b.QBFTController.Height >= specqbft.Height(duty.Slot) { + // assume StartingDuty is not nil if state is not nil + if b.State != nil && b.State.StartingDuty.Slot >= duty.Slot { return errors.Errorf("duty for slot %d already passed. Current height is %d", duty.Slot, - b.QBFTController.Height) + b.State.StartingDuty.Slot) } return nil } diff --git a/protocol/v2/ssv/runner/validator_registration.go b/protocol/v2/ssv/runner/validator_registration.go index 68bc4351b8..3232fdff3e 100644 --- a/protocol/v2/ssv/runner/validator_registration.go +++ b/protocol/v2/ssv/runner/validator_registration.go @@ -54,13 +54,7 @@ func NewValidatorRegistrationRunner( } func (r *ValidatorRegistrationRunner) StartNewDuty(logger *zap.Logger, duty *spectypes.Duty) error { - // Note: Unlike the other runners, this doesn't call BaseRunner.baseStartNewDuty because - // that requires a QBFTController which ValidatorRegistrationRunner doesn't have. - if r.HasRunningDuty() { - return errors.New("already running duty") - } - r.BaseRunner.baseSetupForNewDuty(duty) - return r.executeDuty(logger, duty) + return r.BaseRunner.baseStartNewDuty(logger, r, duty) } // HasRunningDuty returns true if a duty is already running (StartNewDuty called and returned nil) diff --git a/protocol/v2/ssv/runner/voluntary_exit.go b/protocol/v2/ssv/runner/voluntary_exit.go index 7eba30c616..b569f853cc 100644 --- a/protocol/v2/ssv/runner/voluntary_exit.go +++ b/protocol/v2/ssv/runner/voluntary_exit.go @@ -50,13 +50,7 @@ func NewVoluntaryExitRunner( } func (r *VoluntaryExitRunner) StartNewDuty(logger *zap.Logger, duty *spectypes.Duty) error { - // Note: Unlike the other runners, this doesn't call BaseRunner.baseStartNewDuty because - // that requires a QBFTController which VoluntaryExitRunner doesn't have. - if r.HasRunningDuty() { - return errors.New("already running duty") - } - r.BaseRunner.baseSetupForNewDuty(duty) - return r.executeDuty(logger, duty) + return r.BaseRunner.baseStartNewDuty(logger, r, duty) } // HasRunningDuty returns true if a duty is already running (StartNewDuty called and returned nil) diff --git a/protocol/v2/ssv/spectest/ssv_mapping_test.go b/protocol/v2/ssv/spectest/ssv_mapping_test.go index 14fac24b35..fae52f8e21 100644 --- a/protocol/v2/ssv/spectest/ssv_mapping_test.go +++ b/protocol/v2/ssv/spectest/ssv_mapping_test.go @@ -175,11 +175,13 @@ func newRunnerDutySpecTestFromMap(t *testing.T, m map[string]interface{}) *Start require.NoError(t, json.Unmarshal(byts, duty)) outputMsgs := make([]*spectypes.SignedPartialSignatureMessage, 0) - for _, msg := range m["OutputMessages"].([]interface{}) { - byts, _ = json.Marshal(msg) - typedMsg := &spectypes.SignedPartialSignatureMessage{} - require.NoError(t, json.Unmarshal(byts, typedMsg)) - outputMsgs = append(outputMsgs, typedMsg) + if v, ok := m["OutputMessages"].([]interface{}); ok { + for _, msg := range v { + byts, _ = json.Marshal(msg) + typedMsg := &spectypes.SignedPartialSignatureMessage{} + require.NoError(t, json.Unmarshal(byts, typedMsg)) + outputMsgs = append(outputMsgs, typedMsg) + } } ks := testingutils.KeySetForShare(&spectypes.Share{Quorum: uint64(baseRunnerMap["Share"].(map[string]interface{})["Quorum"].(float64))})