diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index d625984a1..0c33f73e1 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## 0.15.3 - 2024-05-09 + +### Fixed + +- Exclude BNB Chain from zero fee configuration in gas fee logic, thanks @magicsih ([#755](https://github.com/NomicFoundation/hardhat-ignition/pull/755)) + ## 0.15.2 - 2024-05-02 ### Added diff --git a/packages/core/package.json b/packages/core/package.json index 99e8a81ac..666eded7c 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@nomicfoundation/ignition-core", - "version": "0.15.2", + "version": "0.15.3", "license": "MIT", "author": "Nomic Foundation", "homepage": "https://hardhat.org", diff --git a/packages/core/src/internal/execution/jsonrpc-client.ts b/packages/core/src/internal/execution/jsonrpc-client.ts index d5795edb8..8b4b08636 100644 --- a/packages/core/src/internal/execution/jsonrpc-client.ts +++ b/packages/core/src/internal/execution/jsonrpc-client.ts @@ -638,11 +638,14 @@ export class EIP1193JsonRpcClient implements JsonRpcClient { ]); // We prioritize EIP-1559 fees over legacy gasPrice fees, however, - // polygon (chainId 137) requires legacy gasPrice fees so we skip EIP-1559 logic in that case + // polygon (chainId 137) requires legacy gasPrice fees + // so we skip EIP-1559 logic in that case if (latestBlock.baseFeePerGas !== undefined && chainId !== 137) { - if (latestBlock.baseFeePerGas === 0n) { - // Support zero gas fee chains, such as a private instances - // of blockchains using Besu. + // Support zero gas fee chains, such as a private instances + // of blockchains using Besu. We explicitly exclude BNB + // Smartchain (chainId 56) from this logic as it is EIP-1559 + // compliant but only sets a maxPriorityFeePerGas. + if (latestBlock.baseFeePerGas === 0n && chainId !== 56) { return { maxFeePerGas: 0n, maxPriorityFeePerGas: 0n, diff --git a/packages/core/test-integrations/new-api/internal/new-execution/jsonrpc-client.ts b/packages/core/test-integrations/new-api/internal/new-execution/jsonrpc-client.ts index 83d4a19ee..147ebcdd2 100644 --- a/packages/core/test-integrations/new-api/internal/new-execution/jsonrpc-client.ts +++ b/packages/core/test-integrations/new-api/internal/new-execution/jsonrpc-client.ts @@ -185,6 +185,41 @@ describe("JSON-RPC client", function () { }); }); + it("Should not return zero gas fees for BNB Chain even with a zero base fee", async function () { + const bnbClient = new EIP1193JsonRpcClient({ + request: async (req) => { + if (req.method === "eth_chainId") { + return "0x38"; // BNB Chain ID + } + + if (req.method === "eth_getBlockByNumber") { + return { + number: "0x0", + hash: "0x0", + baseFeePerGas: "0x0", // Set the base fee to zero, testing the exception + }; + } + + if (req.method === "eth_gasPrice") { + return "0x1"; + } + + throw new Error(`Unimplemented mock for ${req.method}`); + }, + }); + + const fees = await bnbClient.getNetworkFees(); + + assert.deepStrictEqual( + fees, + { + maxFeePerGas: 1_000_000_000n, + maxPriorityFeePerGas: 1_000_000_000n, + }, + "Both max fee and max priority fee should be 1 gwei, as the base fee is 0 for BNB Chain" + ); + }); + it("Should use the `maxPriorityFeePerGas` from the node if `eth_maxPriorityFeePerGas` is present (and there is no config)", async function () { // TODO: Hardhat does not support `eth_maxPriorityFeePerGas` yet, when it does, this // can be removed. diff --git a/packages/hardhat-plugin-ethers/CHANGELOG.md b/packages/hardhat-plugin-ethers/CHANGELOG.md index 49b80a87b..3453f7098 100644 --- a/packages/hardhat-plugin-ethers/CHANGELOG.md +++ b/packages/hardhat-plugin-ethers/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## 0.15.3 - 2024-05-09 + +### Fixed + +- Exclude BNB Chain from zero fee configuration in gas fee logic, thanks @magicsih ([#755](https://github.com/NomicFoundation/hardhat-ignition/pull/755)) + ## 0.15.2 - 2024-05-02 ### Added diff --git a/packages/hardhat-plugin-ethers/package.json b/packages/hardhat-plugin-ethers/package.json index b15d7ee1e..4f6867b6b 100644 --- a/packages/hardhat-plugin-ethers/package.json +++ b/packages/hardhat-plugin-ethers/package.json @@ -1,6 +1,6 @@ { "name": "@nomicfoundation/hardhat-ignition-ethers", - "version": "0.15.2", + "version": "0.15.3", "license": "MIT", "author": "Nomic Foundation", "homepage": "https://hardhat.org", diff --git a/packages/hardhat-plugin-viem/CHANGELOG.md b/packages/hardhat-plugin-viem/CHANGELOG.md index 9a1ec40de..58d904fc6 100644 --- a/packages/hardhat-plugin-viem/CHANGELOG.md +++ b/packages/hardhat-plugin-viem/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## 0.15.3 - 2024-05-09 + +### Fixed + +- Exclude BNB Chain from zero fee configuration in gas fee logic, thanks @magicsih ([#755](https://github.com/NomicFoundation/hardhat-ignition/pull/755)) + ## 0.15.2 - 2024-05-02 ### Added diff --git a/packages/hardhat-plugin-viem/package.json b/packages/hardhat-plugin-viem/package.json index 9de88d585..1910d6816 100644 --- a/packages/hardhat-plugin-viem/package.json +++ b/packages/hardhat-plugin-viem/package.json @@ -1,6 +1,6 @@ { "name": "@nomicfoundation/hardhat-ignition-viem", - "version": "0.15.2", + "version": "0.15.3", "license": "MIT", "author": "Nomic Foundation", "homepage": "https://hardhat.org", diff --git a/packages/hardhat-plugin/CHANGELOG.md b/packages/hardhat-plugin/CHANGELOG.md index 4c92c2c0d..a5d0b824a 100644 --- a/packages/hardhat-plugin/CHANGELOG.md +++ b/packages/hardhat-plugin/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## 0.15.3 - 2024-05-09 + +### Fixed + +- Exclude BNB Chain from zero fee configuration in gas fee logic, thanks @magicsih ([#755](https://github.com/NomicFoundation/hardhat-ignition/pull/755)) + ## 0.15.2 - 2024-05-02 ### Added diff --git a/packages/hardhat-plugin/package.json b/packages/hardhat-plugin/package.json index 2088f7539..d3c142404 100644 --- a/packages/hardhat-plugin/package.json +++ b/packages/hardhat-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@nomicfoundation/hardhat-ignition", - "version": "0.15.2", + "version": "0.15.3", "license": "MIT", "author": "Nomic Foundation", "homepage": "https://hardhat.org",