[Bug] Erroneous error message "Cannot add more than 16 'set' commands"
CooperShield opened this issue · comments
Hello,
The error message returned by this assert is misleading
https://github.com/AleoHQ/snarkVM/blob/b7c5f49ba0a6b573f5a1f6850338507152827f8c/synthesizer/program/src/finalize/mod.rs#L116
In Finalize, when adding commands commands, you check that there's no more than N::MAX_WRITES
(16) commands
This is a bit misleading since instructions that increase num_writes
are both set
and remove
https://github.com/AleoHQ/snarkVM/blob/b7c5f49ba0a6b573f5a1f6850338507152827f8c/synthesizer/program/src/logic/command/mod.rs#L142
Following is a simple test file:
// The 'test_random.aleo' program.
program test_random.aleo;
mapping mYOtwkkTZi:
key as u128.public;
value as i64.public;
function hello:
async hello into r0;
output r0 as test_random.aleo/hello.future;
finalize hello:
remove mYOtwkkTZi[193311658353881143238061401739458194825u128];
remove mYOtwkkTZi[193311658353881143238061401739458194825u128];
remove mYOtwkkTZi[193311658353881143238061401739458194825u128];
remove mYOtwkkTZi[193311658353881143238061401739458194825u128];
remove mYOtwkkTZi[193311658353881143238061401739458194825u128];
remove mYOtwkkTZi[193311658353881143238061401739458194825u128];
remove mYOtwkkTZi[193311658353881143238061401739458194825u128];
remove mYOtwkkTZi[193311658353881143238061401739458194825u128];
remove mYOtwkkTZi[193311658353881143238061401739458194825u128];
remove mYOtwkkTZi[193311658353881143238061401739458194825u128];
remove mYOtwkkTZi[193311658353881143238061401739458194825u128];
remove mYOtwkkTZi[193311658353881143238061401739458194825u128];
remove mYOtwkkTZi[193311658353881143238061401739458194825u128];
remove mYOtwkkTZi[193311658353881143238061401739458194825u128];
remove mYOtwkkTZi[193311658353881143238061401739458194825u128];
remove mYOtwkkTZi[193311658353881143238061401739458194825u128];
remove mYOtwkkTZi[193311658353881143238061401739458194825u128];
Trying to compile this code will result in the error code Cannot add more than 16 'set' commands