Skip to content

Commit ae2e43e

Browse files
committed
remove this.length from error message as it is provable type
1 parent 4ec384c commit ae2e43e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lib/provable/dynamic-array.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class DynamicArrayBase<ProvableValue = any, Value = any> {
171171
* @param message - optional error message to use in case the assertion fails
172172
*/
173173
assertIndexInRange(i: Field, message?: string): void {
174-
let errorMessage = message ?? `assertIndexInRange(): index ${i} must be in range [0, ${this.length}]`;
174+
let errorMessage = message ?? `assertIndexInRange(): index ${i} must be in range [0, length]`;
175175
if (!this.#indicesInRange.has(i)) {
176176
if (i.isConstant() && this.length.isConstant()) {
177177
assert(i.toBigInt() < this.length.toBigInt(), errorMessage);
@@ -238,7 +238,7 @@ class DynamicArrayBase<ProvableValue = any, Value = any> {
238238
* Sets a value at index i and proves that the index is in the array.
239239
*/
240240
set(i: Field, value: ProvableValue, message?: string): void {
241-
let errorMessage = message ?? `set(): index ${i} must be in range [0, ${this.length}]`;
241+
let errorMessage = message ?? `set(): index ${i} must be in range [0, length]`;
242242
this.assertIndexInRange(i, errorMessage);
243243
this.setOrDoNothing(i, value);
244244
}
@@ -348,7 +348,7 @@ class DynamicArrayBase<ProvableValue = any, Value = any> {
348348
decreaseLengthBy(n: Field, message?: string): void {
349349
let errorMessage =
350350
message ??
351-
`decreaseLengthBy: cannot decrease length because provided n is larger than current array length ${this.length}`;
351+
`decreaseLengthBy: cannot decrease length because provided n is larger than current array length`;
352352

353353
let oldLength = this.length;
354354
n.assertLessThanOrEqual(this.length, errorMessage);

0 commit comments

Comments
 (0)