mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-03 00:27:38 +00:00
parent
e610d2a5de
commit
5a2453ac9c
@ -242,7 +242,7 @@ func main() {
|
|||||||
blkRoot,
|
blkRoot,
|
||||||
preStateRoot,
|
preStateRoot,
|
||||||
)
|
)
|
||||||
postState, err := transition.ExecuteStateTransition(context.Background(), stateObj, block)
|
postState, err := debugStateTransition(context.Background(), stateObj, block)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -355,3 +355,32 @@ func benchmarkHash(sszPath string, sszType string) {
|
|||||||
log.Fatal("Invalid type")
|
log.Fatal("Invalid type")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func debugStateTransition(
|
||||||
|
ctx context.Context,
|
||||||
|
st state.BeaconState,
|
||||||
|
signed interfaces.ReadOnlySignedBeaconBlock,
|
||||||
|
) (state.BeaconState, error) {
|
||||||
|
var err error
|
||||||
|
|
||||||
|
parentRoot := signed.Block().ParentRoot()
|
||||||
|
st, err = transition.ProcessSlotsUsingNextSlotCache(ctx, st, parentRoot[:], signed.Block().Slot())
|
||||||
|
if err != nil {
|
||||||
|
return st, errors.Wrap(err, "could not process slots")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Execute per block transition.
|
||||||
|
set, st, err := transition.ProcessBlockNoVerifyAnySig(ctx, st, signed)
|
||||||
|
if err != nil {
|
||||||
|
return st, errors.Wrap(err, "could not process block")
|
||||||
|
}
|
||||||
|
var valid bool
|
||||||
|
valid, err = set.VerifyVerbosely()
|
||||||
|
if err != nil {
|
||||||
|
return st, errors.Wrap(err, "could not batch verify signature")
|
||||||
|
}
|
||||||
|
if !valid {
|
||||||
|
return st, errors.New("signature in block failed to verify")
|
||||||
|
}
|
||||||
|
return st, nil
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user