Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Terminal replay targets cannot be snapshotted, and the maximum input index silently overflows.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Migrates replay and proof generation to the native Go machine stack.
Changes:
- Adds memory-proof support to
machine.Machine. - Replaces external CLI/Lua replay and proof logic with Go APIs.
- Updates builds, mocks, integration tests, and scripts.
| File | Description |
|---|---|
Makefile |
Builds machine-tool with CGO/libcartesi. |
pkg/machine/machine.go |
Exposes GetProof. |
pkg/machine/implementation.go |
Implements memory-proof retrieval. |
pkg/machine/machine_test.go |
Tests proof generation. |
internal/manager/instance_test.go |
Updates machine mock. |
internal/advancer/determinism_test.go |
Updates deterministic runtime mock. |
cmd/cartesi-rollups-machine-tool/main.go |
Moves replay and proof operations into Go. |
cmd/cartesi-rollups-machine-tool/replay_dave.go |
Removes subprocess-based Dave replay. |
cmd/cartesi-rollups-machine-tool/replay_dave.lua |
Removes Lua replay implementation. |
cmd/cartesi-rollups-machine-tool/replay_dave_test.go |
Removes obsolete helper tests. |
scripts/withdrawal-lifecycle |
Uses database-backed replay templates. |
test/integration/withdrawal_lifecycle_test.go |
Updates machine-tool invocation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Replace the Lua Dave replay and the cartesi-machine CLI invocations with the in-process machine stack. replay now drives a manager.MachineInstance through internal/replay.Run (per-input verification against persisted canonical evidence), stores with CreateSnapshot, and reads the root in-memory; prove accounts-drive loads the stored machine with machine.Load and builds the proof with the new machine.Machine.GetProof. Expose GetProof on the machine interface with the implementation and the test-mock stubs. Drop the --template (template now comes from the DB and is hash-verified), --lua, --cartesi-sdk-root, and --cartesi-machine flags, and delete replay_dave.lua with its Go plumbing. Build cartesi-rollups-machine-tool with CGO and the libcartesi rpath like the other machine-linked artifacts, and update the withdrawal-lifecycle script and integration test for the flag removal.
mpolitzer
force-pushed
the
feature/ew-with-replay-api
branch
from
September 22, 2026 10:47
73933bb to
6e38d7b
Compare
A replay whose target is the application's terminal input ends in a terminal machine state that CreateSnapshot and Hash cannot read — MachineInstanceImpl disposes the runtime on terminal completion — so the store step failed with an opaque ErrMachineClosed only after a full replay. Check the last processed input's persisted status before creating the machine instance. If it is terminal and the requested range reaches it, fail fast and hint at replaying up to the preceding input. replay.Run's contradiction check remains the backstop for a terminal input that is not the application's last. Drop the HasRuntime method (MachineInstanceImpl, the MachineInstance interface, and the test mocks) that the previous after-the-fact check used.
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Native machine replay and proof generation span database state, emulator behavior, and contract-facing proofs, requiring final human and CI validation.
Review effort: Balanced
Findings: None
Resolved since last review (2)
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.


No description provided.