这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@Lazar955
Copy link
Member

@Lazar955 Lazar955 commented Sep 15, 2025

Instead of requesting eots to sign height by height, we do it in batches.

Local modified (not committed) cosmos (as we have 1s block time) e2e catch-up test shows that for a batch of 60, execution time for old implementations is 1.149s and for the new implementation 95.10ms. These times should be even more exaggerated as the local e2e test has minimal network latency.

Copilot AI review requested due to automatic review settings September 15, 2025 20:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements batch signing functionality for EOTS (Extractable One-Time Signatures) to improve performance by processing multiple signatures in a single request instead of height-by-height. Performance testing shows a 12x improvement (from 1.149s to 95.10ms for a batch of 60 signatures).

Key changes:

  • Introduces batch signing methods across the EOTS manager interface and implementations
  • Adds database operations for batch retrieval and storage of signing records
  • Replaces individual signing calls with batch processing in the finality submitter

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
finality-provider/service/finality_submitter.go Implements batch signing workflow using new SignFinalitySigBatch method
eotsmanager/store/storedsigningrecord.go Adds BatchSignRecord struct for batch operations
eotsmanager/store/eotsstore.go Implements batch database operations for sign records
eotsmanager/service/rpcserver.go Adds RPC handler for batch EOTS signing
eotsmanager/proto/ files Defines protobuf messages and gRPC service for batch operations
eotsmanager/localmanager.go Implements core batch signing logic with double-sign protection
eotsmanager/eotsmanager.go Defines interface and data structures for batch signing
eotsmanager/client/rpcclient.go Implements gRPC client for batch signing requests
CHANGELOG.md Documents the new batch signing feature

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

heights = append(heights, request.Height)
}

existingRecords, err := lm.es.GetSignRecordsBatch(eotsPk, chainID, heights)
Copy link
Contributor

Choose a reason for hiding this comment

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

nice 💯

Comment on lines 358 to 359
lm.metrics.IncrementEotsFpTotalEotsSignCounter(hex.EncodeToString(eotsPk))
lm.metrics.SetEotsFpLastEotsSignHeight(hex.EncodeToString(eotsPk), float64(height))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion to move hex.EncodeToString(eotsPk) outside of for loop

Copy link
Member Author

Choose a reason for hiding this comment

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

agreed


// Create slices to store only the valid items
// Use batch signing for better performance
batchSigMap, err := ds.SignFinalitySigBatch(ctx, blocks)
Copy link
Contributor

Choose a reason for hiding this comment

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

what happens if on SubmitBatchFinalitySigs only one of the signatures fails?

Copy link
Member Author

Choose a reason for hiding this comment

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

if it's an unexpected error, the whole batch fails

Copy link
Contributor

@RafilxTenfen RafilxTenfen left a comment

Choose a reason for hiding this comment

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

Great improvement, only one suggestion and one question

Copy link
Contributor

@GAtom22 GAtom22 left a comment

Choose a reason for hiding this comment

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

LGTM! Great work @Lazar955!! 🚀

One question, should we cap the batch size just in case to avoid OOM?
maybe this can be a config

@Lazar955
Copy link
Member Author

LGTM! Great work @Lazar955!! 🚀

One question, should we cap the batch size just in case to avoid OOM? maybe this can be a config

Thanks! We are already constrained by BatchSubmissionSize (limits how many blocks in the batch we poll for), so we should be good

@Lazar955 Lazar955 merged commit 69503ed into main Sep 17, 2025
21 checks passed
@Lazar955 Lazar955 deleted the lazar/batch-eots-sign branch September 17, 2025 08:28
mergify bot pushed a commit that referenced this pull request Sep 17, 2025
Instead of requesting eots to sign height by height, we do it in
batches.

Local modified (not committed) cosmos (as we have 1s block time) e2e
catch-up test shows that for a batch of 60, execution time for old
implementations is `1.149s` and for the new implementation `95.10ms`.
These times should be even more exaggerated as the local e2e test has
minimal network latency.

(cherry picked from commit 69503ed)
Lazar955 added a commit that referenced this pull request Sep 17, 2025
Instead of requesting eots to sign height by height, we do it in
batches.

Local modified (not committed) cosmos (as we have 1s block time) e2e
catch-up test shows that for a batch of 60, execution time for old
implementations is `1.149s` and for the new implementation `95.10ms`.
These times should be even more exaggerated as the local e2e test has
minimal network latency.
<hr>This is an automatic backport of pull request #715 done by
[Mergify](https://mergify.com).

Co-authored-by: Lazar <12626340+Lazar955@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants