2019-09-09 14:06:29 -05:00
|
|
|
import
|
|
|
|
confutils, chronicles,
|
2019-10-25 12:59:56 +02:00
|
|
|
../beacon_chain/spec/[crypto, datatypes],
|
2019-09-09 14:06:29 -05:00
|
|
|
../beacon_chain/[extras, state_transition, ssz]
|
|
|
|
|
|
|
|
cli do(pre: string, blck: string, post: string, verifyStateRoot = false):
|
|
|
|
let
|
2020-04-23 21:58:54 +03:00
|
|
|
stateX = SSZ.loadFile(pre, BeaconStateRef)
|
2020-02-29 12:15:44 -03:00
|
|
|
blckX = SSZ.loadFile(blck, SignedBeaconBlock)
|
2020-03-05 13:52:10 +01:00
|
|
|
flags = if verifyStateRoot: {skipStateRootValidation} else: {}
|
2019-09-09 14:06:29 -05:00
|
|
|
|
2020-04-28 10:08:32 +02:00
|
|
|
var stateY = HashedBeaconState(data: stateX[], root: hash_tree_root(stateX[]))
|
2020-04-26 21:13:33 +02:00
|
|
|
if not state_transition(stateY, blckX, flags, noRollback):
|
2019-09-09 14:06:29 -05:00
|
|
|
error "State transition failed"
|
2020-04-26 21:13:33 +02:00
|
|
|
else:
|
|
|
|
SSZ.saveFile(post, stateY.data)
|