Skip to content

Pilot: harden ERC-20 project – reproducible build, expanded tests, CI scanning, deployment docs - #12

Open
creatingfire2026 with Copilot wants to merge 10 commits into
mainfrom
copilot/hardening-erc20-project
Open

creatingfire2026 with Copilot wants to merge 10 commits into
mainfrom
copilot/hardening-erc20-project

Conversation

Copilot AI commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Addresses the safe engineering pilot requirements for Cf-: reproducible install, full test hardening, non-deploying CI validation, dependency/secret scanning, and deployment risk documentation. No production deployment, no mainnet interaction, PR #4 excluded throughout.

Changes

Build / install

  • Downgraded Hardhat v3 → v2 (2.29.1); v3 requires ESM and cannot resolve the Solidity compiler CDN in restricted environments
  • Installed @nomicfoundation/hardhat-ethers@hh2 and hardhat-chai-matchers@hh2; added solc@0.8.26 and solidity-coverage as devDependencies
  • Added an offline-compiler fallback subtask in hardhat.config.js that catches CDN failures and uses the bundled solc package:
subtask(TASK_COMPILE_SOLIDITY_GET_SOLC_BUILD, async (args, hre, runSuper) => {
  try {
    return await runSuper(args);
  } catch (_e) {
    const solcPath = require.resolve("solc/soljson");
    const solc = require("solc");
    const longVersion = solc.version().replace(".Emscripten.clang", "");
    return { version: longVersion.split("+")[0], longVersion, compilerPath: solcPath, isSolcJs: true };
  }
});

Tests (test/ERC20_Token_Sample.invariants.test.js)

21 new tests across five categories (46 total, 100% coverage):

  • Supply conservation – transfer sequences, multi-burn, raw ERC20Burnable.burn() path
  • Allowance consumption – partial/exact burnFrom, approve overwrite, partial transferFrom
  • Zero-value rejection – ZeroBurnAmount on both burnTokens(0) and burnFrom(…, 0)
  • Authorization – ERC20InsufficientAllowance on burnFrom/transferFrom without approval
  • Burn consistency – dual-event emission; confirms raw burn() does not emit TokensBurned

CI (.github/workflows/test.yml)

Replaced single-step workflow with three jobs — no deployment step anywhere:

Job What it runs
Compile · Test · Lint · Coverage hardhat compile/test, solhint, hardhat coverage
Dependency Scan npm audit --audit-level=critical
Secret Scan gitleaks/gitleaks-action@v2

Documentation (DEPLOYMENT.md)

New file covering: install prerequisites, pre-deployment checklist, mainnet gate requirements, recipient-wallet controls (multi-sig recommendation), Etherscan verification steps, rollback limitations (contract is fully immutable), and a risk register (R-1–R-7) including the duplicate burn interface question and the known high-severity advisories in Hardhat v2's transitive undici dependency.

Co-authored-by: creatingfire2026 <277700495+creatingfire2026@users.noreply.github.com>
@creatingfire2026
creatingfire2026 marked this pull request as ready for review August 23, 2026 08:14
Copilot AI lite review requested due to automatic review settings August 23, 2026 08:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Enabling ESM at the package level currently breaks existing CommonJS .js entry points (Hardhat config/tests/scripts) unless they’re also migrated or renamed to .cjs.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates the project’s Node module mode to ESM by setting the package-level module type, which is a prerequisite for ESM-compatible Hardhat configuration/tests in an ERC-20 project setup.

Changes:

  • Set "type": "module" in package.json to opt the repo into ESM semantics for .js files.
File summaries
File Description
package.json Enables ESM mode at the package level via "type": "module".
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread package.json Outdated
Comment on lines +21 to +24
"dependencies": {
"@openzeppelin/contracts": "^5.0.0"
}
},
"type": "module"
Copilot AI and others added 2 commits August 23, 2026 08:18
- Downgrade hardhat to v2 (ESM not needed), install compatible
  @nomicfoundation/hardhat-ethers@hh2 and hardhat-chai-matchers@hh2
- Add solc@0.8.26 and solidity-coverage as devDependencies
- Add offline-compiler fallback in hardhat.config.js (bundles solc when
  binaries.soliditylang.org is unreachable)
- Expand CI workflow: lint (solhint), coverage, npm audit, gitleaks scan
- Add invariant/property/negative tests (21 new tests, 46 total, 100% coverage)
- Add DEPLOYMENT.md: prerequisites, recipient-wallet controls, verification,
  rollback limitations, and unresolved risks (no deployment performed)

Co-authored-by: creatingfire2026 <277700495+creatingfire2026@users.noreply.github.com>
Co-authored-by: creatingfire2026 <277700495+creatingfire2026@users.noreply.github.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d3489bac56

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread package.json Outdated
Copilot AI changed the title [WIP] Establish clean install for ERC-20 project without PR #4 Pilot: harden ERC-20 project – reproducible build, expanded tests, CI scanning, deployment docs Aug 23, 2026
Copilot AI requested a review from creatingfire2026 August 23, 2026 08:22
@creatingfire2026

Copy link
Copy Markdown
Owner

Git-town

Co-authored-by: creatingfire2026 <277700495+creatingfire2026@users.noreply.github.com>
Copilot AI and others added 3 commits September 12, 2026 03:42
Co-authored-by: creatingfire2026 <277700495+creatingfire2026@users.noreply.github.com>
Co-authored-by: creatingfire2026 <277700495+creatingfire2026@users.noreply.github.com>
Co-authored-by: creatingfire2026 <277700495+creatingfire2026@users.noreply.github.com>
Copilot AI and others added 2 commits September 12, 2026 03:47
Co-authored-by: creatingfire2026 <277700495+creatingfire2026@users.noreply.github.com>
Co-authored-by: creatingfire2026 <277700495+creatingfire2026@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

None yet

Development

Successfully merging this pull request may close these issues.

Pilot: harden ERC-20 project without PR #4 or production deployment

3 participants