Skip to content

Conversation

@jialinli98
Copy link
Collaborator

@jialinli98 jialinli98 commented Dec 15, 2025

Description

Use u256 from Bignum and remove customized u256 implementation.
Added overflow checks for addition manually.

Problem*

closes #2

Summary*

Additional Context

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

Comment on lines 22 to 28
pub fn from_field(field: Field) -> u256 {
let bytes = field.to_be_bytes::<32>();
let mut bytes33 = [0; 33];
for i in 0..32 {
bytes33[i + 1] = bytes[i];
}
u256::from_be_bytes(bytes33)
Copy link
Member

Choose a reason for hiding this comment

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

bignum should expose a method like this already afaik.

Base automatically changed from jl/compile_vlayer to main December 19, 2025 16:54
@TomAFrench TomAFrench merged commit 0a78877 into main Jan 7, 2026
9 checks passed
@TomAFrench TomAFrench deleted the jl/u256_bignum branch January 7, 2026 16:52
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.

Replace the custom U256 impl with u256 from Bignum

3 participants