Reuse ProcessBlockForStateRoot (#8781)

This commit is contained in:
terence tsao 2021-04-16 10:18:59 -07:00 committed by GitHub
parent 59ee339497
commit 400e42cc2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -174,16 +174,11 @@ func ProcessBlockNoVerifyAnySig(
}
blk := signed.Block
body := blk.Body
bodyRoot, err := body.HashTreeRoot()
state, err := ProcessBlockForStateRoot(ctx, state, signed)
if err != nil {
return nil, nil, err
}
state, err = b.ProcessBlockHeaderNoVerify(state, blk.Slot, blk.ProposerIndex, blk.ParentRoot, bodyRoot[:])
if err != nil {
traceutil.AnnotateError(span, err)
return nil, nil, errors.Wrap(err, "could not process block header")
}
bSet, err := b.BlockSignatureSet(state, blk.ProposerIndex, signed.Signature, blk.HashTreeRoot)
if err != nil {
traceutil.AnnotateError(span, err)
@ -194,23 +189,6 @@ func ProcessBlockNoVerifyAnySig(
traceutil.AnnotateError(span, err)
return nil, nil, errors.Wrap(err, "could not retrieve randao signature set")
}
state, err = b.ProcessRandaoNoVerify(state, signed.Block.Body.RandaoReveal)
if err != nil {
traceutil.AnnotateError(span, err)
return nil, nil, errors.Wrap(err, "could not verify and process randao")
}
state, err = b.ProcessEth1DataInBlock(ctx, state, signed.Block.Body.Eth1Data)
if err != nil {
traceutil.AnnotateError(span, err)
return nil, nil, errors.Wrap(err, "could not process eth1 data")
}
state, err = ProcessOperationsNoVerifyAttsSigs(ctx, state, signed)
if err != nil {
traceutil.AnnotateError(span, err)
return nil, nil, errors.Wrap(err, "could not process block operation")
}
aSet, err := b.AttestationSignatureSet(ctx, state, signed.Block.Body.Attestations)
if err != nil {
return nil, nil, errors.Wrap(err, "could not retrieve attestation signature set")