From 5616a7a6d54ebdc37127f398ec773edbc0e8ccf7 Mon Sep 17 00:00:00 2001 From: Gabe Rodriguez Date: Thu, 29 Aug 2024 17:17:34 +0200 Subject: [PATCH] Lower batch limit (#1741) --- .../end-or-withdraw-all-button.tsx | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/apps/minifront/src/components/swap/auction-list/end-or-withdraw-all-button.tsx b/apps/minifront/src/components/swap/auction-list/end-or-withdraw-all-button.tsx index 1504490f5d..a6152e2b40 100644 --- a/apps/minifront/src/components/swap/auction-list/end-or-withdraw-all-button.tsx +++ b/apps/minifront/src/components/swap/auction-list/end-or-withdraw-all-button.tsx @@ -44,6 +44,14 @@ export const assembleAuctionBatch = ( return { auctions: filteredBySeqAndAddressIndexAuctions, source: firstFoundAddressIndex! }; }; +// Chain has a transaction size limit, so we can add at most a batch of 48 auctions in a single transaction +// see https://github.com/penumbra-zone/web/issues/1166#issuecomment-2263550249 +// However, due to wasm memory limits, making the max lower until resolved: +// https://github.com/penumbra-zone/web/issues/1702 +const BATCH_LIMIT = 24; +const endTooltipContent = `End a batch of open auctions, with a limit of ${BATCH_LIMIT} auctions per transaction`; +const withdrawTooltipContent = `Withdraw a batch of ended auctions, with a limit of ${BATCH_LIMIT} auctions per transaction`; + export const EndOrWithdrawAllButton = () => { const { endAllAuctions, withdrawAllAuctions } = useStoreShallow(endOrWithdrawAllButtonSelector); const { data } = useAuctionInfos(); @@ -57,9 +65,7 @@ export const EndOrWithdrawAllButton = () => { { - // Chain has a transaction size limit, so we can add at most a batch of 48 auctions in a single transaction - // see https://github.com/penumbra-zone/web/issues/1166#issuecomment-2263550249 - const auctionBatch = assembleAuctionBatch(data, 0n, 48); + const auctionBatch = assembleAuctionBatch(data, 0n, BATCH_LIMIT); void endAllAuctions( auctionBatch.auctions, @@ -67,17 +73,15 @@ export const EndOrWithdrawAllButton = () => { auctionBatch.source, ); }} - aria-label='End all open auctions, with a limit of 48 auctions per transaction' + aria-label={endTooltipContent} > -
+
- - End all open auctions, with a limit of 48 auctions per transaction - + {endTooltipContent} ); @@ -89,26 +93,22 @@ export const EndOrWithdrawAllButton = () => { { - // Chain has a transaction size limit, so we can add at most a batch of 48 auctions in a single transaction - // see https://github.com/penumbra-zone/web/issues/1166#issuecomment-2263550249 - const auctionBatch = assembleAuctionBatch(data, 1n, 48); + const auctionBatch = assembleAuctionBatch(data, 1n, BATCH_LIMIT); void withdrawAllAuctions( auctionBatch.auctions, // TODO Should use the index of the selected account after the account selector for the auction is implemented auctionBatch.source, ); }} - aria-label='Withdraw all ended auctions, with a limit of 48 auctions per transaction' + aria-label={withdrawTooltipContent} > -
+
- - Withdraw all ended auctions, with a limit of 48 auctions per transaction - + {withdrawTooltipContent} );