Skip to content

Sync Committee: Batch Aggregation#774

Merged
zadykian merged 3 commits intomainfrom
sync-committee/batch-aggregation
Apr 23, 2025
Merged

Sync Committee: Batch Aggregation#774
zadykian merged 3 commits intomainfrom
sync-committee/batch-aggregation

Conversation

@zadykian
Copy link
Copy Markdown
Contributor

@zadykian zadykian commented Apr 8, 2025

BlockBatch type API

Modified the APIs of the BlockBatch and Subgraph types for better support of multi-subgraph batch construction

  • NewBlockBatch(...) now always constructs an empty batch;
  • Implemented BlockBatch.WithAddedBlocks(...) method, which checks per-shard block sequencing and appends a new blocks to the batch;

Simplified Block Batching

  • Replaced the Subgraph type, which depends on the main shard block, with ChainSegments;
  • Simplified the BlockBatch structure and its methods (using a map of blocks instead of a list of subgraphs);
  • SubgraphFetcher still uses the main shard block as the starting point, but now returns ChainSegments;

Batch Reconstruction

  • Replaced TryGetLatestBatchId with TryGetLatestBatch to return full batch details instead of just the ID. Will be used in the next PR by Aggregator;

@notion-workspace
Copy link
Copy Markdown

Enable observer

@zadykian zadykian force-pushed the sync-committee/batch-aggregation branch from 295d31a to ca27e27 Compare April 8, 2025 13:58
@zadykian zadykian requested review from akokoshn, oclaw and x-mass April 10, 2025 07:54
@zadykian zadykian marked this pull request as ready for review April 10, 2025 07:54
func validateBatch(subgraphs []Subgraph) error {
if len(subgraphs) == 0 {
return errors.New("subgraphs cannot be empty")
func ExistingBlockBatch(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A bit confusing name. What does Existing word means here?

Copy link
Copy Markdown
Contributor Author

@zadykian zadykian Apr 16, 2025

Choose a reason for hiding this comment

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

The idea is that ExistingBlockBatch reconstructs an existing batch, while NewBlockBatch creates a new one

upd: renamed to ReconstructExistingBlockBatch(...)

Modified the APIs of the `BlockBatch` and `Subgraph` types for better support of multi-subgraph batch construction

* `NewBlockBatch(...)` now always constructs an empty batch;
* Implemented `BlockBatch.WithAddedSubgraph(...)` method, which checks per-shard block sequencing and appends a new subgraph to the batch;
* Replaced `BlockBatch.SetDataProofs(...)` with `BlockBatch.WithDataProofs(...)`;

Both `WithAddedSubgraph(...)` and `WithDataProofs(...)` are implemented as immutable methods that return a shallow copy of the original batch. This is required for batch event handling (to be implemented in a follow-up PR)
* Replaced the `Subgraph` type, which depends on the main shard block, with `ChainSegments`;
* Simplified the `BlockBatch` structure and its methods (using a map of blocks instead of a list of subgraphs);
* `SubgraphFetcher` still uses the main shard block as the starting point, but now returns `ChainSegments`;
Replaced `TryGetLatestBatchId` with `TryGetLatestBatch` to return full batch details instead of just the ID.
Will be used in the next PR by `Aggregator`.
@zadykian zadykian added this pull request to the merge queue Apr 23, 2025
Merged via the queue into main with commit dc3e7b1 Apr 23, 2025
16 checks passed
@zadykian zadykian deleted the sync-committee/batch-aggregation branch April 23, 2025 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants