Skip to content

fix: execution from non-zero instret#2155

Merged
jonathanpwang merged 2 commits into
mainfrom
fix/execution-ctx-instret-end
Oct 7, 2025
Merged

fix: execution from non-zero instret#2155
jonathanpwang merged 2 commits into
mainfrom
fix/execution-ctx-instret-end

Conversation

@jonathanpwang

Copy link
Copy Markdown
Contributor

InterpretedInstance::execute_from_state for pure execution was using num_insns instead of instret_end in the ExecutionCtx constructor. This was not caught because we currently only ever execute from instret=0.

@jonathanpwang jonathanpwang requested review from Copilot, nyunyunyunyu and shuklaayush and removed request for Copilot October 7, 2025 07:22
Comment thread crates/vm/src/arch/interpreter.rs Outdated
@github-actions

This comment has been minimized.

Copilot AI review requested due to automatic review settings October 7, 2025 07:31

Copilot AI 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.

Pull Request Overview

This PR fixes a bug in the execution context initialization where num_insns was incorrectly used instead of instret_end when executing from a non-zero instruction counter state.

  • Properly calculates instret_end by adding num_insns to the current instret value
  • Adds overflow protection with a new InstretOverflow error variant
  • Moves instret retrieval to occur before execution context creation

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
crates/vm/src/arch/interpreter.rs Fixes execution context initialization to use calculated instret_end instead of raw num_insns
crates/vm/src/arch/execution.rs Adds new InstretOverflow error variant for handling instruction counter overflow

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions

github-actions Bot commented Oct 7, 2025

Copy link
Copy Markdown
group app.proof_time_ms app.cycles app.cells_used leaf.proof_time_ms leaf.cycles leaf.cells_used
verify_fibair (+4 [+1.8%]) 231 322,610 2,058,654 - - -
fibonacci 1,024 1,500,209 2,100,402 - - -
regex (-24 [-1.0%]) 2,359 4,137,372 17,759,394 - - -
ecrecover (+8 [+1.2%]) 702 122,859 2,262,718 - - -
pairing (+8 [+0.6%]) 1,450 1,745,742 25,468,210 - - -

Commit: 2e0c069

Benchmark Workflow

@shuklaayush shuklaayush 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.

lgtm. good catch

@jonathanpwang jonathanpwang merged commit b804923 into main Oct 7, 2025
44 checks passed
@jonathanpwang jonathanpwang deleted the fix/execution-ctx-instret-end branch October 7, 2025 17:39
jonathanpwang added a commit that referenced this pull request Oct 10, 2025
Adds `AsyncAppProver` which executes metered serially and then
re-executes while spawning prover tasks for each continuation segment.
The prover tasks use a semaphore to limit the max concurrency.

Note this PR includes the fix
#2155

---------

Co-authored-by: Ayush Shukla <ayush@axiom.xyz>
Maillew pushed a commit that referenced this pull request Oct 22, 2025
`InterpretedInstance::execute_from_state` for pure execution was using
`num_insns` instead of `instret_end` in the `ExecutionCtx` constructor.
This was not caught because we currently only ever execute from
`instret=0`.
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.

4 participants