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