-
Notifications
You must be signed in to change notification settings - Fork 42
[docs] mem continuation check #1323
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| # Memory Continuation Checks | ||
|
|
||
| When execution is split into multiple shards, Ceno must check not only | ||
| that control flow continues correctly, but also that the dynamic memory | ||
| regions exposed through public values remain consistent across shard | ||
| boundaries. | ||
|
|
||
| The two dynamic regions are: | ||
|
|
||
| - **Heap** | ||
| - **Hints** | ||
|
|
||
| Each shard exposes the start address and length of its current heap and | ||
| hint segment. The verifier then checks that these segments form one | ||
| continuous sequence over the full trace. | ||
|
|
||
| <p align="center"> | ||
|
|
||
| ```text | ||
| heap / hint address space | ||
|
|
||
| shard 0 shard 1 shard 2 | ||
| ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ | ||
| │ start = s0 │ │ start = e0 │ │ start = e1 │ | ||
| │ len = l0 │ │ len = l1 │ │ len = l2 │ | ||
| │ end = e0 │───▶│ end = e1 │───▶│ end = e2 │ | ||
| └──────────────┘ └──────────────┘ └──────────────┘ | ||
|
|
||
| Requirements: | ||
| - every start/end stays inside the allowed platform range | ||
| - next shard starts exactly at previous shard end | ||
| - proof table length matches the public length | ||
| ``` | ||
|
|
||
| </p> | ||
|
|
||
| ## What Is Being Checked | ||
|
|
||
| For both heap and hints, full-trace verification enforces: | ||
|
|
||
| - **Range correctness**: each shard's start and end must stay inside the | ||
| configured memory window | ||
| - **Continuation**: shard `i + 1` must start exactly where shard `i` | ||
| ended | ||
| - **Length consistency**: the dynamic init table proved inside the shard | ||
| must have the same length as the public value | ||
|
|
||
| These checks rule out three classes of errors: | ||
|
|
||
| - a shard claiming memory outside the allowed heap or hint range | ||
| - a gap or overlap between consecutive shards | ||
| - a mismatch between the public memory length and the table actually | ||
| proved | ||
|
|
||
| ## How This Fits with the Other Memory Checks | ||
|
|
||
| These continuation checks are different from the cross-shard RAM | ||
| consistency check. | ||
|
|
||
| - **RAM consistency** checks that reads and writes across shards compose | ||
| to one valid memory history | ||
| - **Memory continuation** checks that the dynamic heap and hint segments | ||
| themselves are chained correctly from shard to shard | ||
|
|
||
| Both are needed: | ||
|
|
||
| - RAM consistency protects the memory contents | ||
| - continuation checks protect the public memory layout | ||
|
|
||
| ## Full-Trace vs Single-Shard Verification | ||
|
|
||
| Continuation is a **full-trace** property. | ||
|
|
||
| - In full-trace verification, heap and hint segments are chained across | ||
| all shards | ||
| - In single-shard debug verification, Ceno only checks that the selected | ||
| shard is internally valid; it does not claim that the shard forms a | ||
| complete continuation of the whole execution | ||
|
|
||
| ## Where This Lives in the System | ||
|
|
||
| - the platform defines the allowed heap and hint ranges | ||
| - the native verifier checks shard-by-shard continuation | ||
| - the recursion verifier enforces the same bounds in aggregation | ||
|
|
||
| This keeps the memory-state invariant aligned across both native and | ||
| recursive verification. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot does this doc implies the main intuition/idea that heap/init does not need to initialized in the first shard? We can load it until it's first accessed. Then we have to require that not a single address are being initialized twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes—that is the intended model. I updated the doc to state lazy dynamic init explicitly: early shards can have zero-length heap/hint segments until first access, and continuation is append-only/non-overlapping so an address cannot be initialized twice across shards. Fixed in
fc8fc48.