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

[ePBS] implement UpdateVotesOnPayloadAttestation #14308

Merged
Merged
Show file tree
Hide file tree
Changes from 91 commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
a1fe2f8
Add protos for ePBS except state
potuz Jul 15, 2024
a03cf14
Add ePBS beacon state proto
potuz Jul 4, 2024
60168f2
ePBS configuration constants
potuz May 7, 2024
d17c681
Helper for Payload Attestation Signing (#13901)
potuz Jul 15, 2024
390c569
Add ePBS stuff to consensus-types: block
potuz Jul 30, 2024
a407537
Add testing utility methods to return randomly populated ePBS objects
potuz May 6, 2024
acbd2a1
Add ePBS to state (#13926)
potuz Jul 29, 2024
6ac3c2e
Implement get_ptc
potuz May 24, 2024
c9221c2
Add EPBS slashing params
potuz May 10, 2024
8d0799e
Add ePBS to db (#13971)
potuz Jul 4, 2024
de644f2
Fix GetPayloadTimelinessCommittee to return correct PTC size (#14012)
terencechain May 17, 2024
799e9a1
Change gwei math to primitives package for ePBS state
potuz Jul 4, 2024
f575470
use Keymanager() in validator client
potuz May 22, 2024
3f17a44
Add PTC assignment support for Duty endpoint (#14032)
potuz Jul 31, 2024
e45f414
Enable validator client to submit payload attestation message (#14064)
potuz Jul 15, 2024
a1c6919
Remove inclusion list from epbs (#14188)
potuz Jul 15, 2024
cc728c0
Modify `get_ptc` function to follow the Python spec (#14256)
jihoonsong Jul 23, 2024
4239f74
Add `remove_flag` and its unit test (#14260)
jihoonsong Jul 29, 2024
24fc61a
Ensure epbs state getters & setters check versions (#14276)
terencechain Jul 30, 2024
3dd1fa3
Use slot for latest message in forkchoice (#14279)
potuz Jul 31, 2024
4c04218
Add payload attestation helper functions (#14258)
jihoonsong Jul 31, 2024
ca85845
Use BeaconCommittees helper to get the ptc (#14286)
potuz Aug 1, 2024
63b72e1
Allow nodes with and without payload in forkchoice (#14288)
potuz Aug 2, 2024
27b1b7e
Read only payload attestation message with Verifier (#14222)
terencechain Aug 2, 2024
b2ad6e4
Broadcast signed execution payload header to peer (#14300)
terencechain Aug 5, 2024
130508a
Add `execution_payload` and `payload_attestation_message` topics (#14…
jihoonsong Aug 5, 2024
ffae017
Indexed paylaod attestation test (#14299)
Redidacove Aug 5, 2024
ae49842
Process Execution Payload Envelope in Chain Service (#14295)
potuz Aug 6, 2024
bbf24ee
Implement OnPayloadAttestationMessage; add setters and required fields
shyam-patel-kira Aug 6, 2024
a436dde
Update ptcVote from byte to primitives; update functions
shyam-patel-kira Aug 6, 2024
8e82c0f
Update fields in struct
shyam-patel-kira Aug 6, 2024
d6897a4
fix lint error: unnecessary conversion
shyam-patel-kira Aug 7, 2024
def6065
fix lint error: unnecessary conversion
shyam-patel-kira Aug 7, 2024
c70927b
organize code; move ptcVote to node from store
shyam-patel-kira Aug 7, 2024
7d406c6
add check to avoid computation if the payload boost is already applied
shyam-patel-kira Aug 8, 2024
592b9aa
cleanup
shyam-patel-kira Aug 8, 2024
7a51aec
update code to loop over bitfield
shyam-patel-kira Aug 8, 2024
5afc0c0
fix deepsource errors
shyam-patel-kira Aug 8, 2024
3ba6b82
use preset value instead of .len()
shyam-patel-kira Aug 8, 2024
02d34c0
Payload Attestation Sync package changes (#13989)
potuz Aug 8, 2024
639fc05
Merge branch 'epbs' of https://github.com/prysmaticlabs/prysm into ep…
shyam-patel-kira Aug 10, 2024
662ef84
change the name of the function; Add comprehensive comments
shyam-patel-kira Aug 10, 2024
15ef69a
Add comprehensive unit tests for updateVotes function
shyam-patel-kira Aug 10, 2024
b351f38
fix unused var
shyam-patel-kira Aug 12, 2024
cbce4ed
fix nits
shyam-patel-kira Aug 12, 2024
141ce2b
only updateBoosts onDemand
shyam-patel-kira Aug 12, 2024
05de4f3
handle potential equivocation
shyam-patel-kira Aug 13, 2024
44fedc5
Add protos for ePBS except state
potuz Jul 15, 2024
29a2ae4
Add ePBS beacon state proto
potuz Jul 4, 2024
d2f5d8f
ePBS configuration constants
potuz May 7, 2024
0cfd90e
Helper for Payload Attestation Signing (#13901)
potuz Jul 15, 2024
86bbfad
Add ePBS stuff to consensus-types: block
potuz Jul 30, 2024
3202277
Add testing utility methods to return randomly populated ePBS objects
potuz May 6, 2024
348195f
Add ePBS to state (#13926)
potuz Jul 29, 2024
3aa0eaa
Implement get_ptc
potuz May 24, 2024
88d74c7
Add EPBS slashing params
potuz May 10, 2024
9a84eaa
Add ePBS to db (#13971)
potuz Jul 4, 2024
8910964
Fix GetPayloadTimelinessCommittee to return correct PTC size (#14012)
terencechain May 17, 2024
1de2757
Change gwei math to primitives package for ePBS state
potuz Jul 4, 2024
1870842
use Keymanager() in validator client
potuz May 22, 2024
069b141
Add PTC assignment support for Duty endpoint (#14032)
potuz Jul 31, 2024
52d2413
Enable validator client to submit payload attestation message (#14064)
potuz Jul 15, 2024
8a6e90e
Remove inclusion list from epbs (#14188)
potuz Jul 15, 2024
e2a7cc8
Modify `get_ptc` function to follow the Python spec (#14256)
jihoonsong Jul 23, 2024
91edc1d
Add `remove_flag` and its unit test (#14260)
jihoonsong Jul 29, 2024
3e89433
Ensure epbs state getters & setters check versions (#14276)
terencechain Jul 30, 2024
56b0a9b
Use slot for latest message in forkchoice (#14279)
potuz Jul 31, 2024
ae438d0
Add payload attestation helper functions (#14258)
jihoonsong Jul 31, 2024
a0e8255
Use BeaconCommittees helper to get the ptc (#14286)
potuz Aug 1, 2024
ce4d561
Allow nodes with and without payload in forkchoice (#14288)
potuz Aug 2, 2024
e6cd1bd
Read only payload attestation message with Verifier (#14222)
terencechain Aug 2, 2024
7446bf0
Broadcast signed execution payload header to peer (#14300)
terencechain Aug 5, 2024
367791d
Add `execution_payload` and `payload_attestation_message` topics (#14…
jihoonsong Aug 5, 2024
04b1f33
Indexed paylaod attestation test (#14299)
Redidacove Aug 5, 2024
cefd895
Process Execution Payload Envelope in Chain Service (#14295)
potuz Aug 13, 2024
67f13a0
Payload Attestation Sync package changes (#13989)
potuz Aug 8, 2024
8f13f41
Add getter for payload attestation cache (#14328)
terencechain Aug 12, 2024
5b38115
Initialize payload att message verfier in sync (#14323)
terencechain Aug 12, 2024
f8c1ea2
Enable validator client to sign execution header (#14333)
terencechain Aug 12, 2024
74faa44
Process withdrawal (#14297)
Redidacove Aug 13, 2024
fefc3f2
Merge branch 'epbs' of https://github.com/prysmaticlabs/prysm into ep…
shyam-patel-kira Aug 13, 2024
f3f49f5
Update tests
shyam-patel-kira Aug 14, 2024
b19e892
Merge branch 'epbs' of https://github.com/prysmaticlabs/prysm into ep…
shyam-patel-kira Aug 14, 2024
ea83aa2
undo changes
shyam-patel-kira Aug 14, 2024
c7d5545
UpdateVote independent of timing; updatePayloadboosts if the block is…
shyam-patel-kira Aug 14, 2024
40155ad
fix deep source
shyam-patel-kira Aug 14, 2024
8db2160
remove timinng checks; move to onDemand payloadBoosts; update testCas…
shyam-patel-kira Aug 15, 2024
9598921
update errors and returns; update test cases for the changes
shyam-patel-kira Aug 15, 2024
add8dbe
fix deep source errors
shyam-patel-kira Aug 15, 2024
86f8b71
reduce cyclomatic complexity
shyam-patel-kira Aug 15, 2024
234524f
Merge branch 'epbs' of https://github.com/prysmaticlabs/prysm into ep…
shyam-patel-kira Aug 21, 2024
d8f85dc
Merge branch 'epbs' of https://github.com/prysmaticlabs/prysm into ep…
shyam-patel-kira Aug 22, 2024
4ece711
gazelle fix
shyam-patel-kira Aug 22, 2024
4640eff
remove a comment
shyam-patel-kira Aug 22, 2024
261a3dc
fix duplication in beacon-chain config
shyam-patel-kira Aug 26, 2024
41ac86d
Merge branch 'epbs' of https://github.com/prysmaticlabs/prysm into ep…
shyam-patel-kira Aug 26, 2024
48e0bef
fix config tests
shyam-patel-kira Aug 27, 2024
7b2e0bf
fast forward
shyam-patel-kira Aug 27, 2024
acf9238
fix number of config params
shyam-patel-kira Aug 27, 2024
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
60 changes: 60 additions & 0 deletions beacon-chain/forkchoice/doubly-linked-tree/forkchoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -721,3 +721,63 @@ func (f *ForkChoice) ParentRoot(root [32]byte) ([32]byte, error) {
}
return n.parent.root, nil
}

// UpdateVotesOnPayloadAttestation processes a new aggregated
// payload attestation message and updates
// the Payload Timeliness Committee (PTC) votes for the corresponding block.
// It may update payload boost roots based on the attestation data.
shyam-patel-kira marked this conversation as resolved.
Show resolved Hide resolved
func (s *Store) updateVotesOnPayloadAttestation(
payloadAttestation *ethpb.PayloadAttestation) error {
// Extract the attestation data and convert the beacon block root to a 32-byte array
data := payloadAttestation.Data
blockRoot := bytesutil.ToBytes32(data.BeaconBlockRoot)

// Check if the block exists in the store
node, ok := s.nodeByRoot[blockRoot]
if !ok || node == nil {
return ErrNilNode
}

shyam-patel-kira marked this conversation as resolved.
Show resolved Hide resolved
// Update the PTC votes based on the attestation
// We only set the vote if it hasn't been set before
// to handle potential equivocations
for i := uint64(0); i < fieldparams.PTCSize; i++ {
if payloadAttestation.AggregationBits.BitAt(i) && node.ptcVote[i] == primitives.PAYLOAD_ABSENT {
node.ptcVote[i] = data.PayloadStatus
}
}

return nil
}

// updatePayloadBoosts checks the PTC votes for a given node and updates
// the payload reveal and withhold boost roots if the necessary thresholds are met.
func (s *Store) updatePayloadBoosts(node *Node) {
presentCount := 0
withheldCount := 0

// Count the number of PRESENT and WITHHELD votes
for _, vote := range node.ptcVote {
if vote == primitives.PAYLOAD_PRESENT {
presentCount++
} else if vote == primitives.PAYLOAD_WITHHELD {
withheldCount++
}
}

// If the number of PRESENT votes exceeds the threshold,
// update the payload reveal boost root
if presentCount > int(params.BeaconConfig().PayloadTimelyThreshold) {
s.payloadRevealBoostRoot = node.root
shyam-patel-kira marked this conversation as resolved.
Show resolved Hide resolved
return
}
// If the number of WITHHELD votes exceeds the threshold,
// update the payload reveal boost root
if withheldCount > int(params.BeaconConfig().PayloadTimelyThreshold) {
if node.parent != nil {
s.payloadWithholdBoostRoot = node.parent.root
// A node is considered "full" if it has a non-zero payload hash
s.payloadWithholdBoostFull = node.parent.payloadHash != [32]byte{}
}
}
}
235 changes: 235 additions & 0 deletions beacon-chain/forkchoice/doubly-linked-tree/forkchoice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ import (
"testing"
"time"

"github.com/prysmaticlabs/go-bitfield"
"github.com/prysmaticlabs/prysm/v5/beacon-chain/forkchoice"
forkchoicetypes "github.com/prysmaticlabs/prysm/v5/beacon-chain/forkchoice/types"
"github.com/prysmaticlabs/prysm/v5/beacon-chain/state"
state_native "github.com/prysmaticlabs/prysm/v5/beacon-chain/state/state-native"
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
"github.com/prysmaticlabs/prysm/v5/config/params"
"github.com/prysmaticlabs/prysm/v5/consensus-types/blocks"
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
"github.com/prysmaticlabs/prysm/v5/crypto/hash"
"github.com/prysmaticlabs/prysm/v5/encoding/bytesutil"
enginev1 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1"
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/v5/testing/assert"
Expand Down Expand Up @@ -62,6 +65,14 @@ func prepareForkchoiceState(
return st, blockRoot, err
}

// Helper function to set all bits in a Bitvector512
func setAllBits(bv bitfield.Bitvector512) bitfield.Bitvector512 {
for i := 0; i < len(bv); i++ {
bv[i] = 0xFF
}
return bv
}

func TestForkChoice_UpdateBalancesPositiveChange(t *testing.T) {
f := setup(0, 0)
ctx := context.Background()
Expand Down Expand Up @@ -888,3 +899,227 @@ func TestForkchoiceParentRoot(t *testing.T) {
require.NoError(t, err)
require.Equal(t, zeroHash, root)
}

func TestStore_UpdateVotesOnPayloadAttestation(t *testing.T) {
tests := []struct {
name string
setupStore func(*Store)
payloadAttestation *ethpb.PayloadAttestation
wantErr bool
expectedPTCVotes []primitives.PTCStatus
expectedBoosts func(*Store) bool
}{
{
name: "Unknown block root",
setupStore: func(_ *Store) {},
payloadAttestation: &ethpb.PayloadAttestation{
Data: &ethpb.PayloadAttestationData{
BeaconBlockRoot: []byte{1, 2, 3},
},
},
wantErr: true,
},
{
name: "Update PTC votes - all present",
setupStore: func(s *Store) {
root := [32]byte{1, 2, 3}
s.nodeByRoot[root] = &Node{root: root, ptcVote: make([]primitives.PTCStatus, fieldparams.PTCSize)}
},
payloadAttestation: &ethpb.PayloadAttestation{
Data: &ethpb.PayloadAttestationData{
BeaconBlockRoot: []byte{1, 2, 3},
PayloadStatus: primitives.PAYLOAD_PRESENT,
},
AggregationBits: setAllBits(bitfield.NewBitvector512()),
},
expectedPTCVotes: func() []primitives.PTCStatus {
return makeVotes(fieldparams.PTCSize, primitives.PAYLOAD_PRESENT)
}(),
expectedBoosts: noBoosts,
},
{
name: "Update PTC votes - all withheld",
setupStore: func(s *Store) {
root := [32]byte{4, 5, 6}
s.nodeByRoot[root] = &Node{root: root, ptcVote: make([]primitives.PTCStatus, fieldparams.PTCSize)}
},
payloadAttestation: &ethpb.PayloadAttestation{
Data: &ethpb.PayloadAttestationData{
BeaconBlockRoot: []byte{4, 5, 6},
PayloadStatus: primitives.PAYLOAD_WITHHELD,
},
AggregationBits: setAllBits(bitfield.NewBitvector512()),
},
expectedPTCVotes: func() []primitives.PTCStatus {
return makeVotes(fieldparams.PTCSize, primitives.PAYLOAD_WITHHELD)
}(),
expectedBoosts: noBoosts,
},
{
name: "Update PTC votes - partial attestation",
setupStore: func(s *Store) {
root := [32]byte{7, 8, 9}
s.nodeByRoot[root] = &Node{root: root, ptcVote: make([]primitives.PTCStatus, fieldparams.PTCSize)}
},
payloadAttestation: &ethpb.PayloadAttestation{
Data: &ethpb.PayloadAttestationData{
BeaconBlockRoot: []byte{7, 8, 9},
PayloadStatus: primitives.PAYLOAD_PRESENT,
},
AggregationBits: func() bitfield.Bitvector512 {
bits := bitfield.NewBitvector512()
for i := 0; i < fieldparams.PTCSize/2; i++ {
bits.SetBitAt(uint64(i), true)
}
return bits
}(),
},
expectedPTCVotes: func() []primitives.PTCStatus {
votes := make([]primitives.PTCStatus, fieldparams.PTCSize)
for i := 0; i < fieldparams.PTCSize/2; i++ {
votes[i] = primitives.PAYLOAD_PRESENT
}
return votes
}(),
expectedBoosts: noBoosts,
},
{
name: "Update PTC votes - no change for already set votes",
setupStore: func(s *Store) {
root := [32]byte{10, 11, 12}
votes := make([]primitives.PTCStatus, fieldparams.PTCSize)
for i := range votes {
if i%2 == 0 {
votes[i] = primitives.PAYLOAD_PRESENT
}
}
s.nodeByRoot[root] = &Node{root: root, ptcVote: votes}
},
payloadAttestation: &ethpb.PayloadAttestation{
Data: &ethpb.PayloadAttestationData{
BeaconBlockRoot: []byte{10, 11, 12},
PayloadStatus: primitives.PAYLOAD_WITHHELD,
},
AggregationBits: setAllBits(bitfield.NewBitvector512()),
},
expectedPTCVotes: func() []primitives.PTCStatus {
votes := make([]primitives.PTCStatus, fieldparams.PTCSize)
for i := range votes {
if i%2 == 0 {
votes[i] = primitives.PAYLOAD_PRESENT
} else {
votes[i] = primitives.PAYLOAD_WITHHELD
}
}
return votes
}(),
expectedBoosts: noBoosts,
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
s := &Store{
nodeByRoot: make(map[[32]byte]*Node),
}
tt.setupStore(s)

err := s.updateVotesOnPayloadAttestation(tt.payloadAttestation)

if tt.wantErr {
require.ErrorIs(t, err, ErrNilNode, "Expected ErrNilNode")
} else {
require.NoError(t, err)
node := s.nodeByRoot[bytesutil.ToBytes32(tt.payloadAttestation.Data.BeaconBlockRoot)]
assert.DeepEqual(t, tt.expectedPTCVotes, node.ptcVote, "Unexpected PTC votes")
assert.Equal(t, tt.expectedBoosts(s), true, "Unexpected boost values")
}
})
}
}

func makeVotes(count int, status primitives.PTCStatus) []primitives.PTCStatus {
votes := make([]primitives.PTCStatus, fieldparams.PTCSize)
for i := 0; i < count; i++ {
votes[i] = status
}
return votes
}

func noBoosts(s *Store) bool {
return s.payloadRevealBoostRoot == [32]byte{} &&
s.payloadWithholdBoostRoot == [32]byte{} &&
!s.payloadWithholdBoostFull
}

func TestStore_UpdatePayloadBoosts(t *testing.T) {
tests := []struct {
name string
setupNode func(*Node)
expectedRevealBoost [32]byte
expectedWithholdBoost [32]byte
expectedWithholdFull bool
}{
{
name: "No boost",
setupNode: func(n *Node) {
n.ptcVote = make([]primitives.PTCStatus, fieldparams.PTCSize)
},
},
{
name: "Reveal boost",
setupNode: func(n *Node) {
n.root = [32]byte{1, 2, 3}
n.ptcVote = make([]primitives.PTCStatus, fieldparams.PTCSize)
for i := 0; i < int(params.BeaconConfig().PayloadTimelyThreshold)+1; i++ {
n.ptcVote[i] = primitives.PAYLOAD_PRESENT
}
},
expectedRevealBoost: [32]byte{1, 2, 3},
},
{
name: "Withhold boost",
setupNode: func(n *Node) {
n.ptcVote = make([]primitives.PTCStatus, fieldparams.PTCSize)
for i := 0; i < int(params.BeaconConfig().PayloadTimelyThreshold)+1; i++ {
n.ptcVote[i] = primitives.PAYLOAD_WITHHELD
}
n.parent = &Node{root: [32]byte{4, 5, 6}, payloadHash: [32]byte{7, 8, 9}}
},
expectedWithholdBoost: [32]byte{4, 5, 6},
expectedWithholdFull: true,
},
{
name: "Reveal boost with early return",
setupNode: func(n *Node) {
n.root = [32]byte{1, 2, 3}
n.ptcVote = make([]primitives.PTCStatus, fieldparams.PTCSize)
for i := 0; i < int(params.BeaconConfig().PayloadTimelyThreshold)+1; i++ {
n.ptcVote[i] = primitives.PAYLOAD_PRESENT
}
// Set up conditions for withhold boost, which should not be applied due to early return
n.parent = &Node{root: [32]byte{4, 5, 6}, payloadHash: [32]byte{7, 8, 9}}
for i := int(params.BeaconConfig().PayloadTimelyThreshold) + 1; i < fieldparams.PTCSize; i++ {
n.ptcVote[i] = primitives.PAYLOAD_WITHHELD
}
},
expectedRevealBoost: [32]byte{1, 2, 3},
expectedWithholdBoost: [32]byte{}, // Should remain zero due to early return
expectedWithholdFull: false, // Should remain false due to early return
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
s := &Store{}
n := &Node{}
tt.setupNode(n)

s.updatePayloadBoosts(n)

assert.Equal(t, tt.expectedRevealBoost, s.payloadRevealBoostRoot, "Unexpected reveal boost root")
assert.Equal(t, tt.expectedWithholdBoost, s.payloadWithholdBoostRoot, "Unexpected withhold boost root")
assert.Equal(t, tt.expectedWithholdFull, s.payloadWithholdBoostFull, "Unexpected withhold full status")
})
}
}
4 changes: 4 additions & 0 deletions beacon-chain/forkchoice/doubly-linked-tree/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ type Store struct {
highestReceivedNode *Node // The highest slot node.
receivedBlocksLastEpoch [fieldparams.SlotsPerEpoch]primitives.Slot // Using `highestReceivedSlot`. The slot of blocks received in the last epoch.
allTipsAreInvalid bool // tracks if all tips are not viable for head
payloadWithholdBoostRoot [fieldparams.RootLength]byte // the root of the block that receives the withhold boost
payloadWithholdBoostFull bool // Indicator of whether the block receiving the withhold boost is full or empty
payloadRevealBoostRoot [fieldparams.RootLength]byte // the root of the block that receives the reveal boost
}

// Node defines the individual block which includes its block parent, ancestor and how much weight accounted for it.
Expand All @@ -61,6 +64,7 @@ type Node struct {
bestDescendant *Node // bestDescendant node of this node.
optimistic bool // whether the block has been fully validated or not
timestamp uint64 // The timestamp when the node was inserted.
ptcVote []primitives.PTCStatus // tracks the Payload Timeliness Committee (PTC) votes for the node
}

// Vote defines an individual validator's vote.
Expand Down
1 change: 1 addition & 0 deletions config/fieldparams/mainnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const (
SlashingsLength = 8192 // EPOCHS_PER_SLASHINGS_VECTOR
SyncCommitteeLength = 512 // SYNC_COMMITTEE_SIZE
PTCSize = 512 // PTC_SIZE [New in ePBS]
PayloadTimelyThreshold = 256 // PTC_SIZE / 2 [New in ePBS]
RootLength = 32 // RootLength defines the byte length of a Merkle root.
BLSSignatureLength = 96 // BLSSignatureLength defines the byte length of a BLSSignature.
BLSPubkeyLength = 48 // BLSPubkeyLength defines the byte length of a BLSSignature.
Expand Down
5 changes: 5 additions & 0 deletions config/params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,15 @@ type BeaconChainConfig struct {

// Fork choice algorithm constants.
ProposerScoreBoost uint64 `yaml:"PROPOSER_SCORE_BOOST" spec:"true"` // ProposerScoreBoost defines a value that is a % of the committee weight for fork-choice boosting.
ProposerScoreBoostEPBS uint64 `yaml:"PROPOSER_SCORE_BOOST_EPBS" spec:"true"` // ProposerScoreBoostEPBS defines a value that is a % of the committee weight for fork-choice boosting.
ReorgWeightThreshold uint64 `yaml:"REORG_WEIGHT_THRESHOLD" spec:"true"` // ReorgWeightThreshold defines a value that is a % of the committee weight to consider a block weak and subject to being orphaned.
ReorgParentWeightThreshold uint64 `yaml:"REORG_PARENT_WEIGHT_THRESHOLD" spec:"true"` // ReorgParentWeightThreshold defines a value that is a % of the committee weight to consider a parent block strong and subject its child to being orphaned.
ReorgMaxEpochsSinceFinalization primitives.Epoch `yaml:"REORG_MAX_EPOCHS_SINCE_FINALIZATION" spec:"true"` // This defines a limit to consider safe to orphan a block if the network is finalizing
IntervalsPerSlot uint64 `yaml:"INTERVALS_PER_SLOT" spec:"true"` // IntervalsPerSlot defines the number of fork choice intervals in a slot defined in the fork choice spec.
IntervalsPerSlotEPBS uint64 `yaml:"INTERVALS_PER_SLOT_EPBS" spec:"true"` // IntervalsPerSlotEPBS defines the number of fork choice intervals in a slot defined in the fork choice spec from EIP-7732.
PayloadWithholdBoost uint64 `yaml:"PAYLOAD_WITHHOLD_BOOST" spec:"true"` // PayloadWithholdBoost define a value that is the score boost given when a payload is withheld by the builder
PayloadRevealBoost uint64 `yaml:"PAYLOAD_REVEAL_BOOST" spec:"true"` // PayloadRevealBoost a value that is the score boost given when a payload is revealed by the builder
PayloadTimelyThreshold uint64 `yaml:"PAYLOAD_REVEAL_BOOST" spec:"true"` // PayloadTimelyThreshold is the threshold for considering a payload timely.

// Ethereum PoW parameters.
DepositChainID uint64 `yaml:"DEPOSIT_CHAIN_ID" spec:"true"` // DepositChainID of the eth1 network. This used for replay protection.
Expand Down
7 changes: 6 additions & 1 deletion config/params/mainnet_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,15 @@ var mainnetBeaconConfig = &BeaconChainConfig{

// Fork choice algorithm constants.
ProposerScoreBoost: 40,
ProposerScoreBoostEPBS: 20,
ReorgWeightThreshold: 20,
ReorgParentWeightThreshold: 160,
ReorgMaxEpochsSinceFinalization: 2,
IntervalsPerSlot: 3,
IntervalsPerSlotEPBS: 4,
PayloadWithholdBoost: 40,
PayloadRevealBoost: 40,
PayloadTimelyThreshold: 256, // PTC_SIZE / 2.

// Ethereum PoW parameters.
DepositChainID: 1, // Chain ID of eth1 mainnet.
Expand Down Expand Up @@ -247,7 +252,7 @@ var mainnetBeaconConfig = &BeaconChainConfig{
EpochsPerSyncCommitteePeriod: 256,

// Updated penalty values.
InactivityPenaltyQuotientAltair: 3 * 1 << 24, //50331648
InactivityPenaltyQuotientAltair: 3 * 1 << 24, // 50331648
shyam-patel-kira marked this conversation as resolved.
Show resolved Hide resolved
MinSlashingPenaltyQuotientAltair: 64,
ProportionalSlashingMultiplierAltair: 2,
MinSlashingPenaltyQuotientBellatrix: 32,
Expand Down
Loading