Skip to content

Commit bbc09ea

Browse files
committed
rm Electra builder API support
1 parent 321e38f commit bbc09ea

15 files changed

+91
-402
lines changed

AllTests-mainnet.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -836,15 +836,15 @@ AllTests-mainnet
836836
```
837837
## MEV calls serialization/deserialization and behavior test suite
838838
```diff
839-
+ /eth/v1/builder/blinded_blocks [json/json] test OK
840-
+ /eth/v1/builder/blinded_blocks [json/ssz] test OK
841-
+ /eth/v1/builder/blinded_blocks [ssz/json] test OK
842-
+ /eth/v1/builder/blinded_blocks [ssz/ssz] test OK
843839
+ /eth/v1/builder/header [json] test OK
844840
+ /eth/v1/builder/header [ssz] test OK
845841
+ /eth/v1/builder/status test OK
846842
+ /eth/v1/builder/validators [json] test OK
847843
+ /eth/v1/builder/validators [ssz] test OK
844+
+ /eth/v2/builder/blinded_blocks [json/json] test OK
845+
+ /eth/v2/builder/blinded_blocks [json/ssz] test OK
846+
+ /eth/v2/builder/blinded_blocks [ssz/json] test OK
847+
+ /eth/v2/builder/blinded_blocks [ssz/ssz] test OK
848848
```
849849
## Message signatures
850850
```diff

beacon_chain/rpc/rest_beacon_api.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ proc installBeaconApiHandlers*(router: var RestRouter, node: BeaconNode) =
11621162
debugGloasComment ""
11631163
return RestApiResponse.jsonError(
11641164
Http400, $consensusFork & " builder API unsupported")
1165-
elif consensusFork >= ConsensusFork.Electra:
1165+
elif consensusFork >= ConsensusFork.Fulu:
11661166
let
11671167
restBlock = decodeBodyJsonOrSsz(
11681168
consensusFork.SignedBlindedBeaconBlock, body).valueOr:

beacon_chain/rpc/rest_validator_api.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ proc installValidatorApiHandlers*(router: var RestRouter, node: BeaconNode) =
416416
# produceBlockV3 won't work past Fulu.
417417
return RestApiResponse.jsonError(
418418
Http500, "Unsupported fork for block production: " & $consensusFork)
419-
elif consensusFork >= ConsensusFork.Electra:
419+
elif consensusFork >= ConsensusFork.Fulu:
420420
let
421421
message = (await node.makeMaybeBlindedBeaconBlockForHeadAndSlot(
422422
consensusFork, proposer, qrandao, qgraffiti, qhead, qslot,

beacon_chain/spec/eth2_apis/eth2_rest_json_serialization.nim

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,7 @@ RestJson.useDefaultSerializationFor(
281281
electra.TrustedAttestation,
282282
electra_mev.BlindedBeaconBlock,
283283
electra_mev.BlindedBeaconBlockBody,
284-
electra_mev.BuilderBid,
285-
electra_mev.ExecutionPayloadAndBlobsBundle,
286284
electra_mev.SignedBlindedBeaconBlock,
287-
electra_mev.SignedBuilderBid,
288285
fulu.BeaconBlock,
289286
fulu.BeaconBlockBody,
290287
fulu.BeaconState,
@@ -1261,7 +1258,7 @@ proc readValue*(
12611258
ForkedMaybeBlindedBeaconBlock.init(
12621259
RestJson.decode(string(v.data), consensusFork.BlockContents)
12631260
)
1264-
elif consensusFork >= ConsensusFork.Electra:
1261+
elif consensusFork >= ConsensusFork.Fulu:
12651262
if v.execution_payload_blinded:
12661263
ForkedMaybeBlindedBeaconBlock.init(
12671264
RestJson.decode(string(v.data), consensusFork.BlindedBlockContents),

beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ type
7070
capella.SignedBeaconBlock |
7171
phase0.SignedBeaconBlock |
7272
DenebSignedBlockContents |
73+
deneb_mev.SignedBlindedBeaconBlock |
7374
ElectraSignedBlockContents |
7475
FuluSignedBlockContents |
7576
GloasSignedBlockContents |
7677
ForkedMaybeBlindedBeaconBlock |
77-
deneb_mev.SignedBlindedBeaconBlock |
7878
electra_mev.SignedBlindedBeaconBlock |
7979
fulu_mev.SignedBlindedBeaconBlock
8080

@@ -95,9 +95,7 @@ type
9595
seq[RestSyncCommitteeSelection]
9696

9797
MevDecodeTypes* =
98-
GetHeaderResponseElectra |
99-
GetHeaderResponseFulu |
100-
SubmitBlindedBlockResponseElectra
98+
GetHeaderResponseFulu
10199

102100
DecodeTypes* =
103101
DataEnclosedObject |
@@ -904,7 +902,7 @@ proc decodeBytes*[T: ProduceBlockResponseV3](
904902
debugGloasComment ""
905903
when consensusFork == ConsensusFork.Gloas:
906904
return err("gloas produceblockv3 not available yet")
907-
elif consensusFork >= ConsensusFork.Electra:
905+
elif consensusFork >= ConsensusFork.Fulu:
908906
if blinded:
909907
let contents =
910908
? readSszResBytes(consensusFork.BlindedBlockContents, value)

beacon_chain/spec/eth2_apis/rest_types.nim

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,10 +560,7 @@ type
560560
GetValidatorsLivenessResponse* = DataEnclosedObject[seq[RestLivenessItem]]
561561
SubmitBeaconCommitteeSelectionsResponse* = DataEnclosedObject[seq[RestBeaconCommitteeSelection]]
562562
SubmitSyncCommitteeSelectionsResponse* = DataEnclosedObject[seq[RestSyncCommitteeSelection]]
563-
564-
GetHeaderResponseElectra* = DataVersionEnclosedObject[electra_mev.SignedBuilderBid]
565563
GetHeaderResponseFulu* = DataVersionEnclosedObject[fulu_mev.SignedBuilderBid]
566-
SubmitBlindedBlockResponseElectra* = DataVersionEnclosedObject[electra_mev.ExecutionPayloadAndBlobsBundle]
567564

568565
RestNodeValidity* {.pure.} = enum
569566
valid = "VALID",

beacon_chain/spec/forks.nim

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -180,30 +180,24 @@ type
180180
gloas.ExecutionPayloadForSigning
181181

182182
ForkyBlindedBeaconBlock* =
183-
electra_mev.BlindedBeaconBlock |
184183
fulu_mev.BlindedBeaconBlock
185184

186185
SomeForkyBlindedBeaconBlock* =
187186
ForkyBlindedBeaconBlock |
188-
electra_mev.SigVerifiedBlindedBeaconBlock |
189187
fulu_mev.SigVerifiedBlindedBeaconBlock
190188

191189
SomeForkyBlindedBeaconBlockBody* =
192-
electra_mev.BlindedBeaconBlockBody |
193190
fulu_mev.BlindedBeaconBlockBody |
194-
electra_mev.SigVerifiedBlindedBeaconBlockBody |
195191
fulu_mev.SigVerifiedBlindedBeaconBlockBody
196192

197193
ForkyBuilderBid* =
198-
electra_mev.BuilderBid |
199194
fulu_mev.BuilderBid
200195

201196
ForkyBlobsBundle* =
202197
deneb.BlobsBundle |
203198
fulu.BlobsBundle
204199

205200
ForkySignedBuilderBid* =
206-
electra_mev.SignedBuilderBid |
207201
fulu_mev.SignedBuilderBid
208202

209203
ForkyBlockContents* =
@@ -270,7 +264,7 @@ type
270264
of ConsensusFork.Deneb:
271265
denebData*: deneb.BlockContents
272266
of ConsensusFork.Electra:
273-
electraData*: electra_mev.MaybeBlindedBeaconBlock
267+
electraData*: electra.BlockContents
274268
of ConsensusFork.Fulu:
275269
fuluData*: fulu_mev.MaybeBlindedBeaconBlock
276270
of ConsensusFork.Gloas:
@@ -483,10 +477,7 @@ template kind*(
483477
electra.TrustedSignedBeaconBlock |
484478
electra.AggregateAndProof |
485479
electra.SignedAggregateAndProof |
486-
electra_mev.BlindedBeaconBlock |
487-
electra_mev.SignedBlindedBeaconBlock |
488-
electra_mev.SignedBuilderBid |
489-
electra_mev.ExecutionPayloadAndBlobsBundle]): ConsensusFork =
480+
electra_mev.SignedBlindedBeaconBlock]): ConsensusFork =
490481
ConsensusFork.Electra
491482

492483
template kind*(
@@ -653,40 +644,30 @@ template ExecutionPayloadForSigning*(kind: static ConsensusFork): typedesc =
653644
template BlindedBeaconBlock*(kind: static ConsensusFork): auto =
654645
when kind == ConsensusFork.Fulu:
655646
fulu_mev.BlindedBeaconBlock
656-
elif kind == ConsensusFork.Electra:
657-
electra_mev.BlindedBeaconBlock
658647
else:
659648
{.error: "BlindedBeaconBlock unsupported in " & $kind.}
660649

661650
template MaybeBlindedBeaconBlock*(kind: static ConsensusFork): auto =
662651
when kind == ConsensusFork.Fulu:
663652
fulu_mev.MaybeBlindedBeaconBlock
664-
elif kind == ConsensusFork.Electra:
665-
electra_mev.MaybeBlindedBeaconBlock
666653
else:
667654
{.error: "MaybeBlindedBeaconBlock unsupported in " & $kind.}
668655

669656
template SignedBlindedBeaconBlock*(kind: static ConsensusFork): typedesc =
670657
when kind == ConsensusFork.Fulu:
671658
fulu_mev.SignedBlindedBeaconBlock
672-
elif kind == ConsensusFork.Electra:
673-
electra_mev.SignedBlindedBeaconBlock
674659
else:
675660
{.error: "SignedBlindedBeaconBlock unsupported in " & $kind.}
676661

677662
template BuilderBid*(kind: static ConsensusFork): typedesc =
678663
when kind == ConsensusFork.Fulu:
679664
fulu_mev.BuilderBid
680-
elif kind == ConsensusFork.Electra:
681-
electra_mev.BuilderBid
682665
else:
683666
{.error: "BuilderBid unsupported in " & $kind.}
684667

685668
template SignedBuilderBid*(kind: static ConsensusFork): typedesc =
686669
when kind == ConsensusFork.Fulu:
687670
fulu_mev.SignedBuilderBid
688-
elif kind == ConsensusFork.Electra:
689-
electra_mev.SignedBuilderBid
690671
else:
691672
{.error: "SignedBuilderBid unsupported in " & $kind.}
692673

@@ -1382,17 +1363,11 @@ template withForkyMaybeBlindedBlck*(
13821363
template forkyMaybeBlindedBlck: untyped {.inject, used.} = d.data
13831364
body
13841365
of ConsensusFork.Electra:
1385-
const consensusFork {.inject, used.} = ConsensusFork.Electra
1386-
template d: untyped = b.electraData
1387-
case d.isBlinded:
1388-
of true:
1389-
const isBlinded {.inject, used.} = true
1390-
template forkyMaybeBlindedBlck: untyped {.inject, used.} = d.blindedData
1391-
body
1392-
of false:
1393-
const isBlinded {.inject, used.} = false
1394-
template forkyMaybeBlindedBlck: untyped {.inject, used.} = d.data
1395-
body
1366+
const
1367+
consensusFork {.inject, used.} = ConsensusFork.Electra
1368+
isBlinded {.inject, used.} = false
1369+
template forkyMaybeBlindedBlck: untyped {.inject, used.} = b.electraData
1370+
body
13961371
of ConsensusFork.Deneb:
13971372
const
13981373
consensusFork {.inject, used.} = ConsensusFork.Deneb
@@ -1914,9 +1889,7 @@ template init*(T: type ForkedMaybeBlindedBeaconBlock,
19141889
evalue: Opt[UInt256], cvalue: Opt[UInt256]): T =
19151890
ForkedMaybeBlindedBeaconBlock(
19161891
kind: ConsensusFork.Electra,
1917-
electraData: electra_mev.MaybeBlindedBeaconBlock(
1918-
isBlinded: false,
1919-
data: blck),
1892+
electraData: blck,
19201893
consensusValue: cvalue,
19211894
executionValue: evalue)
19221895

beacon_chain/spec/mev/electra_mev.nim

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,6 @@ from ".."/datatypes/deneb import BlobsBundle, ExecutionPayloadHeader, KzgCommitm
1616
from ".."/eth2_merkleization import hash_tree_root
1717

1818
type
19-
# https://github.com/ethereum/builder-specs/blob/v0.5.0/specs/bellatrix/builder.md#validatorregistrationv1
20-
ValidatorRegistrationV1* = object
21-
fee_recipient*: ExecutionAddress
22-
gas_limit*: uint64
23-
timestamp*: uint64
24-
pubkey*: ValidatorPubKey
25-
26-
# https://github.com/ethereum/builder-specs/blob/v0.5.0/specs/bellatrix/builder.md#signedvalidatorregistrationv1
27-
SignedValidatorRegistrationV1* = object
28-
message*: ValidatorRegistrationV1
29-
signature*: ValidatorSig
30-
31-
# https://github.com/ethereum/builder-specs/blob/v0.5.0/specs/electra/builder.md#builderbid
32-
BuilderBid* = object
33-
header*: deneb.ExecutionPayloadHeader
34-
blob_kzg_commitments*: KzgCommitments
35-
execution_requests*: ExecutionRequests # [New in Electra]
36-
value*: UInt256
37-
pubkey*: ValidatorPubKey
38-
39-
# https://github.com/ethereum/builder-specs/blob/v0.5.0/specs/bellatrix/builder.md#signedbuilderbid
40-
SignedBuilderBid* = object
41-
message*: BuilderBid
42-
signature*: ValidatorSig
43-
4419
# https://github.com/ethereum/builder-specs/blob/v0.5.0/specs/electra/builder.md#blindedbeaconblockbody
4520
BlindedBeaconBlockBody* = object
4621
randao_reveal*: ValidatorSig
@@ -86,42 +61,11 @@ type
8661
state_root*: Eth2Digest
8762
body*: BlindedBeaconBlockBody # [Modified in Deneb]
8863

89-
# https://github.com/ethereum/builder-specs/blob/v0.5.0/specs/bellatrix/builder.md#blindedbeaconblock
90-
SigVerifiedBlindedBeaconBlock* = object
91-
slot*: Slot
92-
proposer_index*: uint64
93-
parent_root*: Eth2Digest
94-
state_root*: Eth2Digest
95-
body*: SigVerifiedBlindedBeaconBlockBody # [Modified in Deneb]
96-
97-
MaybeBlindedBeaconBlock* = object
98-
case isBlinded*: bool
99-
of false:
100-
data*: electra.BlockContents
101-
of true:
102-
blindedData*: BlindedBeaconBlock
103-
10464
# https://github.com/ethereum/builder-specs/blob/v0.5.0/specs/bellatrix/builder.md#signedblindedbeaconblock
10565
SignedBlindedBeaconBlock* = object
10666
message*: BlindedBeaconBlock
10767
signature*: ValidatorSig
10868

109-
# https://github.com/ethereum/builder-specs/blob/v0.5.0/specs/deneb/builder.md#executionpayloadandblobsbundle
110-
ExecutionPayloadAndBlobsBundle* = object
111-
execution_payload*: deneb.ExecutionPayload
112-
blobs_bundle*: BlobsBundle
113-
114-
const
115-
# https://github.com/ethereum/builder-specs/blob/v0.5.0/specs/bellatrix/builder.md#domain-types
116-
DOMAIN_APPLICATION_BUILDER* = DomainType([byte 0x00, 0x00, 0x00, 0x01])
117-
118-
# https://github.com/ethereum/builder-specs/blob/v0.5.0/specs/bellatrix/validator.md#constants
119-
EPOCHS_PER_VALIDATOR_REGISTRATION_SUBMISSION* = 1
120-
121-
# Spec is 1 second, but mev-boost indirection can induce delay when the relay
122-
# itself has already consumed the entire second.
123-
BUILDER_PROPOSAL_DELAY_TOLERANCE* = 1500.milliseconds
124-
12569
func shortLog*(v: BlindedBeaconBlock): auto =
12670
(
12771
slot: shortLog(v.slot),
@@ -150,7 +94,3 @@ func shortLog*(v: SignedBlindedBeaconBlock): auto =
15094
blck: shortLog(v.message),
15195
signature: shortLog(v.signature)
15296
)
153-
154-
template asSigVerified*(
155-
x: BlindedBeaconBlock): SigVerifiedBlindedBeaconBlock =
156-
isomorphicCast[SigVerifiedBlindedBeaconBlock](x)

beacon_chain/spec/mev/fulu_mev.nim

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ from ".."/datatypes/electra import
1818
from ".."/eth2_merkleization import hash_tree_root
1919

2020
type
21+
# https://github.com/ethereum/builder-specs/blob/v0.5.0/specs/bellatrix/builder.md#validatorregistrationv1
22+
ValidatorRegistrationV1* = object
23+
fee_recipient*: ExecutionAddress
24+
gas_limit*: uint64
25+
timestamp*: uint64
26+
pubkey*: ValidatorPubKey
27+
28+
# https://github.com/ethereum/builder-specs/blob/v0.5.0/specs/bellatrix/builder.md#signedvalidatorregistrationv1
29+
SignedValidatorRegistrationV1* = object
30+
message*: ValidatorRegistrationV1
31+
signature*: ValidatorSig
32+
2133
BuilderBid* = object
2234
header*: deneb.ExecutionPayloadHeader
2335
blob_kzg_commitments*: KzgCommitments
@@ -94,6 +106,17 @@ type
94106
message*: BlindedBeaconBlock
95107
signature*: ValidatorSig
96108

109+
const
110+
# https://github.com/ethereum/builder-specs/blob/v0.5.0/specs/bellatrix/builder.md#domain-types
111+
DOMAIN_APPLICATION_BUILDER* = DomainType([byte 0x00, 0x00, 0x00, 0x01])
112+
113+
# https://github.com/ethereum/builder-specs/blob/v0.5.0/specs/bellatrix/validator.md#constants
114+
EPOCHS_PER_VALIDATOR_REGISTRATION_SUBMISSION* = 1
115+
116+
# Spec is 1 second, but mev-boost indirection can induce delay when the relay
117+
# itself has already consumed the entire second.
118+
BUILDER_PROPOSAL_DELAY_TOLERANCE* = 1500.milliseconds
119+
97120
func shortLog*(v: BlindedBeaconBlock): auto =
98121
(
99122
slot: shortLog(v.slot),

beacon_chain/spec/mev/rest_mev_calls.nim

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
66
# at your option. This file may not be copied, modified, or distributed except according to those terms.
77

8-
{.push raises: [].}
8+
{.push raises: [], gcsafe.}
99

1010
import
1111
chronos, presto/client,
@@ -47,32 +47,13 @@ proc getHeader*(
4747
restAcceptType = "application/octet-stream,application/json;q=0.5",
4848
)
4949

50-
proc submitBlindedBlockPlain*(
51-
body: electra_mev.SignedBlindedBeaconBlock
52-
): RestPlainResponse {.
53-
rest, endpoint: "/eth/v1/builder/blinded_blocks",
54-
meth: MethodPost, connection: {Dedicated, Close}.}
55-
## https://github.com/ethereum/builder-specs/blob/v0.5.0/apis/builder/blinded_blocks.yaml
56-
5750
proc submitBlindedBlockV2Plain*(
5851
body: fulu_mev.SignedBlindedBeaconBlock
5952
): RestPlainResponse {.
6053
rest, endpoint: "/eth/v2/builder/blinded_blocks",
6154
meth: MethodPost, connection: {Dedicated, Close}.}
6255
## https://github.com/ethereum/builder-specs/blob/ae1d97d080a12bfb7ca248b58fb1fc6b10aed02e/apis/builder/blinded_blocks_v2.yaml
6356

64-
proc submitBlindedBlock*(
65-
client: RestClientRef,
66-
body: electra_mev.SignedBlindedBeaconBlock
67-
): Future[RestPlainResponse] {.
68-
async: (raises: [CancelledError, RestEncodingError, RestDnsResolveError,
69-
RestCommunicationError], raw: true).} =
70-
client.submitBlindedBlockPlain(
71-
body,
72-
restAcceptType = "application/octet-stream,application/json;q=0.5",
73-
extraHeaders = @[("eth-consensus-version", toString(typeof(body).kind))]
74-
)
75-
7657
proc submitBlindedBlock*(
7758
client: RestClientRef,
7859
body: fulu_mev.SignedBlindedBeaconBlock

0 commit comments

Comments
 (0)