Skip to content

Use value equality for 256-bit zero and -1 checks#1825

Merged
mootz12 merged 1 commit intorelease/v26-previewfrom
improve-256-bit-is-zero-check
Apr 7, 2026
Merged

Use value equality for 256-bit zero and -1 checks#1825
mootz12 merged 1 commit intorelease/v26-previewfrom
improve-256-bit-is-zero-check

Conversation

@mootz12
Copy link
Copy Markdown
Contributor

@mootz12 mootz12 commented Apr 6, 2026

What

Use == for 256-bit zero and -1 checks.

Why

It is possible via the SDK to create object back 256-bit numbers like U256::from_parts(&env, 0, 0, 0, 0). This have a different payload than U256::from_u32(&env, 0).

Known limitations

This is slightly more expensive to do.

@mootz12 mootz12 requested a review from jayz22 April 6, 2026 20:57
@mootz12 mootz12 merged commit cc92a01 into release/v26-preview Apr 7, 2026
195 checks passed
@mootz12 mootz12 deleted the improve-256-bit-is-zero-check branch April 7, 2026 11:54
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