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
14 changes: 13 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 {
// Config initialises the client
rpc Config(ConfigRequest) returns (ConfigResponse) {}
tuxcanfly marked this conversation as resolved.
Show resolved Hide resolved

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

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

// ConfigRequest is the request type for the Config rpc method.
message ConfigRequest {
}

// ConfigResponse is the response type for the Config rpc method.
message ConfigResponse {
int64 max_blob_size = 1;
}

// GetRequest is the request type for the Get rpc method.
message GetRequest {
repeated ID ids = 1;
Expand Down Expand Up @@ -89,4 +101,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) Config(ctx context.Context, request *pbda.ConfigRequest) (*pbda.ConfigResponse, error) {
return &pbda.ConfigResponse{MaxBlobSize: 1024}, nil
}

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