Visitar URL original
feat(js): add exact BigInt conversions, toI128LowBits and fromWords by nazarhussain · Pull Request #91 · ChainSafe/zapi · GitHub
Skip to content

feat(js): add exact BigInt conversions, toI128LowBits and fromWords - #91

Merged
GrapeBaBa merged 4 commits into
mainfrom
nh/bigint-exact-variants
Nov 13, 2026
Merged

GrapeBaBa merged 4 commits into
mainfrom
nh/bigint-exact-variants

Conversation

@nazarhussain

Copy link
Copy Markdown
Contributor

Motivation

The fuzz harness in #41 needs exact BigInt conversions and word-level construction. These are the non-breaking parts of #83, so #41 can merge without waiting for the breaking change.

Description

Adds BigInt.toI64Exact/toU64Exact (throw Overflow instead of returning low bits), BigInt.toI128LowBits (BigInt.asIntN(128)) and BigInt.fromWords. It also fixes getValueBigintWords leaving sign_bit unset on overflow, and documents N-API Number conversion semantics. Existing methods are unchanged.

🤖 Generated with Claude Code

nazarhussain and others added 4 commits November 6, 2026 12:40
napi fills the low-order words and the sign even when the BigInt needs
more words than the buffer holds. Setting sign_bit before returning
error.Overflow lets callers catch the error and read the truncated value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BigInt.toI64Exact and BigInt.toU64Exact return error.Overflow when the
value does not fit, instead of the low 64 bits toI64/toU64 return.
BigInt.toI128LowBits returns BigInt.asIntN(128) semantics. Existing
methods are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@matthewkeil matthewkeil moved this from In Progress to Awaiting Author in Lodestar Team Coordination Nov 12, 2026
@GrapeBaBa
GrapeBaBa merged commit b56bf2d into main Nov 13, 2026
5 checks passed
@github-project-automation github-project-automation Bot moved this from Awaiting Author to Done in Lodestar Team Coordination Nov 13, 2026
GrapeBaBa pushed a commit that referenced this pull request Nov 13, 2026
🤖 I have created a release *beep* *boop*
---


##
[4.4.0](zapi-v4.3.0...zapi-v4.4.0)
(2026-11-13)


### Features

* **js:** add exact BigInt conversions, toI128LowBits and fromWords
([#91](#91))
([b56bf2d](b56bf2d))


### Performance Improvements

* use c allocator for shared io
([#92](#92))
([a736d8a](a736d8a))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants