fix: use getAddress() throughout tests for ethers v6 compatibility - #6
fix: use getAddress() throughout tests for ethers v6 compatibility#6creatingfire2026 with Copilot wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the ERC20 token test suite to be compatible with ethers v6 / Hardhat signer behavior by avoiding direct .address property access and using await signer.getAddress() instead, preventing null addresses from breaking event argument assertions.
Changes:
- Replaced direct signer
.addressusages withawait signer.getAddress()across deployment, transfer, allowance, and burn-related tests. - Updated event
.withArgs()expectations and balance/allowance checks to use resolved address strings.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| it("reverts for an insufficient balance", async function () { | ||
| const aliceAddr = await alice.getAddress(); | ||
| const bobAddr = await bob.getAddress(); |
|
The test file changes look good — all The "action_required" status on this PR branch is a GitHub Actions workflow approval issue, not a code problem. A repo admin can approve the workflow run in the Actions tab to get the green check on this PR. |
Summary
Fixes the failing "Hardhat Test / test" GitHub Actions check by replacing all direct
.addressproperty accesses on ethers.js signer objects withawait signer.getAddress()calls.Root Cause
The test file was using
signer.addressdirectly (e.g.recipient.address,alice.address). In ethers v6, this can returnnullin certain Hardhat test contexts, causing theInvalidArgumentsError: invalid type: null, expected 32 byteserror when those values were passed to.withArgs()event expectations.Changes
test/ERC20_Token_Sample.test.js— replaced all 19 instances ofsigner.addresswithawait signer.getAddress():await recipient.getAddress()getAddress()for deployer and recipientgetAddress()for recipient and alice in transfer and.withArgs()callsgetAddress()for recipient, alice, and bobgetAddress()for recipient in event assertions and balance checksgetAddress()for alice and bob in beforeEach, assertions, and event checksValidation required before merge
npm run compilenpm testpasses in CI