Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebalance duty times #3433

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open
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
21 changes: 20 additions & 1 deletion configs/mainnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ CHURN_LIMIT_QUOTIENT: 65536
# ---------------------------------------------------------------
# 40%
PROPOSER_SCORE_BOOST: 40
# 6000ms
LATE_BLOCK_CUTOFF_MS: 6000


# Deposit contract
# ---------------------------------------------------------------
Expand Down Expand Up @@ -131,7 +134,21 @@ ATTESTATION_SUBNET_EXTRA_BITS: 0
# ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS
ATTESTATION_SUBNET_PREFIX_BITS: 6

# Deneb

# Validator duties
# ---------------------------------------------------------------
# 6000ms
ATTESTATION_DUE_MS: 6000
# 9000ms
AGGREGATE_DUE_MS: 9000
# 6000ms
SYNC_MESSAGE_DUE_MS: 6000
# 9000ms
CONTRIBUTION_DUE_MS: 9000


# Deneb:EIP4844
# ---------------------------------------------------------------
# `2**7` (=128)
MAX_REQUEST_BLOCKS_DENEB: 128
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK
Expand All @@ -141,7 +158,9 @@ MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096
# `6`
BLOB_SIDECAR_SUBNET_COUNT: 6


# Whisk
# ---------------------------------------------------------------
# `Epoch(2**8)`
WHISK_EPOCHS_PER_SHUFFLING_PHASE: 256
# `Epoch(2)`
Expand Down
22 changes: 21 additions & 1 deletion configs/minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ CHURN_LIMIT_QUOTIENT: 32
# ---------------------------------------------------------------
# 40%
PROPOSER_SCORE_BOOST: 40
# [customized] 3000ms
LATE_BLOCK_CUTOFF_MS: 3000


# Deposit contract
Expand Down Expand Up @@ -132,7 +134,21 @@ ATTESTATION_SUBNET_EXTRA_BITS: 0
# ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS
ATTESTATION_SUBNET_PREFIX_BITS: 6

# Deneb

# Validator duties
# ---------------------------------------------------------------
# [customized] 3000ms
ATTESTATION_DUE_MS: 3000
# [customized] 4500ms
AGGREGATE_DUE_MS: 4500
# [customized] 3000ms
SYNC_MESSAGE_DUE_MS: 3000
# [customized] 4500ms
CONTRIBUTION_DUE_MS: 4500


# Deneb:EIP4844
# ---------------------------------------------------------------
# `2**7` (=128)
MAX_REQUEST_BLOCKS_DENEB: 128
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK
Expand All @@ -142,6 +158,10 @@ MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096
# `6`
BLOB_SIDECAR_SUBNET_COUNT: 6


# Whisk
# ---------------------------------------------------------------
# [customized]
WHISK_EPOCHS_PER_SHUFFLING_PHASE: 4
# [customized]
WHISK_PROPOSER_SELECTION_GAP: 1
11 changes: 9 additions & 2 deletions specs/deneb/fork-choice.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

- [Introduction](#introduction)
- [Containers](#containers)
- [Configurations](#configurations)
- [Helpers](#helpers)
- [Extended `PayloadAttributes`](#extended-payloadattributes)
- [`is_data_available`](#is_data_available)
Expand All @@ -22,6 +23,12 @@ This is the modification of the fork choice accompanying the Deneb upgrade.

## Containers

## Configurations

| Name | Value |
| ---------------------- | ----------- |
| `LATE_BLOCK_CUTOFF_MS` | `6000` |

## Helpers

### Extended `PayloadAttributes`
Expand Down Expand Up @@ -105,9 +112,9 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:

# Add proposer score boost if the block is timely
time_into_slot = (store.time - store.genesis_time) % SECONDS_PER_SLOT
is_before_attesting_interval = time_into_slot < SECONDS_PER_SLOT // INTERVALS_PER_SLOT
is_before_late_block_cutoff = time_into_slot * 1000 < LATE_BLOCK_CUTOFF_MS
is_first_block = store.proposer_boost_root == Root()
if get_current_slot(store) == block.slot and is_before_attesting_interval and is_first_block:
if get_current_slot(store) == block.slot and is_before_late_block_cutoff and is_first_block:
store.proposer_boost_root = hash_tree_root(block)

# Update checkpoints in store if necessary
Expand Down
41 changes: 41 additions & 0 deletions specs/deneb/validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

- [Introduction](#introduction)
- [Prerequisites](#prerequisites)
- [Configurations](#configurations)
- [Helpers](#helpers)
- [`BlobsBundle`](#blobsbundle)
- [Modified `GetPayloadResponse`](#modified-getpayloadresponse)
Expand All @@ -23,6 +24,11 @@
- [Blob KZG commitments](#blob-kzg-commitments)
- [Constructing the `SignedBlobSidecar`s](#constructing-the-signedblobsidecars)
- [Sidecar](#sidecar)
- [Validator duties](#validator-duties)
- [Attestations](#attestations)
- [Aggregates](#aggregates)
- [Sync committee messages](#sync-committee-messages)
- [Sync committee contributions](#sync-committee-contributions)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->
<!-- /TOC -->
Expand All @@ -39,6 +45,15 @@ All behaviors and definitions defined in this document, and documents it extends
All terminology, constants, functions, and protocol mechanics defined in the updated [Beacon Chain doc of Deneb](./beacon-chain.md) are requisite for this document and used throughout.
Please see related Beacon Chain doc before continuing and use them as a reference throughout.

## Configurations

| Name | Value |
| --------------------- | ----------- |
| `ATTESTATION_DUE_MS` | `6000` |
| `AGGREGATE_DUE_MS` | `9000` |
| `SYNC_MESSAGE_DUE_MS` | `6000` |
| `CONTRIBUTION_DUE_MS` | `9000` |
Comment on lines +52 to +55
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah good idea splitting sync committee and contributions to their own constants, I like it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think sync messages should be aligned with attestations. the logic is the same as for attestations in that they should be created once the block has been fully validated and it is reasonable to assume that it propagated.


## Helpers

### `BlobsBundle`
Expand Down Expand Up @@ -191,3 +206,29 @@ The validator MUST hold on to sidecars for `MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUEST
to ensure the data-availability of these blobs throughout the network.

After `MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS` nodes MAY prune the sidecars and/or stop serving them.

### Validator duties

The timing for sending attestation, aggregate, sync committee messages and contributions change.

#### Attestations

A validator must create and broadcast the `attestation` to the associated attestation subnet as soon as the validator has received a valid block from the expected block proposer for the assigned `slot`.

If the block has not been observed at `ATTESTATION_DUE_MS` milliseconds into the slot, the validator should send the attestation voting for its current head as selected by fork choice.

Within each slot, clients must be prepared to receive attestations out of order with respect to the block that it's voting for.

#### Aggregates

If the validator is selected to aggregate (`is_aggregator`), then they broadcast their best aggregate as a `SignedAggregateAndProof` to the global aggregate channel (`beacon_aggregate_and_proof`) `AGGREGATE_DUE_MS` milliseconds after the start of the slot.

Within each slot, clients must be prepared to receive aggregates out of order with respect to the block that it's voting for.

#### Sync committee messages

This logic is triggered upon the same conditions as when producing an attestation, using `SYNC_MESSAGE_DUE_MS` as cutoff time.

#### Sync committee contributions

This logic is triggered upon the same conditions as when producing an aggregate, , using `CONTRIBUTION_DUE_MS` as cutoff time.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
is_ready_to_justify,
find_next_justifying_slot,
)
from eth2spec.test.helpers.forks import (
is_post_deneb,
)
from eth2spec.test.helpers.state import (
next_epoch,
next_slots,
Expand Down Expand Up @@ -523,8 +526,13 @@ def test_proposer_boost_root_same_slot_untimely_block(spec, state):
signed_block = state_transition_and_sign_block(spec, state, block)

# Process block on untimely arrival in the same slot
time = (store.genesis_time + block.slot * spec.config.SECONDS_PER_SLOT +
spec.config.SECONDS_PER_SLOT // spec.INTERVALS_PER_SLOT)
if not is_post_deneb(spec):
time = (store.genesis_time + block. slot * spec.config.SECONDS_PER_SLOT +
spec.config.SECONDS_PER_SLOT // spec.INTERVALS_PER_SLOT)
else:
time = (store.genesis_time + block.slot * spec.config.SECONDS_PER_SLOT +
spec.config.LATE_BLOCK_CUTOFF_MS // 1000)

on_tick_and_append_step(spec, store, time, test_steps)
yield from add_block(spec, store, signed_block, test_steps)

Expand Down