Skip to content

statement store: Implement basic statement-store support#3127

Merged
AndreiEres merged 45 commits into
mainfrom
ae-statement-store
Mar 31, 2026
Merged

statement store: Implement basic statement-store support#3127
AndreiEres merged 45 commits into
mainfrom
ae-statement-store

Conversation

@AndreiEres

@AndreiEres AndreiEres commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Summary:

Protocol Implementation:

  • Statement encoding/decoding
  • Topic-based filtering with three modes: Any, MatchAll, and MatchAny
  • Duplicate detection via LRU cache of statement hashes

Network Layer:

  • New StatementProtocolConfig for enabling the protocol on a chain
  • Statement notification substream handling
  • StatementProtocolConnected and StatementNotification events

@AndreiEres

Copy link
Copy Markdown
Contributor Author

/cmd fmt

@alexggh alexggh left a comment

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.

Had a pass, things are looking good to me. I put some comments, but nothing major.

One thing it is not clear to me is how do we want to test E2E, but that could be answered in followup PRs and issues.

Comment thread examples/statement-chat/README.md Outdated
Comment thread lib/src/json_rpc/service/client_main_task.rs
Comment thread lib/src/network/codec/statement.rs Outdated
Comment thread lib/src/network/codec/statement.rs
Comment thread lib/src/network/codec.rs
Comment thread light-base/src/json_rpc_service/background.rs
Comment thread lib/src/network/service.rs Outdated
Comment thread lib/src/network/codec/statement.rs Outdated
Comment thread lib/src/network/codec/statement.rs Outdated
Comment thread lib/src/network/codec/statement.rs Outdated
Comment thread lib/Cargo.toml Outdated
Comment thread lib/src/json_rpc/methods.rs Outdated
Comment thread lib/src/network/service.rs Outdated
Comment thread lib/src/network/service.rs Outdated
Comment thread lib/src/network/service.rs Outdated
Comment thread lib/src/network/service.rs
Comment thread lib/src/network/service.rs Outdated
Comment thread lib/src/network/service.rs Outdated
Comment thread light-base/src/network_service.rs Outdated
Comment thread light-base/src/network_service.rs Outdated
Comment thread light-base/src/network_service.rs Outdated
Comment thread light-base/src/json_rpc_service/background.rs Outdated
Comment thread light-base/src/json_rpc_service/background.rs Outdated
Comment thread light-base/src/json_rpc_service/background.rs Outdated
Comment thread light-base/src/json_rpc_service/background.rs Outdated
Comment thread light-base/src/json_rpc_service/background.rs Outdated
Comment thread light-base/src/json_rpc_service/background.rs Outdated
Comment thread light-base/src/network_service.rs Outdated

@dmitry-markin dmitry-markin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Left some nits, but overall the approach looks good!

Comment thread lib/src/json_rpc/methods.rs Outdated
@AndreiEres

Copy link
Copy Markdown
Contributor Author

@alexggh @dmitry-markin
Thank you for the thorough review.

There were many comments, so to avoid getting lost in them, I resolved the fixed or outdated ones and left some with my answers. I would greatly appreciate it if you could take another look.

@dmitry-markin dmitry-markin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Everything looks good, but let's move the statement-chat folder to a dedicated repo before merging the PR.

Comment thread examples/statement-chat/.gitignore Outdated
Comment thread lib/src/json_rpc/methods.rs Outdated
Comment thread lib/src/network/codec/statement.rs
Comment thread lib/src/network/service.rs Outdated
Comment thread lib/src/network/service.rs Outdated
Comment thread light-base/src/json_rpc_service/background.rs
Comment thread light-base/src/json_rpc_service/background.rs
Comment thread light-base/src/json_rpc_service/background.rs Outdated
Comment thread light-base/src/json_rpc_service/background.rs Outdated
Comment thread light-base/src/json_rpc_service/background.rs Outdated
AndreiEres and others added 8 commits March 27, 2026 16:58
Co-authored-by: Dmitry Markin <dmitry@markin.tech>
Co-authored-by: Dmitry Markin <dmitry@markin.tech>
Co-authored-by: Dmitry Markin <dmitry@markin.tech>
Co-authored-by: Dmitry Markin <dmitry@markin.tech>
Co-authored-by: Dmitry Markin <dmitry@markin.tech>

@dmitry-markin dmitry-markin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the solid PR! The implementation is clean and well-scoped. Ready for merging.

continue;
}

// TODO: not efficient on a big number of subscriptions

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: a brief description of the current complexity would be nice (you can copy from the original comment).

@bkchr

bkchr commented Mar 31, 2026

Copy link
Copy Markdown
Member

@AndreiEres let's get this merged if you are happy.

@AndreiEres AndreiEres merged commit c3fdfd0 into main Mar 31, 2026
24 checks passed
@AndreiEres AndreiEres deleted the ae-statement-store branch March 31, 2026 09:03
bkchr pushed a commit that referenced this pull request Apr 1, 2026
Summary:
- Based on https://github.com/bkchr/smoldot/tree/bkchr-battleship
- Implements the Statement Store networking protocol for peer-to-peer
statement distribution
- Adds JSON-RPC methods for submitting and subscribing to statements


Protocol Implementation:
- Statement encoding/decoding
- Topic-based filtering with three modes: Any, MatchAll, and MatchAny
- Duplicate detection via LRU cache of statement hashes

Network Layer:
- New StatementProtocolConfig for enabling the protocol on a chain
- Statement notification substream handling
- StatementProtocolConnected and StatementNotification events

---------

Co-authored-by: Dmitry Markin <dmitry@markin.tech>
bkchr pushed a commit that referenced this pull request Apr 1, 2026
Summary:
- Based on https://github.com/bkchr/smoldot/tree/bkchr-battleship
- Implements the Statement Store networking protocol for peer-to-peer
statement distribution
- Adds JSON-RPC methods for submitting and subscribing to statements


Protocol Implementation:
- Statement encoding/decoding
- Topic-based filtering with three modes: Any, MatchAll, and MatchAny
- Duplicate detection via LRU cache of statement hashes

Network Layer:
- New StatementProtocolConfig for enabling the protocol on a chain
- Statement notification substream handling
- StatementProtocolConnected and StatementNotification events

---------

Co-authored-by: Dmitry Markin <dmitry@markin.tech>
bkchr pushed a commit that referenced this pull request Apr 1, 2026
Summary:
- Based on https://github.com/bkchr/smoldot/tree/bkchr-battleship
- Implements the Statement Store networking protocol for peer-to-peer
statement distribution
- Adds JSON-RPC methods for submitting and subscribing to statements

Protocol Implementation:
- Statement encoding/decoding
- Topic-based filtering with three modes: Any, MatchAll, and MatchAny
- Duplicate detection via LRU cache of statement hashes

Network Layer:
- New StatementProtocolConfig for enabling the protocol on a chain
- Statement notification substream handling
- StatementProtocolConnected and StatementNotification events

---------

Co-authored-by: Dmitry Markin <dmitry@markin.tech>
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.

statement-store: Implement a working prototype of light node for non-production use

4 participants