Skip to content

fix(node): accept plain slot hash inputs - #400

Merged
Aursen merged 1 commit into
LiteSVM:masterfrom
xternet:agent/fix-node-slot-hashes
Aug 16, 2026
Merged

fix(node): accept plain slot hash inputs#400
Aursen merged 1 commit into
LiteSVM:masterfrom
xternet:agent/fix-node-slot-hashes

Conversation

@xternet

@xternet xternet commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #178.

TypeScript accepts a structural { slot, hash } value for setSlotHashes, but the native method previously required references to the NAPI SlotHash class. At runtime, a plain object therefore failed with Failed to recover SlotHash type from napi value.

Add a setter-only SlotHashInput NAPI object and accept that input in the native setter. The existing SlotHash NAPI class is deliberately preserved for getter results and runtime compatibility.

Compatibility

  • SlotHash remains an exported runtime class.
  • getSlotHashes() continues to return SlotHash instances.
  • Existing SlotHash instances remain structurally valid setter inputs.
  • Plain { slot, hash } object literals now work as the public TypeScript signature implies.

Regression test

The new test passes an object literal to setSlotHashes, checks the values returned by getSlotHashes, and asserts that the returned value is still instanceof SlotHash.

Validation

  • Full Node test suite — 23 passed
  • yarn build:js
  • yarn lint:js
  • cargo test -p litesvm-node
  • cargo clippy -p litesvm-node --all-targets
  • cargo +nightly fmt --all -- --check
  • git diff --check

@xternet
xternet marked this pull request as ready for review August 13, 2026 19:41
@Aursen

Aursen commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

Thank you for the fix

@Aursen
Aursen merged commit a1637bc into LiteSVM:master Aug 16, 2026
23 checks passed
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.

issue in litesvm, when calling setSlotHashes

2 participants