Skip to content

Lower full-width modular arithmetic for native execution - #1568

Merged
sbillig merged 1 commit into
masterfrom
fevm-pr-native-modular
Sep 24, 2026
Merged

sbillig merged 1 commit into
masterfrom
fevm-pr-native-modular

Conversation

@sbillig

@sbillig sbillig commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Native addmod and mulmod must preserve the mathematical sum or product when a 256-bit intermediate would overflow. Reduce the operands first, use carry-safe modular addition, and implement multiplication with a bounded shift-and-add loop that keeps its accumulator below the modulus.

A zero modulus returns zero. The native implementation uses ordinary 256-bit integer operations; EVM lowering continues to emit the dedicated opcodes.

Depends on #1566; stacked on fevm-pr-native-process.

@sbillig
sbillig marked this pull request as ready for review September 22, 2026 07:06
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-23T21:42:55.812098Z 11821f5 New commits
🔒 Security Review ✅ Completed 2026-09-23T21:46:14.890390Z 11821f5 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sbillig
sbillig added this pull request to stack #1577 September 22, 2026 20:12
@sbillig
sbillig removed this pull request from stack #1577 September 22, 2026 20:37
@sbillig
sbillig added this pull request to stack #1578 September 22, 2026 20:38
@sbillig
sbillig force-pushed the fevm-pr-native-modular branch from 0c89e8f to b631b6d Compare September 22, 2026 23:12
@sbillig
sbillig removed this pull request from stack #1578 September 23, 2026 04:48
@sbillig
sbillig added this pull request to stack #1583 September 23, 2026 04:49
@sbillig
sbillig removed this pull request from stack #1583 September 23, 2026 04:53
@sbillig
sbillig added this pull request to stack #1584 September 23, 2026 04:54
@sbillig
sbillig removed this pull request from stack #1584 September 23, 2026 06:26
@sbillig
sbillig force-pushed the fevm-pr-native-modular branch from b631b6d to 7d4bfa0 Compare September 23, 2026 06:27
@sbillig
sbillig added this pull request to stack #1588 September 23, 2026 06:28
@sbillig
sbillig force-pushed the fevm-pr-native-modular branch from 7d4bfa0 to 43fc878 Compare September 23, 2026 20:45
Base automatically changed from fevm-pr-native-process to master September 23, 2026 21:40
@sbillig
sbillig force-pushed the fevm-pr-native-modular branch from 43fc878 to 11821f5 Compare September 23, 2026 21:40
@sbillig
sbillig merged commit f00132a into master Sep 24, 2026
9 checks passed
@sbillig
sbillig deleted the fevm-pr-native-modular branch September 24, 2026 03:32
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.

1 participant