Skip to content
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

test: tweak BNB chain test #756

Merged
merged 1 commit into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading