From 321ecf964ddbed59c66cdeddd7158f42232dbcc3 Mon Sep 17 00:00:00 2001 From: Teddy Knox Date: Fri, 16 Feb 2024 18:32:17 -0500 Subject: [PATCH] Accept finalized blobs. Update grpc dial options --- op-batcher/batcher/driver.go | 2 +- op-node/rollup/derive/calldata_source.go | 12 ++++-------- op-service/eigenda/da.go | 15 +++++++++++---- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/op-batcher/batcher/driver.go b/op-batcher/batcher/driver.go index acef8fdcd656..bfe813580181 100644 --- a/op-batcher/batcher/driver.go +++ b/op-batcher/batcher/driver.go @@ -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())), }, diff --git a/op-node/rollup/derive/calldata_source.go b/op-node/rollup/derive/calldata_source.go index bdd1642d9b54..b157b63cb426 100644 --- a/op-node/rollup/derive/calldata_source.go +++ b/op-node/rollup/derive/calldata_source.go @@ -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 diff --git a/op-service/eigenda/da.go b/op-service/eigenda/da.go index ef2a98545c0f..0003a0a8a733 100644 --- a/op-service/eigenda/da.go +++ b/op-service/eigenda/da.go @@ -2,6 +2,7 @@ package eigenda import ( "context" + "crypto/tls" "encoding/base64" "encoding/hex" "fmt" @@ -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 { @@ -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 } @@ -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 } @@ -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