Replies: 6 comments 28 replies
-
This is a great start! I'm leaving a few comments per section focusing on the high-level use-cases (and hopefully not bikeshedding on minor details): BlobsThe service scope makes a lot of sense and I think this generally should be the methods of the blob module/service: service BlobService {
rpc GetBlobByCommitment (BlobRequest) returns (BlobResponse) {}
rpc GetBlobs (BlobListRequest) returns (BlobListResponse) {}
rpc SubmitBlob (SubmitBlobRequest) returns (SubmitBlobResponse) {}
} That said, the
Proofs:
Data Availability ProofsHaving a proof API could be a good idea but the see the last point on Proofs above. It could be better to expose the proofs per service instead of a lower-level generalized Fraud Proofs
There is actually a concrete implementation, i.e. for bad encoding fraud proofs. Users will need two endpoints for those:
Extended HeadersI think this additionally needs a way to subscribe / listen to a header stream. SharesA few comments on the proposed API:
Other commentsThe two methods used by blobstream (but can potentially be useful for other rollups/data attestation bridges) that are not covered by the API nor my comments above, should also be part of the protobuf definition:
// GetDataCommitment collects the data roots over a provided ordered range of blocks,
// and then creates a new Merkle root of those data roots. The range is end exclusive.
GetDataCommitment(ctx context.Context, start, end uint64) (*ResultDataCommitment, error)
// GetDataRootInclusionProof creates an inclusion proof for the data root of block
// height `height` in the set of blocks defined by `start` and `end`. The range
// is end exclusive.
GetDataRootInclusionProof(
ctx context.Context,
height int64,
start, end uint64,
) (*ResultDataRootInclusionProof, error) It is also worth discussing if there should be 3 modes for each of the data types that can be requested:
I am not convinced 1. is ever needed tbh but left it here for completeness. Regarding key management and signing, and if the API should contain all grpc endpoints of the state machine as well, I'm also linking these two discussions as they are related:
Also, orthogonal to the above, there is no notion of error codes/error IDs in the above Response types. |
Beta Was this translation helpful? Give feedback.
-
Thanks @jbowen93. The API looks great. I'd like to add a few things to the Blob Module:
|
Beta Was this translation helpful? Give feedback.
-
Providing a list of things I find essential to be emphasized and some of them might be repeated. There are more little details that I need to look into as it is too early for them. The next step is incorporating all the feedback into the Draft for the next round of reviews. Avoid any dependence on
|
Beta Was this translation helpful? Give feedback.
-
Tx / blob submission optionsI would also suggest to add the following type below (maybe name it differently?). This will allow to set all necessary params for blob (or any tx) submission. Question is if we need both // TxConfig specifies additional options that will be applied to the Tx.
message TxConfig {
string signer_address = 1; // Specifies the address from the keystore that will sign transactions.
string key_name = 2; // Specifies the key from the keystore associated with an account that will be used to sign transactions.
float gas_price = 3; // Represents the amount to be paid per gas unit.
// bool is_gas_price_set = 4; // Indicates if the gas price has been explicitly set by the user.
uint64 gas = 5; // Specifies the gas amount.
string fee_granter_address = 6; // Specifies the account that will pay for the transaction.
} The blob service then would look sth like that: message SubmitBlobRequest {
Blob blob = 1;
TxConfig tx_config = 2;
} ref: #3349 Note that all fields in proto3 are optional by default but we could also more explicitly tag them with the |
Beta Was this translation helpful? Give feedback.
-
Error codesRegarding error handling, I would suggest a similar approach as @walldiss suggested here: #3529 (comment) Particularly, as we might want to expose this API via json over http. Suggested proto messsages: enum ErrorCode {
UNKNOWN_ERROR = 0; // TODO better start at a much higher error code range
INVALID_REQUEST = 1;
INVALID_PARAMS = 3;
INTERNAL_ERROR = 4;
// TODO Add more specific error codes here.
// related issues:
// https://github.com/celestiaorg/celestia-node/issues/3335#issuecomment-2079748320
// https://github.com/rollkit/go-da/issues/65
}
message RpcError {
ErrorCode code = 1;
string message = 2;
} Response messages should be changed to (for example): message BlobResponse {
oneof response {
Blob blob = 1;
RpcError error = 2;
}
} |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
This discussion proposes an initial rough draft of a Protobuf API for the Celestia Node.
This API should be seen as an addition to the existing JSON RPC API, comments on the potential implications of this API replacing the existing API are premature.
This API doesn't provide an equivalent of the existing State API, for discussion of how the Node API should or shouldn't interact with the broader Celestia state machine see this post.
This API doesn't provide provide an equivalent of the existing Node or P2P APIs. These APIs should only be used by a node's admin and thus are out of scope.
This API is agnostic to any specific programming language's semantics.
This API attempts to follow a Resource-oriented design.
This API attempts to follow Protocol Buffers API Best Practices
Blobs
The
blob
type is defined in the celestia-node codebase here:types.Blob
is a reference to"github.com/celestiaorg/celestia-app/x/blob/types"
which defines its own blob proto here and references the go-square proto here.The only difference between these protos is that the latter adds a
bytes signer = 5;
field, for simplicity we ignore that field.Data Availability Proofs
The
proof
type is defined in the celestia-node codebase here:nmt.Proof
is a reference"github.com/celestiaorg/nmt"
which defines aProof
here.A comment in the celestia-node codebase states
The referenced issue (#2303) is still open but is beyond the scope of this API.
Fraud Proofs
Fraud Proofs seem to be referenced in the celestia-node code here which references the go-fraud repo which a stub proto here.
There doesn't seem to be a concrete implementation of fraud proofs, so we leave this API as a TODO.
Extended Headers
The ExtendedHeader is already defined as a proto here
Shares
The celestia-node codebase defines a
NamespacedSharesResponse
here which references theshare
module which defines aShare
as[]byte
.Extended Data Square
ExtendedDataSquare
is defined ingithub.com/celestiaorg/rsmt2d
hereTODO: Define the correct proto for an
ExtendedDataSquare
Beta Was this translation helpful? Give feedback.
All reactions