Perna/solidity step#390
Draft
mpernambuco wants to merge 27 commits into
Draft
Conversation
added 7 commits
June 16, 2026 11:31
added 20 commits
June 17, 2026 06:17
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
New binary step-log anatomy
A step log is a sparse Merkle witness of a state transition (any number of steps, or a single operation): only the touched parts of the state tree, enough to recompute the root before and after.
p1 = uarch shadow state,p2 = uarch RAMhash_before+hash_after(no data) — witnesses a bulk write. e.g.n1 = cmio rx bufferreset_uarch→ uarch-state subtree (hash_after= pristine);send_cmio_response→ rx-buffer subtreehash_before(+ siblings) → root before; mutated pages + nodes'hash_after(+ siblings) → root afterWire format (header + page/node/sibling entries) is specified in
src/step-log.hpp.Cost of verifying one uarch cycle in Solidity
New binary log vs the old access-log verifier — all uarch cycles of the
rv64ui-uarch-addtest program measured in both formats:Cheaper to run and a third less calldata — cheaper on L1, much more so on L2.
This is one uarch cycle per log. A single log can hold many cycles, which spreads its fixed decode cost across all of them — so per-cycle cost falls as the log grows. The old per-access format can't batch like this.
CLI: cartesi-machine.lua
New / reshaped options that produce binary step logs
--log-step-uarch=<uarch-cycle-count>,<filename>[,pretty[=<out>]]Log
<uarch-cycle-count>microarchitecture cycles to a binary step log (was a single fixed micro-step). Logging stops early at the uarch halt, so a count at or above the per-mcycle budget records one whole mcycle. Append,prettyto also emit a human-readable printout to stderr, or,pretty=<out>to write it to a file.--log-reset-uarch=<filename>Reset the microarchitecture state and write a binary step log.
--log-send-cmio-response=reason:<n>,filename:<path>,(file:<path>|hex:<0x…>|str:<text>)Send a CMIO response into the rx buffer and write a binary step log. Response bytes come from exactly one of
file:/hex:/str:. Expects the machine yielded (iflags.Y == 1); otherwise the logged transition is a no-op.