-
Notifications
You must be signed in to change notification settings - Fork 159
Fulu #1592
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
Fulu #1592
Changes from 12 commits
5563dc4
d2e2a66
4a61b5f
daa1532
00050f1
f28b9c6
9b4ed31
1d248df
e4c1493
b9d1cfd
391d2ed
eea19fd
3f5b1d9
ef0021f
5c030d2
dfa861b
aca0dbc
14a86ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,46 +81,57 @@ type ForkVersion string | |
| const ( | ||
| Deneb ForkVersion = "Deneb" | ||
| Electra ForkVersion = "Electra" | ||
| Fulu ForkVersion = "Fulu" | ||
| ) | ||
|
|
||
| func (p *Protocol) ForkVersion(slot uint64) ForkVersion { | ||
| epoch := p.ComputeEpochAtSlot(slot) | ||
| fv := Deneb | ||
| if epoch >= p.Settings.ForkVersions.Fulu { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The order of this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch, fixed in 3f5b1d9. |
||
| fv = Fulu | ||
| } | ||
| if epoch >= p.Settings.ForkVersions.Electra { | ||
| return Electra | ||
| fv = Electra | ||
| } | ||
| return Deneb | ||
| log.WithField("fork_version", fv).Info("Found fork version") | ||
|
claravanstaden marked this conversation as resolved.
Outdated
|
||
| return fv | ||
| } | ||
|
|
||
| func (p *Protocol) BlockRootGeneralizedIndex(slot uint64) int { | ||
| if p.ForkVersion(slot) == Electra { | ||
| forkVersion := p.ForkVersion(slot) | ||
| if forkVersion == Fulu || forkVersion == Electra { | ||
| return ElectraBlockRootGeneralizedIndex | ||
| } | ||
| return AltairBlockRootGeneralizedIndex | ||
| } | ||
|
|
||
| func (p *Protocol) FinalizedCheckpointGeneralizedIndex(slot uint64) int { | ||
| if p.ForkVersion(slot) == Electra { | ||
| forkVersion := p.ForkVersion(slot) | ||
| if forkVersion == Fulu || forkVersion == Electra { | ||
| return ElectraFinalizedCheckpointGeneralizedIndex | ||
| } | ||
| return AltairFinalizedCheckpointGeneralizedIndex | ||
| } | ||
|
|
||
| func (p *Protocol) CurrentSyncCommitteeGeneralizedIndex(slot uint64) int { | ||
| if p.ForkVersion(slot) == Electra { | ||
| forkVersion := p.ForkVersion(slot) | ||
| if forkVersion == Fulu || forkVersion == Electra { | ||
| return ElectraCurrentSyncCommitteeGeneralizedIndex | ||
| } | ||
| return AltairCurrentSyncCommitteeGeneralizedIndex | ||
| } | ||
|
|
||
| func (p *Protocol) NextSyncCommitteeGeneralizedIndex(slot uint64) int { | ||
| if p.ForkVersion(slot) == Electra { | ||
| forkVersion := p.ForkVersion(slot) | ||
| if forkVersion == Fulu || forkVersion == Electra { | ||
| return ElectraNextSyncCommitteeGeneralizedIndex | ||
| } | ||
| return AltairNextSyncCommitteeGeneralizedIndex | ||
| } | ||
|
|
||
| func (p *Protocol) ExecutionPayloadGeneralizedIndex(slot uint64) int { | ||
| if p.ForkVersion(slot) == Electra { | ||
| forkVersion := p.ForkVersion(slot) | ||
| if forkVersion == Fulu || forkVersion == Electra { | ||
| return ElectraExecutionPayloadGeneralizedIndex | ||
| } | ||
| return AltairExecutionPayloadGeneralizedIndex | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| package state | ||
|
|
||
| type BeaconStateFulu struct { | ||
| GenesisTime uint64 `json:"genesis_time"` | ||
| GenesisValidatorsRoot []byte `json:"genesis_validators_root" ssz-size:"32"` | ||
| Slot uint64 `json:"slot"` | ||
| Fork *Fork `json:"fork"` | ||
| LatestBlockHeader *BeaconBlockHeader `json:"latest_block_header"` | ||
| BlockRoots [][]byte `json:"block_roots" ssz-size:"8192,32"` | ||
| StateRoots [][]byte `json:"state_roots" ssz-size:"8192,32"` | ||
| HistoricalRoots [][]byte `json:"historical_roots" ssz-max:"16777216" ssz-size:"?,32"` | ||
| Eth1Data *Eth1Data `json:"eth1_data"` | ||
| Eth1DataVotes []*Eth1Data `json:"eth1_data_votes" ssz-max:"2048"` | ||
| Eth1DepositIndex uint64 `json:"eth1_deposit_index"` | ||
| Validators []*Validator `json:"validators" ssz-max:"1099511627776"` | ||
| Balances []uint64 `json:"balances" ssz-max:"1099511627776"` | ||
| RandaoMixes [][]byte `json:"randao_mixes" ssz-size:"65536,32"` | ||
| Slashings []uint64 `json:"slashings" ssz-size:"8192"` | ||
| PreviousEpochParticipation []byte `json:"previous_epoch_participation" ssz-max:"1099511627776"` | ||
| CurrentEpochParticipation []byte `json:"current_epoch_participation" ssz-max:"1099511627776"` | ||
| JustificationBits []byte `json:"justification_bits" cast-type:"github.com/prysmaticlabs/go-bitfield.Bitvector4" ssz-size:"1"` | ||
| PreviousJustifiedCheckpoint *Checkpoint `json:"previous_justified_checkpoint"` | ||
| CurrentJustifiedCheckpoint *Checkpoint `json:"current_justified_checkpoint"` | ||
| FinalizedCheckpoint *Checkpoint `json:"finalized_checkpoint"` | ||
| InactivityScores []uint64 `json:"inactivity_scores" ssz-max:"1099511627776"` | ||
| CurrentSyncCommittee *SyncCommittee `json:"current_sync_committee"` | ||
| NextSyncCommittee *SyncCommittee `json:"next_sync_committee"` | ||
| LatestExecutionPayloadHeader *ExecutionPayloadHeaderDeneb `json:"latest_execution_payload_header"` | ||
| NextWithdrawalIndex uint64 `json:"next_withdrawal_index,omitempty"` | ||
| NextWithdrawalValidatorIndex uint64 `json:"next_withdrawal_validator_index,omitempty"` | ||
| HistoricalSummaries []*HistoricalSummary `json:"historical_summaries,omitempty" ssz-max:"16777216"` | ||
| DepositRequestsStartIndex uint64 `json:"deposit_requests_start_index,omitempty"` | ||
| DepositBalanceToConsume uint64 `json:"deposit_balance_to_consume,omitempty"` | ||
| ExitBalanceToConsume uint64 `json:"exit_balance_to_consume,omitempty"` | ||
| EarliestExitEpoch uint64 `json:"earliest_exit_epoch,omitempty"` | ||
| ConsolidationBalanceToConsume uint64 `json:"consolidation_balance_to_consume,omitempty"` | ||
| EarliestConsolidationEpoch uint64 `json:"earliest_consolidation_epoch,omitempty"` | ||
| PendingDeposits []*PendingDeposit `json:"pending_deposits,omitempty" ssz-max:"134217728"` | ||
| PendingPartialWithdrawals []*PendingPartialWithdrawal `json:"pending_partial_withdrawals,omitempty" ssz-max:"134217728"` | ||
| PendingConsolidations []*PendingConsolidation `json:"pending_consolidations,omitempty" ssz-max:"262144"` | ||
| ProposerLookahead []uint64 `json:"proposer_lookahead,omitempty" ssz-size:"64"` // New in Fulu:EIP7917 | ||
| } | ||
|
|
||
| func (b *BeaconStateFulu) GetSlot() uint64 { | ||
| return b.Slot | ||
| } | ||
|
|
||
| func (b *BeaconStateFulu) GetLatestBlockHeader() *BeaconBlockHeader { | ||
| return b.LatestBlockHeader | ||
| } | ||
|
|
||
| func (b *BeaconStateFulu) GetBlockRoots() [][]byte { | ||
| return b.BlockRoots | ||
| } | ||
|
|
||
| func (b *BeaconStateFulu) SetBlockRoots(blockRoots [][]byte) { | ||
| b.BlockRoots = blockRoots | ||
| } | ||
|
|
||
| func (b *BeaconStateFulu) GetFinalizedCheckpoint() *Checkpoint { | ||
| return b.FinalizedCheckpoint | ||
| } | ||
|
|
||
| func (b *BeaconStateFulu) GetNextSyncCommittee() *SyncCommittee { | ||
| return b.NextSyncCommittee | ||
| } | ||
| func (b *BeaconStateFulu) GetCurrentSyncCommittee() *SyncCommittee { | ||
| return b.CurrentSyncCommittee | ||
| } |
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.
nit: Golang guidelines suggest that this should be named
forkVersions()instead. The suggestion is to drop thegetprefix for getters