hardhat icon indicating copy to clipboard operation
hardhat copied to clipboard

Fix hardhat-ledger in some chains

Open daveroga opened this issue 10 months ago • 5 comments

  • [ ] Because this PR includes a bug fix, relevant tests have been included.
  • [ ] Because this PR includes a new feature, the change was previously discussed on an Issue or with someone from the team.
  • [x] I didn't do anything of this.

Fixes issues: #5785 , #5786

After fixing these issues with this code, I'm able to deploy with Ledger to networks that weren't supported before like Polygon zkEVM.

daveroga avatar Feb 24 '25 11:02 daveroga

🦋 Changeset detected

Latest commit: 914178c5333dcebcd541922dc30962f8b5d42a99

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@nomicfoundation/hardhat-ledger Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Feb 24 '25 11:02 changeset-bot[bot]

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hardhat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 10, 2025 9:08pm

vercel[bot] avatar Feb 24 '25 11:02 vercel[bot]

@daveroga We just released a new version of hardhat (2.24.2) which wraps calls to eth_accounts, defaulting to empty array. Would it be possible for you to test with this new version and see if you are still having issues deploying to polygon or zkEVM ?

antico5 avatar Jun 04 '25 12:06 antico5

@daveroga We just released a new version of hardhat (2.24.2) which wraps calls to eth_accounts, defaulting to empty array. Would it be possible for you to test with this new version and see if you are still having issues deploying to polygon or zkEVM ?

@antico5 I tested and seems that issue for eth_accounts is solved but I still have error for only supporting legacy transactions on zkEVM:

ProviderError: RPC error response: only legacy transactions are supported

I solved this issue in my patch by forcing legacy transaction before signing tx in _ethSendTransaction if EIP1559 fields were not present.

   ...

   if (!hasEip1559Fields) {
      baseTx.type = 0; // Legacy transaction type
    }

    const txToSign =
      ethers.Transaction.from(baseTx).unsignedSerialized.substring(2);

  ...

daveroga avatar Jun 05 '25 11:06 daveroga

Thanks @daveroga, you are right #5786 is still an issue. We are looking now at porting the hardhat-ledger plugin to Hardhat 3. That should give us an opportunity to test chains that require legacy transactions and validate your approach.

kanej avatar Jun 05 '25 13:06 kanej

Resolved by #6983

michalbrabec avatar Oct 16 '25 10:10 michalbrabec