From 54d9b0f4f4513541287bfb310d088a0ef9a7560d Mon Sep 17 00:00:00 2001 From: MatheusFranco99 <48058141+MatheusFranco99@users.noreply.github.com> Date: Tue, 13 Aug 2024 15:09:48 +0100 Subject: [PATCH 1/4] Remove nolint comment and export timeout variables --- qbft/timeout.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/qbft/timeout.go b/qbft/timeout.go index c575e9c85..ddb8eed25 100644 --- a/qbft/timeout.go +++ b/qbft/timeout.go @@ -1,14 +1,15 @@ package qbft import ( - "github.com/pkg/errors" "time" + + "github.com/pkg/errors" ) var ( - quickTimeoutThreshold = Round(8) //nolint - quickTimeout = 2 * time.Second //nolint - slowTimeout = 2 * time.Minute //nolint + QuickTimeoutThreshold = Round(8) + QuickTimeout = 2 * time.Second + SlowTimeout = 2 * time.Minute // CutoffRound which round the instance should stop its timer and progress no further CutoffRound = 12 // stop processing attestations after 8*2+120*3 = 6.2 min (~ 1 epoch) ) From 9544b8cc9f6d8c10e661de593f38e2e3a0bbdd1f Mon Sep 17 00:00:00 2001 From: MatheusFranco99 <48058141+MatheusFranco99@users.noreply.github.com> Date: Tue, 13 Aug 2024 15:10:05 +0100 Subject: [PATCH 2/4] Drop unnecessary nolint --- qbft/instance.go | 2 -- .../tests/runner/duties/newduty/consensus_not_started.go | 2 -- ssv/spectest/tests/runner/duties/newduty/finished.go | 2 -- ssv/spectest/tests/runner/duties/newduty/not_decided.go | 2 -- ssv/spectest/tests/runner/duties/newduty/post_future_decided.go | 2 -- ssv/spectest/tests/runner/preconsensus/post_decided.go | 2 -- ssv/spectest/tests/runner/preconsensus/post_finish.go | 2 -- 7 files changed, 14 deletions(-) diff --git a/qbft/instance.go b/qbft/instance.go index 76a4cd458..ba2ef75f0 100644 --- a/qbft/instance.go +++ b/qbft/instance.go @@ -67,11 +67,9 @@ func (i *Instance) Start(value []byte, height Height) { // propose if this node is the proposer if proposer(i.State, i.GetConfig(), FirstRound) == i.State.CommitteeMember.OperatorID { proposal, err := CreateProposal(i.State, i.signer, i.StartValue, nil, nil) - // nolint if err != nil { fmt.Printf("%s\n", err.Error()) } - // nolint if err := i.Broadcast(proposal); err != nil { fmt.Printf("%s\n", err.Error()) } diff --git a/ssv/spectest/tests/runner/duties/newduty/consensus_not_started.go b/ssv/spectest/tests/runner/duties/newduty/consensus_not_started.go index 304cd4faf..ed4655c91 100644 --- a/ssv/spectest/tests/runner/duties/newduty/consensus_not_started.go +++ b/ssv/spectest/tests/runner/duties/newduty/consensus_not_started.go @@ -12,8 +12,6 @@ import ( func ConsensusNotStarted() tests.SpecTest { ks := testingutils.Testing4SharesSet() - // TODO: check error - // nolint startRunner := func(r ssv.Runner, duty types.Duty) ssv.Runner { r.GetBaseRunner().State = ssv.NewRunnerState(3, duty) return r diff --git a/ssv/spectest/tests/runner/duties/newduty/finished.go b/ssv/spectest/tests/runner/duties/newduty/finished.go index 451a136e0..f92e18275 100644 --- a/ssv/spectest/tests/runner/duties/newduty/finished.go +++ b/ssv/spectest/tests/runner/duties/newduty/finished.go @@ -14,8 +14,6 @@ import ( func Finished() tests.SpecTest { ks := testingutils.Testing4SharesSet() - // TODO: check error - // nolint finishRunner := func(r ssv.Runner, duty types.Duty, finishController bool) ssv.Runner { r.GetBaseRunner().State = ssv.NewRunnerState(3, duty) diff --git a/ssv/spectest/tests/runner/duties/newduty/not_decided.go b/ssv/spectest/tests/runner/duties/newduty/not_decided.go index 8f6bd8174..3f796ed15 100644 --- a/ssv/spectest/tests/runner/duties/newduty/not_decided.go +++ b/ssv/spectest/tests/runner/duties/newduty/not_decided.go @@ -16,8 +16,6 @@ import ( func NotDecided() tests.SpecTest { ks := testingutils.Testing4SharesSet() - // TODO: check error - // nolint startRunner := func(r ssv.Runner, duty types.Duty) ssv.Runner { r.GetBaseRunner().State = ssv.NewRunnerState(3, duty) r.GetBaseRunner().State.RunningInstance = qbft.NewInstance( diff --git a/ssv/spectest/tests/runner/duties/newduty/post_future_decided.go b/ssv/spectest/tests/runner/duties/newduty/post_future_decided.go index 32ef225f8..dc121e836 100644 --- a/ssv/spectest/tests/runner/duties/newduty/post_future_decided.go +++ b/ssv/spectest/tests/runner/duties/newduty/post_future_decided.go @@ -17,8 +17,6 @@ import ( func PostFutureDecided() tests.SpecTest { ks := testingutils.Testing4SharesSet() - // TODO: check error - // nolint futureDecide := func(r ssv.Runner, duty types.Duty) ssv.Runner { r.GetBaseRunner().State = ssv.NewRunnerState(3, duty) r.GetBaseRunner().State.RunningInstance = qbft.NewInstance( diff --git a/ssv/spectest/tests/runner/preconsensus/post_decided.go b/ssv/spectest/tests/runner/preconsensus/post_decided.go index eeba2978f..a2e6ba89f 100644 --- a/ssv/spectest/tests/runner/preconsensus/post_decided.go +++ b/ssv/spectest/tests/runner/preconsensus/post_decided.go @@ -16,8 +16,6 @@ import ( func PostDecided() tests.SpecTest { ks := testingutils.Testing4SharesSet() - // TODO: check errors - // nolint decideRunner := func(r ssv.Runner, duty *types.ValidatorDuty, decidedValue *types.ValidatorConsensusData, preMsgs []*types.PartialSignatureMessages) ssv.Runner { r.GetBaseRunner().State = ssv.NewRunnerState(3, duty) for _, msg := range preMsgs { diff --git a/ssv/spectest/tests/runner/preconsensus/post_finish.go b/ssv/spectest/tests/runner/preconsensus/post_finish.go index c5300b66c..d1a572a22 100644 --- a/ssv/spectest/tests/runner/preconsensus/post_finish.go +++ b/ssv/spectest/tests/runner/preconsensus/post_finish.go @@ -15,8 +15,6 @@ import ( func PostFinish() tests.SpecTest { ks := testingutils.Testing4SharesSet() - // TODO: check errors - // nolint finishRunner := func(runner ssv.Runner, duty *types.ValidatorDuty) ssv.Runner { runner.GetBaseRunner().State = ssv.NewRunnerState(3, duty) runner.GetBaseRunner().State.Finished = true From b113f77be29ce8b764be62cb738a7d62a9793e0f Mon Sep 17 00:00:00 2001 From: MatheusFranco99 <48058141+MatheusFranco99@users.noreply.github.com> Date: Thu, 15 Aug 2024 09:51:31 +0100 Subject: [PATCH 3/4] Add comment --- qbft/timeout.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qbft/timeout.go b/qbft/timeout.go index ddb8eed25..58caf4931 100644 --- a/qbft/timeout.go +++ b/qbft/timeout.go @@ -6,6 +6,8 @@ import ( "github.com/pkg/errors" ) +// At the moment, these variables are useful for the node implementation +// TODO: It's usage should be updated in the PR https://github.com/ssvlabs/ssv-spec/pull/352 var ( QuickTimeoutThreshold = Round(8) QuickTimeout = 2 * time.Second From 2f4be60c83c91a45faf54ea15a691267646c5f71 Mon Sep 17 00:00:00 2001 From: MatheusFranco99 <48058141+MatheusFranco99@users.noreply.github.com> Date: Thu, 15 Aug 2024 09:56:17 +0100 Subject: [PATCH 4/4] Fix lint issue --- ssv/runner_validations.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ssv/runner_validations.go b/ssv/runner_validations.go index c3b66e3b8..e5a0cbc8b 100644 --- a/ssv/runner_validations.go +++ b/ssv/runner_validations.go @@ -50,7 +50,7 @@ func (b *BaseRunner) ValidatePostConsensusMsg(runner Runner, psigMsgs *types.Par } // TODO https://github.com/ssvlabs/ssv-spec/issues/142 need to fix with this issue solution instead. - if b.State.DecidedValue == nil || len(b.State.DecidedValue) == 0 { + if len(b.State.DecidedValue) == 0 { return errors.New("no decided value") }