2019-09-09 19:06:29 +00:00
|
|
|
import
|
|
|
|
confutils, chronicles,
|
2020-06-23 13:54:24 +00:00
|
|
|
../beacon_chain/spec/[crypto, datatypes, state_transition],
|
|
|
|
../beacon_chain/extras,
|
2020-06-03 13:52:02 +00:00
|
|
|
../beacon_chain/ssz/[merkleization, ssz_serialization]
|
2019-09-09 19:06:29 +00:00
|
|
|
|
2020-06-25 10:23:10 +00:00
|
|
|
cli do(pre: string, blck: string, post: string, verifyStateRoot = true):
|
2019-09-09 19:06:29 +00:00
|
|
|
let
|
2020-04-29 20:12:07 +00:00
|
|
|
stateY = (ref HashedBeaconState)(
|
|
|
|
data: SSZ.loadFile(pre, BeaconState),
|
|
|
|
)
|
2020-02-29 15:15:44 +00:00
|
|
|
blckX = SSZ.loadFile(blck, SignedBeaconBlock)
|
2020-06-25 10:23:10 +00:00
|
|
|
flags = if not verifyStateRoot: {skipStateRootValidation} else: {}
|
2019-09-09 19:06:29 +00:00
|
|
|
|
2020-04-29 20:12:07 +00:00
|
|
|
stateY.root = hash_tree_root(stateY.data)
|
|
|
|
|
|
|
|
if not state_transition(stateY[], blckX, flags, noRollback):
|
2019-09-09 19:06:29 +00:00
|
|
|
error "State transition failed"
|
2020-05-08 14:16:44 +00:00
|
|
|
quit 1
|
2020-04-26 19:13:33 +00:00
|
|
|
else:
|
|
|
|
SSZ.saveFile(post, stateY.data)
|