-
Notifications
You must be signed in to change notification settings - Fork 24
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
Version Block Support - testing infrastructure #223
Version Block Support - testing infrastructure #223
Conversation
Duty: testingutils.TestingProposerDutyV(spec.DataVersionBellatrix), | ||
Messages: []*types.SSVMessage{ | ||
testingutils.SSVMsgProposer(nil, testingutils.PostConsensusProposerMsgV(ks.Shares[1], 1, spec.DataVersionBellatrix)), | ||
testingutils.SSVMsgProposer(nil, testingutils.PostConsensusWrongProposerMsgV(ks.Shares[1], 1, spec.DataVersionBellatrix)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so we're testing only Bellatrix as part of this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, u can find the info in description
"github.com/bloxapp/ssv-spec/types" | ||
) | ||
|
||
var TestingBeaconBlockV = func(version spec.DataVersion) *spec.VersionedBeaconBlock { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why you don't just write functions? instead of vars that hold functions..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keeping the current design
up to @GalRogozinski to decide if we want to break it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think both of ways are fine...
So I don't see a reason to do a needless change
if @y0sher feels strongly about changing it we can discuss
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this is what existed before than yeah this isn't in the scope of this PR to change. generally I don't see why to write this way. in terms of IDE tooling like being able to see the function signature before using it's better to use the classic function structure than this.
"github.com/bloxapp/ssv-spec/types" | ||
) | ||
|
||
var TestingBeaconBlockV = func(version spec.DataVersion) *spec.VersionedBeaconBlock { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think both of ways are fine...
So I don't see a reason to do a needless change
if @y0sher feels strongly about changing it we can discuss
@@ -15,7 +15,7 @@ func InvalidMsgType() tests.SpecTest { | |||
fullData, _ := obj.Encode() | |||
root, _ := qbft.HashDataRoot(fullData) | |||
msg := &qbft.Message{ | |||
MsgType: qbft.PrepareMsgType, //invalid, qbft.ProposeMsgType expected | |||
MsgType: qbft.PrepareMsgType, //invalid, qbft.ProposeMsgType expected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This happened automatically right?
We need to setup a formatting standard for Go for all Blox's projects. Once everyone will have the same settings we will see less of those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, automatically. agree
CommitteeIndex: 3, | ||
CommitteesAtSlot: 36, | ||
CommitteeLength: 128, | ||
ValidatorCommitteeIndex: 11, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will those numbers make sense for future forks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not affect future forks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If those fields are not used by our spec (and from my checks I believe there aren't) then I am not sure why we bother assigning them values.
I find adding code that looks somehow meaningful confusing.
I would delete this in another PR (because you copy-pasted existing logic, and we don't want to add changes here).
In the meanwhile add the following comment.
// ISSUE 233: We are initializing unused struct fields here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CommitteeIndex: 3, | ||
CommitteesAtSlot: 36, | ||
CommitteeLength: 128, | ||
ValidatorCommitteeIndex: 11, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
switch version { | ||
case spec.DataVersionBellatrix: | ||
duty.Slot = TestingDutySlot2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did you decide on this value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see new commits
@@ -52,7 +54,7 @@ var TestAggregatorConsensusDataByts, _ = TestAggregatorConsensusData.Encode() | |||
|
|||
var TestProposerConsensusData = &types.ConsensusData{ | |||
Duty: TestingProposerDuty, | |||
Version: spec2.DataVersionBellatrix, | |||
Version: spec.DataVersionBellatrix, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole file will be deleted and this is just temporary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file should not be deleted, there is a logic besides proposals
"github.com/bloxapp/ssv-spec/types" | ||
) | ||
|
||
var TestProposerConsensusDataV = func(version spec.DataVersion) *types.ConsensusData { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the functions in this file are currently being used in tests?
Meaning we can know they are ok since roots didn't change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the functions in this file are currently being used in tests?
almost, there is a function PreConsensusRandaoNoMsgV
that there is no usage for it in ssv_msgs as well
Meaning we can know they are ok since roots didn't change?
yes
return duty | ||
} | ||
|
||
var TestingProposerDutyNextEpochV = func(version spec.DataVersion) *types.Duty { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
Messages: []*types.SSVMessage{ | ||
testingutils.SSVMsgProposer(nil, invalidateSlot(testingutils.PostConsensusProposerMsg(ks.Shares[1], 1))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happened to the impl of the old invalidate slot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
msgF := func(obj *types.ConsensusData, id []byte) *qbft.SignedMessage { | ||
// change slot | ||
if len(obj.PreConsensusJustifications) > 0 { | ||
obj.PreConsensusJustifications[0].Message.Slot = testingutils.TestingDutySlot2 | ||
} | ||
return signedMsg(obj, id) | ||
} | ||
|
||
msgFV := func(obj *types.ConsensusData, id []byte) *qbft.SignedMessage { | ||
// change slot | ||
if len(obj.PreConsensusJustifications) > 0 { | ||
obj.PreConsensusJustifications[0].Message.Slot = testingutils.TestingInvalidDutySlotV(obj.Version) | ||
} | ||
return signedMsg(obj, id) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we still need both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
theoretically not, but if we want to keep the same design for all the versioned examples in current PR, so yes
"github.com/bloxapp/ssv-spec/types" | ||
) | ||
|
||
var SSVDecidingMsgsV = func(consensusData *types.ConsensusData, ks *TestKeySet, role types.BeaconRole) []*types.SSVMessage { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right that the description said all the V suffixed tests should have the "V" removed out of them, since they become the default only option.
However, we noticed that doing so will create lots of changes that will have to be reviewed, slowing us down farther.
So I will change the description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after reading the top msg, LGTM. approved.
So @y0sher and @alonmuroch In essence, @y0sher is correct. Since this is an infra PR, and in theory future forks can change data for any duty, we should have only versioned code now. However, let's take the following engineering principles into account:
So I am not sure if those changes should happen in this PR, or that they are even a priority. |
This PR adds support for different beacon blocks in tests.
Currently, only Bellatrix is supported, but Capella will be added in a future PR.
To support multiple beacon block versions, we have added versioned functions with a "V" suffix to the existing beacon_node/ssv_msgs/runner functions. This allows us to keep the original functions while also supporting new versions.
We have also added versioned tests for proposer functions to ensure that there are no changes in roots, which use the versioned functions. Once this PR is approved and merged, we will adjust all proposer tests to use the versioned functions in a separate PR and delete the duplicates.
Once all proposer/randao tests have been aligned with the versioned functions, we can
remove the "V" suffix anddelete the deprecated functions. This will help us maintain a more efficient and streamlined codebase going forward.