Conversation
constwz
pushed a commit
that referenced
this pull request
Sep 26, 2025
* feat: add handle for fail in middle of superinstruction opcode * feat: modify block terminator and fallthrough * Revert "feat: modify block terminator and fallthrough" This reverts commit 1ddb74f. * fix: mem last gas cost bug --------- Co-authored-by: cbh876 <3930922419@qq.com>
constwz
pushed a commit
that referenced
this pull request
Oct 11, 2025
* feat: add handle for fail in middle of superinstruction opcode * feat: modify block terminator and fallthrough * Revert "feat: modify block terminator and fallthrough" This reverts commit 1ddb74f. * fix: mem last gas cost bug --------- Co-authored-by: cbh876 <3930922419@qq.com>
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.
Description
patch for BSC superinstruction
Rationale
There might be an edge case when Run() encounters error during superinstruction execution. This pr handle that case.
Example
Path 1: Direct Super-instruction Execution
When executing the super-instruction directly and encountering insufficient gas
Result: Immediate ErrOutOfGas return
Final state:
pc = super-instruction start address
gas consumed = total gas cost of the super-instruction
remaining gas = original gas (no deduction since execution failed)
Path 2: Fallback to Regular Opcode Execution
When falling back to execute the 5 individual opcodes sequentially
Execution flow:
Opcode 1: executes successfully, gas deducted, pc advances
Opcode 2: executes successfully, gas deducted, pc advances
Opcode 3: encounters insufficient gas, execution fails
Final state:
pc = start address of the 3rd opcode
gas consumed = sum of gas costs for opcodes 1, 2, and 3
remaining gas = original gas - consumed gas
The above will result in diverge of gas and pc state at return. This pr will break down path 1 to path 2 at gas caused errors.
Changes
Notable changes: