Fix modern build and automated npm publishing - #50
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR modernizes the Rust/Wasm build for evmdecoder, updates the JS/TS bridge to rely on stable wasm-bindgen exports, and introduces an automated npm publish workflow for releases from main.
Changes:
- Updates the
wasm/ethabiRust/Wasm toolchain and serialization approach (moves offwasm-bindgen’s deprecated serde integration toserde-wasm-bindgen). - Replaces the internal generated
*_bgmemory import with an explicit exportedwasm_memory()accessor and updates TS imports to the newwasm-pkgoutput directory. - Adds a GitHub Actions workflow to publish to npm on
mainand adjusts packaging to exclude Rust build artifacts while including the generated Wasm runtime.
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
wasm/ethabi/src/lib.rs |
Switches JS serialization to serde-wasm-bindgen and exports wasm_memory() for stable memory access. |
wasm/ethabi/Cargo.toml |
Updates serde deps and adds serde-wasm-bindgen; removes obsolete wasm-bindgen serde feature and wasm test dep. |
wasm/ethabi/Cargo.lock |
Refreshes lockfile for updated wasm-bindgen/serde dependency graph. |
wasm/ethabi/alt-package.json |
Updates wasm package file list to match new wasm-pack outputs (drops generated _bg.js). |
src/abi/wasm.ts |
Imports from new wasm-pkg location and uses wasm_memory() instead of _bg internal import. |
rust-toolchain.toml |
Pins Rust toolchain and wasm target for reproducible builds. |
package.json |
Bumps version to 0.0.72, adjusts repository metadata, and packages wasm-pkg while updating build scripts. |
.gitignore |
Ignores generated /wasm-pkg directory. |
.github/workflows/publish.yml |
Adds a publish-on-main workflow with version gate and provenance publishing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root cause
The Rust lockfile pinned wasm-bindgen 0.2.58, which current Rust rejects because versions older than 0.2.88 are incompatible. Updating wasm-bindgen also removed the generated *_bg.js module that the TypeScript bridge imported directly.
The prior npm files configuration included the entire wasm directory, so the tarball contained the Rust target tree and host-specific build products.
Impact
The package now builds on Apple Silicon with Node 22 and Rust 1.91.1, generates a portable Node.js Wasm runtime, and publishes a small reproducible npm package through GitHub Actions. The workflow fails clearly when package.json has not been bumped to an unpublished version.
Validation