Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions beacon_chain/el/engine_api_conversions.nim
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,11 @@ func asConsensusType*(
# The `mapIt` calls below are necessary only because we use different distinct
# types for KZG commitments and Blobs in the `web3` and the `deneb` spec types.
# Both are defined as `array[N, byte]` under the hood.
blobsBundle: deneb.BlobsBundle(
blobsBundle: fulu.BlobsBundleV2(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commitments: KzgCommitments.init(
payload.blobsBundle.commitments.mapIt(
kzg_abi.KzgCommitment(bytes: it.data))),
proofs: KzgProofs.init(
proofs: KzgProofsV2.init(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also not accurate.

payload.blobsBundle.proofs.mapIt(
kzg_abi.KzgProof(bytes: it.data))),
blobs: Blobs.init(
Expand Down
6 changes: 4 additions & 2 deletions beacon_chain/rpc/rest_beacon_api.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,8 @@ proc installBeaconApiHandlers*(router: var RestRouter, node: BeaconNode) =
doAssert strictVerification notin node.dag.updateFlags
return RestApiResponse.jsonError(Http400, InvalidBlockObjectError)

when consensusFork >= ConsensusFork.Deneb:
when consensusFork >= ConsensusFork.Deneb and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two points:

  • https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlock shows " Warning: Deprecated". That is, I'll remove (Http410) this entire handler as soon as feasible come Fulu. It doesn't matter if it works under Fulu; it will never have to.

  • Even otherwise, this endpoint isn't about blinded blocks, but non-MEV blocks, and those should be sending their blob/column sidecars somewhere.

But the first point is more important. There's no reason to change this to work in Fulu, nor should it be changed.

consensusFork < ConsensusFork.Fulu:
await node.router.routeSignedBeaconBlock(
forkyBlck, Opt.some(
forkyBlck.create_blob_sidecars(kzg_proofs, blobs)),
Expand Down Expand Up @@ -1099,7 +1100,8 @@ proc installBeaconApiHandlers*(router: var RestRouter, node: BeaconNode) =
doAssert strictVerification notin node.dag.updateFlags
return RestApiResponse.jsonError(Http400, InvalidBlockObjectError)

when consensusFork >= ConsensusFork.Deneb:
when consensusFork >= ConsensusFork.Deneb and
consensusFork < ConsensusFork.Fulu:
await node.router.routeSignedBeaconBlock(
forkyBlck, Opt.some(
forkyBlck.create_blob_sidecars(kzg_proofs, blobs)),
Expand Down
1 change: 1 addition & 0 deletions beacon_chain/spec/datatypes/deneb.nim
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ type
excess_blob_gas*: uint64 # [New in Deneb]

# https://github.com/ethereum/consensus-specs/blob/v1.6.0-alpha.0/specs/deneb/validator.md#blobsbundle
# https://github.com/ethereum/builder-specs/blob/ae1d97d080a12bfb7ca248b58fb1fc6b10aed02e/specs/fulu/builder.md#blobsbundle
KzgProofs* = List[KzgProof, Limit MAX_BLOB_COMMITMENTS_PER_BLOCK]
Blobs* = List[Blob, Limit MAX_BLOB_COMMITMENTS_PER_BLOCK]
BlobRoots* = List[Eth2Digest, Limit MAX_BLOB_COMMITMENTS_PER_BLOCK]
Expand Down
13 changes: 11 additions & 2 deletions beacon_chain/spec/datatypes/fulu.nim
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ type
column_index*: ColumnIndex
row_index*: RowIndex

# https://github.com/ethereum/builder-specs/blob/ae1d97d080a12bfb7ca248b58fb1fc6b10aed02e/specs/fulu/builder.md#blobsbundle
KzgProofsV2* = List[KzgProof, Limit FIELD_ELEMENTS_PER_EXT_BLOB * MAX_BLOB_COMMITMENTS_PER_BLOCK]

# https://github.com/ethereum/builder-specs/blob/ae1d97d080a12bfb7ca248b58fb1fc6b10aed02e/specs/fulu/builder.md#blobsbundle
BlobsBundleV2* = object
commitments*: KzgCommitments
proofs*: KzgProofsV2
blobs*: Blobs

# Not in spec, defined in order to compute custody subnets
CgcBits* = BitArray[DATA_COLUMN_SIDECAR_SUBNET_COUNT]

Expand Down Expand Up @@ -164,7 +173,7 @@ type
ExecutionPayloadForSigning* = object
executionPayload*: ExecutionPayload
blockValue*: Wei
blobsBundle*: BlobsBundle
blobsBundle*: BlobsBundleV2 # [New in Fulu]
executionRequests*: seq[seq[byte]]

# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.10/specs/deneb/beacon-chain.md#executionpayloadheader
Expand Down Expand Up @@ -606,7 +615,7 @@ type

BlockContents* = object
`block`*: BeaconBlock
kzg_proofs*: KzgProofs
kzg_proofs*: KzgProofsV2
blobs*: Blobs

func shortLog*(v: DataColumnSidecar): auto =
Expand Down
1 change: 1 addition & 0 deletions beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ RestJson.useDefaultSerializationFor(
fulu_mev.BlindedBeaconBlock,
fulu_mev.BlindedBeaconBlockBody,
fulu_mev.BuilderBid,
fulu_mev.ExecutionPayloadAndBlobsBundle,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because SubmitBlindedBlockResponseFulu isn't used, neither is this.

fulu_mev.SignedBlindedBeaconBlock,
fulu_mev.SignedBuilderBid,
phase0.AggregateAndProof,
Expand Down
3 changes: 2 additions & 1 deletion beacon_chain/spec/eth2_apis/rest_types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ type

FuluSignedBlockContents* = object
signed_block*: fulu.SignedBeaconBlock
kzg_proofs*: deneb.KzgProofs
kzg_proofs*: fulu.KzgProofsV2
blobs*: deneb.Blobs

RestPublishedSignedBlockContents* = object
Expand Down Expand Up @@ -550,6 +550,7 @@ type
GetHeaderResponseElectra* = DataVersionEnclosedObject[electra_mev.SignedBuilderBid]
GetHeaderResponseFulu* = DataVersionEnclosedObject[fulu_mev.SignedBuilderBid]
SubmitBlindedBlockResponseElectra* = DataVersionEnclosedObject[electra_mev.ExecutionPayloadAndBlobsBundle]
SubmitBlindedBlockResponseFulu* = DataVersionEnclosedObject[fulu_mev.ExecutionPayloadAndBlobsBundle]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per ethereum/builder-specs#123 the v2 API which Nimbus now uses for Fulu instead of the deprecated v1 API "does not return the execution payload and blobs".

There's no decoding to do, unlike Pectra. So this SubmitBlindedBlockResponseFulu type is neither necessary nor useful.


RestNodeValidity* {.pure.} = enum
valid = "VALID",
Expand Down
3 changes: 2 additions & 1 deletion beacon_chain/spec/forks.nim
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,8 @@ template kind*(
fulu.TrustedSignedBeaconBlock |
fulu_mev.BlindedBeaconBlock |
fulu_mev.SignedBlindedBeaconBlock |
fulu_mev.SignedBuilderBid]): ConsensusFork =
fulu_mev.SignedBuilderBid |
fulu_mev.ExecutionPayloadAndBlobsBundle]): ConsensusFork =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be used either.

I removed all this, for good reason, back in #7308

There's still no actual block/blob return from submitBlindedBlock in Fulu, so all of this is pointless. The stateroot bug was related, as far as it seems so far, in the construction of the shim block in state_transition, and that fix is elsewhere. There's still nothing to decode from the relay for Fulu, aside from checking the 202-or-not-204 HTTP return.

ConsensusFork.Fulu

template BeaconState*(kind: static ConsensusFork): typedesc =
Expand Down
7 changes: 7 additions & 0 deletions beacon_chain/spec/mev/fulu_mev.nim
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ from stew/byteutils import to0xHex
from ".."/datatypes/phase0 import AttesterSlashing
from ".."/datatypes/capella import SignedBLSToExecutionChange
from ".."/datatypes/deneb import BlobsBundle, KzgCommitments
from ".."/datatypes/fulu import BlobsBundleV2
from ".."/datatypes/electra import
Attestation, AttesterSlashing, ExecutionRequests
from ".."/eth2_merkleization import hash_tree_root
Expand Down Expand Up @@ -69,11 +70,17 @@ type
message*: BlindedBeaconBlock
signature*: ValidatorSig

# https://github.com/ethereum/builder-specs/blob/ae1d97d080a12bfb7ca248b58fb1fc6b10aed02e/specs/fulu/builder.md#executionpayloadandblobsbundle
ExecutionPayloadAndBlobsBundle* = object
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See elsewhere, not useful/necessary.

execution_payload*: electra.ExecutionPayload
blobs_bundle*: BlobsBundleV2 # [New in Fulu]

# Not spec, but suggested by spec
BlindedExecutionPayloadAndBlobsBundle* = object
execution_payload_header*: fulu.ExecutionPayloadHeader
blob_kzg_commitments*: KzgCommitments # [New in Deneb]


func shortLog*(v: BlindedBeaconBlock): auto =
(
slot: shortLog(v.slot),
Expand Down
2 changes: 1 addition & 1 deletion beacon_chain/spec/state_transition.nim
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ proc makeBeaconBlockWithRewards*(
hash_tree_root(validator_changes.proposer_slashings),
hash_tree_root(validator_changes.electra_attester_slashings),
hash_tree_root(
List[electra.Attestation, Limit MAX_ATTESTATIONS](
List[electra.Attestation, Limit MAX_ATTESTATIONS_ELECTRA](
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the actual fix.

attestations)),
hash_tree_root(List[Deposit, Limit MAX_DEPOSITS](deposits)),
hash_tree_root(validator_changes.voluntary_exits),
Expand Down
Loading
Loading