Skip to content

Commit

Permalink
Support zero gas fee chains
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Zhang <jim.zhang@kaleido.io>
  • Loading branch information
jimthematrix authored and kanej committed Apr 30, 2024
1 parent fc90abf commit 0bff8cc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/core/src/internal/execution/jsonrpc-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,14 @@ export class EIP1193JsonRpcClient implements JsonRpcClient {
// We prioritize EIP-1559 fees over legacy gasPrice fees
if (latestBlock.baseFeePerGas !== undefined) {
// Logic copied from ethers v6
const maxPriorityFeePerGas = 1_000_000_000n; // 1gwei
let maxPriorityFeePerGas = 1_000_000_000n; // 1gwei

if (latestBlock.baseFeePerGas === 0n) {
// Support zero gas fee chains, such as a private instances
// of blockchains using Besu.
maxPriorityFeePerGas = 0n;
}

const maxFeePerGas =
latestBlock.baseFeePerGas * 2n + maxPriorityFeePerGas;

Expand Down

0 comments on commit 0bff8cc

Please sign in to comment.