test fix
This commit is contained in:
parent
7c0b4d28d2
commit
b246d51ac1
|
@ -15,7 +15,8 @@ import
|
|||
datatypes, crypto, helpers, beaconstate, helpers,
|
||||
state_transition_block, state_transition_epoch, state_transition],
|
||||
../beacon_chain/extras,
|
||||
../beacon_chain/ssz/[merkleization, ssz_serialization]
|
||||
../beacon_chain/ssz/[merkleization, ssz_serialization],
|
||||
../tests/official/fixtures_utils
|
||||
|
||||
# Nimbus Bench - Scenario configuration
|
||||
# --------------------------------------------------
|
||||
|
@ -253,7 +254,7 @@ template genProcessBlockScenario(name, transitionFn,
|
|||
|
||||
genProcessEpochScenario(runProcessJustificationFinalization,
|
||||
process_justification_and_finalization,
|
||||
needCache = true)
|
||||
needCache = false)
|
||||
|
||||
genProcessEpochScenario(runProcessRegistryUpdates,
|
||||
process_registry_updates,
|
||||
|
@ -261,7 +262,7 @@ genProcessEpochScenario(runProcessRegistryUpdates,
|
|||
|
||||
genProcessEpochScenario(runProcessSlashings,
|
||||
process_slashings,
|
||||
needCache = true)
|
||||
needCache = false)
|
||||
|
||||
genProcessEpochScenario(runProcessFinalUpdates,
|
||||
process_final_updates,
|
||||
|
|
|
@ -10,7 +10,7 @@ import
|
|||
os, strutils, typetraits,
|
||||
# Internals
|
||||
../../beacon_chain/ssz,
|
||||
../../beacon_chain/spec/[datatypes, crypto],
|
||||
../../beacon_chain/spec/[datatypes, crypto, state_transition_epoch],
|
||||
# Status libs
|
||||
stew/byteutils,
|
||||
serialization, json_serialization
|
||||
|
@ -64,3 +64,16 @@ proc sszDecodeEntireInput*(input: openarray[byte], Decoded: type): Decoded =
|
|||
|
||||
if stream.readable:
|
||||
raise newException(UnconsumedInput, "Remaining bytes in the input")
|
||||
|
||||
proc process_justification_and_finalization*(state: var BeaconState) =
|
||||
var cache = StateCache()
|
||||
|
||||
var validator_statuses = ValidatorStatuses.init(state)
|
||||
validator_statuses.process_attestations(state, cache)
|
||||
process_justification_and_finalization(state, validator_statuses.total_balances)
|
||||
|
||||
proc process_slashings*(state: var BeaconState) =
|
||||
var cache = StateCache()
|
||||
var validator_statuses = ValidatorStatuses.init(state)
|
||||
validator_statuses.process_attestations(state, cache)
|
||||
process_slashings(state, validator_statuses.total_balances.current_epoch)
|
||||
|
|
|
@ -27,19 +27,6 @@ from ../../beacon_chain/spec/beaconstate import process_registry_updates
|
|||
#
|
||||
# We store the state on the heap to avoid that
|
||||
|
||||
proc process_justification_and_finalization(state: var BeaconState) =
|
||||
var cache = StateCache()
|
||||
|
||||
var validator_statuses = ValidatorStatuses.init(state)
|
||||
validator_statuses.process_attestations(state, cache)
|
||||
process_justification_and_finalization(state, validator_statuses.total_balances)
|
||||
|
||||
proc process_slashings(state: var BeaconState) =
|
||||
var cache = StateCache()
|
||||
var validator_statuses = ValidatorStatuses.init(state)
|
||||
validator_statuses.process_attestations(state, cache)
|
||||
process_slashings(state, validator_statuses.total_balances.current_epoch)
|
||||
|
||||
template runSuite(suiteDir, testName: string, transitionProc: untyped{ident}, useCache: static bool): untyped =
|
||||
# We wrap the tests in a proc to avoid running out of globals
|
||||
# in the future: Nim supports up to 3500 globals
|
||||
|
|
Loading…
Reference in New Issue