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

Commit

Permalink
Change endpoint for retriever
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyknox committed Dec 14, 2023
1 parent 9f74082 commit 5faa4a7
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 20 deletions.
4 changes: 2 additions & 2 deletions op-node/da/da_config.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package da

import "github.com/Layr-Labs/eigenda/api/grpc/retriever"
import "github.com/Layr-Labs/eigenda/api/grpc/disperser"

type DAConfig struct {
Rpc string
Client retriever.RetrieverClient
Client disperser.DisperserClient
}
10 changes: 4 additions & 6 deletions op-node/rollup/derive/calldata_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import (
"fmt"
"io"

"github.com/Layr-Labs/eigenda/api/grpc/retriever"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"google.golang.org/protobuf/proto"

"github.com/Layr-Labs/eigenda/api/grpc/disperser"
"github.com/ethereum-optimism/optimism/op-node/da"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-service/eth"
Expand Down Expand Up @@ -146,11 +146,9 @@ func DataFromEVMTransactions(config *rollup.Config, daCfg *da.DAConfig, batcherA
}

log.Info("requesting data from EigenDA", "quorum id", frameRef.QuorumIds[0], "confirmation block number", frameRef.ReferenceBlockNumber)
blobRequest := &retriever.BlobRequest{
BatchHeaderHash: frameRef.BatchHeaderHash,
BlobIndex: frameRef.BlobIndex,
ReferenceBlockNumber: frameRef.ReferenceBlockNumber,
QuorumId: frameRef.QuorumIds[0],
blobRequest := &disperser.RetrieveBlobRequest{
BatchHeaderHash: frameRef.BatchHeaderHash,
BlobIndex: frameRef.BlobIndex,
}
blobRes, err := daCfg.Client.RetrieveBlob(context.Background(), blobRequest)
if err != nil {
Expand Down
24 changes: 16 additions & 8 deletions op-node/rollup/derive/calldata_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"math/rand"
"testing"

"github.com/Layr-Labs/eigenda/api/grpc/retriever"
"github.com/Layr-Labs/eigenda/api/grpc/disperser"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"

Expand Down Expand Up @@ -54,14 +54,14 @@ type calldataTest struct {
txs []testTx
}

var _ retriever.RetrieverClient = RetrieverClientMock{}
var _ disperser.DisperserClient = &DisperserClientMock{}

type RetrieverClientMock struct {
Responses []*retriever.BlobReply
type DisperserClientMock struct {
Responses []*disperser.RetrieveBlobReply
ResponseIndex int
}

func (c RetrieverClientMock) RetrieveBlob(ctx context.Context, in *retriever.BlobRequest, opts ...grpc.CallOption) (*retriever.BlobReply, error) {
func (c *DisperserClientMock) RetrieveBlob(ctx context.Context, in *disperser.RetrieveBlobRequest, opts ...grpc.CallOption) (*disperser.RetrieveBlobReply, error) {
if c.ResponseIndex < len(c.Responses) {
res := c.Responses[c.ResponseIndex]
c.ResponseIndex += 1
Expand All @@ -71,8 +71,16 @@ func (c RetrieverClientMock) RetrieveBlob(ctx context.Context, in *retriever.Blo
}
}

func NewRetrieverClientMock(responses []*retriever.BlobReply) retriever.RetrieverClient {
return &RetrieverClientMock{
func (c *DisperserClientMock) DisperseBlob(ctx context.Context, in *disperser.DisperseBlobRequest, opts ...grpc.CallOption) (*disperser.DisperseBlobReply, error) {
return nil, fmt.Errorf("not implemented")
}

func (c *DisperserClientMock) GetBlobStatus(ctx context.Context, in *disperser.BlobStatusRequest, opts ...grpc.CallOption) (*disperser.BlobStatusReply, error) {
return nil, fmt.Errorf("not implemented")
}

func NewDisperserClientMock(responses []*disperser.RetrieveBlobReply) disperser.DisperserClient {
return &DisperserClientMock{
Responses: responses,
ResponseIndex: 0,
}
Expand All @@ -91,7 +99,7 @@ func TestDataFromEVMTransactions(t *testing.T) {

daCfg := &da.DAConfig{
Rpc: "",
Client: NewRetrieverClientMock([]*retriever.BlobReply{
Client: NewDisperserClientMock([]*disperser.RetrieveBlobReply{
{
Data: []byte{0x00, 0x01, 0x02},
},
Expand Down
4 changes: 2 additions & 2 deletions op-node/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"os"
"strings"

"github.com/Layr-Labs/eigenda/api/grpc/retriever"
"github.com/Layr-Labs/eigenda/api/grpc/disperser"
"github.com/ethereum-optimism/optimism/op-node/chaincfg"
oppprof "github.com/ethereum-optimism/optimism/op-service/pprof"
"github.com/ethereum-optimism/optimism/op-service/sources"
Expand Down Expand Up @@ -266,7 +266,7 @@ func NewDAConfig(ctx *cli.Context) (da.DAConfig, error) {
if err != nil {
return da.DAConfig{}, err
}
client := retriever.NewRetrieverClient(conn)
client := disperser.NewDisperserClient(conn)

return da.DAConfig{
Rpc: rpc,
Expand Down
4 changes: 2 additions & 2 deletions ops-bedrock/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ services:
--metrics.port=7300
--pprof.enabled
--rpc.enable-admin
--da-rpc=host.docker.internal:32026
--da-rpc=host.docker.internal:32003
ports:
- "7545:8545"
- "9003:9003"
Expand Down Expand Up @@ -130,7 +130,7 @@ services:
OP_PROPOSER_METRICS_ENABLED: "true"
OP_PROPOSER_ALLOW_NON_FINALIZED: "true"
OP_PROPOSER_RPC_ENABLE_ADMIN: "true"
OP_PROPOSER_DA_RPC: host.docker.internal:32026
OP_PROPOSER_DA_RPC: host.docker.internal:32003
OP_PROPOSER_DA_PRIMARY_QUORUM_ID: 0
OP_PROPOSER_DA_PRIMARY_ADVERSARY_THRESHOLD: 40
OP_PROPOSER_DA_PRIMARY_QUORUM_THRESHOLD: 60
Expand Down

0 comments on commit 5faa4a7

Please sign in to comment.