From f99337d47fedb4ed8020b9c28c3e6ab4ae9ecb84 Mon Sep 17 00:00:00 2001 From: vvvvvv1vvvvvv <86296331+vvvvvv1vvvvvv@users.noreply.github.com> Date: Fri, 22 Sep 2023 09:55:13 +0800 Subject: [PATCH] fix: use 95% of block gasLimit when gasLimit greater than block gasLimit (#1760) --- src/ui/views/Approval/components/SignTx.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/views/Approval/components/SignTx.tsx b/src/ui/views/Approval/components/SignTx.tsx index 00b75bba828..4b6634db6b3 100644 --- a/src/ui/views/Approval/components/SignTx.tsx +++ b/src/ui/views/Approval/components/SignTx.tsx @@ -1730,7 +1730,7 @@ const SignTx = ({ params, origin }: SignTxProps) => { }); if (block && res > Number(block.gasLimit)) { - res = Number(block.gasLimit); + res = Math.floor(Number(block.gasLimit) * 0.95); // use 95% of block gasLimit when gasLimit greater than block gasLimit } if (!new BigNumber(res).eq(calcGasLimit)) { setGasLimit(`0x${new BigNumber(res).toNumber().toString(16)}`);