Skip to content

Commit ccd4cd6

Browse files
fix: overestimate zksync gas limit for paymaster extra gas (#4979)
1 parent bd0dbb7 commit ccd4cd6

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

.changeset/nasty-experts-whisper.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Overestimate zksync gas limit to account for paymaster extra gas

packages/thirdweb/src/transaction/actions/zksync/send-eip712-transaction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export async function populateEip712Transaction(
128128
max_priority_fee_per_gas: string;
129129
gas_per_pubdata_limit: string;
130130
};
131-
gas = toBigInt(result.gas_limit);
131+
gas = toBigInt(result.gas_limit) * 2n; // overestimating to avoid issues when not accounting for paymaster extra gas ( we should really pass the paymaster input above for better accuracy )
132132
const baseFee = toBigInt(result.max_fee_per_gas);
133133
maxFeePerGas = baseFee * 2n; // bumping the base fee per gas to ensure fast inclusion
134134
maxPriorityFeePerGas = toBigInt(result.max_priority_fee_per_gas) || 1n;

packages/thirdweb/src/wallets/smart/smart-wallet-zksync.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,18 @@ describe.runIf(process.env.TW_SECRET_KEY).todo(
6464
expect(tx.transactionHash.length).toBe(66);
6565
});
6666

67+
it("should send dummy a transactions", async () => {
68+
const tx = await sendAndConfirmTransaction({
69+
transaction: prepareTransaction({
70+
chain,
71+
client,
72+
to: "0x611e71B12a2B1C0c884574042414Fe360aF0C5A7",
73+
}),
74+
account: smartAccount,
75+
});
76+
expect(tx.transactionHash.length).toBe(66);
77+
});
78+
6779
it.skip("should send a transaction on zkcandy", async () => {
6880
const zkCandy = defineChain(302);
6981
const zkCandySmartWallet = smartWallet({

0 commit comments

Comments
 (0)