From b86bbf7dad69b8d0e0bedd98d50d64584cb20f1b Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Fri, 24 Feb 2023 13:02:41 +1100 Subject: [PATCH 1/3] SSE for payload attributes --- apis/eventstream/index.yaml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/apis/eventstream/index.yaml b/apis/eventstream/index.yaml index 31d8572e..d50dfc98 100644 --- a/apis/eventstream/index.yaml +++ b/apis/eventstream/index.yaml @@ -32,6 +32,7 @@ get: - contribution_and_proof - light_client_finality_update - light_client_optimistic_update + - payload_attributes responses: "200": description: Opened SSE stream. @@ -91,6 +92,32 @@ get: value: | event: light_client_optimistic_update data: {"version":"phase0", "data": {"attested_header": {"beacon": {"slot":"1", "proposer_index":"1", "parent_root":"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", "state_root":"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", "body_root":"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"}}, "sync_aggregate": {"sync_committee_bits":"0x01", "sync_committee_signature":"0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"}, "signature_slot":"1"}} + payload_attributes: + description: | + The node has computed new payload attributes for execution payload building. + + This event gives block builders and relays sufficient information to construct or + verify a block at `proposal_slot`. The meanings of the fields are: + + - `version`: the identifier of the beacon hard fork at `proposal_slot`, e.g. + `"bellatrix"`, `"capella"`. + - `proposal_slot`: the slot at which a block using these payload attributes may be + built. + - `parent_block_root`: the beacon block root of the parent block to be built upon. + - `parent_block_number`: the execution block number of the parent block. + - `parent_block_hash`: the execution block hash of the parent block. + - `proposer_index`: the validator index of the proposer at `proposal_slot` on + the chain identified by `parent_block_root`. + - `payload_attributes`: beacon-style encoding of `PayloadAttributesV` as + defined by the `execution-apis` specification. The version `N` must match the + payload attributes for the hard fork matching `version`. + The object here must have equivalent fields to its counterpart in + `execution-apis` with two differences: 1) `snake_case` identifiers must be used + rather than `camelCase`; 2) integers must be encoded as quoted decimals rather + than big-endian hex. + value: | + event: payload_attributes + data: {"version": "capella", "data": {"proposer_index": "123", "proposal_slot": "10", "proposal_block_number": "9", "parent_block_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", "parent_block_hash": "0x9a2fefd2fdb57f74993c7780ea5b9030d2897b615b89f808011ca5aebed54eaf", "payload_attributes": {"timestamp": "123456", "prev_randao": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", "suggested_fee_recipient": "0x0000000000000000000000000000000000000000", "withdrawals": [{"index": "5", "validator_index": "10", "address": "0x0000000000000000000000000000000000000000", "amount": "15640"}]}}}, "400": description: "The topics supplied could not be parsed" content: From 57f46b476554cde3108bdf97c3bcd9c69db05bea Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Sat, 25 Feb 2023 18:26:36 +1100 Subject: [PATCH 2/3] Tweak encoding wording --- apis/eventstream/index.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apis/eventstream/index.yaml b/apis/eventstream/index.yaml index d50dfc98..9349c87b 100644 --- a/apis/eventstream/index.yaml +++ b/apis/eventstream/index.yaml @@ -108,10 +108,10 @@ get: - `parent_block_hash`: the execution block hash of the parent block. - `proposer_index`: the validator index of the proposer at `proposal_slot` on the chain identified by `parent_block_root`. - - `payload_attributes`: beacon-style encoding of `PayloadAttributesV` as + - `payload_attributes`: beacon API encoding of `PayloadAttributesV` as defined by the `execution-apis` specification. The version `N` must match the payload attributes for the hard fork matching `version`. - The object here must have equivalent fields to its counterpart in + The beacon API encoded object must have equivalent fields to its counterpart in `execution-apis` with two differences: 1) `snake_case` identifiers must be used rather than `camelCase`; 2) integers must be encoded as quoted decimals rather than big-endian hex. From cb15cac95f36d9d2fd909a4395d0b8317500857b Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Tue, 28 Feb 2023 10:42:43 +1100 Subject: [PATCH 3/3] Add comment about beacon node config --- apis/eventstream/index.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apis/eventstream/index.yaml b/apis/eventstream/index.yaml index 9349c87b..3c8f6dc8 100644 --- a/apis/eventstream/index.yaml +++ b/apis/eventstream/index.yaml @@ -115,6 +115,10 @@ get: `execution-apis` with two differences: 1) `snake_case` identifiers must be used rather than `camelCase`; 2) integers must be encoded as quoted decimals rather than big-endian hex. + + The frequency at which this event is sent may depend on beacon node configuration. + The fee recipient may also be set via beacon node config, but should likely be + ignored by block builders and most other API consumers. value: | event: payload_attributes data: {"version": "capella", "data": {"proposer_index": "123", "proposal_slot": "10", "proposal_block_number": "9", "parent_block_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", "parent_block_hash": "0x9a2fefd2fdb57f74993c7780ea5b9030d2897b615b89f808011ca5aebed54eaf", "payload_attributes": {"timestamp": "123456", "prev_randao": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", "suggested_fee_recipient": "0x0000000000000000000000000000000000000000", "withdrawals": [{"index": "5", "validator_index": "10", "address": "0x0000000000000000000000000000000000000000", "amount": "15640"}]}}},