Skip to content

Commit eb1b85d

Browse files
authored
Merge pull request #27 from Inphi/eip-4844-devnet-2
2 parents e4cae54 + a3be962 commit eb1b85d

File tree

9 files changed

+107
-70
lines changed

9 files changed

+107
-70
lines changed

beacon-chain/rpc/apimiddleware/custom_hooks.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -440,13 +440,9 @@ type tempBlobsSidecarJson struct {
440440
AggregatedProof string `json:"kzg_aggregated_proof"`
441441
}
442442

443-
type tempBlobsResponseJson struct {
444-
Data tempBlobsSidecarJson `json:"data"`
445-
}
446-
447443
// This takes the blobs list and exposes the data field of each blob as the blob content itself in the json
448444
func prepareBlobsResponse(body []byte, responseContainer interface{}) (apimiddleware.RunDefault, apimiddleware.ErrorJson) {
449-
tempContainer := &tempBlobsResponseJson{}
445+
tempContainer := &tempBlobsSidecarJson{}
450446
if err := json.Unmarshal(body, tempContainer); err != nil {
451447
return false, apimiddleware.InternalServerErrorWithMessage(err, "could not unmarshal response into temp container")
452448
}
@@ -456,12 +452,12 @@ func prepareBlobsResponse(body []byte, responseContainer interface{}) (apimiddle
456452
}
457453

458454
container.Data = &blobsSidecarJson{
459-
BeaconBlockRoot: tempContainer.Data.BeaconBlockRoot,
460-
BeaconBlockSlot: tempContainer.Data.BeaconBlockSlot,
461-
Blobs: make([]string, len(tempContainer.Data.Blobs)),
462-
AggregatedProof: tempContainer.Data.AggregatedProof,
455+
BeaconBlockRoot: tempContainer.BeaconBlockRoot,
456+
BeaconBlockSlot: tempContainer.BeaconBlockSlot,
457+
Blobs: make([]string, len(tempContainer.Blobs)),
458+
AggregatedProof: tempContainer.AggregatedProof,
463459
}
464-
for i, blob := range tempContainer.Data.Blobs {
460+
for i, blob := range tempContainer.Blobs {
465461
container.Data.Blobs[i] = blob.Data
466462
}
467463
return false, nil

beacon-chain/rpc/apimiddleware/structs.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ type beaconBlockBodyEip4844Json struct {
461461
Deposits []*depositJson `json:"deposits"`
462462
VoluntaryExits []*signedVoluntaryExitJson `json:"voluntary_exits"`
463463
SyncAggregate *syncAggregateJson `json:"sync_aggregate"`
464-
ExecutionPayload *executionPayloadJson `json:"execution_payload"`
464+
ExecutionPayload *executionPayload4844Json `json:"execution_payload"`
465465
BlobKzgs []string `json:"blob_kzgs" hex:"true"`
466466
}
467467

@@ -496,6 +496,24 @@ type executionPayloadJson struct {
496496
Transactions []string `json:"transactions" hex:"true"`
497497
}
498498

499+
type executionPayload4844Json struct {
500+
ParentHash string `json:"parent_hash" hex:"true"`
501+
FeeRecipient string `json:"fee_recipient" hex:"true"`
502+
StateRoot string `json:"state_root" hex:"true"`
503+
ReceiptsRoot string `json:"receipts_root" hex:"true"`
504+
LogsBloom string `json:"logs_bloom" hex:"true"`
505+
PrevRandao string `json:"prev_randao" hex:"true"`
506+
BlockNumber string `json:"block_number"`
507+
GasLimit string `json:"gas_limit"`
508+
GasUsed string `json:"gas_used"`
509+
TimeStamp string `json:"timestamp"`
510+
ExtraData string `json:"extra_data" hex:"true"`
511+
BaseFeePerGas string `json:"base_fee_per_gas" uint256:"true"`
512+
ExcessDataGas string `json:"excess_data_gas" uint256:"true"`
513+
BlockHash string `json:"block_hash" hex:"true"`
514+
Transactions []string `json:"transactions" hex:"true"`
515+
}
516+
499517
type executionPayloadHeaderJson struct {
500518
ParentHash string `json:"parent_hash" hex:"true"`
501519
FeeRecipient string `json:"fee_recipient" hex:"true"`

beacon-chain/rpc/eth/beacon/blobs.go

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ import (
88
)
99

1010
func (bs *Server) GetBlobsSidecar(ctx context.Context, req *ethpbv1.BlobsRequest) (*ethpbv1.BlobsResponse, error) {
11-
blk, err := bs.blockFromBlockID(ctx, req.BlockId)
12-
err = handleGetBlockError(blk, err)
11+
sblk, err := bs.blockFromBlockID(ctx, req.BlockId)
12+
err = handleGetBlockError(sblk, err)
1313
if err != nil {
1414
return nil, errors.Wrap(err, "GetBlobs")
1515
}
16-
root, err := blk.Block().HashTreeRoot()
16+
block := sblk.Block()
17+
root, err := block.HashTreeRoot()
1718
if err != nil {
1819
return nil, errors.Wrap(err, "failed to htr block")
1920
}
@@ -22,18 +23,22 @@ func (bs *Server) GetBlobsSidecar(ctx context.Context, req *ethpbv1.BlobsRequest
2223
return nil, fmt.Errorf("failed to get blobs sidecar for block %x", root)
2324
}
2425
var blobs []*ethpbv1.Blob
25-
for _, b := range sidecar.Blobs {
26-
var data []byte
27-
// go through each element, concat them
28-
for _, el := range b.Blob {
29-
data = append(data, el...)
26+
var aggregatedProof []byte
27+
if sidecar != nil {
28+
aggregatedProof = sidecar.AggregatedProof
29+
for _, b := range sidecar.Blobs {
30+
var data []byte
31+
// go through each element, concat them
32+
for _, el := range b.Blob {
33+
data = append(data, el...)
34+
}
35+
blobs = append(blobs, &ethpbv1.Blob{Data: data})
3036
}
31-
blobs = append(blobs, &ethpbv1.Blob{Data: data})
3237
}
3338
return &ethpbv1.BlobsResponse{
34-
BeaconBlockRoot: sidecar.BeaconBlockRoot,
35-
BeaconBlockSlot: uint64(sidecar.BeaconBlockSlot),
39+
BeaconBlockRoot: root[:],
40+
BeaconBlockSlot: uint64(block.Slot()),
3641
Blobs: blobs,
37-
AggregatedProof: sidecar.AggregatedProof,
42+
AggregatedProof: aggregatedProof,
3843
}, nil
3944
}

beacon-chain/sync/initial-sync/BUILD.bazel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ go_library(
1818
deps = [
1919
"//async/abool:go_default_library",
2020
"//beacon-chain/blockchain:go_default_library",
21-
"//beacon-chain/core/blob:go_default_library",
22-
"//beacon-chain/core/blocks:go_default_library",
2321
"//beacon-chain/core/feed:go_default_library",
2422
"//beacon-chain/core/feed/block:go_default_library",
2523
"//beacon-chain/core/feed/state:go_default_library",

config/params/testnet_eip4844_config.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ func UseEIP4844NetworkConfig() {
66
cfg.MinEpochsForBlobsSidecarsRequest = 1200 // 1 day
77
cfg.ContractDeploymentBlock = 0 // deposit contract is a predeploy
88
cfg.BootstrapNodes = []string{
9-
"enr:-JG4QFKX3vHhpsIZ5gwHaStj8k9Z4OudBunL8srykq4yTfL-cwX03zyOCGRXVgefXep3wUb3liC26grESiHK6Wn-7zqGAYI-FNCugmlkgnY0gmlwhCJ7uEyJc2VjcDI1NmsxoQJpeftU6RbmIhcFllICznlAMJXL3EwHEGhn73_Gk0wrCYN0Y3CCMsiDdWRwgi7g",
9+
"enr:-MK4QFURnlP5nu_JHdrj6XVYPo4an3tLVD3Ii_hLpFxAvdaVVLOOHPzmAYQQ4lk1U2fwb4oQIh-lYL3UbpTGYr-yJjKGAYO2dGzih2F0dG5ldHOIAAAAAAAAAACEZXRoMpCcZxEogwAP_f__________gmlkgnY0gmlwhCJ5ITWJc2VjcDI1NmsxoQIlwaxycUgJ_Ht4lYdDlInbIuRxu0HcHcFbu0D7As2SLYhzeW5jbmV0cwCDdGNwgjLIg3VkcIIu4A",
10+
"enr:-MK4QCC-n6C8hHOsUacSgYR7E2UknE_Slz5Tt8h0FiSKxiXDBrki2iwIALq9FIPreXp2GgFJqFM4Bd-1oMlrHgOPKY2GAYO2dG08h2F0dG5ldHOIAAAACAAAAACEZXRoMpCcZxEogwAP_f__________gmlkgnY0gmlwhCJ6vpeJc2VjcDI1NmsxoQNJzjxNKr7-a-iEDs0KvaL_vo1UH91kefEiWzgAdwSntYhzeW5jbmV0cw-DdGNwgjLIg3VkcIIu4A",
11+
"enr:-MK4QBRIqJE6bT7janDe8o3l_bW20WVtZBqqaxUNvsrHrKYjOUNEG1DFgj-9aOOrRzkZxRgczQZacChxObWGq1X3q3CGAYO2dGzHh2F0dG5ldHOIAAAAAAAAACCEZXRoMpCcZxEogwAP_f__________gmlkgnY0gmlwhCKtCCuJc2VjcDI1NmsxoQJb4OOCku4riQKTyRXbWh0ooc_NXFlP6Y1_A5imyBJcoohzeW5jbmV0cw-DdGNwgjLIg3VkcIIu4A",
1012
// TODO(EIP-4844): Coinbase boot node
1113
}
1214
OverrideBeaconNetworkConfig(cfg)
@@ -20,17 +22,17 @@ func EIP4844Config() *BeaconChainConfig {
2022
cfg.Eth1FollowDistance = 15
2123
cfg.ConfigName = EIP4844Name
2224
cfg.GenesisForkVersion = []byte{0x00, 0x00, 0x0f, 0xfd}
23-
cfg.SecondsPerETH1Block = 14
24-
cfg.DepositChainID = 1331
25-
cfg.DepositNetworkID = 69
25+
cfg.SecondsPerETH1Block = 12
26+
cfg.DepositChainID = 1332
27+
cfg.DepositNetworkID = 70
2628
cfg.AltairForkEpoch = 1
2729
cfg.AltairForkVersion = []byte{0x01, 0x00, 0x0f, 0xfd}
2830
cfg.BellatrixForkEpoch = 2
2931
cfg.BellatrixForkVersion = []byte{0x02, 0x00, 0x0f, 0xfd}
3032
cfg.Eip4844ForkEpoch = 3
3133
cfg.SlotsPerEpoch = 8 // 96 secs; reduced from 32 (6.4 mins) for testing
3234
cfg.Eip4844ForkVersion = []byte{0x83, 0x00, 0x0f, 0xfd}
33-
cfg.TerminalTotalDifficulty = "40"
35+
cfg.TerminalTotalDifficulty = "2"
3436
cfg.DepositContractAddress = "0x8A04d14125D0FDCDc742F4A05C051De07232EDa4"
3537
cfg.DomainBlobsSidecar = [4]byte{0x0a, 0x00, 0x00, 0x00}
3638
cfg.InitializeForkSchedule()

proto/eth/ext/options.pb.go

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/eth/service/beacon_chain_service.pb.go

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/eth/service/beacon_chain_service.pb.gw.go

Lines changed: 31 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/eth/service/beacon_chain_service.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ service BeaconChain {
391391

392392
// GetBlobs retrieves blob data by block ID and data hash
393393
rpc GetBlobsSidecar(v1.BlobsRequest) returns (v1.BlobsResponse) {
394-
option (google.api.http) = {get: "/internal/eth/v1/blobs/sidecar"};
394+
option (google.api.http) = {get: "/internal/eth/v1/blobs/sidecar/{block_id}"};
395395
}
396396
}
397397

0 commit comments

Comments
 (0)