-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Implement consensus spec v1.5.0-alpha.10 #14733
Conversation
02dd398
to
8d74f95
Compare
if effectiveBal*maxRandomByte >= maxEB*uint64(randomByte) { | ||
cIndices = append(cIndices, cIndex) | ||
|
||
if s.Version() >= version.Electra { |
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 change is related to: ethereum/consensus-specs#4039
We defer fieldparams for MaxRandomByte
as single source of truth
beacon-chain/core/blocks/payload.go
Outdated
@@ -233,8 +233,14 @@ func verifyBlobCommitmentCount(body interfaces.ReadOnlyBeaconBlockBody) error { | |||
if err != nil { | |||
return err | |||
} | |||
if len(kzgs) > field_params.MaxBlobsPerBlock { | |||
return fmt.Errorf("too many kzg commitments in block: %d", len(kzgs)) | |||
if body.Version() >= version.Electra { |
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 change is related to: ethereum/consensus-specs#4023
It's a place holder to make sure we can pass spec test, it'll be superseded by #14678
@@ -78,7 +77,7 @@ func ProcessPendingConsolidations(ctx context.Context, st state.BeaconState) err | |||
if err != nil { | |||
return err | |||
} | |||
b := min(validatorBalance, helpers.ValidatorMaxEffectiveBalance(sourceValidator)) | |||
b := min(validatorBalance, sourceValidator.EffectiveBalance()) |
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 is related to: ethereum/consensus-specs#4040
Also updated spec test above
@@ -217,6 +217,7 @@ func TestSlashValidator_OK(t *testing.T) { | |||
} | |||
|
|||
func TestSlashValidator_Electra(t *testing.T) { | |||
helpers.ClearCache() |
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.
Running TestSlashValidator_Electra
by itself passes but running the entire package will fail because previous test uses cache. This wasn't an issue before but now becomes an issue because shuffling is different after Electra
@@ -253,7 +248,7 @@ func ProcessConsolidationRequests(ctx context.Context, st state.BeaconState, req | |||
} | |||
|
|||
// Target validator must have their withdrawal credentials set appropriately. | |||
if !helpers.HasExecutionWithdrawalCredentials(tgtV) { | |||
if !helpers.HasCompoundingWithdrawalCredential(tgtV) { |
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 is related to ethereum/consensus-specs#4020
533e5a7
to
bca3668
Compare
Fix tests Fix tests
Fix test stream events by properly set effective balance
randomByteSlice := bytesutil.PadTo(randomByte[offset:offset+2], 8) | ||
randomValue := binary.LittleEndian.Uint64(randomByteSlice) |
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.
A matter of taste but I kinda read better this without the allocation
randomValue := uint64(randomByte[offset]) | uint64(randomByte[offset+1])<<8
// Use the preallocated seed buffer | ||
binary.LittleEndian.PutUint64(seedBuffer[len(seed):], uint64(i/32)) | ||
randomByte := hashFunc(seedBuffer)[i%32] | ||
if effectiveBal*fieldparams.MaxRandomValue >= cfg.MaxEffectiveBalance*uint64(randomByte) { |
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 this be MaxRandomByte?
if effectiveBal*fieldparams.MaxRandomValue >= cfg.MaxEffectiveBalance*uint64(randomByte) { | |
if effectiveBal*maxRandomByte >= cfg.MaxEffectiveBalance*uint64(randomByte) { |
84d6500
to
54f9df0
Compare
54f9df0
to
aee1467
Compare
Fix tests Fix tests
Fix test stream events by properly set effective balance
aee1467
to
1a49d61
Compare
CHANGELOG.md
Outdated
@@ -82,6 +82,7 @@ Notable features: | |||
- Save light client updates and bootstraps in DB. | |||
- Added more comprehensive tests for `BlockToLightClientHeader`. [PR](https://github.com/prysmaticlabs/prysm/pull/14699) | |||
- Added light client feature flag check to RPC handlers. [PR](https://github.com/prysmaticlabs/prysm/pull/14736) | |||
- Add field param placeholder for Electra blob target and max to pass spec tests. |
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.
Please add this to the unreleased section
CHANGELOG.md
Outdated
- Enforce Compound prefix (0x02) for target when processing pending consolidation request. | ||
- Limit consolidating by validator's effective balance. | ||
- Use 16-bit random value for proposer and sync committee selection filter. |
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.
Please add this to the unreleased section
@@ -20,7 +20,7 @@ func createValidatorsWithTotalActiveBalance(totalBal primitives.Gwei) []*eth.Val | |||
vals := make([]*eth.Validator, num) | |||
for i := range vals { | |||
wd := make([]byte, 32) | |||
wd[0] = params.BeaconConfig().ETH1AddressWithdrawalPrefixByte |
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 seems unexpected. Why is it changed?
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.
Related to: ethereum/consensus-specs#4020
In latest spec, consolidation is only allowed if validator has 0x02
…nto alpha10-spec-tests
1145786
This PR implements the following changes to the consensus spec. To ensure clarity and smooth review, I will add comments referencing the specific consensus spec changes, making it easy to follow: