Skip to content

Commit

Permalink
Merge pull request #72 from bloXroute-Labs/v2.129.74
Browse files Browse the repository at this point in the history
Publish release v2.129.74
  • Loading branch information
bogdanprodanj authored Feb 7, 2025
2 parents 91e9f6e + 6a648ab commit 65a2b08
Show file tree
Hide file tree
Showing 118 changed files with 1,770 additions and 15,365 deletions.
File renamed without changes.
File renamed without changes.
62 changes: 62 additions & 0 deletions blockchain/bdn/block.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package bdn

import (
"errors"

"github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces"
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/v5/runtime/version"
)

// ErrNotDenebBlock is returned when the block is not a Deneb block.
var ErrNotDenebBlock = errors.New("block is not Deneb block")

// PbGenericBlock returns a generic signed beacon block.
func PbGenericBlock(b interfaces.ReadOnlySignedBeaconBlock) (*ethpb.GenericSignedBeaconBlock, error) {
pb, err := b.Proto()
if err != nil {
return nil, err
}
switch b.Version() {
case version.Deneb:
if b.IsBlinded() {
return &ethpb.GenericSignedBeaconBlock{
Block: &ethpb.GenericSignedBeaconBlock_BlindedDeneb{BlindedDeneb: pb.(*ethpb.SignedBlindedBeaconBlockDeneb)},
}, nil
}

block, ok := pb.(*ethpb.SignedBeaconBlockDeneb)
if !ok {
return b.PbGenericBlock()
}

return &ethpb.GenericSignedBeaconBlock{
Block: &ethpb.GenericSignedBeaconBlock_Deneb{
Deneb: &ethpb.SignedBeaconBlockContentsDeneb{
Block: block,
},
},
}, nil
case version.Electra:
if b.IsBlinded() {
return &ethpb.GenericSignedBeaconBlock{
Block: &ethpb.GenericSignedBeaconBlock_BlindedElectra{BlindedElectra: pb.(*ethpb.SignedBlindedBeaconBlockElectra)},
}, nil
}

block, ok := pb.(*ethpb.SignedBeaconBlockElectra)
if !ok {
return b.PbGenericBlock()
}

return &ethpb.GenericSignedBeaconBlock{
Block: &ethpb.GenericSignedBeaconBlock_Electra{
Electra: &ethpb.SignedBeaconBlockContentsElectra{
Block: block,
},
},
}, nil
default:
return b.PbGenericBlock()
}
}
16 changes: 11 additions & 5 deletions blockchain/beacon/handle_bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import (
"fmt"
"time"

"github.com/bloXroute-Labs/gateway/v2/blockchain"
log "github.com/bloXroute-Labs/gateway/v2/logger"
"github.com/bloXroute-Labs/gateway/v2/types"
"github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces"
"github.com/prysmaticlabs/prysm/v5/encoding/bytesutil"
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"

"github.com/bloXroute-Labs/gateway/v2/blockchain"
log "github.com/bloXroute-Labs/gateway/v2/logger"
"github.com/bloXroute-Labs/gateway/v2/types"
)

// HandleBDNBeaconMessages waits for beacon messages from BDN and broadcast it to the connected nodes
Expand Down Expand Up @@ -108,9 +109,14 @@ func HandleBDNBlocks(ctx context.Context, b blockchain.Bridge, n *Node, beaconAP
}

func fillBlockContents(blobsManager *BlobSidecarCacheManager, castedBlock interfaces.ReadOnlySignedBeaconBlock, blockHash string) (*ethpb.SignedBeaconBlockContentsDeneb, error) {
denebBlock, err := castedBlock.PbDenebBlock()
bp, err := castedBlock.Proto()
if err != nil {
return nil, fmt.Errorf("failed to convert block to Deneb block: %v", err)
return nil, fmt.Errorf("failed to convert block to proto message: %v", err)
}

denebBlock, ok := bp.(*ethpb.SignedBeaconBlockDeneb)
if !ok {
return nil, fmt.Errorf("failed to convert block of type %T to Deneb block", bp)
}

kzgCommits := denebBlock.Block.Body.BlobKzgCommitments
Expand Down
13 changes: 7 additions & 6 deletions blockchain/beacon/prysm_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ import (
"context"
"time"

"github.com/bloXroute-Labs/gateway/v2/blockchain"
"github.com/bloXroute-Labs/gateway/v2/blockchain/network"
log "github.com/bloXroute-Labs/gateway/v2/logger"
"github.com/bloXroute-Labs/gateway/v2/types"
"github.com/bloXroute-Labs/gateway/v2/utils"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/prysmaticlabs/prysm/v5/consensus-types/blocks"
"github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces"
prysmTypes "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

"github.com/bloXroute-Labs/gateway/v2/blockchain"
"github.com/bloXroute-Labs/gateway/v2/blockchain/network"
log "github.com/bloXroute-Labs/gateway/v2/logger"
"github.com/bloXroute-Labs/gateway/v2/types"
"github.com/bloXroute-Labs/gateway/v2/utils"
)

const prysmClientTimeout = 10 * time.Second
Expand Down Expand Up @@ -68,7 +69,7 @@ func (c *PrysmClient) run() {
func() {
c.log.Trace("connecting to prysm")

conn, err := grpc.DialContext(c.ctx, c.addr, grpc.WithTransportCredentials(insecure.NewCredentials()))
conn, err := grpc.NewClient(c.addr, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
c.log.Warnf("could not establish a connection to the Prysm: %v, retrying in %v seconds...", err, prysmClientTimeout)
return
Expand Down
Loading

0 comments on commit 65a2b08

Please sign in to comment.