Skip to content

Commit

Permalink
Add Badger Hardfork: BeaconStateBadger, BeaconBlockBadger (#74)
Browse files Browse the repository at this point in the history
* Add missing fork version/epoch

* Skipping the failing assertion: will be fixed in the next PR

* Add type alias: BeaconStateBadger

* Add upgrade to Badger

* Add badger key in db/kv & Add arm for badger in marshalling state

* Add badger state for api/server/structs

* Add missing state related things

* Add HackForksMaxuint for test

* Add badger for debug/handlers.go

* Add badger for testing/util/attestation.go

* Fix test: TestReplayBlocks_ThroughFutureForkBoundaries

* Fix TestHostIsResolved: IP was changed

* Add object mapping for badger

* Add BeaconBlock type in Badger: re-define in Badger

* Add badger for consensus-types package

* Add badger for encoding/ssz/detect package

* Fix TestHostIsResolved: this test is dependent to example.org

* Add NewBeaconBlockBadger series in testing/merge.go

* Add NewBeaconBlockBadger series in testing/util/block.go

* Add Badger for runtime/interop/premine-state.go

* Add Badger for beacon-chain/db/kv

* Add alias for beacon-chain/rpc/eth/shared/testing/json.go

* Add badger for beacon-chain/sync package

* Add badger for beacon-chain/rpc/eth/validator package

* Add badger for beacon-chain/p2p package

* Add badger for testing/util folder

* Add badger for beacon-chain/execution package

* Add badger for beacon-chain/rpc/prysm/v1alpha1/validator package

* Add badger for api/server/structs package

* Add badger for beacon-chain/rpc/eth/beacon package

* Add badger for validator/client package

* Use badger for blinded blocks

* Empty commit for triggering CI

* Remove eth/v2 things

* Gofmt
  • Loading branch information
syjn99 authored Feb 4, 2025
1 parent ec7d47c commit ee0f13e
Show file tree
Hide file tree
Showing 79 changed files with 9,180 additions and 2,434 deletions.
86 changes: 86 additions & 0 deletions api/server/structs/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,92 @@ type BlindedBeaconBlockBodyElectra struct {
ExecutionRequests *ExecutionRequests `json:"execution_requests"`
}

type SignedBeaconBlockContentsBadger struct {
SignedBlock *SignedBeaconBlockBadger `json:"signed_block"`
KzgProofs []string `json:"kzg_proofs"`
Blobs []string `json:"blobs"`
}

type BeaconBlockContentsBadger struct {
Block *BeaconBlockBadger `json:"block"`
KzgProofs []string `json:"kzg_proofs"`
Blobs []string `json:"blobs"`
}

type SignedBeaconBlockBadger struct {
Message *BeaconBlockBadger `json:"message"`
Signature string `json:"signature"`
}

var _ SignedMessageJsoner = &SignedBeaconBlockBadger{}

func (s *SignedBeaconBlockBadger) MessageRawJson() ([]byte, error) {
return json.Marshal(s.Message)
}

func (s *SignedBeaconBlockBadger) SigString() string {
return s.Signature
}

type BeaconBlockBadger struct {
Slot string `json:"slot"`
ProposerIndex string `json:"proposer_index"`
ParentRoot string `json:"parent_root"`
StateRoot string `json:"state_root"`
Body *BeaconBlockBodyBadger `json:"body"`
}

type BeaconBlockBodyBadger struct {
RandaoReveal string `json:"randao_reveal"`
Eth1Data *Eth1Data `json:"eth1_data"`
Graffiti string `json:"graffiti"`
ProposerSlashings []*ProposerSlashing `json:"proposer_slashings"`
AttesterSlashings []*AttesterSlashingElectra `json:"attester_slashings"`
Attestations []*AttestationElectra `json:"attestations"`
Deposits []*Deposit `json:"deposits"`
VoluntaryExits []*SignedVoluntaryExit `json:"voluntary_exits"`
ExecutionPayload *ExecutionPayloadDeneb `json:"execution_payload"`
BlobKzgCommitments []string `json:"blob_kzg_commitments"`
ExecutionRequests *ExecutionRequests `json:"execution_requests"`
}

type BlindedBeaconBlockBadger struct {
Slot string `json:"slot"`
ProposerIndex string `json:"proposer_index"`
ParentRoot string `json:"parent_root"`
StateRoot string `json:"state_root"`
Body *BlindedBeaconBlockBodyBadger `json:"body"`
}

type SignedBlindedBeaconBlockBadger struct {
Message *BlindedBeaconBlockBadger `json:"message"`
Signature string `json:"signature"`
}

var _ SignedMessageJsoner = &SignedBlindedBeaconBlockBadger{}

func (s *SignedBlindedBeaconBlockBadger) MessageRawJson() ([]byte, error) {
return json.Marshal(s.Message)
}

func (s *SignedBlindedBeaconBlockBadger) SigString() string {
return s.Signature
}

type BlindedBeaconBlockBodyBadger struct {
RandaoReveal string `json:"randao_reveal"`
Eth1Data *Eth1Data `json:"eth1_data"`
Graffiti string `json:"graffiti"`
ProposerSlashings []*ProposerSlashing `json:"proposer_slashings"`
AttesterSlashings []*AttesterSlashingElectra `json:"attester_slashings"`
Attestations []*AttestationElectra `json:"attestations"`
Deposits []*Deposit `json:"deposits"`
VoluntaryExits []*SignedVoluntaryExit `json:"voluntary_exits"`
ExecutionPayloadHeader *ExecutionPayloadHeaderDeneb `json:"execution_payload_header"`
BlobKzgCommitments []string `json:"blob_kzg_commitments"`
ExecutionRequests *ExecutionRequests `json:"execution_requests"`
}

type SignedBeaconBlockHeaderContainer struct {
Header *SignedBeaconBlockHeader `json:"header"`
Root string `json:"root"`
Expand Down
Loading

0 comments on commit ee0f13e

Please sign in to comment.