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

Add dependent_root metadata to attestation and block duties #117

Merged
merged 4 commits into from
Nov 27, 2020
Merged
Show file tree
Hide file tree
Changes from 3 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 apis/eventstream/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ get:
description: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format
examples:
head:
description: The node has finished processing, resulting in a new head
description: The node has finished processing, resulting in a new head. previous_duty_dependent_root is `get_block_root_at_slot(state, compute_start_slot_at_epoch(epoch - 1) - 1)` and current_duty_dependent_root is `get_block_root_at_slot(state, compute_start_slot_at_epoch(epoch) - 1)`. Both dependent roots use the genesis block root in the case of underflow.
value: |
event: head\n
data: "{\"slot\": \"10\", \"block\": \"0x9a2fefd2fdb57f74993c7780ea5b9030d2897b615b89f808011ca5aebed54eaf\", \"state\":\"0x600e852a08c1200654ddf11025f1ceacb3c2e74bdd5c630cde0838b2591b69f9\", \"epoch_transition\": false}"\n
data: "{\"slot\": \"10\", \"block\": \"0x9a2fefd2fdb57f74993c7780ea5b9030d2897b615b89f808011ca5aebed54eaf\", \"state\":\"0x600e852a08c1200654ddf11025f1ceacb3c2e74bdd5c630cde0838b2591b69f9\", \"epoch_transition\": false, \"previous_duty_dependent_root\": \"0x5e0043f107cb57913498fbf2f99ff55e730bf1e151f02f221e977c91a90a0e91\", \"current_duty_dependent_root\": \"0x5e0043f107cb57913498fbf2f99ff55e730bf1e151f02f221e977c91a90a0e91\"}"\n
\n
block:
description: The node has received a valid block (from P2P or API)
Expand Down
14 changes: 13 additions & 1 deletion apis/validator/duties/attester.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,17 @@ post:

Duties should only need to be checked once per epoch,
however a chain reorganization (of > MIN_SEED_LOOKAHEAD epochs) could occur,
resulting in a change of duties. For full safety, you should monitor chain reorganizations events."
resulting in a change of duties. For full safety, you should monitor head events and confirm the
dependent root in this response matches:

- event.previous_duty_dependent_root when `compute_epoch_at_slot(event.slot) == epoch`

- event.current_duty_dependent_root when `compute_epoch_at_slot(event.slot) + 1 == epoch`

- event.block otherwise

The dependent_root value is `get_block_root_at_slot(state, compute_start_slot_at_epoch(epoch - 1) - 1)`
or the genesis block root in the case of underflow."
parameters:
- name: epoch
description: "Should only be allowed 1 epoch ahead"
Expand Down Expand Up @@ -37,6 +47,8 @@ post:
title: GetAttesterDutiesResponse
type: object
properties:
dependent_root:
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/DependentRoot"
data:
type: array
items:
Expand Down
16 changes: 15 additions & 1 deletion apis/validator/duties/proposer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,19 @@ get:
- Validator
summary: "Get block proposers duties"
operationId: "getProposerDuties"
description: "Request beacon node to provide all validators that are scheduled to propose a block in the given epoch"
description: "Request beacon node to provide all validators that are scheduled to propose a block in the given epoch.

Duties should only need to be checked once per epoch,
however a chain reorganization (of > MIN_SEED_LOOKAHEAD epochs) could occur,
ajsutton marked this conversation as resolved.
Show resolved Hide resolved
resulting in a change of duties. For full safety, you should monitor head events and confirm the
dependent root in this response matches:

- event.current_duty_dependent_root when `compute_epoch_at_slot(event.slot) == epoch`

- event.block otherwise

The dependent_root value is `get_block_root_at_slot(state, compute_start_slot_at_epoch(epoch) - 1)`
or the genesis block root in the case of underflow."
parameters:
- name: epoch
in: path
Expand All @@ -20,6 +32,8 @@ get:
title: GetProposerDutiesResponse
type: object
properties:
dependent_root:
$ref: "../../../beacon-node-oapi.yaml#/components/schemas/DependentRoot"
data:
type: array
items:
Expand Down
2 changes: 2 additions & 0 deletions beacon-node-oapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ components:
$ref: './types/primitive.yaml#/Version'
ForkVersion:
$ref: './types/primitive.yaml#/ForkVersion'
DependentRoot:
$ref: './types/primitive.yaml#/DependentRoot'
Root:
$ref: './types/primitive.yaml#/Root'
Hex:
Expand Down
5 changes: 5 additions & 0 deletions types/primitive.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ Uint64:
type: string
example: "1"

DependentRoot:
allOf:
- $ref: "./primitive.yaml#/Root"
- description: "The block root that this response is dependent on."

Root:
type: string
example: "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
Expand Down