Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion core/vm/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,9 @@ func (c *bigModExp) RequiredGas(input []byte) uint64 {
gas.Mul(gas, adjExpLen)
}
// 2. Different divisor (`GQUADDIVISOR`) (3)
gas.Div(gas, big3)
if !c.eip7883 {
gas.Div(gas, big3)
}
Comment on lines 440 to +443
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

The inline comment says the divisor (GQUADDIVISOR) is 3, but with the new conditional the divisor becomes 1 when eip7883 is enabled (division is skipped). Please update the comment (and/or factor the divisor into a named variable) so the documented formula matches the implemented behavior for both modes.

Copilot uses AI. Check for mistakes.
Comment on lines +441 to +443
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

This change only takes effect when c.eip7883 is true. In this repo, eip7883 is currently only enabled in PrecompiledContractsOsaka, while the network constants schedule Cancun but keep Osaka at math.MaxInt64 (unscheduled). If the intent is to fix modexp pricing post-Cancun (per PR title), this condition will never be hit on mainnet/testnet; consider wiring the eip7883 mode to the Cancun (or intended) fork rules instead of Osaka-only.

Copilot uses AI. Check for mistakes.
Comment on lines +441 to +443
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

The PR changes modexp gas accounting, but the existing precompile tests don't assert RequiredGas (they only run with whatever gas RequiredGas returns). Please add/extend unit tests to assert the expected RequiredGas for at least a few representative vectors (e.g., reuse the Gas field already present in core/vm/testdata/precompiles/modexp_eip7883.json) so this repricing can’t regress silently.

Copilot uses AI. Check for mistakes.
if gas.BitLen() > 64 {
return math.MaxUint64
}
Expand Down
Loading