-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exclude BNB Chain from zero fee configuration in gas fee logic #755
Conversation
This commit updates the gas fee configuration logic to accommodate the BNB Chain (chainId 56). While the BNB Network supports EIP-1559, it reports a `baseFeePerGas` of zero. This adjustment ensures that transactions on the BNB Chain do not mistakenly receive a max fee configuration of zero, which is not appropriate despite the reported base fee. This change maintains the functionality for other chains such as Polygon (chainId 137) that require legacy gasPrice fees, and excludes only BNB Chain from the zero max fee logic. This is crucial for proper transaction fee handling on networks supporting EIP-1559 but reporting a base fee of zero.
Thanks @magicsih, could you add a test based on this example: hardhat-ignition/packages/core/test-integrations/new-api/internal/new-execution/jsonrpc-client.ts Line 157 in d748a7d
|
@@ -640,7 +640,7 @@ 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 | |||
if (latestBlock.baseFeePerGas !== undefined && chainId !== 137) { | |||
if (latestBlock.baseFeePerGas === 0n) { | |||
if (latestBlock.baseFeePerGas === 0n && chainId != 56) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (latestBlock.baseFeePerGas === 0n && chainId != 56) { | |
if (latestBlock.baseFeePerGas === 0n && chainId !== 56) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will satisfy our eslint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for letting me know. I should have read contribution guide carefully. Today was the contract deployment day. We handled this problem with downgrading version to v0.15.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you been able to test the change with a deployment against BNB?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. by modifying the line, I confirmed that BNB distribution was successful.
this was original stacktrace.
√ Confirm deploy to network bnb (56)? ... yes
Hardhat Ignition 🚀
Deploying [ TestTokenModule ]
Batch #1
Executing TestTokenModule#TestToken...
An unexpected error occurred:
ProviderError: transaction underpriced: tip needed 1000000000, tip permitted 0
at HttpProvider.request (node_modules\hardhat\src\internal\core\providers\http.ts:90:21)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async EIP1193JsonRpcClient.sendTransaction (node_modules\@nomicfoundation\ignition-core\src\internal\execution\jsonrpc-client.ts:418:24)
at async sendTransactionForOnchainInteraction (node_modules\@nomicfoundation\ignition-core\src\internal\execution\future-processor\helpers\network-interaction-execution.ts:181:18)
at async sendTransaction (node_modules\@nomicfoundation\ignition-core\src\internal\execution\future-processor\handlers\send-transaction.ts:86:18)
at async FutureProcessor.processFuture (node_modules\@nomicfoundation\ignition-core\src\internal\execution\future-processor\future-processor.ts:114:9)
at async ExecutionEngine._executeBatch (node_modules\@nomicfoundation\ignition-core\src\internal\execution\execution-engine.ts:153:30)
at async ExecutionEngine.executeModule (node_modules\@nomicfoundation\ignition-core\src\internal\execution\execution-engine.ts:114:25)
at async Deployer.deploy (node_modules\@nomicfoundation\ignition-core\src\internal\deployer.ts:194:25)
at async SimpleTaskDefinition.action (node_modules\@nomicfoundation\hardhat-ignition\src\index.ts:302:24)
after the change
√ Confirm deploy to network bnb (56)? ... yes
Hardhat Ignition 🚀
Resuming existing deployment from .\ignition\deployments\chain-56
Deploying [ TestTokenModule ]
Batch #1
Executed TestTokenModule#TestToken
Batch #2
Executed TestTokenModule#TestToken.mint
[ TestTokenModule ] successfully deployed 🚀
Deployed Addresses
TestTokenModule#TestToken - (hide)
in gas fee logic This commit updates the gas fee configuration logic to accommodate the BNB Chain (chainId 56). While the BNB Network supports EIP-1559, it reports a `baseFeePerGas` of zero. This adjustment ensures that transactions on the BNB Chain do not mistakenly receive a max fee configuration of zero, which is not appropriate despite the reported base fee. This change maintains the functionality for other chains such as Polygon (chainId 137) that require legacy gasPrice fees, and excludes only BNB Chain from the zero max fee logic. This is crucial for proper transaction fee handling on networks supporting EIP-1559 but reporting a base fee of zero.
Correct the indentation in the test files to resolve linting errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks @magicsih
* fix: Exclude BNB Chain from zero fee configuration in gas fee logic This commit updates the gas fee configuration logic to accommodate the BNB Chain (chainId 56). While the BNB Network supports EIP-1559, it reports a `baseFeePerGas` of zero. This adjustment ensures that transactions on the BNB Chain do not mistakenly receive a max fee configuration of zero, which is not appropriate despite the reported base fee. This change maintains the functionality for other chains such as Polygon (chainId 137) that require legacy gasPrice fees, and excludes only BNB Chain from the zero max fee logic. This is crucial for proper transaction fee handling on networks supporting EIP-1559 but reporting a base fee of zero.
Hi. Should we also fix the same issue for BNB Testnet Chain? It's chainId is 97. Thanks. |
Hey @blackbear10000, yes we should add the testnet, I have opened a separate issue for this: #763 |
This commit updates the gas fee configuration logic to accommodate the BNB Chain (chainId 56). While the BNB Network supports EIP-1559, it reports a
baseFeePerGas
of zero(bnb-chain/bsc#2062). This adjustment ensures that transactions on the BNB Chain do not mistakenly receive a max fee configuration of zero, which is not appropriate despite the reported base fee. This change maintains the functionality for other chains such as Polygon (chainId 137) that require legacy gasPrice fees, and excludes only BNB Chain from the zero max fee logic. This is crucial for proper transaction fee handling on networks supporting EIP-1559 but reporting a base fee of zero.Deployments on the BNB Chain were failing. The required tip for transactions should be n wei, but because the
baseFeePerGas
was mistakenly set to 0, the actual tip was also calculated as 0. This resulted in deployment errors that prevented successful transaction submissions. This commit corrects this misconfiguration, ensuring that the correct transaction fees are applied, thus enabling proper deployments on the BNB Chain.