Skip to content

Commit

Permalink
Test that fee currency is used in tx pool
Browse files Browse the repository at this point in the history
Before, the gas price was always sufficiently high in all e2e tests to
mask certain cases of bad fee currency handling in the tx pool.
  • Loading branch information
karlb committed Sep 27, 2024
1 parent cdc399d commit 132d6f1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions e2e_test/js-tests/test_viem_tx.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -270,4 +270,28 @@ describe("viem send tx", () => {
}
}
}).timeout(10_000);

it("send fee currency tx with just high enough gas price", async () => {
const block = await publicClient.getBlock({});
// Actually, the base fee will be a bit lower next block, since our blocks
// are always mostly empty. But the difference will be much less than the
// exchange rate of 2, so the test will still check that we take the fee
// currency into account everywhere.
const maxFeePerGas = block.baseFeePerGas / 2n;
const request = await walletClient.prepareTransactionRequest({
account,
to: "0x00000000000000000000000000000000DeaDBeef",
value: 2,
gas: 90000,
feeCurrency: process.env.FEE_CURRENCY2,
maxFeePerGas,
maxPriorityFeePerGas: 1n,
});
const signature = await walletClient.signTransaction(request);
const hash = await walletClient.sendRawTransaction({
serializedTransaction: signature,
});
const receipt = await publicClient.waitForTransactionReceipt({ hash });
assert.equal(receipt.status, "success", "receipt status 'failure'");
}).timeout(5_000);
});
1 change: 1 addition & 0 deletions e2e_test/shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export REGISTRY_ADDR=0x000000000000000000000000000000000000ce10
export TOKEN_ADDR=0x471ece3750da237f93b8e339c536989b8978a438
export FEE_CURRENCY_DIRECTORY_ADDR=0x9212Fb72ae65367A7c887eC4Ad9bE310BAC611BF
export FEE_CURRENCY=0x000000000000000000000000000000000000ce16
export FEE_CURRENCY2=0x000000000000000000000000000000000000ce17
export FEE_HANDLER=0xcd437749e43a154c07f3553504c68fbfd56b8778
export ORACLE3=0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0003

Expand Down

0 comments on commit 132d6f1

Please sign in to comment.