You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

401 lines
16 KiB

  1. package statedb
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. "io/ioutil"
  6. "os"
  7. "testing"
  8. "github.com/hermeznetwork/hermez-node/common"
  9. "github.com/hermeznetwork/hermez-node/log"
  10. "github.com/hermeznetwork/hermez-node/test/til"
  11. "github.com/stretchr/testify/assert"
  12. "github.com/stretchr/testify/require"
  13. )
  14. func checkBalance(t *testing.T, tc *til.Context, sdb *StateDB, username string, tokenid int, expected string) {
  15. idx := tc.Users[username].Accounts[common.TokenID(tokenid)].Idx
  16. acc, err := sdb.GetAccount(idx)
  17. require.Nil(t, err)
  18. assert.Equal(t, expected, acc.Balance.String())
  19. }
  20. func TestProcessTxsBalances(t *testing.T) {
  21. dir, err := ioutil.TempDir("", "tmpdb")
  22. require.Nil(t, err)
  23. defer assert.Nil(t, os.RemoveAll(dir))
  24. sdb, err := NewStateDB(dir, TypeSynchronizer, 32)
  25. assert.Nil(t, err)
  26. // generate test transactions from test.SetBlockchain0 code
  27. tc := til.NewContext(common.RollupConstMaxL1UserTx)
  28. blocks, err := tc.GenerateBlocks(til.SetBlockchainMinimumFlow0)
  29. require.Nil(t, err)
  30. // Coordinator Idx where to send the fees
  31. coordIdxs := []common.Idx{256, 257}
  32. log.Debug("block:0 batch:0, only L1CoordinatorTxs")
  33. _, err = sdb.ProcessTxs(nil, nil, blocks[0].Rollup.Batches[0].L1CoordinatorTxs, nil)
  34. require.Nil(t, err)
  35. log.Debug("block:0 batch:1")
  36. l1UserTxs := []common.L1Tx{}
  37. l2Txs := common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[1].L2Txs)
  38. _, err = sdb.ProcessTxs(coordIdxs, l1UserTxs, blocks[0].Rollup.Batches[1].L1CoordinatorTxs, l2Txs)
  39. require.Nil(t, err)
  40. log.Debug("block:0 batch:2")
  41. l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[2].Batch.ForgeL1TxsNum])
  42. l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[2].L2Txs)
  43. _, err = sdb.ProcessTxs(coordIdxs, l1UserTxs, blocks[0].Rollup.Batches[2].L1CoordinatorTxs, l2Txs)
  44. require.Nil(t, err)
  45. checkBalance(t, tc, sdb, "A", 0, "500")
  46. log.Debug("block:0 batch:3")
  47. l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[3].Batch.ForgeL1TxsNum])
  48. l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[3].L2Txs)
  49. _, err = sdb.ProcessTxs(coordIdxs, l1UserTxs, blocks[0].Rollup.Batches[3].L1CoordinatorTxs, l2Txs)
  50. require.Nil(t, err)
  51. checkBalance(t, tc, sdb, "A", 0, "500")
  52. checkBalance(t, tc, sdb, "A", 1, "500")
  53. log.Debug("block:0 batch:4")
  54. l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[4].Batch.ForgeL1TxsNum])
  55. l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[4].L2Txs)
  56. _, err = sdb.ProcessTxs(coordIdxs, l1UserTxs, blocks[0].Rollup.Batches[4].L1CoordinatorTxs, l2Txs)
  57. require.Nil(t, err)
  58. checkBalance(t, tc, sdb, "A", 0, "500")
  59. checkBalance(t, tc, sdb, "A", 1, "500")
  60. log.Debug("block:0 batch:5")
  61. l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[5].Batch.ForgeL1TxsNum])
  62. l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[5].L2Txs)
  63. _, err = sdb.ProcessTxs(coordIdxs, l1UserTxs, blocks[0].Rollup.Batches[5].L1CoordinatorTxs, l2Txs)
  64. require.Nil(t, err)
  65. checkBalance(t, tc, sdb, "A", 0, "600")
  66. checkBalance(t, tc, sdb, "A", 1, "500")
  67. checkBalance(t, tc, sdb, "B", 0, "400")
  68. log.Debug("block:0 batch:6")
  69. l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[6].Batch.ForgeL1TxsNum])
  70. l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[6].L2Txs)
  71. _, err = sdb.ProcessTxs(coordIdxs, l1UserTxs, blocks[0].Rollup.Batches[6].L1CoordinatorTxs, l2Txs)
  72. require.Nil(t, err)
  73. checkBalance(t, tc, sdb, "Coord", 0, "10")
  74. checkBalance(t, tc, sdb, "Coord", 1, "20")
  75. checkBalance(t, tc, sdb, "A", 0, "600")
  76. checkBalance(t, tc, sdb, "A", 1, "280")
  77. checkBalance(t, tc, sdb, "B", 0, "290")
  78. checkBalance(t, tc, sdb, "B", 1, "200")
  79. checkBalance(t, tc, sdb, "C", 0, "100")
  80. checkBalance(t, tc, sdb, "D", 0, "800")
  81. log.Debug("block:0 batch:7")
  82. l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[7].Batch.ForgeL1TxsNum])
  83. l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[7].L2Txs)
  84. _, err = sdb.ProcessTxs(coordIdxs, l1UserTxs, blocks[0].Rollup.Batches[7].L1CoordinatorTxs, l2Txs)
  85. require.Nil(t, err)
  86. checkBalance(t, tc, sdb, "Coord", 0, "35")
  87. checkBalance(t, tc, sdb, "Coord", 1, "30")
  88. checkBalance(t, tc, sdb, "A", 0, "430")
  89. checkBalance(t, tc, sdb, "A", 1, "280")
  90. checkBalance(t, tc, sdb, "B", 0, "390")
  91. checkBalance(t, tc, sdb, "B", 1, "90")
  92. checkBalance(t, tc, sdb, "C", 0, "45")
  93. checkBalance(t, tc, sdb, "C", 1, "100")
  94. checkBalance(t, tc, sdb, "D", 0, "800")
  95. log.Debug("block:1 batch:0")
  96. l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[1].Rollup.Batches[0].Batch.ForgeL1TxsNum])
  97. l2Txs = common.L2TxsToPoolL2Txs(blocks[1].Rollup.Batches[0].L2Txs)
  98. _, err = sdb.ProcessTxs(coordIdxs, l1UserTxs, blocks[1].Rollup.Batches[0].L1CoordinatorTxs, l2Txs)
  99. require.Nil(t, err)
  100. checkBalance(t, tc, sdb, "Coord", 0, "75")
  101. checkBalance(t, tc, sdb, "Coord", 1, "30")
  102. checkBalance(t, tc, sdb, "A", 0, "730")
  103. checkBalance(t, tc, sdb, "A", 1, "280")
  104. checkBalance(t, tc, sdb, "B", 0, "380")
  105. checkBalance(t, tc, sdb, "B", 1, "90")
  106. checkBalance(t, tc, sdb, "C", 0, "845")
  107. checkBalance(t, tc, sdb, "C", 1, "100")
  108. checkBalance(t, tc, sdb, "D", 0, "470")
  109. log.Debug("block:1 batch:1")
  110. l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[1].Rollup.Batches[1].Batch.ForgeL1TxsNum])
  111. l2Txs = common.L2TxsToPoolL2Txs(blocks[1].Rollup.Batches[1].L2Txs)
  112. _, err = sdb.ProcessTxs(coordIdxs, l1UserTxs, blocks[1].Rollup.Batches[1].L1CoordinatorTxs, l2Txs)
  113. require.Nil(t, err)
  114. // use Set of PoolL2 txs
  115. poolL2Txs, err := tc.GeneratePoolL2Txs(til.SetPoolL2MinimumFlow0)
  116. assert.Nil(t, err)
  117. _, err = sdb.ProcessTxs(coordIdxs, []common.L1Tx{}, []common.L1Tx{}, poolL2Txs)
  118. require.Nil(t, err)
  119. checkBalance(t, tc, sdb, "Coord", 0, "105")
  120. checkBalance(t, tc, sdb, "Coord", 1, "40")
  121. checkBalance(t, tc, sdb, "A", 0, "510")
  122. checkBalance(t, tc, sdb, "A", 1, "170")
  123. checkBalance(t, tc, sdb, "B", 0, "480")
  124. checkBalance(t, tc, sdb, "B", 1, "190")
  125. checkBalance(t, tc, sdb, "C", 0, "845")
  126. checkBalance(t, tc, sdb, "C", 1, "100")
  127. checkBalance(t, tc, sdb, "D", 0, "360")
  128. checkBalance(t, tc, sdb, "F", 0, "100")
  129. }
  130. func TestProcessTxsSynchronizer(t *testing.T) {
  131. dir, err := ioutil.TempDir("", "tmpdb")
  132. require.Nil(t, err)
  133. defer assert.Nil(t, os.RemoveAll(dir))
  134. sdb, err := NewStateDB(dir, TypeSynchronizer, 32)
  135. assert.Nil(t, err)
  136. // generate test transactions from test.SetBlockchain0 code
  137. tc := til.NewContext(common.RollupConstMaxL1UserTx)
  138. blocks, err := tc.GenerateBlocks(til.SetBlockchain0)
  139. require.Nil(t, err)
  140. assert.Equal(t, 31, len(blocks[0].Rollup.L1UserTxs))
  141. assert.Equal(t, 4, len(blocks[0].Rollup.Batches[0].L1CoordinatorTxs))
  142. assert.Equal(t, 0, len(blocks[0].Rollup.Batches[1].L1CoordinatorTxs))
  143. assert.Equal(t, 22, len(blocks[0].Rollup.Batches[2].L2Txs))
  144. assert.Equal(t, 1, len(blocks[1].Rollup.Batches[0].L1CoordinatorTxs))
  145. assert.Equal(t, 62, len(blocks[1].Rollup.Batches[0].L2Txs))
  146. assert.Equal(t, 1, len(blocks[1].Rollup.Batches[1].L1CoordinatorTxs))
  147. assert.Equal(t, 8, len(blocks[1].Rollup.Batches[1].L2Txs))
  148. // Coordinator Idx where to send the fees
  149. coordIdxs := []common.Idx{256, 257, 258, 259}
  150. // Idx of user 'A'
  151. idxA1 := tc.Users["A"].Accounts[common.TokenID(1)].Idx
  152. // Process the 1st batch, which contains the L1CoordinatorTxs necessary
  153. // to create the Coordinator accounts to receive the fees
  154. log.Debug("block:0 batch:0, only L1CoordinatorTxs")
  155. ptOut, err := sdb.ProcessTxs(nil, nil, blocks[0].Rollup.Batches[0].L1CoordinatorTxs, nil)
  156. require.Nil(t, err)
  157. assert.Equal(t, 4, len(ptOut.CreatedAccounts))
  158. assert.Equal(t, 0, len(ptOut.CollectedFees))
  159. log.Debug("block:0 batch:1")
  160. l2Txs := common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[1].L2Txs)
  161. ptOut, err = sdb.ProcessTxs(coordIdxs, blocks[0].Rollup.L1UserTxs,
  162. blocks[0].Rollup.Batches[1].L1CoordinatorTxs, l2Txs)
  163. require.Nil(t, err)
  164. assert.Equal(t, 0, len(ptOut.ExitInfos))
  165. assert.Equal(t, 31, len(ptOut.CreatedAccounts))
  166. assert.Equal(t, 4, len(ptOut.CollectedFees))
  167. assert.Equal(t, "0", ptOut.CollectedFees[common.TokenID(0)].String())
  168. assert.Equal(t, "0", ptOut.CollectedFees[common.TokenID(1)].String())
  169. assert.Equal(t, "0", ptOut.CollectedFees[common.TokenID(2)].String())
  170. assert.Equal(t, "0", ptOut.CollectedFees[common.TokenID(3)].String())
  171. acc, err := sdb.GetAccount(idxA1)
  172. require.Nil(t, err)
  173. assert.Equal(t, "50", acc.Balance.String())
  174. log.Debug("block:0 batch:2")
  175. l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[2].L2Txs)
  176. ptOut, err = sdb.ProcessTxs(coordIdxs, nil, blocks[0].Rollup.Batches[2].L1CoordinatorTxs, l2Txs)
  177. require.Nil(t, err)
  178. assert.Equal(t, 0, len(ptOut.ExitInfos))
  179. assert.Equal(t, 0, len(ptOut.CreatedAccounts))
  180. assert.Equal(t, 4, len(ptOut.CollectedFees))
  181. assert.Equal(t, "2", ptOut.CollectedFees[common.TokenID(0)].String())
  182. assert.Equal(t, "1", ptOut.CollectedFees[common.TokenID(1)].String())
  183. assert.Equal(t, "0", ptOut.CollectedFees[common.TokenID(2)].String())
  184. assert.Equal(t, "0", ptOut.CollectedFees[common.TokenID(3)].String())
  185. acc, err = sdb.GetAccount(idxA1)
  186. require.Nil(t, err)
  187. assert.Equal(t, "35", acc.Balance.String())
  188. log.Debug("block:1 batch:0")
  189. l2Txs = common.L2TxsToPoolL2Txs(blocks[1].Rollup.Batches[0].L2Txs)
  190. // before processing expect l2Txs[0:2].Nonce==0
  191. assert.Equal(t, common.Nonce(0), l2Txs[0].Nonce)
  192. assert.Equal(t, common.Nonce(0), l2Txs[1].Nonce)
  193. assert.Equal(t, common.Nonce(0), l2Txs[2].Nonce)
  194. ptOut, err = sdb.ProcessTxs(coordIdxs, nil, blocks[1].Rollup.Batches[0].L1CoordinatorTxs, l2Txs)
  195. require.Nil(t, err)
  196. // after processing expect l2Txs[0:2].Nonce!=0 and has expected value
  197. assert.Equal(t, common.Nonce(6), l2Txs[0].Nonce)
  198. assert.Equal(t, common.Nonce(7), l2Txs[1].Nonce)
  199. assert.Equal(t, common.Nonce(8), l2Txs[2].Nonce)
  200. assert.Equal(t, 4, len(ptOut.ExitInfos)) // the 'ForceExit(1)' is not computed yet, as the batch is without L1UserTxs
  201. assert.Equal(t, 1, len(ptOut.CreatedAccounts))
  202. assert.Equal(t, 4, len(ptOut.CollectedFees))
  203. assert.Equal(t, "0", ptOut.CollectedFees[common.TokenID(0)].String())
  204. assert.Equal(t, "1", ptOut.CollectedFees[common.TokenID(1)].String())
  205. assert.Equal(t, "0", ptOut.CollectedFees[common.TokenID(2)].String())
  206. assert.Equal(t, "0", ptOut.CollectedFees[common.TokenID(3)].String())
  207. acc, err = sdb.GetAccount(idxA1)
  208. require.Nil(t, err)
  209. assert.Equal(t, "57", acc.Balance.String())
  210. log.Debug("block:1 batch:1")
  211. l2Txs = common.L2TxsToPoolL2Txs(blocks[1].Rollup.Batches[1].L2Txs)
  212. ptOut, err = sdb.ProcessTxs(coordIdxs, blocks[1].Rollup.L1UserTxs,
  213. blocks[1].Rollup.Batches[1].L1CoordinatorTxs, l2Txs)
  214. require.Nil(t, err)
  215. assert.Equal(t, 2, len(ptOut.ExitInfos)) // 2, as previous batch was without L1UserTxs, and has pending the 'ForceExit(1) A: 5'
  216. assert.Equal(t, 1, len(ptOut.CreatedAccounts))
  217. assert.Equal(t, 4, len(ptOut.CollectedFees))
  218. assert.Equal(t, "0", ptOut.CollectedFees[common.TokenID(0)].String())
  219. assert.Equal(t, "0", ptOut.CollectedFees[common.TokenID(1)].String())
  220. assert.Equal(t, "0", ptOut.CollectedFees[common.TokenID(2)].String())
  221. assert.Equal(t, "0", ptOut.CollectedFees[common.TokenID(3)].String())
  222. acc, err = sdb.GetAccount(idxA1)
  223. assert.Nil(t, err)
  224. assert.Equal(t, "77", acc.Balance.String())
  225. idxB0 := tc.Users["C"].Accounts[common.TokenID(0)].Idx
  226. acc, err = sdb.GetAccount(idxB0)
  227. require.Nil(t, err)
  228. assert.Equal(t, "51", acc.Balance.String())
  229. // get balance of Coordinator account for TokenID==0
  230. acc, err = sdb.GetAccount(common.Idx(256))
  231. require.Nil(t, err)
  232. assert.Equal(t, "2", acc.Balance.String())
  233. }
  234. func TestProcessTxsBatchBuilder(t *testing.T) {
  235. dir, err := ioutil.TempDir("", "tmpdb")
  236. require.Nil(t, err)
  237. defer assert.Nil(t, os.RemoveAll(dir))
  238. sdb, err := NewStateDB(dir, TypeBatchBuilder, 32)
  239. assert.Nil(t, err)
  240. // generate test transactions from test.SetBlockchain0 code
  241. tc := til.NewContext(common.RollupConstMaxL1UserTx)
  242. blocks, err := tc.GenerateBlocks(til.SetBlockchain0)
  243. require.Nil(t, err)
  244. // Coordinator Idx where to send the fees
  245. coordIdxs := []common.Idx{256, 257, 258, 259}
  246. // Idx of user 'A'
  247. idxA1 := tc.Users["A"].Accounts[common.TokenID(1)].Idx
  248. // Process the 1st batch, which contains the L1CoordinatorTxs necessary
  249. // to create the Coordinator accounts to receive the fees
  250. log.Debug("block:0 batch:0, only L1CoordinatorTxs")
  251. ptOut, err := sdb.ProcessTxs(nil, nil, blocks[0].Rollup.Batches[0].L1CoordinatorTxs, nil)
  252. require.Nil(t, err)
  253. // expect 0 at CreatedAccount, as is only computed when StateDB.Type==TypeSynchronizer
  254. assert.Equal(t, 0, len(ptOut.CreatedAccounts))
  255. log.Debug("block:0 batch:1")
  256. l2Txs := common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[1].L2Txs)
  257. ptOut, err = sdb.ProcessTxs(coordIdxs, blocks[0].Rollup.L1UserTxs, blocks[0].Rollup.Batches[1].L1CoordinatorTxs, l2Txs)
  258. require.Nil(t, err)
  259. assert.Equal(t, 0, len(ptOut.ExitInfos))
  260. assert.Equal(t, 0, len(ptOut.CreatedAccounts))
  261. acc, err := sdb.GetAccount(idxA1)
  262. require.Nil(t, err)
  263. assert.Equal(t, "50", acc.Balance.String())
  264. log.Debug("block:0 batch:2")
  265. l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[2].L2Txs)
  266. ptOut, err = sdb.ProcessTxs(coordIdxs, nil, blocks[0].Rollup.Batches[2].L1CoordinatorTxs, l2Txs)
  267. require.Nil(t, err)
  268. assert.Equal(t, 0, len(ptOut.ExitInfos))
  269. assert.Equal(t, 0, len(ptOut.CreatedAccounts))
  270. acc, err = sdb.GetAccount(idxA1)
  271. require.Nil(t, err)
  272. assert.Equal(t, "35", acc.Balance.String())
  273. log.Debug("block:1 batch:0")
  274. l2Txs = common.L2TxsToPoolL2Txs(blocks[1].Rollup.Batches[0].L2Txs)
  275. _, err = sdb.ProcessTxs(coordIdxs, nil, blocks[1].Rollup.Batches[0].L1CoordinatorTxs, l2Txs)
  276. require.Nil(t, err)
  277. acc, err = sdb.GetAccount(idxA1)
  278. require.Nil(t, err)
  279. assert.Equal(t, "57", acc.Balance.String())
  280. log.Debug("block:1 batch:1")
  281. l2Txs = common.L2TxsToPoolL2Txs(blocks[1].Rollup.Batches[1].L2Txs)
  282. _, err = sdb.ProcessTxs(coordIdxs, blocks[1].Rollup.L1UserTxs, blocks[1].Rollup.Batches[1].L1CoordinatorTxs, l2Txs)
  283. require.Nil(t, err)
  284. acc, err = sdb.GetAccount(idxA1)
  285. assert.Nil(t, err)
  286. assert.Equal(t, "77", acc.Balance.String())
  287. idxB0 := tc.Users["C"].Accounts[common.TokenID(0)].Idx
  288. acc, err = sdb.GetAccount(idxB0)
  289. require.Nil(t, err)
  290. assert.Equal(t, "51", acc.Balance.String())
  291. // get balance of Coordinator account for TokenID==0
  292. acc, err = sdb.GetAccount(common.Idx(256))
  293. require.Nil(t, err)
  294. assert.Equal(t, common.TokenID(0), acc.TokenID)
  295. assert.Equal(t, "2", acc.Balance.String())
  296. acc, err = sdb.GetAccount(common.Idx(257))
  297. require.Nil(t, err)
  298. assert.Equal(t, common.TokenID(1), acc.TokenID)
  299. assert.Equal(t, "2", acc.Balance.String())
  300. }
  301. func TestZKInputsGeneration(t *testing.T) {
  302. dir, err := ioutil.TempDir("", "tmpdb")
  303. require.Nil(t, err)
  304. defer assert.Nil(t, os.RemoveAll(dir))
  305. sdb, err := NewStateDB(dir, TypeBatchBuilder, 4)
  306. assert.Nil(t, err)
  307. set := `
  308. Type: Blockchain
  309. AddToken(1)
  310. CreateAccountDeposit(1) A: 10
  311. > batchL1
  312. CreateAccountCoordinator(1) B
  313. CreateAccountCoordinator(1) C
  314. > batchL1
  315. // idxs: A:258, B:256, C:257
  316. Transfer(1) A-B: 6 (1)
  317. Transfer(1) A-C: 2 (1)
  318. > batch
  319. > block
  320. `
  321. // generate test transactions from test.SetBlockchain0 code
  322. tc := til.NewContext(common.RollupConstMaxL1UserTx)
  323. blocks, err := tc.GenerateBlocks(set)
  324. require.Nil(t, err)
  325. // Coordinator Idx where to send the fees
  326. coordIdxs := []common.Idx{256}
  327. log.Debug("block:0 batch:0, only L1UserTx")
  328. _, err = sdb.ProcessTxs(nil, blocks[0].Rollup.L1UserTxs, nil, nil)
  329. require.Nil(t, err)
  330. log.Debug("block:0 batch:1, only L1CoordinatorTxs")
  331. _, err = sdb.ProcessTxs(nil, nil, blocks[0].Rollup.Batches[1].L1CoordinatorTxs, nil)
  332. require.Nil(t, err)
  333. log.Debug("block:0 batch:2, only L2Txs")
  334. l2Txs := common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[2].L2Txs)
  335. ptOut, err := sdb.ProcessTxs(coordIdxs, nil, nil, l2Txs)
  336. require.Nil(t, err)
  337. checkBalance(t, tc, sdb, "A", 1, "2")
  338. s, err := json.Marshal(ptOut.ZKInputs)
  339. require.Nil(t, err)
  340. debug := false
  341. if debug {
  342. fmt.Println(string(s))
  343. }
  344. }