|
25 | 25 | - [`get_data_column_sidecars`](#get_data_column_sidecars) |
26 | 26 | - [Custody](#custody) |
27 | 27 | - [Custody requirement](#custody-requirement) |
| 28 | + - [Validator custody](#validator-custody) |
28 | 29 | - [Public, deterministic selection](#public-deterministic-selection) |
29 | 30 | - [Custody sampling](#custody-sampling) |
30 | 31 | - [Extended data](#extended-data) |
@@ -72,6 +73,8 @@ The following values are (non-configurable) constants used throughout the specif |
72 | 73 | | `SAMPLES_PER_SLOT` | `8` | Number of `DataColumnSidecar` random samples a node queries per slot | |
73 | 74 | | `NUMBER_OF_CUSTODY_GROUPS` | `128` | Number of custody groups available for nodes to custody | |
74 | 75 | | `CUSTODY_REQUIREMENT` | `4` | Minimum number of custody groups an honest node custodies and serves samples from | |
| 76 | +| `VALIDATOR_CUSTODY_REQUIREMENT` | `8` | Minimum number of custody groups an honest node with validators attached custodies and serves samples from | |
| 77 | +| `BALANCE_PER_ADDITIONAL_CUSTODY_GROUP` | `Gwei(32 * 10**9)` | Balance increment corresponding to one additional group to custody | |
75 | 78 |
|
76 | 79 | ### Containers |
77 | 80 |
|
@@ -224,12 +227,25 @@ def get_data_column_sidecars(signed_block: SignedBeaconBlock, |
224 | 227 |
|
225 | 228 | ### Custody requirement |
226 | 229 |
|
227 | | -Columns are grouped into custody groups. Nodes custodying a custody group MUST custody all the columns in that group. |
| 230 | +Columns are grouped into custody groups. Nodes custodying a custody group MUST custody all the columns in that group. When syncing, a node MUST backfill columns from all of its custody groups. |
228 | 231 |
|
229 | 232 | A node *may* choose to custody and serve more than the minimum honesty requirement. Such a node explicitly advertises a number greater than `CUSTODY_REQUIREMENT` through the peer discovery mechanism, specifically by setting a higher value in the `custody_group_count` field within its ENR. This value can be increased up to `NUMBER_OF_CUSTODY_GROUPS`, indicating a super-full node. |
230 | 233 |
|
231 | 234 | A node stores the custodied columns for the duration of the pruning period and responds to peer requests for samples on those columns. |
232 | 235 |
|
| 236 | +### Validator custody |
| 237 | + |
| 238 | +A node with validators attached downloads and custodies a higher minimum of custody groups per slot, determined by `get_validators_custody_requirement(state, validator_indices)`. Here, `state` is the current `BeaconState` and `validator_indices` is the list of indices corresponding to validators attached to the node. Any node with at least one validator attached, and with the sum of the balances of all attached validators being `total_node_balance`, downloads and custodies `total_node_balance // BALANCE_PER_ADDITIONAL_CUSTODY_GROUP` custody groups per slot, with a minimum of `VALIDATOR_CUSTODY_REQUIREMENT` and of course a maximum of `NUMBER_OF_CUSTODY_GROUPS`. |
| 239 | + |
| 240 | +```python |
| 241 | +def get_validators_custody_requirement(state: BeaconState, validator_indices: Sequence[ValidatorIndex]) -> uint64: |
| 242 | + total_node_balance = sum(state.balances[index] for index in validator_indices) |
| 243 | + count = total_node_balance // BALANCE_PER_ADDITIONAL_CUSTODY_GROUP |
| 244 | + return min(max(count, VALIDATOR_CUSTODY_REQUIREMENT), NUMBER_OF_CUSTODY_GROUPS) |
| 245 | +``` |
| 246 | + |
| 247 | +This higher custody is advertised in the node's Metadata by setting a higher `custody_group_count` and in the node's ENR by setting a higher `cgc`. As with the regular custody requirement, a node with validators *may* still choose to custody, advertise and serve more than this minimum. As with the regular custody requirement, a node MUST backfill columns when syncing. In addition, when the validator custody requirement increases, due to an increase in the total balance of the attached validators, a node MUST backfill columns from the new custody groups. However, a node *may* wait to advertise a higher custody in its Metadata and ENR until backfilling is complete. |
| 248 | + |
233 | 249 | ### Public, deterministic selection |
234 | 250 |
|
235 | 251 | The particular columns/groups that a node custodies are selected pseudo-randomly as a function (`get_custody_groups`) of the node-id and custody size -- importantly this function can be run by any party as the inputs are all public. |
|
0 commit comments