Skip to content

Commit

Permalink
fix execution header proof
Browse files Browse the repository at this point in the history
  • Loading branch information
claravanstaden committed Jan 15, 2025
1 parent 8fc7910 commit 6104059
Show file tree
Hide file tree
Showing 13 changed files with 585 additions and 819 deletions.
2 changes: 1 addition & 1 deletion relayer/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func Build() {
}

func BuildMain() error {
err := sh.Run("sszgen", "--path", "relays/beacon/state", "--objs", "BeaconStateCapellaMainnet,BlockRootsContainerMainnet,TransactionsRootContainer,BeaconBlockCapellaMainnet,WithdrawalsRootContainerMainnet,BeaconStateDenebMainnet,BeaconBlockDenebMainnet,BeaconStateElectra,BeaconBlockElectra,DepositRequestsContainer,WithdrawalRequestsContainer,ConsolidationRequestsContainer")
err := sh.Run("sszgen", "--path", "relays/beacon/state", "--objs", "BeaconStateCapellaMainnet,BlockRootsContainerMainnet,TransactionsRootContainer,BeaconBlockCapellaMainnet,WithdrawalsRootContainerMainnet,BeaconStateDenebMainnet,BeaconBlockDenebMainnet,SignedBeaconBlockDeneb,SignedBeaconBlockElectra,BeaconStateElectra,BeaconBlockElectra,DepositRequestsContainer,WithdrawalRequestsContainer,ConsolidationRequestsContainer")
if err != nil {
return err
}
Expand Down
29 changes: 29 additions & 0 deletions relayer/relays/beacon/header/syncer/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type BeaconAPI interface {
GetBeaconBlockBySlot(slot uint64) (BeaconBlockResponse, error)
GetBeaconBlockRoot(slot uint64) (common.Hash, error)
GetBeaconBlock(blockID common.Hash) (BeaconBlockResponse, error)
GetBeaconBlockBytes(blockID common.Hash) ([]byte, error)
GetSyncCommitteePeriodUpdate(from uint64) (SyncCommitteePeriodUpdateResponse, error)
GetLatestFinalizedUpdate() (LatestFinalisedUpdateResponse, error)
GetBeaconState(stateIdOrSlot string) ([]byte, error)
Expand Down Expand Up @@ -436,3 +437,31 @@ func (b *BeaconClient) GetBeaconState(stateIdOrSlot string) ([]byte, error) {
data = buf.Bytes()
return data, nil
}

func (b *BeaconClient) GetBeaconBlockBytes(blockID common.Hash) ([]byte, error) {
var data []byte
req, err := http.NewRequest("GET", fmt.Sprintf("%s/eth/v2/beacon/blocks/%s", b.stateEndpoint, blockID), nil)
if err != nil {
return data, err
}

req.Header.Add("Accept", "application/octet-stream")

res, err := b.httpClient.Do(req)
if err != nil {
return data, err
}

if res.StatusCode != http.StatusOK {
if res.StatusCode == 404 {
return data, ErrNotFound
}

return data, fmt.Errorf("%s: %d", DoHTTPRequestErrorMessage, res.StatusCode)
}

buf := new(bytes.Buffer)
buf.ReadFrom(res.Body)
data = buf.Bytes()
return data, nil
}
80 changes: 0 additions & 80 deletions relayer/relays/beacon/header/syncer/api/api_electra.go

This file was deleted.

Loading

0 comments on commit 6104059

Please sign in to comment.