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

Add configuration setting for high-level EigenDA client for returning as soon as the blob has confirmed #620

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions api/clients/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ type EigenDAClientConfig struct {
// the commitment. With this mode disabled, you will need to supply the entire blob to perform a verification
// that any part of the data matches the KZG commitment.
DisablePointVerificationMode bool

// If true, will wait for the blob to finalize, if false, will wait only for the blob to confirm.
WaitForFinalization bool
}

func (c *EigenDAClientConfig) CheckAndSetDefaults() error {
Expand Down
8 changes: 7 additions & 1 deletion api/clients/eigenda_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,13 @@ func (m EigenDAClient) putBlob(ctx context.Context, rawData []byte, resultChan c
errChan <- fmt.Errorf("EigenDA blob dispersal failed in processing with insufficient signatures, requestID=%s: %w", base64RequestID, err)
return
case grpcdisperser.BlobStatus_CONFIRMED:
m.Log.Info("EigenDA blob confirmed, waiting for finalization", "requestID", base64RequestID)
if m.Config.WaitForFinalization {
m.Log.Info("EigenDA blob confirmed, waiting for finalization", "requestID", base64RequestID)
} else {
m.Log.Info("EigenDA blob confirmed", "requestID", base64RequestID)
resultChan <- statusRes.Info
return
}
case grpcdisperser.BlobStatus_FINALIZED:
batchHeaderHashHex := fmt.Sprintf("0x%s", hex.EncodeToString(statusRes.Info.BlobVerificationProof.BatchMetadata.BatchHeaderHash))
m.Log.Info("Successfully dispersed blob to EigenDA", "requestID", base64RequestID, "batchHeaderHash", batchHeaderHashHex)
Expand Down
1 change: 1 addition & 0 deletions api/clients/eigenda_client_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func TestClientUsingTestnet(t *testing.T) {
StatusQueryRetryInterval: 5 * time.Second,
CustomQuorumIDs: []uint{},
SignerPrivateKeyHex: "2d23e142a9e86a9175b9dfa213f20ea01f6c1731e09fa6edf895f70fe279cbb1",
WaitForFinalization: true,
})
data := "hello world!"
assert.NoError(t, err)
Expand Down
10 changes: 10 additions & 0 deletions api/clients/eigenda_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func TestPutRetrieveBlobIFFTSuccess(t *testing.T) {
DisableTLS: false,
PutBlobEncodingVersion: codecs.DefaultBlobEncoding,
DisablePointVerificationMode: false,
WaitForFinalization: true,
},
Client: disperserClient,
Codec: codecs.NewIFFTCodec(codecs.NewDefaultBlobCodec()),
Expand Down Expand Up @@ -133,6 +134,7 @@ func TestPutRetrieveBlobIFFTNoDecodeSuccess(t *testing.T) {
DisableTLS: false,
PutBlobEncodingVersion: codecs.DefaultBlobEncoding,
DisablePointVerificationMode: false,
WaitForFinalization: true,
},
Client: disperserClient,
Codec: codecs.NewIFFTCodec(codecs.NewDefaultBlobCodec()),
Expand Down Expand Up @@ -203,6 +205,7 @@ func TestPutRetrieveBlobNoIFFTSuccess(t *testing.T) {
DisableTLS: false,
PutBlobEncodingVersion: codecs.DefaultBlobEncoding,
DisablePointVerificationMode: true,
WaitForFinalization: true,
},
Client: disperserClient,
Codec: codecs.NewNoIFFTCodec(codecs.NewDefaultBlobCodec()),
Expand Down Expand Up @@ -234,6 +237,7 @@ func TestPutBlobFailDispersal(t *testing.T) {
SignerPrivateKeyHex: "75f9e29cac7f5774d106adb355ef294987ce39b7863b75bb3f2ea42ca160926d",
DisableTLS: false,
PutBlobEncodingVersion: codecs.DefaultBlobEncoding,
WaitForFinalization: true,
},
Client: disperserClient,
Codec: codecs.NewIFFTCodec(codecs.NewDefaultBlobCodec()),
Expand Down Expand Up @@ -266,6 +270,7 @@ func TestPutBlobFailureInsufficentSignatures(t *testing.T) {
SignerPrivateKeyHex: "75f9e29cac7f5774d106adb355ef294987ce39b7863b75bb3f2ea42ca160926d",
DisableTLS: false,
PutBlobEncodingVersion: codecs.DefaultBlobEncoding,
WaitForFinalization: true,
},
Client: disperserClient,
Codec: codecs.NewIFFTCodec(codecs.NewDefaultBlobCodec()),
Expand Down Expand Up @@ -298,6 +303,7 @@ func TestPutBlobFailureGeneral(t *testing.T) {
SignerPrivateKeyHex: "75f9e29cac7f5774d106adb355ef294987ce39b7863b75bb3f2ea42ca160926d",
DisableTLS: false,
PutBlobEncodingVersion: codecs.DefaultBlobEncoding,
WaitForFinalization: true,
},
Client: disperserClient,
Codec: codecs.NewIFFTCodec(codecs.NewDefaultBlobCodec()),
Expand Down Expand Up @@ -330,6 +336,7 @@ func TestPutBlobFailureUnknown(t *testing.T) {
SignerPrivateKeyHex: "75f9e29cac7f5774d106adb355ef294987ce39b7863b75bb3f2ea42ca160926d",
DisableTLS: false,
PutBlobEncodingVersion: codecs.DefaultBlobEncoding,
WaitForFinalization: true,
},
Client: disperserClient,
Codec: codecs.NewIFFTCodec(codecs.NewDefaultBlobCodec()),
Expand Down Expand Up @@ -364,6 +371,7 @@ func TestPutBlobFinalizationTimeout(t *testing.T) {
SignerPrivateKeyHex: "75f9e29cac7f5774d106adb355ef294987ce39b7863b75bb3f2ea42ca160926d",
DisableTLS: false,
PutBlobEncodingVersion: codecs.DefaultBlobEncoding,
WaitForFinalization: true,
},
Client: disperserClient,
Codec: codecs.NewIFFTCodec(codecs.NewDefaultBlobCodec()),
Expand Down Expand Up @@ -423,6 +431,7 @@ func TestPutBlobIndividualRequestTimeout(t *testing.T) {
SignerPrivateKeyHex: "75f9e29cac7f5774d106adb355ef294987ce39b7863b75bb3f2ea42ca160926d",
DisableTLS: false,
PutBlobEncodingVersion: codecs.DefaultBlobEncoding,
WaitForFinalization: true,
},
Client: disperserClient,
Codec: codecs.NewIFFTCodec(codecs.NewDefaultBlobCodec()),
Expand Down Expand Up @@ -485,6 +494,7 @@ func TestPutBlobTotalTimeout(t *testing.T) {
SignerPrivateKeyHex: "75f9e29cac7f5774d106adb355ef294987ce39b7863b75bb3f2ea42ca160926d",
DisableTLS: false,
PutBlobEncodingVersion: codecs.DefaultBlobEncoding,
WaitForFinalization: true,
},
Client: disperserClient,
Codec: codecs.NewIFFTCodec(codecs.NewDefaultBlobCodec()),
Expand Down
Loading