From 9f4ae4c6eeb281a76788900ae2552a59a7f55eb1 Mon Sep 17 00:00:00 2001 From: terence tsao Date: Fri, 21 Oct 2022 17:33:55 -0700 Subject: [PATCH] Update validator spec with `SignedBeaconBlockAndBlobsSidecar` --- specs/eip4844/p2p-interface.md | 6 +++--- specs/eip4844/validator.md | 33 +++++++++++++-------------------- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/specs/eip4844/p2p-interface.md b/specs/eip4844/p2p-interface.md index 735230027..2162ab161 100644 --- a/specs/eip4844/p2p-interface.md +++ b/specs/eip4844/p2p-interface.md @@ -18,7 +18,7 @@ The specification of these changes continues in the same format as the network s - [The gossip domain: gossipsub](#the-gossip-domain-gossipsub) - [Topics and messages](#topics-and-messages) - [Global topics](#global-topics) - - [`beacon_block_and_blob_sidecar`](#beacon_block_and_blob_sidecar) + - [`beacon_block_and_blobs_sidecar`](#beacon_block_and_blobs_sidecar) - [Transitioning the gossip](#transitioning-the-gossip) - [The Req/Resp domain](#the-reqresp-domain) - [Messages](#messages) @@ -83,14 +83,14 @@ The new topics along with the type of the `data` field of a gossipsub message ar | Name | Message Type | | - | - | -| `beacon_block_and_blob_sidecar` | `SignedBeaconBlockAndBlobsSidecar` (new) | +| `beacon_block_and_blobs_sidecar` | `SignedBeaconBlockAndBlobsSidecar` (new) | #### Global topics EIP4844 introduces a new global topic for beacon block and blobs-sidecars. -##### `beacon_block_and_blob_sidecar` +##### `beacon_block_and_blobs_sidecar` This topic is used to propagate new signed and coupled beacon blocks and blobs sidecars to all nodes on the networks. diff --git a/specs/eip4844/validator.md b/specs/eip4844/validator.md index e1bcf9564..18623659a 100644 --- a/specs/eip4844/validator.md +++ b/specs/eip4844/validator.md @@ -192,9 +192,9 @@ def get_blobs_and_kzg_commitments(payload_id: PayloadId) -> Tuple[Sequence[BLSFi ## Beacon chain responsibilities All validator responsibilities remain unchanged other than those noted below. -Namely, the blob handling and the addition of `BlobsSidecar`. +Namely, the blob handling and the addition of `SignedBeaconBlockAndBlobsSidecar`. -### Block proposal +### Block and sidecar proposal #### Constructing the `BeaconBlockBody` @@ -218,13 +218,16 @@ def validate_blobs_and_kzg_commitments(execution_payload: ExecutionPayload, 3. If valid, set `block.body.blob_kzg_commitments = blob_kzg_commitments`. -Note that the `blobs` should be held with the block in preparation of publishing. -Without the `blobs`, the published block will effectively be ignored by honest validators. +#### Constructing the `SignedBeaconBlockAndBlobsSidecar` +To construct a `SignedBeaconBlockAndBlobsSidecar`, a `signed_beacon_block_and_blobs_sidecar` is defined with the necessary context for block and sidecar proposal. -### Beacon Block publishing time +##### Block +Set `signed_beacon_block_and_blobs_sidecar.beacon_block = block` where `block` is obtained above. -Before publishing a prepared beacon block proposal, the corresponding blobs are packaged into a sidecar object for distribution to the network: +##### Sidecar +Coupled with block, the corresponding blobs are packaged into a sidecar object for distribution to the network. +Set `signed_beacon_block_and_blobs_sidecar.blobs_sidecar = sidecar` where `sidecar` is obtained from: ```python def get_blobs_sidecar(block: BeaconBlock, blobs: Sequence[Blob]) -> BlobsSidecar: return BlobsSidecar( @@ -235,20 +238,10 @@ def get_blobs_sidecar(block: BeaconBlock, blobs: Sequence[Blob]) -> BlobsSidecar ) ``` -And then signed: +This `signed_beacon_block_and_blobs_sidecar` is then published to the global `beacon_block_and_blobs_sidecar` topic. -```python -def get_signed_blobs_sidecar(state: BeaconState, blobs_sidecar: BlobsSidecar, privkey: int) -> SignedBlobsSidecar: - domain = get_domain(state, DOMAIN_BLOBS_SIDECAR, blobs_sidecar.beacon_block_slot // SLOTS_PER_EPOCH) - signing_root = compute_signing_root(blobs_sidecar, domain) - signature = bls.Sign(privkey, signing_root) - return SignedBlobsSidecar(message=blobs_sidecar, signature=signature) -``` - -This `signed_blobs_sidecar` is then published to the global `blobs_sidecar` topic as soon as the `signed_beacon_block` is published. - -After publishing the sidecar peers on the network may request the sidecar through sync-requests, or a local user may be interested. -The validator MUST hold on to blobs for `MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUESTS` epochs and serve when capable, +After publishing the peers on the network may request the sidecar through sync-requests, or a local user may be interested. +The validator MUST hold on to sidecars for `MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUESTS` epochs and serve when capable, to ensure the data-availability of these blobs throughout the network. -After `MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUESTS` nodes MAY prune the blobs and/or stop serving them. +After `MIN_EPOCHS_FOR_BLOBS_SIDECARS_REQUESTS` nodes MAY prune the sidecars and/or stop serving them.