Skip to content

Commit

Permalink
Merge pull request #756 from NomicFoundation/test/bnb-test-tweak
Browse files Browse the repository at this point in the history
test: tweak BNB chain test
  • Loading branch information
zoeyTM authored May 9, 2024
2 parents 42ccfc7 + 49e57c1 commit 1f7fdd3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 6 additions & 3 deletions packages/core/src/internal/execution/jsonrpc-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
// 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) {
// Support zero gas fee chains, such as a private instances
// of blockchains using Besu.
return {
maxFeePerGas: 0n,
maxPriorityFeePerGas: 0n,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,13 @@ describe("JSON-RPC client", function () {

const fees = await bnbClient.getNetworkFees();

assert.notDeepEqual(
assert.deepStrictEqual(
fees,
{
maxFeePerGas: 0n,
maxPriorityFeePerGas: 0n,
maxFeePerGas: 1_000_000_000n,
maxPriorityFeePerGas: 1_000_000_000n,
},
"Fees should not be zero due to the specific handling for BNB Chain."
"Both max fee and max priority fee should be 1 gwei, as the base fee is 0 for BNB Chain"
);
});

Expand Down

0 comments on commit 1f7fdd3

Please sign in to comment.