Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: force start duties in ValidatorRegistrationRunner #1188

Merged
merged 9 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 0 additions & 46 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
# +---------------------+
Expand Down
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@moshe-blox The PR number is missing in the link

replace github.com/bloxapp/ssv-spec => github.com/moshe-blox/ssv-spec v0.0.0-20231105135956-a64e63f6e35a
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down
5 changes: 3 additions & 2 deletions protocol/v2/ssv/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
8 changes: 1 addition & 7 deletions protocol/v2/ssv/runner/validator_registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 1 addition & 7 deletions protocol/v2/ssv/runner/voluntary_exit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 7 additions & 5 deletions protocol/v2/ssv/spectest/ssv_mapping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))})
Expand Down
Loading