Skip to content

Commit

Permalink
Can build
Browse files Browse the repository at this point in the history
  • Loading branch information
terencechain committed Aug 20, 2022
1 parent a22d62e commit 5c2ebec
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 25 deletions.
1 change: 1 addition & 0 deletions beacon-chain/blockchain/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ go_library(
"//config/features:go_default_library",
"//config/fieldparams:go_default_library",
"//config/params:go_default_library",
"//consensus-types/blobs:go_default_library",
"//consensus-types/blocks:go_default_library",
"//consensus-types/interfaces:go_default_library",
"//consensus-types/primitives:go_default_library",
Expand Down
1 change: 1 addition & 0 deletions beacon-chain/blockchain/process_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/prysmaticlabs/prysm/v3/beacon-chain/state"
"github.com/prysmaticlabs/prysm/v3/config/features"
"github.com/prysmaticlabs/prysm/v3/config/params"
"github.com/prysmaticlabs/prysm/v3/consensus-types/blobs"
consensusblocks "github.com/prysmaticlabs/prysm/v3/consensus-types/blocks"
"github.com/prysmaticlabs/prysm/v3/consensus-types/interfaces"
types "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives"
Expand Down
1 change: 1 addition & 0 deletions beacon-chain/node/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ go_library(
],
deps = [
"//api/gateway:go_default_library",
"//async:go_default_library",
"//async/event:go_default_library",
"//beacon-chain/blockchain:go_default_library",
"//beacon-chain/builder:go_default_library",
Expand Down
1 change: 1 addition & 0 deletions beacon-chain/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/pkg/errors"
apigateway "github.com/prysmaticlabs/prysm/v3/api/gateway"
"github.com/prysmaticlabs/prysm/v3/async"
"github.com/prysmaticlabs/prysm/v3/async/event"
"github.com/prysmaticlabs/prysm/v3/beacon-chain/blockchain"
"github.com/prysmaticlabs/prysm/v3/beacon-chain/builder"
Expand Down
5 changes: 3 additions & 2 deletions beacon-chain/rpc/eth/beacon/blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
ethpbv1 "github.com/prysmaticlabs/prysm/v3/proto/eth/v1"
ethpbv2 "github.com/prysmaticlabs/prysm/v3/proto/eth/v2"
"github.com/prysmaticlabs/prysm/v3/proto/migration"
ethpb "github.com/prysmaticlabs/prysm/v3/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/v3/time/slots"
"go.opencensus.io/trace"
"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -535,8 +536,8 @@ func (bs *Server) GetBlockV2(ctx context.Context, req *ethpbv2.BlockRequestV2) (
}
return &ethpbv2.BlockResponseV2{
Version: ethpbv2.Version_EIP4844,
Data: &ethpbv2.SignedBeaconBlockContainerV2{
Message: &ethpbv2.SignedBeaconBlockContainerV2_Eip4844Block{Eip4844Block: v2Blk},
Data: &ethpbv2.SignedBeaconBlockContainer{
Message: &ethpbv2.SignedBeaconBlockContainer_Eip4844Block{Eip4844Block: v2Blk},
Signature: blk.Signature(),
},
ExecutionOptimistic: isOptimistic,
Expand Down
2 changes: 2 additions & 0 deletions beacon-chain/sync/initial-sync/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ go_library(
"//beacon-chain/sync:go_default_library",
"//cmd/beacon-chain/flags:go_default_library",
"//config/params:go_default_library",
"//consensus-types/blobs:go_default_library",
"//consensus-types/blocks:go_default_library",
"//consensus-types/interfaces:go_default_library",
"//consensus-types/primitives:go_default_library",
"//crypto/rand:go_default_library",
Expand Down
25 changes: 14 additions & 11 deletions beacon-chain/sync/initial-sync/blocks_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ import (
prysmsync "github.com/prysmaticlabs/prysm/v3/beacon-chain/sync"
"github.com/prysmaticlabs/prysm/v3/cmd/beacon-chain/flags"
"github.com/prysmaticlabs/prysm/v3/config/params"
"github.com/prysmaticlabs/prysm/v3/consensus-types/blobs"
"github.com/prysmaticlabs/prysm/v3/consensus-types/blocks"
"github.com/prysmaticlabs/prysm/v3/consensus-types/interfaces"
types "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives"
"github.com/prysmaticlabs/prysm/v3/crypto/rand"
"github.com/prysmaticlabs/prysm/v3/encoding/bytesutil"
p2ppb "github.com/prysmaticlabs/prysm/v3/proto/prysm/v1alpha1"
"github.com/sirupsen/logrus"
"go.opencensus.io/trace"
Expand Down Expand Up @@ -107,7 +110,7 @@ type fetchRequestResponse struct {
start types.Slot
count uint64
blocks []interfaces.SignedBeaconBlock
sidecars []*ethpb.BlobsSidecar
sidecars []*p2ppb.BlobsSidecar
err error
}

Expand Down Expand Up @@ -249,7 +252,7 @@ func (f *blocksFetcher) handleRequest(ctx context.Context, start types.Slot, cou
start: start,
count: count,
blocks: []interfaces.SignedBeaconBlock{},
sidecars: []*ethpb.BlobsSidecar{},
sidecars: []*p2ppb.BlobsSidecar{},
err: nil,
}

Expand Down Expand Up @@ -283,7 +286,7 @@ func (f *blocksFetcher) fetchBlocksFromPeer(
ctx context.Context,
start types.Slot, count uint64,
peers []peer.ID,
) ([]interfaces.SignedBeaconBlock, []*ethpb.BlobsSidecar, peer.ID, error) {
) ([]interfaces.SignedBeaconBlock, []*p2ppb.BlobsSidecar, peer.ID, error) {
ctx, span := trace.StartSpan(ctx, "initialsync.fetchBlocksFromPeer")
defer span.End()

Expand All @@ -298,7 +301,7 @@ func (f *blocksFetcher) fetchBlocksFromPeer(
Count: count,
}

var sidecars []*ethpb.BlobsSidecar
var sidecars []*p2ppb.BlobsSidecar
for i := 0; i < len(peers); i++ {
blocks, err := f.requestBlocks(ctx, req, peers[i])
if err == nil {
Expand Down Expand Up @@ -387,7 +390,7 @@ func (f *blocksFetcher) requestSidecars(
req *p2ppb.BlobsSidecarsByRangeRequest,
pid peer.ID,
blkRefs []interfaces.SignedBeaconBlock,
) ([]*ethpb.BlobsSidecar, error) {
) ([]*p2ppb.BlobsSidecar, error) {
if ctx.Err() != nil {
return nil, ctx.Err()
}
Expand All @@ -410,7 +413,7 @@ func (f *blocksFetcher) requestSidecars(
f.rateLimiter.Add(pid.String(), int64(req.Count))
l.Unlock()

var sidecarProcessor func(*ethpb.BlobsSidecar) error
var sidecarProcessor func(*p2ppb.BlobsSidecar) error
if blkRefs != nil {
sidecarProcessor = sidecarVerifier(blkRefs)
}
Expand All @@ -431,9 +434,9 @@ func (f *blocksFetcher) waitForBandwidth(pid peer.ID) error {
return nil
}

func checkBlocksForAvailableSidecars(blks []interfaces.SignedBeaconBlock, sidecars []*ethpb.BlobsSidecar) error {
func checkBlocksForAvailableSidecars(blks []interfaces.SignedBeaconBlock, sidecars []*p2ppb.BlobsSidecar) error {
for _, b := range blks {
if cb.IsPreEIP4844Version(b.Version()) {
if blocks.IsPreEIP4844Version(b.Version()) {
continue
}
blobKzgs, err := b.Block().Body().BlobKzgs()
Expand Down Expand Up @@ -461,10 +464,10 @@ func checkBlocksForAvailableSidecars(blks []interfaces.SignedBeaconBlock, sideca
return nil
}

func sidecarVerifier(blks []interfaces.SignedBeaconBlock) func(*ethpb.BlobsSidecar) error {
return func(sidecar *ethpb.BlobsSidecar) error {
func sidecarVerifier(blks []interfaces.SignedBeaconBlock) func(*p2ppb.BlobsSidecar) error {
return func(sidecar *p2ppb.BlobsSidecar) error {
for _, b := range blks {
if cb.IsPreEIP4844Version(b.Version()) {
if blocks.IsPreEIP4844Version(b.Version()) {
continue
}
blobKzgs, err := b.Block().Body().BlobKzgs()
Expand Down
3 changes: 2 additions & 1 deletion beacon-chain/sync/initial-sync/blocks_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

"github.com/libp2p/go-libp2p-core/peer"
p2ppb "github.com/prysmaticlabs/prysm/v3/proto/prysm/v1alpha1"

"github.com/prysmaticlabs/prysm/v3/beacon-chain/db"
"github.com/prysmaticlabs/prysm/v3/beacon-chain/p2p"
Expand Down Expand Up @@ -91,7 +92,7 @@ type blocksQueue struct {
type blocksQueueFetchedData struct {
pid peer.ID
blocks []interfaces.SignedBeaconBlock
sidecars []*ethpb.BlobsSidecar
sidecars []*p2ppb.BlobsSidecar
}

// newBlocksQueue creates initialized priority queue.
Expand Down
4 changes: 2 additions & 2 deletions beacon-chain/sync/rpc_chunked_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func WriteBlobsSidecarChunk(stream libp2pcore.Stream, chain blockchain.ChainInfo
return err
}

func ReadChunkedBlobsSidecar(stream libp2pcore.Stream, chain blockchain.ChainInfoFetcher, p2p p2p.P2P, isFirstChunk bool) (*pb.BlobsSidecar, error) {
func ReadChunkedBlobsSidecar(stream libp2pcore.Stream, chain blockchain.ChainInfoFetcher, p2p p2p.P2P, isFirstChunk bool) (*ethpb.BlobsSidecar, error) {
var (
code uint8
errMsg string
Expand All @@ -127,7 +127,7 @@ func ReadChunkedBlobsSidecar(stream libp2pcore.Stream, chain blockchain.ChainInf
if len(rpcCtx) != 0 {
return nil, errors.New("unexpected fork digest in stream")
}
sidecar := new(pb.BlobsSidecar)
sidecar := new(ethpb.BlobsSidecar)
err = p2p.Encoding().DecodeWithMaxLength(stream, sidecar)
return sidecar, err
}
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/sync/subscriber_beacon_blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (s *Service) beaconBlockSubscriber(ctx context.Context, msg proto.Message)
return err
}

var sidecar *eth.BlobsSidecar
var sidecar *ethpb.BlobsSidecar
contains, err := blobs.BlockContainsKZGs(block)
if err != nil {
return err
Expand Down
3 changes: 2 additions & 1 deletion beacon-chain/sync/validate_beacon_blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
types "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives"
"github.com/prysmaticlabs/prysm/v3/encoding/bytesutil"
"github.com/prysmaticlabs/prysm/v3/monitoring/tracing"
"github.com/prysmaticlabs/prysm/v3/runtime/version"
prysmTime "github.com/prysmaticlabs/prysm/v3/time"
"github.com/prysmaticlabs/prysm/v3/time/slots"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -281,7 +282,7 @@ func (s *Service) validateEIP4844BeaconBlock(ctx context.Context, parentState st
return errors.New("execution payload is nil")
}

if b.IsPreEIP4844Version(blk.Version()) {
if consensusblocks.IsPreEIP4844Version(blk.Version()) {
return nil
}

Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1139,10 +1139,6 @@ github.com/prysmaticlabs/go-bitfield v0.0.0-20210108222456-8e92c3709aa0/go.mod h
github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7 h1:0tVE4tdWQK9ZpYygoV7+vS6QkDvQVySboMVEIxBJmXw=
github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7/go.mod h1:wmuf/mdK4VMD+jA9ThwcUKjg3a2XWM9cVfFYjDyY4j4=
github.com/prysmaticlabs/gohashtree v0.0.0-20220517220438-192ee5ae6982/go.mod h1:4pWaT30XoEx1j8KNJf3TV+E3mQkaufn7mf+jRNb/Fuk=
github.com/prysmaticlabs/gohashtree v0.0.1-alpha.0.20220303211031-f753e083138c h1:920mmUNkTZ9zIWXjArGv6iU45b85gjUvq/4L1ZHWVYQ=
github.com/prysmaticlabs/gohashtree v0.0.1-alpha.0.20220303211031-f753e083138c/go.mod h1:4pWaT30XoEx1j8KNJf3TV+E3mQkaufn7mf+jRNb/Fuk=
github.com/prysmaticlabs/grpc-gateway/v2 v2.3.1-0.20220428175429-ee99f663f83d h1:X89lsbPFK9rUDa8mxXazgAT34jlXdCHZrn8kdptFbBU=
github.com/prysmaticlabs/grpc-gateway/v2 v2.3.1-0.20220428175429-ee99f663f83d/go.mod h1:IOyTYjcIO0rkmnGBfJTL0NJ11exy/Tc2QEuv7hCXp24=
github.com/prysmaticlabs/gohashtree v0.0.2-alpha h1:hk5ZsDQuSkyUMhTd55qB396P1+dtyIKiSwMmYE/hyEU=
github.com/prysmaticlabs/gohashtree v0.0.2-alpha/go.mod h1:4pWaT30XoEx1j8KNJf3TV+E3mQkaufn7mf+jRNb/Fuk=
github.com/prysmaticlabs/grpc-gateway/v2 v2.3.1-0.20220721162526-0d1c40b5f064 h1:elSfkWAcpL94zg7B9J2ozu+WcbMxD1rZ3rzUjYAy6R8=
Expand Down
1 change: 0 additions & 1 deletion proto/eth/service/beacon_chain_service.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion proto/eth/service/beacon_debug_service.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion proto/eth/service/validator_service.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5c2ebec

Please sign in to comment.