Skip to content

Conversation

@amkCha
Copy link
Collaborator

@amkCha amkCha commented Oct 27, 2025

Note

Refactors BlockData to an instruction-based design per opcode, introduces BlockDataExoCall for WCP/EUC interactions, updates fork modules, and removes legacy operation classes.

  • Core Blockdata refactor:
    • Replace BlockdataOperation list with Map<Long, List<BlockDataInstruction>> blockInstructions and iterate per-instruction in commit.
    • Track firstBlockNumber, blockNumber, blockTimestamp; compute lineCount from blockInstructions.
    • Add factory getInstruction(...) to build opcode-specific instructions.
  • New instruction classes:
    • Add CoinbaseInstruction, TimestampInstruction, NumberInstruction, DifficultyInstruction, PrevRandaoInstruction, GasLimitInstruction, ChainIdInstruction, BaseFeeInstruction, BlobBaseFeeInstruction with handle/nbRows/traceInstruction and exo-call setups.
    • Introduce shared base BlockDataInstruction handling tracing and per-row fields.
  • Utility:
    • Add BlockDataExoCall to encapsulate WCP/EUC calls and results (callToLT/GT/LEQ/GEQ/IsZero/EUC).
  • Fork module updates:
    • LondonBlockData, ParisBlockData, ShanghaiBlockData, CancunBlockData updated to define opcode sets and implement tracing hooks (timestamp/number or relTxNumMax as applicable).
  • Removals:
    • Delete legacy moduleOperation classes (BlockdataOperation and fork-specific subclasses).

Written by Cursor Bugbot for commit bd1bc31. This will update automatically on new commits. Configure here.

.arg1Lo(arg1B32.hi())
.arg2Hi(arg2B32.lo())
.arg2Lo(arg2B32.hi())
.res(booleanToBytes(wcp.callLT(arg1B32, arg2B32)))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Comparison Methods Return Incorrect Values

The callToGT method calls wcp.callLT instead of wcp.callGT, and callToGEQ calls wcp.callLEQ instead of wcp.callGEQ. This copy-paste error results in both methods returning the opposite boolean value for their intended comparisons.

Additional Locations (1)

Fix in Cursor Fix in Web

.arg1Lo(arg1B32.hi())
.arg2Hi(arg2B32.lo())
.arg2Lo(arg2B32.hi())
.res(booleanToBytes(wcp.callLEQ(arg1B32, arg2B32)))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Incorrect Method Call Causes Comparison Error

The callToGEQ method incorrectly calls wcp.callLEQ instead of wcp.callGEQ. This causes it to perform a less-than-or-equal comparison, returning the opposite boolean result for greater-than-or-equal checks.

Fix in Cursor Fix in Web

exoCalls[0] = BlockDataExoCall.callToLT(this.wcp, data, POWER_256_8);

// row i + 1
exoCalls[1] = BlockDataExoCall.callToLT(this.wcp, data, prevData);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Timestamp Validation Fails for Decreasing Block Times

The TimestampInstruction incorrectly validates block timestamps. It uses callToLT to compare the current timestamp with the previous one. Blockchain timestamps must be strictly increasing, so this allows blocks with decreasing timestamps to be incorrectly validated.

Fix in Cursor Fix in Web


// row i + 1
// comparison to maximum
exoCalls[1] = BlockDataExoCall.callToGEQ(this.wcp, data, gasLimitMaximum);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Gas Limit Validation Logic Inverted

The gas limit maximum validation incorrectly uses callToGEQ instead of callToLEQ. This inverts the logic, causing gas limits that exceed the maximum allowed value to be considered valid.

Fix in Cursor Fix in Web


/** Store all wcp and euc computations with params and results */
// TODO ctMax vs nbRows
public final BlockDataExoCall[] exoCalls = new BlockDataExoCall[nbRows()];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Abstract Method Called Before Subclass Initialization

The exoCalls array is initialized in the BlockDataInstruction constructor by calling the abstract nbRows() method. This means nbRows() executes before any concrete subclass constructor, potentially leading to runtime errors if the subclass implementation relies on uninitialized state.

Fix in Cursor Fix in Web

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.

2 participants