Skip to content

Commit b1dc237

Browse files
authored
chore(disperser-client): Remove option to rely on disperser for commitment generation (#2320)
* Remove option to rely on disperser for commitment generation Signed-off-by: litt3 <102969658+litt3@users.noreply.github.com> * Fix docs Signed-off-by: litt3 <102969658+litt3@users.noreply.github.com> * Fix more docs Signed-off-by: litt3 <102969658+litt3@users.noreply.github.com> --------- Signed-off-by: litt3 <102969658+litt3@users.noreply.github.com>
1 parent c264fe9 commit b1dc237

File tree

11 files changed

+28
-79
lines changed

11 files changed

+28
-79
lines changed

api/clients/v2/disperser_client.go

Lines changed: 6 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ func NewDisperserClient(
8484
if signer == nil {
8585
return nil, fmt.Errorf("signer must be provided")
8686
}
87+
if committer == nil {
88+
return nil, fmt.Errorf("committer must be provided")
89+
}
8790
if metrics == nil {
8891
return nil, fmt.Errorf("metrics must be provided")
8992
}
@@ -221,37 +224,9 @@ func (c *DisperserClient) DisperseBlob(
221224

222225
probe.SetStage("get_commitments")
223226

224-
var blobCommitments encoding.BlobCommitments
225-
if c.committer == nil {
226-
// if committer is not configured, get blob commitments from disperser
227-
commitments, err := c.GetBlobCommitment(ctx, data)
228-
if err != nil {
229-
// Failover worthy error because it means the disperser is not responsive.
230-
return nil, nil, api.NewErrorFailover(fmt.Errorf("GetBlobCommitment rpc: %w", err))
231-
}
232-
deserialized, err := encoding.BlobCommitmentsFromProtobuf(commitments.GetBlobCommitment())
233-
if err != nil {
234-
return nil, nil, fmt.Errorf("error deserializing blob commitments: %w", err)
235-
}
236-
blobCommitments = *deserialized
237-
238-
// We need to check that the disperser used the correct length. Even once checking the commitment from the
239-
// disperser has been implemented, there is still an edge case where the disperser could truncate trailing 0s,
240-
// yielding the wrong blob length, but not causing commitment verification to fail. It is important that the
241-
// commitment doesn't report a blob length smaller than expected, since this could cause payload parsing to
242-
// fail, if the length claimed in the encoded payload header is larger than the blob length in the commitment.
243-
lengthFromCommitment := commitments.GetBlobCommitment().GetLength()
244-
if lengthFromCommitment != uint32(symbolLength) {
245-
return nil, nil, fmt.Errorf(
246-
"blob commitment length (%d) from disperser doesn't match expected length (%d): %w",
247-
lengthFromCommitment, symbolLength, err)
248-
}
249-
} else {
250-
// if committer is configured, get commitments from committer
251-
blobCommitments, err = c.committer.GetCommitmentsForPaddedLength(data)
252-
if err != nil {
253-
return nil, nil, fmt.Errorf("error getting blob commitments: %w", err)
254-
}
227+
blobCommitments, err := c.committer.GetCommitmentsForPaddedLength(data)
228+
if err != nil {
229+
return nil, nil, fmt.Errorf("get commitments for padded length: %w", err)
255230
}
256231

257232
blobHeader := &corev2.BlobHeader{
@@ -330,24 +305,6 @@ func (c *DisperserClient) GetPaymentState(ctx context.Context) (*disperser_rpc.G
330305
return reply, nil
331306
}
332307

333-
// GetBlobCommitment is a utility method that calculates commitment for a blob payload.
334-
// While the blob commitment can be calculated by anyone, it requires SRS points to
335-
// be loaded. For service that does not have access to SRS points, this method can be
336-
// used to calculate the blob commitment in blob header, which is required for dispersal.
337-
func (c *DisperserClient) GetBlobCommitment(
338-
ctx context.Context,
339-
data []byte,
340-
) (*disperser_rpc.BlobCommitmentReply, error) {
341-
request := &disperser_rpc.BlobCommitmentRequest{
342-
Blob: data,
343-
}
344-
reply, err := c.clientPool.GetClient().GetBlobCommitment(ctx, request)
345-
if err != nil {
346-
return nil, fmt.Errorf("error while calling GetBlobCommitment: %w", err)
347-
}
348-
return reply, nil
349-
}
350-
351308
// initOncePopulateAccountant initializes the accountant if it is not already initialized.
352309
// If initialization fails, it caches the error and will return it on every subsequent call.
353310
func (c *DisperserClient) initOncePopulateAccountant(ctx context.Context) error {

api/grpc/common/v2/common_v2.pb.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/grpc/disperser/v2/disperser_v2_grpc.pb.go

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/proto/common/v2/common_v2.proto

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ message BlobHeader {
3838
// Users can check their reserved quorum numbers on the IPaymentVault's reservation struct: https://github.com/Layr-Labs/eigenda/blob/1430d56258b4e814b388e497320fd76354bfb478/contracts/src/interfaces/IPaymentVault.sol#L10
3939
repeated uint32 quorum_numbers = 2;
4040
// commitment is the KZG commitment to the blob.
41-
// This commitment can either be constructed locally, or obtained by using the disperser's GetBlobCommitment RPC (see disperser_v2.proto).
4241
common.BlobCommitment commitment = 3;
4342
// payment_header contains payment information for the blob
4443
PaymentHeader payment_header = 4;

api/proto/disperser/v2/disperser_v2.proto

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ service Disperser {
2121
// It is provided to help clients who are trying to construct a DisperseBlobRequest.blob_header
2222
// and don't have the ability to calculate the commitment themselves (expensive operation which requires SRS points).
2323
//
24-
// For an example usage, see how our disperser_client makes a call to this endpoint when it doesn't have a local prover:
25-
// https://github.com/Layr-Labs/eigenda/blob/6059c6a068298d11c41e50f5bcd208d0da44906a/api/clients/v2/disperser_client.go#L166
24+
// DEPRECATED: This method is deprecated and will be removed in a future release.
2625
rpc GetBlobCommitment(BlobCommitmentRequest) returns (BlobCommitmentReply) {}
2726

2827
// GetPaymentState is a utility method to get the payment state of a given account, at a given disperser.

docs/spec/src/integration/spec.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,7 @@ sequenceDiagram
4141
%% Blob Creation and Dispersal Flow
4242
B->>SP: Send payload
4343
Note over SP: Encode payload into blob
44-
alt
45-
SP->>D: GetBlobCommitment(blob)
46-
D-->>SP: blob_commitment
47-
else
48-
SP->>SP: Compute commitment locally
49-
end
44+
Note over SP: Compute commitment locally using SRS points
5045
Note over SP: Create blob_header including payment_header
5146
SP->>D: DisperseBlob(blob, blob_header)
5247
D-->>SP: QUEUED status + blob_header_hash

docs/spec/src/integration/spec/1-apis.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ The disperser presents a [grpc v2 service](https://github.com/Layr-Labs/eigenda/
2525
$ EIGENDA_DISPERSER_PREPROD=disperser-preprod-holesky.eigenda.xyz:443
2626
$ grpcurl $EIGENDA_DISPERSER_PREPROD list disperser.v2.Disperser
2727
disperser.v2.Disperser.DisperseBlob
28-
disperser.v2.Disperser.GetBlobCommitment
2928
disperser.v2.Disperser.GetBlobStatus
3029
disperser.v2.Disperser.GetPaymentState
3130
```

docs/spec/src/integration/spec/3-data-structs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ The `blobHeader` version refers to one of the `versionedBlobParams` structs defi
7777

7878
#### BlobCommitment
7979

80-
The `BlobCommitment` is a binding commitment to an EigenDA Blob. Due to the length field, a `BlobCommitment` uniquely represents a single `Blob`. The length field is added to the kzgCommitment to respect the binding property. It is used by the disperser to prove to EigenDA validators that the chunks they received belong to the original blob (or its Reed-Solomon extension). This commitment can either be computed locally by the *EigenDA Client* from the blob or generated by the disperser via the `GetBlobCommitment` [endpoint](./../../protobufs/generated/disperser_v2.md#disperserv2disperser_v2proto###disperser).
80+
The `BlobCommitment` is a binding commitment to an EigenDA Blob. Due to the length field, a `BlobCommitment` uniquely represents a single `Blob`. The length field is added to the kzgCommitment to respect the binding property. It is used by the disperser to prove to EigenDA validators that the chunks they received belong to the original blob (or its Reed-Solomon extension).
8181

8282

8383
```protobuf

docs/spec/src/integration/spec/6-secure-integration.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -223,17 +223,6 @@ Proxy behavior. The EigenDA proxy can return either the encoded payload or the d
223223
- With `?return_encoded_payload=true` or `?return_encoded_payload=1`, it only checks the blob against the kzg commitment and returns the encoded payload, it is useful when integrating with proof systems to control the data transformation.
224224
- Without parameters, it decodes and returns the rollup payload; on any decoding error, it returns HTTP 418.
225225

226-
### Notes on Dispersal
227-
Dispersal:
228-
229-
1. If the `BlobCertificate` was generated using the disperser’s `GetBlobCommitment` RPC endpoint, verify its contents:
230-
1. verify KZG commitment
231-
2. verify that `length` matches the expected value, based on the blob that was actually sent
232-
3. verify the `lengthProof` using the `length` and `lengthCommitment`
233-
2. After dispersal, verify that the `BlobKey` actually dispersed by the disperser matches the locally computed `BlobKey`
234-
235-
Note: The verification steps in point 1. for dispersal are not currently implemented. This route only makes sense for clients that want to avoid having large amounts of SRS data, but KZG commitment verification via Fiat-Shamir is required to do the verification without this data. Until the alternate verification method is implemented, usage of `GetBlobCommitment` places a correctness trust assumption on the disperser generating the commitment.
236-
237226
## Upgradable Quorums and Thresholds for Optimistic Verification
238227
![image.png](../../assets/integration/router-in-fraud-proof.png)
239228

inabox/deploy/config.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,6 @@ func (env *Config) generateDisperserV2Vars(ind int, logPath, dbPath, grpcPort st
226226
DISPERSER_SERVER_GLOBAL_RATE_TABLE_NAME: "e2e_v2_global_reservation",
227227
DISPERSER_SERVER_CONTROLLER_ADDRESS: fmt.Sprintf("localhost:%d", controllerGrpcPort),
228228

229-
// V2 inabox test is setup with a client that doesn't setup a client for some reason,
230-
// so it calls the grpc GetBlobCommitment to generate commitments.
231229
// DisperserV2 uses the V2 prover which always uses SRSOrder=2^28.
232230
// So it needs the trailing g2 points to generate correct length commitments.
233231
DISPERSER_SERVER_G2_TRAILING_PATH: "../resources/srs/g2.trailing.point",

0 commit comments

Comments
 (0)