Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
etan-status committed Nov 10, 2023
1 parent 659199f commit e244c12
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions beacon_chain/spec/presets.nim
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,10 @@ else:
const SLOTS_PER_SYNC_COMMITTEE_PERIOD* =
SLOTS_PER_EPOCH * EPOCHS_PER_SYNC_COMMITTEE_PERIOD

# https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/phase0/p2p-interface.md#configuration
func safeMinEpochsForBlockRequests*(cfg: RuntimeConfig): uint64 =
cfg.MIN_VALIDATOR_WITHDRAWABILITY_DELAY + cfg.CHURN_LIMIT_QUOTIENT div 2

func parse(T: type uint64, input: string): T {.raises: [ValueError].} =
var res: BiggestUInt
if input.len > 2 and input[0] == '0' and input[1] == 'x':
Expand Down Expand Up @@ -784,11 +788,7 @@ proc readRuntimeConfig*(
msg: "Config not compatible with binary, compile with -d:const_preset=" & cfg.PRESET_BASE)

# Requires initialized `cfg`

# https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/phase0/p2p-interface.md#configuration
let safeMinEpochsForBlockRequests =
cfg.MIN_VALIDATOR_WITHDRAWABILITY_DELAY + cfg.CHURN_LIMIT_QUOTIENT div 2
checkCompatibility safeMinEpochsForBlockRequests,
checkCompatibility cfg.safeMinEpochsForBlockRequests(),
"MIN_EPOCHS_FOR_BLOCK_REQUESTS", `>=`

var unknowns: seq[string]
Expand Down
1 change: 1 addition & 0 deletions tests/test_blockchain_dag.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,7 @@ suite "Pruning":
var res = defaultRuntimeConfig
res.MIN_VALIDATOR_WITHDRAWABILITY_DELAY = 4
res.CHURN_LIMIT_QUOTIENT = 1
res.MIN_EPOCHS_FOR_BLOCK_REQUESTS = cfg.safeMinEpochsForBlockRequests()
doAssert res.MIN_EPOCHS_FOR_BLOCK_REQUESTS == 4
res
db = makeTestDB(SLOTS_PER_EPOCH)
Expand Down

0 comments on commit e244c12

Please sign in to comment.