Skip to content

Commit

Permalink
Lower batch limit (#1741)
Browse files Browse the repository at this point in the history
  • Loading branch information
grod220 authored Aug 29, 2024
1 parent a043fe1 commit 5616a7a
Showing 1 changed file with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -57,27 +65,23 @@ export const EndOrWithdrawAllButton = () => {
<Tooltip>
<TooltipTrigger
onClick={() => {
// 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,
// TODO Should use the index of the selected account after the account selector for the auction is implemented
auctionBatch.source,
);
}}
aria-label='End all open auctions, with a limit of 48 auctions per transaction'
aria-label={endTooltipContent}
>
<div className='w-[85px] shrink-0'>
<div className='w-[120px] shrink-0'>
<Button size='sm' variant='secondary' className='w-full'>
End all
End batch
</Button>
</div>
</TooltipTrigger>
<TooltipContent>
End all open auctions, with a limit of 48 auctions per transaction
</TooltipContent>
<TooltipContent>{endTooltipContent}</TooltipContent>
</Tooltip>
</TooltipProvider>
);
Expand All @@ -89,26 +93,22 @@ export const EndOrWithdrawAllButton = () => {
<Tooltip>
<TooltipTrigger
onClick={() => {
// 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}
>
<div className='w-[95px] shrink-0'>
<div className='w-[120px] shrink-0'>
<Button size='sm' variant='secondary' className='w-full'>
Withdraw all
Withdraw batch
</Button>
</div>
</TooltipTrigger>
<TooltipContent>
Withdraw all ended auctions, with a limit of 48 auctions per transaction
</TooltipContent>
<TooltipContent>{withdrawTooltipContent}</TooltipContent>
</Tooltip>
</TooltipProvider>
);
Expand Down

0 comments on commit 5616a7a

Please sign in to comment.