Skip to content
Merged
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
10 changes: 9 additions & 1 deletion beacon_chain/spec/datatypes/fulu.nim
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,19 @@ const
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.10/specs/fulu/p2p-interface.md#configuration
DATA_COLUMN_SIDECAR_SUBNET_COUNT* = 128

# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.10/specs/fulu/das-core.md#custody-setting
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.2/specs/fulu/das-core.md#custody-setting
SAMPLES_PER_SLOT* = 8
CUSTODY_REQUIREMENT* = 4
NUMBER_OF_CUSTODY_GROUPS* = 128

# Minimum number of custody groups an honest node with
# validators attached custodies and serves samples from
VALIDATOR_CUSTODY_REQUIREMENT* = 8
Comment thread
tersec marked this conversation as resolved.

# Balance increment corresponding to one additional group to custody
# 2**5 * 10**9 (= 32,000,000,000) Gwei
BALANCE_PER_ADDITIONAL_CUSTODY_GROUP*: uint64 = 32000000000'u64

# Number of columns in the network per custody group
COLUMNS_PER_GROUP* = NUMBER_OF_COLUMNS div NUMBER_OF_CUSTODY_GROUPS

Expand Down
10 changes: 10 additions & 0 deletions beacon_chain/spec/peerdas_helpers.nim
Original file line number Diff line number Diff line change
Expand Up @@ -342,3 +342,13 @@ proc verify_data_column_sidecar_kzg_proofs*(sidecar: DataColumnSidecar):
return err("DataColumnSidecar: validation failed")

ok()

# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.2/specs/fulu/das-core.md#validator-custody
func get_validators_custody_requirement*(state: fulu.BeaconState,
validator_indices: openArray[ValidatorIndex]):
uint64 =
var total_node_balance: Gwei
for index in validator_indices:
total_node_balance += state.balances[index]
let count = total_node_balance div BALANCE_PER_ADDITIONAL_CUSTODY_GROUP
min(max(count.uint64, VALIDATOR_CUSTODY_REQUIREMENT.uint64), NUMBER_OF_CUSTODY_GROUPS.uint64)