From b34ec4e882dc64f64bcd82d805306ba8e9f508f3 Mon Sep 17 00:00:00 2001 From: guibescos <59208140+guibescos@users.noreply.github.com> Date: Tue, 21 Feb 2023 10:50:54 -0600 Subject: [PATCH] [xc-admin] error if proposals have more than 255 instructions (#618) * Make the change * Revert other files * Remove console log * Fix typo * Add new keyword --- governance/xc_admin/packages/xc_admin_common/src/propose.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/governance/xc_admin/packages/xc_admin_common/src/propose.ts b/governance/xc_admin/packages/xc_admin_common/src/propose.ts index 6cbac903..52a046ff 100644 --- a/governance/xc_admin/packages/xc_admin_common/src/propose.ts +++ b/governance/xc_admin/packages/xc_admin_common/src/propose.ts @@ -64,6 +64,9 @@ export async function proposeInstructions( } const batches = batchIntoExecutorPayload(instructions); + if (255 <= batches.length) { + throw new Error("A proposal can only support 255 instructions"); + } for (const [i, batch] of batches.entries()) { const squadIx = await wrapAsRemoteInstruction( squad, @@ -86,6 +89,9 @@ export async function proposeInstructions( ); } } else { + if (255 <= instructions.length) { + throw new Error("A proposal can only support 255 instructions"); + } for (let i = 0; i < instructions.length; i++) { ixToSend.push( await squad.buildAddInstruction(