Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

da interface: add max blob size method #23

Merged
merged 15 commits into from
Dec 7, 2023
16 changes: 15 additions & 1 deletion proto/da/da.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ package da;

// DAService is the protobuf service definition for interaction with Data Availability layers.
service DAService {
// Init initialises the client
rpc Init(InitRequest) returns (InitResponse) {}

// Get returns Blob for each given ID, or an error.
rpc Get(GetRequest) returns (GetResponse) {}

Expand Down Expand Up @@ -39,6 +42,17 @@ message Proof {
bytes value = 1;
}

// InitRequest is the request type for the Init rpc method.
message InitRequest {
}

// InitResponse is the response type for the Init rpc method.
message InitResponse {
int64 version = 1;
string name = 2;
int64 max_blob_size = 3;
}

// GetRequest is the request type for the Get rpc method.
message GetRequest {
repeated ID ids = 1;
Expand Down Expand Up @@ -89,4 +103,4 @@ message ValidateRequest {
// ValidateResponse is the response type for the Validate rpc method.
message ValidateResponse {
repeated bool results = 1;
}
}
4 changes: 4 additions & 0 deletions proxy/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ type proxySrv struct {
target da.DA
}

func (p *proxySrv) Init(ctx context.Context, request *pbda.InitRequest) (*pbda.InitResponse, error) {
return &pbda.InitResponse{Version: 1, Name: "Proxy Server", MaxBlobSize: 1024}, nil
tuxcanfly marked this conversation as resolved.
Show resolved Hide resolved
}

func (p *proxySrv) Get(ctx context.Context, request *pbda.GetRequest) (*pbda.GetResponse, error) {
ids := idsPB2DA(request.Ids)
blobs, err := p.target.Get(ids)
Expand Down
Loading