fix tools/all build (#2010)

This commit is contained in:
tersec 2020-11-13 13:57:48 +01:00 committed by GitHub
parent f3a63192e6
commit 027e272007
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 6 deletions

View File

@ -145,6 +145,7 @@ proc parseSSZ(path: string, T: typedesc): T =
proc runFullTransition*(dir, preState, blocksPrefix: string, blocksQty: int, skipBLS: bool) =
let prePath = dir / preState & ".ssz"
var cache = StateCache()
echo "Running: ", prePath
let state = (ref HashedBeaconState)(
@ -160,7 +161,7 @@ proc runFullTransition*(dir, preState, blocksPrefix: string, blocksQty: int, ski
let flags = if skipBLS: {skipBlsValidation}
else: {}
let success = state_transition(
defaultRuntimePreset, state[], signedBlock, flags, noRollback)
defaultRuntimePreset, state[], signedBlock, cache, flags, noRollback)
echo "State transition status: ", if success: "SUCCESS ✓" else: "FAILURE ⚠️"
proc runProcessSlots*(dir, preState: string, numSlots: uint64) =

View File

@ -83,8 +83,9 @@ proc doTransition(conf: NcliConf) =
stateY.root = hash_tree_root(stateY.data)
var cache = StateCache()
if not state_transition(getRuntimePresetForNetwork(conf.eth2Network),
stateY[], blckX, flags, noRollback):
stateY[], blckX, cache, flags, noRollback):
error "State transition failed"
quit 1
else:

View File

@ -127,7 +127,8 @@ proc cmdBench(conf: DbConf, runtimePreset: RuntimePreset) =
isEpoch = state[].data.get_current_epoch() !=
b.message.slot.compute_epoch_at_slot
withTimer(timers[if isEpoch: tApplyEpochBlock else: tApplyBlock]):
if not state_transition(runtimePreset, state[], b, {}, noRollback):
var cache = StateCache()
if not state_transition(runtimePreset, state[], b, cache, {}, noRollback):
dump("./", b)
echo "State transition failed (!)"
quit 1

View File

@ -112,9 +112,12 @@ proc nfuzz_block(input: openArray[byte], xoutput: ptr byte,
proc state_transition(
preset: RuntimePreset, data: auto, blck: auto, flags: auto, rollback: RollbackHashedProc):
auto =
var hashedState =
HashedBeaconState(data: data.state, root: hash_tree_root(data.state))
result = state_transition(preset, hashedState, blck, flags, rollback)
var
hashedState =
HashedBeaconState(data: data.state, root: hash_tree_root(data.state))
cache = StateCache()
result =
state_transition(preset, hashedState, blck, cache, flags, rollback)
data.state = hashedState.data
decodeAndProcess(BlockInput):