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

DAS protobuffs #710

Merged
merged 32 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
91feb28
Rough draft for DAS protobuffs.
cody-littley Aug 19, 2024
fe9abf1
Fix whitespace.
cody-littley Aug 19, 2024
4f5aaf4
Removed unecessary RPC.
cody-littley Aug 22, 2024
3fd77c7
Make suggested changes.
cody-littley Aug 27, 2024
4a1a1ac
Revert some changes.
cody-littley Aug 27, 2024
135bae7
Minor changes.
cody-littley Aug 27, 2024
b8795c0
Move things to original location.
cody-littley Aug 27, 2024
31610fb
Revert whitespace changes.
cody-littley Aug 27, 2024
dce9903
Fix retriever protos.
cody-littley Aug 27, 2024
808311c
Remove unused messages.
cody-littley Aug 27, 2024
204949a
Made small changes.
cody-littley Aug 28, 2024
0dad952
Made suggested changes.
cody-littley Aug 29, 2024
45bb359
Update protobufs.
cody-littley Aug 29, 2024
d8e15e8
Add placeholder implementations.
cody-littley Aug 29, 2024
cc291e4
Iterating on protos.
cody-littley Aug 29, 2024
60c0390
Fix proto versions.
cody-littley Aug 29, 2024
0a29fb2
Docker image for building protobufs.
cody-littley Aug 29, 2024
06005c7
Made suggested changes.
cody-littley Aug 30, 2024
0d88c86
Revert changes to dependencies.
cody-littley Aug 30, 2024
3659a68
Fix build issue.
cody-littley Aug 30, 2024
28f3e20
Make requested changes.
cody-littley Sep 4, 2024
bcf4718
Made suggested changes.
cody-littley Sep 6, 2024
a82c869
Merge branch 'master' into das-protobuffs
cody-littley Sep 6, 2024
267b0c6
Rebuilt protos.
cody-littley Sep 6, 2024
e8fec17
Made suggested changes.
cody-littley Sep 6, 2024
ad6c587
Make suggested changes.
cody-littley Sep 9, 2024
a524c0b
Fix whitespace.
cody-littley Sep 9, 2024
d3a9be4
Made suggested changes.
cody-littley Sep 16, 2024
ad0a710
Moved getChunk to relay
cody-littley Sep 17, 2024
9f44421
Made suggested change.
cody-littley Sep 17, 2024
9ac3965
Made suggested change, removed RPC that won't be used in v1
cody-littley Sep 18, 2024
4be81a3
Compile protobufs.
cody-littley Sep 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 43 additions & 4 deletions api/proto/common/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,47 @@ package common;
option go_package = "github.com/Layr-Labs/eigenda/api/grpc/common";

message G1Commitment {
// The X coordinate of the KZG commitment. This is the raw byte representation of the field element.
Copy link
Contributor

@jianoaix jianoaix Sep 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This existing indent was compatible with other protos. Let's make them consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitespace changed back to tabs.

Copy link
Contributor Author

@cody-littley cody-littley Sep 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a search of this directory tree and found a few places that used spaces instead of tabs in proto files. I also updated those places to use tabs.

bytes x = 1;
// The Y coordinate of the KZG commitment. This is the raw byte representation of the field element.
bytes y = 2;
// The X coordinate of the KZG commitment. This is the raw byte representation of the field element.
bytes x = 1;
// The Y coordinate of the KZG commitment. This is the raw byte representation of the field element.
bytes y = 2;
}

/////////////////////////////////////////////////////////////////////////////////////////////////
// Messages for WIP RPCs. These are subject to change, do not consider these to be stable API. //
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could usually call such work "Experimental". E.g.

// # Experimental
//
// The following are EXPERIMENTAL and subject to change, do not consider these to be stable API.

Copy link
Contributor Author

@cody-littley cody-littley Sep 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to the following comment:

/////////////////////////////////////////////////////////////////////////////////////
// Experimental: the following definitions are experimental and subject to change. //
/////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////////

// A unique identifier for a blob.
message BlobKey {
oneof key {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have to support both? It makes the golang code more verbose and less easy to work with (have to check which field is set each time)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably a good discussion topic with @mooselumph, the plan for how to address a blob is something he's been working on.

AuthHeaderBlobKey auth_header_blob_key = 1;
cody-littley marked this conversation as resolved.
Show resolved Hide resolved
BatchHeaderBlobKey batch_header_blob_key = 2;
}
}

// Uniquely identifies a blob based on its auth header hash.
message AuthHeaderBlobKey {
bytes auth_header_hash = 1;
}

// Uniquely identifies a blob based on its batch header hash and blob index.
message BatchHeaderBlobKey {
bytes batch_header_hash = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be more readable if we make the wording consistent with comment: either it's batch_header_hash, or certificate_hash

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment fixed. This was leftover cruft from a previous iteration where we were calling it something different.

uint32 blob_index = 2;
}
cody-littley marked this conversation as resolved.
Show resolved Hide resolved

// A unique identifier for a chunk.
message ChunkKey {
cody-littley marked this conversation as resolved.
Show resolved Hide resolved
BlobKey blob_key = 1;
uint32 chunk_index = 2;
}

// A blob.
message BlobData {
bytes data = 1;
}

// A chunk of a blob.
message ChunkData {
bytes data = 1;
}
14 changes: 13 additions & 1 deletion api/proto/disperser/disperser.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ service Disperser {
// The blob should have been initially dispersed via this Disperser service
// for this API to work.
rpc RetrieveBlob(RetrieveBlobRequest) returns (RetrieveBlobReply) {}

////////////////////////////////////////////////////////////////////////////////////////////////
// These RPCs are a work in progress and are not yet fully functional. API may not be stable. //
////////////////////////////////////////////////////////////////////////////////////////////////

// Retrieves the requested blob from the disperser's backend.
// This RPC is is a work in progress with undefined behavior, use with caution.
rpc GetBlob(common.BlobKey) returns (common.BlobData) {}

// Retrieves the requested chunk from the Disperser's backend.
// This RPC is is a work in progress with undefined behavior, use with caution.
rpc GetChunk(common.ChunkKey) returns (common.ChunkData) {}
cody-littley marked this conversation as resolved.
Show resolved Hide resolved
}

// Requests and Responses
Expand Down Expand Up @@ -249,4 +261,4 @@ message BatchHeader {
// The Disperser will encode and disperse the blobs based on the onchain info
// (e.g. operator stakes) at this block number.
uint32 reference_block_number = 4;
}
}
24 changes: 24 additions & 0 deletions api/proto/lightnode/lightnode.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
syntax = "proto3";
package lightnode;
import "common/common.proto";
option go_package = "github.com/Layr-Labs/eigenda/api/grpc/lightnode";

///////////////////////////////////////////////////////////////////////////////////
// Warning: light node APIs are currently in flux. This is not yet a stable API. //
///////////////////////////////////////////////////////////////////////////////////

service LightNode {
// GetChunk retrieves a specific chunk held by the light node.
rpc GetChunk(common.ChunkKey) returns (common.ChunkData) {}

// StreamAvailabilityStatus streams the availability status of all chunks assigned to the light node.
// For use by a DA node for monitoring the availability of chunks through its constellation of agent light nodes.
rpc StreamAvailabilityStatus(StreamAvailabilityStatusRequest) returns (stream common.ChunkKey) {}
}

// A request from a DA node to an agent light node to stream the availability status of all chunks
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this API specific to agent light node? Should it applicable to all light nodes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All light nodes will expose this API. Non-agents will return an error if it is called. Agents will return an error if the proper authentication token is not provided, and that error will look identical to if a non-agent is called. It's important for the public interface of an agent light node to be indistinguishable from the public interface of an agent light node.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know this, it may be worth documenting the difference of behavior between agent vs. non-agent LNs.

// assigned to the light node.
message StreamAvailabilityStatusRequest {
// TODO describe protocol for authentication
bytes authentication_token = 1;
}
55 changes: 55 additions & 0 deletions api/proto/node/node.proto
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@ service Retrieval {
rpc GetBlobHeader(GetBlobHeaderRequest) returns (GetBlobHeaderReply) {}
// Retrieve node info metadata
rpc NodeInfo(NodeInfoRequest) returns (NodeInfoReply) {}

////////////////////////////////////////////////////////////////////////////////////////////////
// These RPCs are a work in progress and are not yet fully functional. API may not be stable. //
////////////////////////////////////////////////////////////////////////////////////////////////

// GetChunks retrieves all of the chunks for a blob held by the node. Eventually this will replace RetrieveChunks.
rpc GetChunks(common.BlobKey) returns (GetChunksReply) {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's some ambiguity here, since the quorum ID isn't specified in the BlobKey. Maybe we should have a common.BlobKeyAndQuorumID which wraps the BlobKey.

RetrieveChunks can take BlobKeyandQuorumID;
ChunkKey can contain the BlobKeyAndQuorumID and the ChunkIndex

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^Just one idea

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up just calling the argument GetChunksRequest, which contains a blob key and a quorum ID. Do you think we will end up reusing this type? If so, I can move it to common and give it a more general name.

// GetChunk retrieves a specific chunk for a blob custodied at the Node.
rpc GetChunk(common.ChunkKey) returns (common.ChunkData) {}
// StreamChunks requests a stream of chunks with a specific index.
rpc StreamChunks(stream StreamChunksRequest) returns (stream common.ChunkData) {}
cody-littley marked this conversation as resolved.
Show resolved Hide resolved
// GetHeader is similar to RetrieveChunks, this just returns the header of the blob.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may not want to refer to RetrieveChunks in this new set of apis

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the reference to RetrieveChunks, but left the note that it will eventually replace GetBlobHeader.

// Eventually this will replace GetBlobHeader.
rpc GetHeader(common.BlobKey) returns (GetBlobHeaderReply) {}
// StreamHeaders requests a stream all new headers.
rpc StreamHeaders(stream StreamHeadersRequest) returns (stream GetBlobHeaderReply) {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should discuss whether we also want to have a StreamBlobKeys endpoint.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Repeating result of discussion here. It was decided that having a StreamBlobKeys endpoint would probably be useful, but that it was not a necessary component for the initial MVP. We plan on circling back on this question after the MVP launches.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove it for now if we plan to revisit/decide later

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mooselumph's prior comment was about adding an additional RPC. The StreamHeaders RPC is one that we are confident we will want to keep.

// Retrieve node info metadata. Eventually this will replace NodeInfo.
rpc GetNodeInfo(GetNodeInfoRequest) returns (GetNodeInfoReply) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need a new node info API?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main goal is to have better uniformity in the names of the RPCs. This does the same thing as the RPC NodeInfo, it just has a different name. Should we remove this new RPC for now?

}

// Requests and replies
Expand Down Expand Up @@ -216,3 +234,40 @@ message NodeInfoReply {
uint32 num_cpu = 4;
uint64 mem_bytes = 5;
}

/////////////////////////////////////////////////////////////////////////////////////////////////
// Messages for WIP RPCs. These are subject to change, do not consider these to be stable API. //
/////////////////////////////////////////////////////////////////////////////////////////////////

// Reply to GetChunksRequest.
message GetChunksReply {
// The indices of the chunks sent. Each index corresponds to the chunk at the same position in the chunks field.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"indices of the chunks custodied"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change made

repeated uint32 chunk_indices = 1;
// The chunks this node has.
repeated common.ChunkData chunks = 2;
}

// Request that all new chunks with a particular index be sent to the client.
message StreamChunksRequest {
// The quorum ID of the chunks to stream.
uint32 quorum_id = 1;
// The chunk index to start streaming from.
uint32 chunk_index = 2;
}

// Request that all new headers be sent.
message StreamHeadersRequest {
}

// Node info request.
message GetNodeInfoRequest {
}

// Node info reply.
message GetNodeInfoReply {
string semver = 1;
string arch = 2;
string os = 3;
uint32 num_cpu = 4;
uint64 mem_bytes = 5;
}
9 changes: 9 additions & 0 deletions api/proto/retriever/retriever.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
syntax = "proto3";

option go_package = "github.com/Layr-Labs/eigenda/api/grpc/retriever";
import "common/common.proto";
package retriever;

// The Retriever is a service for retrieving chunks corresponding to a blob from
Expand All @@ -20,6 +21,14 @@ service Retriever {
// This fans out request to EigenDA Nodes to retrieve the chunks and returns the
// reconstructed original blob in response.
rpc RetrieveBlob(BlobRequest) returns (BlobReply) {}

////////////////////////////////////////////////////////////////////////////////////////////////
// These RPCs are a work in progress and are not yet fully functional. API may not be stable. //
////////////////////////////////////////////////////////////////////////////////////////////////

// Obtain the chunks necessary to reconstruct a blob and return it.
// Eventually this will replace RetrieveBlob.
rpc GetBlob(common.BlobKey) returns (common.BlobData) {}
}

message BlobRequest {
Expand Down
Loading