Skip to content

Commit

Permalink
Align spec with 375a276 (ssvlabs#1252)
Browse files Browse the repository at this point in the history
* Changes from ssvlabs/ssv-spec#322

* Changes from ssvlabs/ssv-spec#321

* Update spec to 375a276

* Deploy to 21-24

* Deploy to all except 25-28

* Revert "Deploy to all except 25-28"

This reverts commit c3faedb.

* Revert "Deploy to 21-24"

This reverts commit 69e3a2a.

* Deploy to all nodes

* Revert "Deploy to all nodes"

This reverts commit 6f4bd6f.

* Deploy to 21-24

* Revert "Deploy to 21-24"

This reverts commit a333cd6.

* Deploy to all nodes

* Revert "Deploy to all nodes"

This reverts commit 0eb4f8c.

* Deploy to 21-24

* Revert "Deploy to 21-24"

This reverts commit f9d9e9d.

* Update differ.config.yaml with approved changes

---------

Co-authored-by: moshe-blox <[email protected]>
  • Loading branch information
nkryuchkov and moshe-blox authored Jan 15, 2024
1 parent 20ff678 commit be065b6
Show file tree
Hide file tree
Showing 20 changed files with 35 additions and 51 deletions.
2 changes: 1 addition & 1 deletion beacon/goclient/voluntary_exit.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import (
"github.com/attestantio/go-eth2-client/spec/phase0"
)

func (gc *goClient) SubmitVoluntaryExit(voluntaryExit *phase0.SignedVoluntaryExit, _ phase0.BLSSignature) error {
func (gc *goClient) SubmitVoluntaryExit(voluntaryExit *phase0.SignedVoluntaryExit) error {
return gc.client.SubmitVoluntaryExit(gc.ctx, voluntaryExit)
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/aquasecurity/table v1.8.0
github.com/attestantio/go-eth2-client v0.16.3
github.com/bloxapp/eth2-key-manager v1.3.2
github.com/bloxapp/ssv-spec v0.3.4
github.com/bloxapp/ssv-spec v0.3.5-0.20231212075847-375a2766d19e
github.com/btcsuite/btcd/btcec/v2 v2.3.2
github.com/cespare/xxhash/v2 v2.2.0
github.com/cornelk/hashmap v1.0.8
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ 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 h1:xzxwYQZr8DoQrkCBkTnSdDWqqoPq/iy5VoKLxfPf4IY=
github.com/bloxapp/eth2-key-manager v1.3.2/go.mod h1:cT+qAJfnAzNz9StFoHQ8xAkyU2eyEukd6xfxvcBWuZA=
github.com/bloxapp/ssv-spec v0.3.4 h1:uu1pAP8FBucGf1FGORjzqz7if0vWGRY5w6ILLhA7IuM=
github.com/bloxapp/ssv-spec v0.3.4/go.mod h1:zPJR7YnG5iZ6I0h6EzfVly8bTBXaZwcx4TyJ8pzYVd8=
github.com/bloxapp/ssv-spec v0.3.5-0.20231212075847-375a2766d19e h1:/ZRSxON+Dia+Nqa5QznflL/zASMxAmJNQhZW28fQejQ=
github.com/bloxapp/ssv-spec v0.3.5-0.20231212075847-375a2766d19e/go.mod h1:zPJR7YnG5iZ6I0h6EzfVly8bTBXaZwcx4TyJ8pzYVd8=
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
github.com/bradfitz/gomemcache v0.0.0-20170208213004-1952afaa557d/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60=
github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U=
Expand Down
2 changes: 1 addition & 1 deletion networkconfig/jato-v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
var JatoV2 = NetworkConfig{
Name: "jato-v2",
Beacon: beacon.NewNetwork(spectypes.PraterNetwork),
Domain: spectypes.DomainType{0x0, 0x0, 0x4, 0x1},
Domain: spectypes.JatoV2Testnet,
GenesisEpoch: 192100,
RegistrySyncOffset: new(big.Int).SetInt64(9203578),
RegistryContractAddr: "0xC3CD9A0aE89Fff83b71b58b6512D43F8a41f363D",
Expand Down
3 changes: 2 additions & 1 deletion networkconfig/local-testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package networkconfig

import (
spectypes "github.com/bloxapp/ssv-spec/types"

"github.com/bloxapp/ssv/protocol/v2/blockchain/beacon"
)

var LocalTestnet = NetworkConfig{
Name: "local-testnet",
Beacon: beacon.NewLocalTestNetwork(spectypes.PraterNetwork),
Domain: spectypes.DomainType{0x0, 0x0, 0x4, 0x1},
Domain: spectypes.JatoV2Testnet,
GenesisEpoch: 1,
RegistryContractAddr: "0xC3CD9A0aE89Fff83b71b58b6512D43F8a41f363D",
Bootnodes: []string{
Expand Down
2 changes: 1 addition & 1 deletion networkconfig/test-network.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
var TestNetwork = NetworkConfig{
Name: "testnet",
Beacon: beacon.NewNetwork(spectypes.PraterNetwork),
Domain: spectypes.V3Testnet,
Domain: spectypes.JatoTestnet,
GenesisEpoch: 152834,
RegistrySyncOffset: new(big.Int).SetInt64(9015219),
RegistryContractAddr: "0x4B133c68A084B8A88f72eDCd7944B69c8D545f03",
Expand Down
2 changes: 1 addition & 1 deletion operator/validator/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ func SetupRunners(ctx context.Context, logger *zap.Logger, options validator.Opt
config.ValueCheckF = valueCheckF

identifier := spectypes.NewMsgID(ssvtypes.GetDefaultDomain(), options.SSVShare.Share.ValidatorPubKey, role)
qbftCtrl := qbftcontroller.NewController(identifier[:], &options.SSVShare.Share, domainType, config, options.FullNode)
qbftCtrl := qbftcontroller.NewController(identifier[:], &options.SSVShare.Share, config, options.FullNode)
qbftCtrl.NewDecidedHandler = options.NewDecidedHandler
return qbftCtrl
}
Expand Down
8 changes: 4 additions & 4 deletions protocol/v2/blockchain/beacon/mock_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions protocol/v2/qbft/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ type Controller struct {
Height specqbft.Height // incremental Height for InstanceContainer
// StoredInstances stores the last HistoricalInstanceCapacity in an array for message processing purposes.
StoredInstances InstanceContainer
Domain spectypes.DomainType
Share *spectypes.Share
NewDecidedHandler NewDecidedHandler `json:"-"`
config qbft.IConfig
Expand All @@ -36,14 +35,12 @@ type Controller struct {
func NewController(
identifier []byte,
share *spectypes.Share,
domain spectypes.DomainType,
config qbft.IConfig,
fullNode bool,
) *Controller {
return &Controller{
Identifier: identifier,
Height: specqbft.FirstHeight,
Domain: domain,
Share: share,
StoredInstances: make(InstanceContainer, 0, InstanceContainerDefaultCapacity),
config: config,
Expand Down
18 changes: 0 additions & 18 deletions protocol/v2/qbft/instance/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,24 +88,6 @@ func aggregateCommitMsgs(msgs []*specqbft.SignedMessage, fullData []byte) (*spec
return ret, nil
}

// didSendCommitForHeightAndRound returns true if sent commit msg for specific Height and round
/**
!exists m :: && m in current.messagesReceived
&& m.Commit?
&& var uPayload := m.commitPayload.unsignedPayload;
&& uPayload.Height == |current.blockchain|
&& uPayload.round == current.round
&& recoverSignedCommitAuthor(m.commitPayload) == current.id
*/
func didSendCommitForHeightAndRound(state *specqbft.State, commitMsgContainer *specqbft.MsgContainer) bool {
for _, msg := range commitMsgContainer.MessagesForRound(state.Round) {
if msg.MatchedSigners([]spectypes.OperatorID{state.Share.OperatorID}) {
return true
}
}
return false
}

// CreateCommit
/**
Commit(
Expand Down
2 changes: 1 addition & 1 deletion protocol/v2/qbft/instance/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (i *Instance) ProcessMsg(logger *zap.Logger, msg *specqbft.SignedMessage) (
case specqbft.ProposalMsgType:
return i.uponProposal(logger, msg, i.State.ProposeContainer)
case specqbft.PrepareMsgType:
return i.uponPrepare(logger, msg, i.State.PrepareContainer, i.State.CommitContainer)
return i.uponPrepare(logger, msg, i.State.PrepareContainer)
case specqbft.CommitMsgType:
decided, decidedValue, aggregatedCommit, err = i.UponCommit(logger, msg, i.State.CommitContainer)
if decided {
Expand Down
15 changes: 6 additions & 9 deletions protocol/v2/qbft/instance/prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ import (

// uponPrepare process prepare message
// Assumes prepare message is valid!
func (i *Instance) uponPrepare(
logger *zap.Logger,
signedPrepare *specqbft.SignedMessage,
prepareMsgContainer,
commitMsgContainer *specqbft.MsgContainer) error {
func (i *Instance) uponPrepare(logger *zap.Logger, signedPrepare *specqbft.SignedMessage, prepareMsgContainer *specqbft.MsgContainer) error {
hasQuorumBefore := specqbft.HasQuorum(i.State.Share, prepareMsgContainer.MessagesForRound(i.State.Round))

addedMsg, err := prepareMsgContainer.AddFirstMsgForSignerAndRound(signedPrepare)
if err != nil {
Expand All @@ -34,12 +31,12 @@ func (i *Instance) uponPrepare(
zap.Any("prepare-signers", signedPrepare.Signers),
fields.Root(signedPrepare.Message.Root))

if !specqbft.HasQuorum(i.State.Share, prepareMsgContainer.MessagesForRound(i.State.Round)) {
return nil // no quorum yet
if hasQuorumBefore {
return nil // already moved to commit stage
}

if didSendCommitForHeightAndRound(i.State, commitMsgContainer) {
return nil // already moved to commit stage
if !specqbft.HasQuorum(i.State.Share, prepareMsgContainer.MessagesForRound(i.State.Round)) {
return nil // no quorum yet
}

proposedRoot := i.State.ProposalAcceptedForCurrentRound.Message.Root
Expand Down
9 changes: 8 additions & 1 deletion protocol/v2/qbft/instance/round_change.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,19 @@ func (i *Instance) uponRoundChange(
roundChangeMsgContainer *specqbft.MsgContainer,
valCheck specqbft.ProposedValueCheckF,
) error {
hasQuorumBefore := specqbft.HasQuorum(i.State.Share, roundChangeMsgContainer.MessagesForRound(signedRoundChange.Message.
Round))
// Currently, even if we have a quorum of round change messages, we update the container
addedMsg, err := roundChangeMsgContainer.AddFirstMsgForSignerAndRound(signedRoundChange)
if err != nil {
return errors.Wrap(err, "could not add round change msg to container")
}
if !addedMsg {
return nil // UponCommit was already called
return nil // message was already added from signer
}

if hasQuorumBefore {
return nil // already changed round
}

logger = logger.With(
Expand Down
1 change: 0 additions & 1 deletion protocol/v2/qbft/testing/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ func NewTestingQBFTController(
ctrl := controller.NewController(
identifier,
share,
testingutils.TestingSSVDomainType,
config,
fullNode,
)
Expand Down
3 changes: 3 additions & 0 deletions protocol/v2/ssv/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func (b *BaseRunner) SetHighestDecidedSlot(slot spec.Slot) {

// setupForNewDuty is sets the runner for a new duty
func (b *BaseRunner) baseSetupForNewDuty(duty *spectypes.Duty) {
// start new state
state := NewRunnerState(b.Share.Quorum, duty)

// TODO: potentially incomplete locking of b.State. runner.Execute(duty) has access to
Expand Down Expand Up @@ -99,7 +100,9 @@ func (b *BaseRunner) baseStartNewDuty(logger *zap.Logger, runner Runner, duty *s
if err := b.ShouldProcessDuty(duty); err != nil {
return errors.Wrap(err, "can't start duty")
}

b.baseSetupForNewDuty(duty)

return runner.executeDuty(logger, duty)
}

Expand Down
2 changes: 1 addition & 1 deletion protocol/v2/ssv/runner/voluntary_exit.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (r *VoluntaryExitRunner) ProcessPreConsensus(logger *zap.Logger, signedMsg
Signature: specSig,
}

if err := r.beacon.SubmitVoluntaryExit(signedVoluntaryExit, specSig); err != nil {
if err := r.beacon.SubmitVoluntaryExit(signedVoluntaryExit); err != nil {
return errors.Wrap(err, "could not submit voluntary exit")
}

Expand Down
2 changes: 0 additions & 2 deletions protocol/v2/ssv/spectest/ssv_mapping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,11 @@ func fixControllerForRun(t *testing.T, logger *zap.Logger, runner runner.Runner,
newContr := controller.NewController(
contr.Identifier,
contr.Share,
testingutils.TestingConfig(ks).Domain,
config,
false,
)
newContr.StoredInstances = make(controller.InstanceContainer, 0, controller.InstanceContainerTestCapacity)
newContr.Height = contr.Height
newContr.Domain = contr.Domain
newContr.StoredInstances = contr.StoredInstances

for i, inst := range newContr.StoredInstances {
Expand Down
2 changes: 1 addition & 1 deletion protocol/v2/ssv/testing/ssv_msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/herumi/bls-eth-go-binary/bls"
)

var TestingSSVDomainType = spectypes.V3Testnet
var TestingSSVDomainType = spectypes.JatoTestnet
var AttesterMsgID = func() []byte {
ret := spectypes.NewMsgID(TestingSSVDomainType, testingutils.TestingValidatorPubKey[:], spectypes.BNRoleAttester)
return ret[:]
Expand Down
2 changes: 1 addition & 1 deletion protocol/v2/ssv/validator/non_committee_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func NewNonCommitteeValidator(logger *zap.Logger, identifier spectypes.MessageID
Network: opts.Network,
SignatureVerification: true,
}
ctrl := qbftcontroller.NewController(identifier[:], &opts.SSVShare.Share, types.GetDefaultDomain(), config, opts.FullNode)
ctrl := qbftcontroller.NewController(identifier[:], &opts.SSVShare.Share, config, opts.FullNode)
ctrl.StoredInstances = make(qbftcontroller.InstanceContainer, 0, nonCommitteeInstanceContainerCapacity(opts.FullNode))
ctrl.NewDecidedHandler = opts.NewDecidedHandler
if _, err := ctrl.LoadHighestInstance(identifier[:]); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion scripts/spec-alignment/differ.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ApprovedChanges: ["256a3dc0f1eb7abf","22b66e9a63ba145b","12c1c3a1622fb7cc","1c44
"ae1b53fc580ce346","c117bd5db3eeabd6","d06552d71b9ca4cd","4cb333a88af66575","2a580187c312c79a","bf8cf93c55c1eadb","6d877e24991465e4",
"b1c8e0148a4a755","2c25abb7c776bd54","a1754e08473bd1fa","4dbab14670fa155d","2a3667a499a23b16","930379d323dd95e8","65efe31656e8814f",
"1270cef2e573f846","aeafb38ca9114f12","2a83e3384b45f2d7","91fbb874b3ce2570","74ad51ca63526e1e","defd8406641d53a5","efa21b9890ec787b",
"6bd22f1a688bbca8","6b29645373ffac35","cfd236570c82c478","e2b0e9c6454c1c08"]
"6bd22f1a688bbca8","6b29645373ffac35","cfd236570c82c478","e2b0e9c6454c1c08","d5ddc708de23543a","11f8f0ea5709e42e","172a32c59d6f082e"]

IgnoredIdentifiers:
- logger
Expand Down

0 comments on commit be065b6

Please sign in to comment.