Skip to content

feat: Store Replica Mode#1987

Open
sergerad wants to merge 51 commits intonextfrom
sergerad-replicas
Open

feat: Store Replica Mode#1987
sergerad wants to merge 51 commits intonextfrom
sergerad-replicas

Conversation

@sergerad
Copy link
Copy Markdown
Collaborator

@sergerad sergerad commented Apr 23, 2026

Store Replica Mode

Adds a replica mode to the store, enabling (replica) store instances to sync blocks and proofs
from an upstream store. This allows the RPC layer to be scaled horizontally by pointing multiple
RPC nodes at multiple replica stores, without adding load to the primary store or block producer.

Architecture

The store now operates in one of two mutually exclusive modes, controlled by the new StoreMode
enum:

  • BlockProducer mode — existing behaviour. Accepts blocks from the block producer via the
    BlockProducer gRPC service, runs the proof scheduler, and exposes the NtxBuilder service.
  • Replica mode — new. Syncs blocks from an upstream store via the new StoreReplica gRPC
    service. Only exposes the Rpc and StoreReplica services — no block producer service, no NTX builder service, and no proof scheduler task.

New: StoreReplica gRPC service

Implemented on the upstream store side. Exposes two streaming RPCs:

  • SubscribeBlocks — streams committed blocks to a subscriber starting from a given block
    number.
  • SubscribeProofs — streams block proofs to a subscriber starting from a given block number.

Operational

  • run-node.sh updated to demonstrate a topology with a primary store
    and two replicas, with RPC nodes pointing at the replicas.
 # Second replica (upstream = first replica)
➜ grpcurl -plaintext -proto  ./rpc.proto -d '{}' "localhost:57293" rpc.Api/Status
{
...
  "store": {
    "version": "0.15.0",
    "status": "connected",
    "chainTip": 13
  },
...
}

# First replica (upstream = block producer store)
➜ grpcurl -plaintext -proto  ./rpc.proto -d '{}' "localhost:57292" rpc.Api/Status
{
...
  "store": {
    "version": "0.15.0",
    "status": "connected",
    "chainTip": 13
  },
...
}

@sergerad sergerad marked this pull request as ready for review April 24, 2026 03:58
Copy link
Copy Markdown
Collaborator

@Mirko-von-Leipzig Mirko-von-Leipzig left a comment

Choose a reason for hiding this comment

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

I'm about halfway through, I think so far my main question/suggestion is moving the proof inputs out of the db.

Comment thread bin/node/Dockerfile Outdated
Comment thread Makefile Outdated
Comment thread docker-compose.yml
Comment thread CHANGELOG.md
Comment thread proto/proto/internal/store.proto Outdated
Comment thread proto/proto/internal/store.proto Outdated
Comment thread proto/proto/internal/store.proto Outdated
Comment thread proto/proto/internal/store.proto Outdated
Comment thread crates/store/src/db/models/queries/block_headers.rs
Comment thread crates/store/src/server/block_replica_client.rs Outdated
Comment thread crates/store/src/server/block_replica_client.rs Outdated
Comment thread crates/store/src/server/block_replica_client.rs Outdated
Comment thread crates/store/src/server/block_replica_client.rs Outdated
Comment thread crates/store/src/server/block_replica_client.rs Outdated
Comment thread crates/store/src/server/proof_replica_client.rs Outdated
Comment thread crates/store/src/server/proof_replica_client.rs Outdated
Comment thread crates/store/src/server/proof_replica_client.rs Outdated
Comment thread crates/store/src/server/replica.rs Outdated
@sergerad sergerad force-pushed the sergerad-replicas branch from 4907595 to 637af22 Compare April 29, 2026 22:29
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