|
1 | | -import { UInt64, Mina, AccountUpdate, PublicKey, Field, TokenId, PrivateKey } from 'o1js'; |
2 | | -import { describe, it, before, beforeEach, afterEach } from 'node:test'; |
3 | 1 | import { expect } from 'expect'; |
| 2 | +import { afterEach, before, beforeEach, describe, it } from 'node:test'; |
| 3 | +import { AccountUpdate, Field, Mina, PrivateKey, PublicKey, TokenId, UInt64 } from 'o1js'; |
| 4 | +import { TransactionLimits } from './constants.js'; |
4 | 5 |
|
5 | 6 | const defaultNetwork = Mina.Network({ |
6 | 7 | networkId: 'testnet', |
@@ -69,7 +70,11 @@ describe('Test default network', () => { |
69 | 70 |
|
70 | 71 | it('More than limit account update', async () => { |
71 | 72 | let txn = await Mina.transaction(async () => { |
72 | | - for (let index = 0; index < 12; index++) { |
| 73 | + for ( |
| 74 | + let index = 0; |
| 75 | + index < TransactionLimits.MAX_ZKAPP_SEGMENT_PER_TRANSACTION + 1; |
| 76 | + index++ |
| 77 | + ) { |
73 | 78 | const accountUpdateBob = AccountUpdate.create(bobAccount, Field.from(index)); |
74 | 79 | accountUpdateBob.account.balance.requireEquals(UInt64.zero); |
75 | 80 | accountUpdateBob.balance.addInPlace(UInt64.one); |
@@ -114,7 +119,11 @@ describe('Test enforced network', () => { |
114 | 119 |
|
115 | 120 | it('More than limit account update', async () => { |
116 | 121 | let txn = await Mina.transaction(async () => { |
117 | | - for (let index = 0; index < 12; index++) { |
| 122 | + for ( |
| 123 | + let index = 0; |
| 124 | + index < TransactionLimits.MAX_ZKAPP_SEGMENT_PER_TRANSACTION + 1; |
| 125 | + index++ |
| 126 | + ) { |
118 | 127 | const accountUpdateBob = AccountUpdate.create(bobAccount, Field.from(index)); |
119 | 128 | accountUpdateBob.account.balance.requireEquals(UInt64.zero); |
120 | 129 | accountUpdateBob.balance.addInPlace(UInt64.one); |
@@ -159,7 +168,11 @@ describe('Test unlimited network', () => { |
159 | 168 |
|
160 | 169 | it('More than limit account update', async () => { |
161 | 170 | let txn = await Mina.transaction(async () => { |
162 | | - for (let index = 0; index < 12; index++) { |
| 171 | + for ( |
| 172 | + let index = 0; |
| 173 | + index < TransactionLimits.MAX_ZKAPP_SEGMENT_PER_TRANSACTION + 1; |
| 174 | + index++ |
| 175 | + ) { |
163 | 176 | const accountUpdateBob = AccountUpdate.create(bobAccount, Field.from(index)); |
164 | 177 | accountUpdateBob.account.balance.requireEquals(UInt64.zero); |
165 | 178 | accountUpdateBob.balance.addInPlace(UInt64.one); |
@@ -252,7 +265,11 @@ describe('Test network with headers', () => { |
252 | 265 |
|
253 | 266 | it('More than limit account update', async () => { |
254 | 267 | let txn = await Mina.transaction(async () => { |
255 | | - for (let index = 0; index < 12; index++) { |
| 268 | + for ( |
| 269 | + let index = 0; |
| 270 | + index < TransactionLimits.MAX_ZKAPP_SEGMENT_PER_TRANSACTION + 1; |
| 271 | + index++ |
| 272 | + ) { |
256 | 273 | const accountUpdateBob = AccountUpdate.create(bobAccount, Field.from(index)); |
257 | 274 | accountUpdateBob.account.balance.requireEquals(UInt64.zero); |
258 | 275 | accountUpdateBob.balance.addInPlace(UInt64.one); |
|
0 commit comments