Preserve terminal machine outcomes and prepare complete state proofs - #795
Open
vfusco wants to merge 11 commits into
Open
Preserve terminal machine outcomes and prepare complete state proofs#795vfusco wants to merge 11 commits into
vfusco wants to merge 11 commits into
Conversation
vfusco
requested review from
mpolitzer and
renatomaia
and
a balanced review from Copilot
September 2, 2026 17:18
There was a problem hiding this comment.
🟡 Changes recommended
Existing version-1 databases have no forward migration for the newly required enums, columns, constraints, and triggers.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds durable terminal machine outcomes and complete state proofs across execution, persistence, replay, and APIs.
Changes:
- Generates and persists three-leaf machine-state proofs.
- Stops execution durably after terminal outcomes while retaining L1 observation.
- Updates replay, claims, JSON-RPC, fixtures, and tests.
File summaries
| File | Description |
|---|---|
Makefile |
Builds terminal fixtures |
api/openapi/inspect.yaml |
Documents terminal inspection |
internal/advancer/advancer.go |
Persists terminal execution |
internal/advancer/advancer_test.go |
Tests terminal advancement |
internal/advancer/determinism_test.go |
Tests deterministic proofs |
internal/appstatus/appstatus.go |
Manages terminal statuses |
internal/appstatus/appstatus_test.go |
Tests status transitions |
internal/claimer/accept.go |
Reconciles accepted claims |
internal/claimer/accept_test.go |
Tests claim acceptance |
internal/claimer/blockchain.go |
Updates claim interactions |
internal/claimer/divergence.go |
Handles claim divergence |
internal/claimer/divergence_test.go |
Tests divergence handling |
internal/claimer/fixtures_test.go |
Updates claim fixtures |
internal/claimer/inflight.go |
Updates in-flight claims |
internal/claimer/matchers.go |
Matches renamed proof data |
internal/claimer/mocks_test.go |
Updates claimer mocks |
internal/claimer/repository.go |
Extends repository contract |
internal/claimer/reverts.go |
Updates revert reconciliation |
internal/claimer/stage.go |
Updates claim staging |
internal/claimer/stage_test.go |
Tests staging changes |
internal/claimer/submit.go |
Submits TX-buffer proofs |
internal/claimer/submit_test.go |
Tests claim submission |
internal/evmreader/block_scan_plan.go |
Preserves L1 observation |
internal/evmreader/block_scan_plan_test.go |
Tests scan planning |
internal/evmreader/mocks_test.go |
Updates reader mocks |
internal/evmreader/output.go |
Handles terminal mismatches |
internal/evmreader/output_test.go |
Tests output reconciliation |
internal/evmreader/post_foreclosure_withdrawal.go |
Tracks withdrawal events |
internal/evmreader/post_foreclosure_withdrawal_test.go |
Tests withdrawal tracking |
internal/evmreader/sealedepochs.go |
Continues epoch indexing |
internal/evmreader/sealedepochs_test.go |
Tests terminal indexing |
internal/inspect/hardening_test.go |
Tests inspect hardening |
internal/inspect/inspect.go |
Rejects terminal inspections |
internal/inspect/inspect_test.go |
Tests terminal inspection |
internal/jsonrpc/execution_outcome_contract_test.go |
Tests RPC outcomes |
internal/jsonrpc/jsonrpc-discover.json |
Exposes new fields |
internal/jsonrpc/jsonrpc_test.go |
Updates RPC tests |
internal/jsonrpc/util_test.go |
Updates RPC utilities |
internal/manager/instance.go |
Preserves terminal post-state |
internal/manager/instance_test.go |
Tests machine outcomes |
internal/manager/manager.go |
Filters terminal applications |
internal/manager/manager_test.go |
Tests restart behavior |
internal/manager/types.go |
Extends machine interfaces |
internal/model/application_lifecycle_test.go |
Tests application lifecycle |
internal/model/execution_parameters_test.go |
Tests execution limits |
internal/model/models.go |
Defines statuses and proofs |
internal/model/models_json_test.go |
Tests JSON serialization |
internal/prt/handle_foreclosed_test.go |
Tests foreclosed PRT handling |
internal/prt/prt.go |
Gates terminal PRT work |
internal/prt/validation_test.go |
Updates PRT validation |
internal/replay/compare.go |
Verifies terminal replay |
internal/replay/compare_test.go |
Tests replay comparison |
internal/replay/run.go |
Enforces replay boundaries |
internal/replay/run_test.go |
Tests terminal replay |
internal/repository/postgres/application.go |
Persists application status |
internal/repository/postgres/bulk.go |
Atomically stores outcomes |
internal/repository/postgres/claimer.go |
Updates claim persistence |
internal/repository/postgres/db/rollupsdb/public/enum/applicationstatus.go |
Adds application enums |
internal/repository/postgres/db/rollupsdb/public/enum/inputcompletionstatus.go |
Adds input enums |
internal/repository/postgres/db/rollupsdb/public/table/epoch.go |
Adds epoch proof columns |
internal/repository/postgres/db/rollupsdb/public/table/input.go |
Renames input proof field |
internal/repository/postgres/epoch.go |
Reads and publishes proofs |
internal/repository/postgres/input.go |
Reads terminal input data |
internal/repository/postgres/input_exception_data_test.go |
Tests exception persistence |
internal/repository/postgres/postgres_repo_test.go |
Updates repository tests |
internal/repository/postgres/replay.go |
Supplies replay evidence |
internal/repository/postgres/replay_source_test.go |
Tests replay source |
internal/repository/postgres/schema/migrations/000001_create_initial_schema.up.sql |
Alters initial schema |
internal/repository/repository.go |
Extends repository API |
internal/repository/repotest/application_test_cases.go |
Tests application statuses |
internal/repository/repotest/builders.go |
Builds proof fixtures |
internal/repository/repotest/bulk_test_cases.go |
Tests atomic persistence |
internal/repository/repotest/claimer_test_cases.go |
Updates claimer cases |
internal/repository/repotest/epoch_test_cases.go |
Tests epoch proofs |
internal/repository/repotest/input_test_cases.go |
Tests input outcomes |
internal/repository/repotest/output_test_cases.go |
Updates output cases |
internal/repository/repotest/report_test_cases.go |
Updates report cases |
internal/repository/repotest/repotest.go |
Extends repository suite |
internal/repository/repotest/state_hash_test_cases.go |
Tests state hashes |
internal/validator/validator.go |
Validates TX-buffer roots |
internal/validator/validator_test.go |
Tests complete proofs |
pkg/emulator/emulator.go |
Updates emulator bindings |
pkg/emulator/machine.go |
Exposes memory proofs |
pkg/emulator/remote.go |
Updates remote emulator |
pkg/emulator/types.go |
Adds emulator outcomes |
pkg/machine/backend.go |
Extends backend proofs |
pkg/machine/backend_test.go |
Tests backend changes |
pkg/machine/doc.go |
Updates package documentation |
pkg/machine/implementation.go |
Generates verified proofs |
pkg/machine/implementation_test.go |
Tests proof verification |
pkg/machine/libcartesi.go |
Decodes emulator proofs |
pkg/machine/libcartesi_test.go |
Tests proof decoding |
pkg/machine/machine.go |
Defines terminal outcomes |
pkg/machine/machine_test.go |
Tests machine behavior |
pkg/machine/util_test.go |
Updates test utilities |
test/compose/compose.integration.yaml |
Mounts terminal fixtures |
test/integration/divergent_claim_test.go |
Updates divergence integration |
test/integration/echo_authority_staging_test.go |
Updates authority claims |
test/integration/echo_quorum_test.go |
Updates quorum claims |
test/integration/foreclose_replay_test.go |
Updates replay assertions |
test/integration/lifecycle_test.go |
Tests terminal lifecycle |
test/integration/polling_helpers_test.go |
Adds indexing poller |
test/integration/reject_exception_prt_test.go |
Updates PRT exception flow |
test/integration/reject_exception_test.go |
Updates exception flow |
test/integration/same_block_inputs_test.go |
Uses TX-buffer proofs |
test/integration/terminal_machine_states_test.go |
Tests restart durability |
test/integration/withdrawal_lifecycle_test.go |
Updates settlement proofs |
test/tooling/terminalmachine/main.go |
Generates terminal snapshots |
test/validator/validator_test.go |
Updates validator integration |
Review details
- Files reviewed: 109/109 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Ignore an exact tournament-key replay when shutdown leaves the first insert with an uncertain result. Other constraint conflicts remain errors. Suppress nested PRT error logs only for context cancellation while the service is stopping.
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.
This PR prepares the node for the next contracts update and improves terminal machine handling.
iflags.Y, and HTIFtohost.GUEST_EXCEPTION,MACHINE_HALTED,MCYCLE_OVERFLOW, andUNEXPECTED_YIELDapplication states.This PR does not submit the new proof fields to the current contracts.