Skip to content

Commit

Permalink
fix: Exclude BNB Chain from zero fee configuration in gas fee logic
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
magicsih committed May 9, 2024
1 parent d748a7d commit 378ab5a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/internal/execution/jsonrpc-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
// Support zero gas fee chains, such as a private instances
// of blockchains using Besu.
return {
Expand Down

0 comments on commit 378ab5a

Please sign in to comment.