[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
This commit is contained in:
guibescos 2023-02-21 10:50:54 -06:00 committed by GitHub
parent ecb0e174d4
commit b34ec4e882
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -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(