Skip to content

feat(contracts): add pnpm-based precompile package build - #1240

Open
nowooj wants to merge 7 commits into
cosmos:mainfrom
nowooj:feat/contracts-package
Open

feat(contracts): add pnpm-based precompile package build#1240
nowooj wants to merge 7 commits into
cosmos:mainfrom
nowooj:feat/contracts-package

Conversation

@nowooj

@nowooj nowooj commented Jul 23, 2026

Copy link
Copy Markdown

Description

Closes: #428

This PR supersedes the original implementation in #1021, which was closed by the stale workflow. The branch has since been rebased onto the latest main, updated, and reorganized into reviewable commits.

Summary

This PR migrates the repository's Solidity tooling from npm to pnpm and adds a publishable cosmos-evm-contracts package containing:

  • Solidity precompile interfaces
  • Typed ABI modules for ESM and CommonJS
  • TypeScript declaration files

It also keeps make contracts-compile and make test-solidity working under Node.js 22, pnpm 11, and Hardhat 2.

Changes

pnpm migration

  • Replace npm lockfiles with pnpm lockfiles across contracts, Solidity tests, and compatibility projects.
  • Update CI and setup scripts to use Node.js 22 and pnpm 11.
  • Keep the exact local package-manager version in packageManager, while CI installs pnpm by major version.
  • Keep Hardhat on version 2 and use hardhat.config.cjs for the ESM contracts package.
  • Remove the remaining package-lock.json files.

Precompile ABI generation

  • Preserve precompiles/*/abi.json as ABI arrays rather than copying the complete Hardhat artifact.
  • Always overwrite ABI files during contract compilation so generated output remains deterministic.
  • Add regression coverage for ABI extraction and invalid artifacts.

Contracts package build

  • Generate typed ABI sources from Hardhat artifacts with Wagmi.
  • Build ESM, CommonJS, and .d.ts outputs with tsdown.
  • Include publishable Solidity interfaces while excluding testdata and testutil.
  • Clean generated directories before every package build.
  • Document package installation and Solidity/TypeScript import paths.

The generated package contains:

  • 12 ESM ABI modules
  • 12 CommonJS ABI modules
  • 12 TypeScript declaration files
  • 13 Solidity interface files

How to verify

# ABI generation and compilation regression tests
python3 -m pytest -q scripts/compile_smart_contracts/test_compile_smart_contracts.py

# Compile all Solidity contracts
make contracts-compile

# Build publishable precompile bindings
cd contracts
pnpm install --frozen-lockfile
pnpm run build:precompiles
cd ..

# Run the full Solidity test suite
make test-solidity

———

Author Checklist

I have...

  • tackled an existing issue or discussed with a team member
  • left instructions on how to review the changes
  • targeted the main branch

@nowooj
nowooj requested a review from a team as a code owner July 23, 2026 08:16
@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

PR author is not in the allowed authors list.

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.

Declare the common Types.sol as a library.

1 participant