mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 13:28:01 -05:00
Add Fulu fork boilerplate (#14771)
* Prepare for future fork boilerplate. * Implement the Fulu fork boilerplate. * `Upgraded state to <fork> log`: Move from debug to info. Rationale: This log is the only one notifying the user a new fork happened. A new fork is always a little bit stressful for a node operator. Having at least one log indicating the client switched fork is something useful. * Update testing/util/helpers.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Fix Radek's comment. * Fix Radek's comment. * Update beacon-chain/state/state-native/state_trie.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update beacon-chain/state/state-native/state_trie.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Fix Radek's comment. * Fix Radek's comment. * Fix Radek's comment. * Remove Electra struct type aliasing. --------- Co-authored-by: Radosław Kapka <rkapka@wp.pl>
This commit is contained in:
@@ -65,7 +65,7 @@ func NewPreminedGenesis(ctx context.Context, t, nvals, pCreds uint64, version in
|
||||
|
||||
func (s *PremineGenesisConfig) prepare(ctx context.Context) (state.BeaconState, error) {
|
||||
switch s.Version {
|
||||
case version.Phase0, version.Altair, version.Bellatrix, version.Capella, version.Deneb, version.Electra:
|
||||
case version.Phase0, version.Altair, version.Bellatrix, version.Capella, version.Deneb, version.Electra, version.Fulu:
|
||||
default:
|
||||
return nil, errors.Wrapf(errUnsupportedVersion, "version=%s", version.String(s.Version))
|
||||
}
|
||||
@@ -159,6 +159,11 @@ func (s *PremineGenesisConfig) empty() (state.BeaconState, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case version.Fulu:
|
||||
e, err = state_native.InitializeFromProtoFulu(ðpb.BeaconStateFulu{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
default:
|
||||
return nil, errUnsupportedVersion
|
||||
}
|
||||
@@ -342,6 +347,8 @@ func (s *PremineGenesisConfig) setFork(g state.BeaconState) error {
|
||||
pv, cv = params.BeaconConfig().CapellaForkVersion, params.BeaconConfig().DenebForkVersion
|
||||
case version.Electra:
|
||||
pv, cv = params.BeaconConfig().DenebForkVersion, params.BeaconConfig().ElectraForkVersion
|
||||
case version.Fulu:
|
||||
pv, cv = params.BeaconConfig().ElectraForkVersion, params.BeaconConfig().FuluForkVersion
|
||||
default:
|
||||
return errUnsupportedVersion
|
||||
}
|
||||
@@ -563,6 +570,39 @@ func (s *PremineGenesisConfig) setLatestBlockHeader(g state.BeaconState) error {
|
||||
Consolidations: make([]*enginev1.ConsolidationRequest, 0),
|
||||
},
|
||||
}
|
||||
case version.Fulu:
|
||||
body = ðpb.BeaconBlockBodyFulu{
|
||||
RandaoReveal: make([]byte, 96),
|
||||
Eth1Data: ðpb.Eth1Data{
|
||||
DepositRoot: make([]byte, 32),
|
||||
BlockHash: make([]byte, 32),
|
||||
},
|
||||
Graffiti: make([]byte, 32),
|
||||
SyncAggregate: ðpb.SyncAggregate{
|
||||
SyncCommitteeBits: make([]byte, fieldparams.SyncCommitteeLength/8),
|
||||
SyncCommitteeSignature: make([]byte, fieldparams.BLSSignatureLength),
|
||||
},
|
||||
ExecutionPayload: &enginev1.ExecutionPayloadDeneb{
|
||||
ParentHash: make([]byte, 32),
|
||||
FeeRecipient: make([]byte, 20),
|
||||
StateRoot: make([]byte, 32),
|
||||
ReceiptsRoot: make([]byte, 32),
|
||||
LogsBloom: make([]byte, 256),
|
||||
PrevRandao: make([]byte, 32),
|
||||
ExtraData: make([]byte, 0),
|
||||
BaseFeePerGas: make([]byte, 32),
|
||||
BlockHash: make([]byte, 32),
|
||||
Transactions: make([][]byte, 0),
|
||||
Withdrawals: make([]*enginev1.Withdrawal, 0),
|
||||
},
|
||||
BlsToExecutionChanges: make([]*ethpb.SignedBLSToExecutionChange, 0),
|
||||
BlobKzgCommitments: make([][]byte, 0),
|
||||
ExecutionRequests: &enginev1.ExecutionRequests{
|
||||
Deposits: make([]*enginev1.DepositRequest, 0),
|
||||
Withdrawals: make([]*enginev1.WithdrawalRequest, 0),
|
||||
Consolidations: make([]*enginev1.ConsolidationRequest, 0),
|
||||
},
|
||||
}
|
||||
default:
|
||||
return errUnsupportedVersion
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ const (
|
||||
Capella
|
||||
Deneb
|
||||
Electra
|
||||
Fulu
|
||||
)
|
||||
|
||||
var versionToString = map[int]string{
|
||||
@@ -20,6 +21,7 @@ var versionToString = map[int]string{
|
||||
Capella: "capella",
|
||||
Deneb: "deneb",
|
||||
Electra: "electra",
|
||||
Fulu: "fulu",
|
||||
}
|
||||
|
||||
// stringToVersion and allVersions are populated in init()
|
||||
|
||||
Reference in New Issue
Block a user