Skip to content

feat(evm): implement AND, OR, XOR, NOT v2 operations with long[] stack#10148

Closed
parthdagia05 wants to merge 1 commit intobesu-eth:mainfrom
parthdagia05:feat/evm-v2-bitwise-ops
Closed

feat(evm): implement AND, OR, XOR, NOT v2 operations with long[] stack#10148
parthdagia05 wants to merge 1 commit intobesu-eth:mainfrom
parthdagia05:feat/evm-v2-bitwise-ops

Conversation

@parthdagia05
Copy link
Copy Markdown

Fixed Issue(s)

Partial fix for #10131

Description

Implements four bitwise EVM v2 operations using the long[] stack representation introduced in #10105:

  • AndOperationV2 (0x16) - bitwise AND across 4 limbs
  • OrOperationV2 (0x17) - bitwise OR across 4 limbs
  • XorOperationV2 (0x18) - bitwise XOR across 4 limbs
  • NotOperationV2 (0x19) - bitwise NOT applied in-place across 4 limbs

All operations are implemented directly on the long[] stack, ensuring zero object allocation and efficient execution.

Motivation

These operations were previously unimplemented for the v2 stack model, limiting the completeness of the long[]-based EVM execution path. This change adds the missing bitwise operations and aligns them with the performance goals of allocation-free, low-level stack manipulation.

Summary

  • Implements AND, OR, XOR, and NOT operations for v2
  • Performs bitwise computation across 4 limbs (256-bit values)
  • Uses in-place operations to avoid intermediate allocations
  • Completes another portion of the long[] stack transition

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

Notes

Part of #10131

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

@siladu Added v2 implementations for AND, OR, XOR, and NOT operations. Ready for review.

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