Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Commit

Permalink
Accept finalized blobs. Update grpc dial options
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyknox committed Feb 16, 2024
1 parent 4ac08d2 commit 321ecf9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion op-batcher/batcher/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ func (l *BatchSubmitter) sendTransaction(txdata txData, queue *txmgr.Queue[txDat
FrameRef: &op_service.FrameRef{
BatchHeaderHash: blobInfo.BlobVerificationProof.BatchMetadata.BatchHeaderHash,
BlobIndex: blobInfo.BlobVerificationProof.BlobIndex,
ReferenceBlockNumber: blobInfo.BlobVerificationProof.BatchMetadata.ConfirmationBlockNumber,
ReferenceBlockNumber: blobInfo.BlobVerificationProof.BatchMetadata.BatchHeader.ReferenceBlockNumber,
QuorumIds: quorumIDs,
BlobLength: uint32(len(txdata.Bytes())),
},
Expand Down
12 changes: 4 additions & 8 deletions op-node/rollup/derive/calldata_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,11 @@ func DataFromEVMTransactions(dsCfg DataSourceConfig, batcherAddr common.Address,
data, err := daClient.RetrieveBlob(context.Background(), frameRef.BatchHeaderHash, frameRef.BlobIndex)
if err != nil {
retrieveReqJSON, _ := json.Marshal(struct {
BatchHeaderHash string
BlobIndex uint32
ReferenceBlockNumber uint32
QuorumId uint32
BatchHeaderHash string
BlobIndex uint32
}{
BatchHeaderHash: base64.StdEncoding.EncodeToString(frameRef.BatchHeaderHash),
BlobIndex: frameRef.BlobIndex,
ReferenceBlockNumber: frameRef.ReferenceBlockNumber,
QuorumId: frameRef.QuorumIds[0],
BatchHeaderHash: base64.StdEncoding.EncodeToString(frameRef.BatchHeaderHash),
BlobIndex: frameRef.BlobIndex,
})
log.Warn("could not retrieve data from EigenDA", "request", string(retrieveReqJSON), "err", err)
return nil
Expand Down
15 changes: 11 additions & 4 deletions op-service/eigenda/da.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package eigenda

import (
"context"
"crypto/tls"
"encoding/base64"
"encoding/hex"
"fmt"
Expand All @@ -10,7 +11,7 @@ import (
"github.com/Layr-Labs/eigenda/api/grpc/disperser"
"github.com/ethereum/go-ethereum/log"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/credentials"
)

type IEigenDA interface {
Expand All @@ -25,7 +26,10 @@ type EigenDA struct {
}

func (m *EigenDA) RetrieveBlob(ctx context.Context, BatchHeaderHash []byte, BlobIndex uint32) ([]byte, error) {
conn, err := grpc.Dial(m.RPC, grpc.WithTransportCredentials(insecure.NewCredentials()))
config := &tls.Config{}
credential := credentials.NewTLS(config)
dialOptions := []grpc.DialOption{grpc.WithTransportCredentials(credential)}
conn, err := grpc.Dial(m.RPC, dialOptions...)
if err != nil {
return nil, err
}
Expand All @@ -43,7 +47,10 @@ func (m *EigenDA) RetrieveBlob(ctx context.Context, BatchHeaderHash []byte, Blob

func (m *EigenDA) DisperseBlob(ctx context.Context, txData []byte) (*disperser.BlobInfo, error) {
m.Log.Info("Attempting to disperse blob to EigenDA")
conn, err := grpc.Dial(m.RPC, grpc.WithTransportCredentials(insecure.NewCredentials()))
config := &tls.Config{}
credential := credentials.NewTLS(config)
dialOptions := []grpc.DialOption{grpc.WithTransportCredentials(credential)}
conn, err := grpc.Dial(m.RPC, dialOptions...)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -80,7 +87,7 @@ func (m *EigenDA) DisperseBlob(ctx context.Context, txData []byte) (*disperser.B
})
if err != nil {
m.Log.Warn("Unable to retrieve blob dispersal status, will retry", "requestID", base64RequestID, "err", err)
} else if statusRes.Status == disperser.BlobStatus_CONFIRMED {
} else if statusRes.Status == disperser.BlobStatus_CONFIRMED || statusRes.Status == disperser.BlobStatus_FINALIZED {
// TODO(eigenlayer): As long as fault proofs are disabled, we can move on once a blob is confirmed
// but not yet finalized, without further logic. Once fault proofs are enabled, we will need to update
// the proposer to wait until the blob associated with an L2 block has been finalized, i.e. the EigenDA
Expand Down

0 comments on commit 321ecf9

Please sign in to comment.