Compare commits

...

2 Commits

Author SHA1 Message Date
terence tsao
144dbe6d2c Comment out deposit 2022-07-01 08:27:53 -07:00
Potuz
d8158f3bb3 boundary test 2022-06-30 11:10:10 -03:00
2 changed files with 33 additions and 18 deletions

View File

@@ -22,21 +22,21 @@ func (vs *Server) packDepositsAndAttestations(ctx context.Context, head state.Be
var deposits []*ethpb.Deposit var deposits []*ethpb.Deposit
var atts []*ethpb.Attestation var atts []*ethpb.Attestation
eg.Go(func() error { //eg.Go(func() error {
// Pack ETH1 deposits which have not been included in the beacon chain. // // Pack ETH1 deposits which have not been included in the beacon chain.
localDeposits, err := vs.deposits(egctx, head, eth1Data) // localDeposits, err := vs.deposits(egctx, head, eth1Data)
if err != nil { // if err != nil {
return status.Errorf(codes.Internal, "Could not get ETH1 deposits: %v", err) // return status.Errorf(codes.Internal, "Could not get ETH1 deposits: %v", err)
} // }
// if the original context is cancelled, then cancel this routine too // // if the original context is cancelled, then cancel this routine too
select { // select {
case <-egctx.Done(): // case <-egctx.Done():
return egctx.Err() // return egctx.Err()
default: // default:
} // }
deposits = localDeposits // deposits = localDeposits
return nil // return nil
}) //})
eg.Go(func() error { eg.Go(func() error {
// Pack aggregated attestations which have not been included in the beacon chain. // Pack aggregated attestations which have not been included in the beacon chain.

View File

@@ -10,11 +10,13 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/core/transition" "github.com/prysmaticlabs/prysm/beacon-chain/core/transition"
"github.com/prysmaticlabs/prysm/beacon-chain/core/transition/interop" "github.com/prysmaticlabs/prysm/beacon-chain/core/transition/interop"
v "github.com/prysmaticlabs/prysm/beacon-chain/core/validators" v "github.com/prysmaticlabs/prysm/beacon-chain/core/validators"
"github.com/prysmaticlabs/prysm/beacon-chain/state"
"github.com/prysmaticlabs/prysm/config/params" "github.com/prysmaticlabs/prysm/config/params"
types "github.com/prysmaticlabs/prysm/consensus-types/primitives" types "github.com/prysmaticlabs/prysm/consensus-types/primitives"
"github.com/prysmaticlabs/prysm/consensus-types/wrapper" "github.com/prysmaticlabs/prysm/consensus-types/wrapper"
"github.com/prysmaticlabs/prysm/encoding/bytesutil" "github.com/prysmaticlabs/prysm/encoding/bytesutil"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/time/slots"
"go.opencensus.io/trace" "go.opencensus.io/trace"
) )
@@ -91,10 +93,23 @@ func (vs *Server) buildPhase0BlockData(ctx context.Context, req *ethpb.BlockRequ
if err != nil { if err != nil {
return nil, fmt.Errorf("could not retrieve head root: %v", err) return nil, fmt.Errorf("could not retrieve head root: %v", err)
} }
var head state.BeaconState
head, err := vs.HeadFetcher.HeadState(ctx) if slots.SinceEpochStarts(req.Slot) == 0 {
if err != nil { root, err := vs.ForkFetcher.ForkChoicer().AncestorRoot(ctx, bytesutil.ToBytes32(parentRoot), req.Slot-5)
return nil, fmt.Errorf("could not get head state %v", err) if err != nil {
return nil, fmt.Errorf("could not retrieve head root: %v", err)
}
parentRoot = root[:]
head, err = vs.StateGen.StateByRoot(ctx, root)
if err != nil {
return nil, fmt.Errorf("could not get head state %v", err)
}
} else {
head, err = vs.HeadFetcher.HeadState(ctx)
if err != nil {
return nil, fmt.Errorf("could not get head state %v", err)
}
} }
head, err = transition.ProcessSlotsUsingNextSlotCache(ctx, head, parentRoot, req.Slot) head, err = transition.ProcessSlotsUsingNextSlotCache(ctx, head, parentRoot, req.Slot)