Skip to content

graph: replace to_signed_u256 with fallible to_i256#6560

Open
incrypto32 wants to merge 1 commit intomasterfrom
krishna/bigint-conversion-fix
Open

graph: replace to_signed_u256 with fallible to_i256#6560
incrypto32 wants to merge 1 commit intomasterfrom
krishna/bigint-conversion-fix

Conversation

@incrypto32
Copy link
Copy Markdown
Member

to_signed_u256 panicked when given a BigInt outside int256 range. The reachable call sites (declared-call entity triggers in data_source/common.rs, WASM ABI conversion in runtime/wasm) had no protection, so an out-of-range entity value would kill the runner thread instead of failing the deployment cleanly.

Replace it with to_i256 returning Result<I256, _>. Also adds the missing length check in to_unsigned_u256 (same shape of latent panic via ruint for values >= 2^256).

  • New BigInt::to_i256 / BigInt::from_i256 returning I256 directly; old to_signed_u256 / from_signed_u256 removed
  • ? propagation at the two reachable call sites
  • to_unsigned_u256 now errors instead of panicking on out-of-range positives
  • Unit tests covering boundary behavior for both helpers

@incrypto32 incrypto32 force-pushed the krishna/bigint-conversion-fix branch from d2f276b to 280850c Compare May 6, 2026 06:54
to_signed_u256 panicked on values outside the int256 range, killing the
runner thread silently. The replacement to_i256 returns Result and is
plumbed through both reachable call sites (declared-call entity triggers
in data_source/common.rs, WASM ABI conversion in runtime/wasm) via the
existing Deterministic failure path.

to_unsigned_u256 had the symmetric latent panic for values >= 2^256
(via ruint's from_le_slice); add an explicit length check there too.

Removes the redundant U256-as-signed-transport API now that alloy
provides I256 directly.
@incrypto32 incrypto32 force-pushed the krishna/bigint-conversion-fix branch from 280850c to 5bbe22d Compare May 6, 2026 07:34
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