Skip to content

feat: implement AddOperationV2 with long[] carry-propagated addition#10143

Closed
parthdagia05 wants to merge 3 commits intobesu-eth:mainfrom
parthdagia05:feat/evm-v2-add-operation
Closed

feat: implement AddOperationV2 with long[] carry-propagated addition#10143
parthdagia05 wants to merge 3 commits intobesu-eth:mainfrom
parthdagia05:feat/evm-v2-add-operation

Conversation

@parthdagia05
Copy link
Copy Markdown

@parthdagia05 parthdagia05 commented Mar 31, 2026

Fixed Issue(s)

Partial fix for #10131

Description

Implements AddOperationV2.staticOperation() that was stubbed in #10105. Performs 256-bit addition directly on the long[] stack with carry propagation across 4 limbs. Zero object allocation per operation.

Motivation

The previous implementation was a stub that threw UnsupportedOperationException, preventing execution paths from using this operation. This change enables efficient 256-bit addition aligned with EVM design goals of low-level, allocation-free execution.

Summary

  • Implements AddOperationV2.staticOperation()
  • Adds 256-bit addition using long[] with carry propagation across 4 limbs
  • Eliminates object allocation by operating directly on primitive arrays
  • Replaces stub implementation with a fully functional operation

Checklist

  • Considered documentation - no doc changes required (internal EVM change behind experimental flag)
  • Considered the changelog - no changelog update required (experimental feature)
  • No database changes

Tests run locally

  • spotless: ./gradlew spotlessApply
  • compile: ./gradlew :evm:compileJava
  • unit tests: ./gradlew :evm:test

Notes

Part of #10131

Signed-off-by: Parth Dagia <parth.24bcs10414@sst.scaler.com>
@parthdagia05
Copy link
Copy Markdown
Author

@siladu can you review this PR

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.

Why is this deleted?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The file MulOperationOptimized.java has a trailing space in its filename . On Windows, git can't checkout files with trailing spaces, so it was automatically marked as deleted and got included in my commit unintentionally. I've restored it in the latest push. The trailing space in the upstream filename may need to be fixed separately to avoid this issue for other Windows contributors.

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.

Thanks fixing in #10147

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.

Actually, I already fixed that in #10030

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I've addressed the requested changes, Please take another look.

Copy link
Copy Markdown
Author

@parthdagia05 parthdagia05 Apr 2, 2026

Choose a reason for hiding this comment

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

Actually, I already fixed that in #10030

Rebased onto latest main which includes #10030 the MulOperationOptimized deletion is no longer in my changes. Could you review the PR

…s trailing-space limitation

Signed-off-by: Parth Dagia <parth.24bcs10414@sst.scaler.com>
@siladu
Copy link
Copy Markdown
Contributor

siladu commented Apr 15, 2026

Closing as discussed

@siladu siladu closed this Apr 15, 2026
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