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.

1377 lines
340 KiB

  1. package txprocessor
  2. import (
  3. "encoding/hex"
  4. "encoding/json"
  5. "fmt"
  6. "io/ioutil"
  7. "math/big"
  8. "os"
  9. "strconv"
  10. "testing"
  11. ethCommon "github.com/ethereum/go-ethereum/common"
  12. "github.com/hermeznetwork/hermez-node/common"
  13. "github.com/hermeznetwork/hermez-node/db/statedb"
  14. "github.com/hermeznetwork/hermez-node/log"
  15. "github.com/hermeznetwork/hermez-node/test/til"
  16. "github.com/iden3/go-iden3-crypto/babyjub"
  17. "github.com/stretchr/testify/assert"
  18. "github.com/stretchr/testify/require"
  19. )
  20. //nolint:deadcode,unused
  21. func printZKInputs(t *testing.T, zki *common.ZKInputs) {
  22. s, err := json.Marshal(zki)
  23. require.NoError(t, err)
  24. h, err := zki.HashGlobalData()
  25. require.NoError(t, err)
  26. fmt.Println("\nCopy&Paste into js circom test:\n let zkInput = JSON.parse(`" + string(s) + "`);")
  27. // fmt.Println("\nZKInputs json:\n echo '" + string(s) + "' | jq > ~/go.txt")
  28. fmt.Printf(`
  29. const output={
  30. hashGlobalInputs: "%s",
  31. };
  32. await circuit.assertOut(w, output);
  33. `, h.String())
  34. fmt.Println("")
  35. }
  36. func generateJsUsers(t *testing.T) []til.User {
  37. // same values than in the js test
  38. // skJsHex is equivalent to the 0000...000i js private key in commonjs
  39. skJsHex := []string{"7eb258e61862aae75c6c1d1f7efae5006ffc9e4d5596a6ff95f3df4ea209ea7f", "c005700f76f4b4cec710805c21595688648524df0a9d467afae537b7a7118819", "b373d14c67fb2a517bf4ac831c93341eec8e1b38dbc14e7d725b292a7cf84707", "2064b68d04a7aaae0ac3b36bf6f1850b380f1423be94a506c531940bd4a48b76"}
  40. addrHex := []string{"0x7e5f4552091a69125d5dfcb7b8c2659029395bdf", "0x2b5ad5c4795c026514f8317c7a215e218dccd6cf", "0x6813eb9362372eef6200f3b1dbc3f819671cba69", "0x1eff47bc3a10a45d4b230b5d10e37751fe6aa718"}
  41. var users []til.User
  42. for i := 0; i < len(skJsHex); i++ {
  43. skJs, err := hex.DecodeString(skJsHex[i])
  44. require.NoError(t, err)
  45. var sk babyjub.PrivateKey
  46. copy(sk[:], skJs)
  47. // bjj := sk.Public()
  48. user := til.User{
  49. Name: strconv.Itoa(i),
  50. BJJ: &sk,
  51. Addr: ethCommon.HexToAddress(addrHex[i]),
  52. }
  53. users = append(users, user)
  54. }
  55. assert.Equal(t, "d746824f7d0ac5044a573f51b278acb56d823bec39551d1d7bf7378b68a1b021", users[0].BJJ.Public().String())
  56. assert.Equal(t, "4d05c307400c65795f02db96b1b81c60386fd53e947d9d3f749f3d99b1853909", users[1].BJJ.Public().String())
  57. assert.Equal(t, "38ffa002724562eb2a952a2503e206248962406cf16392ff32759b6f2a41fe11", users[2].BJJ.Public().String())
  58. assert.Equal(t, "c719e6401190be7fa7fbfcd3448fe2755233c01575341a3b09edadf5454f760b", users[3].BJJ.Public().String())
  59. return users
  60. }
  61. func signL2Tx(t *testing.T, chainID uint16, user til.User, l2Tx common.PoolL2Tx) common.PoolL2Tx {
  62. toSign, err := l2Tx.HashToSign(chainID)
  63. require.NoError(t, err)
  64. sig := user.BJJ.SignPoseidon(toSign)
  65. l2Tx.Signature = sig.Compress()
  66. return l2Tx
  67. }
  68. func TestZKInputsHashTestVector0(t *testing.T) {
  69. dir, err := ioutil.TempDir("", "tmpdb")
  70. require.NoError(t, err)
  71. defer assert.Nil(t, os.RemoveAll(dir))
  72. sdb, err := statedb.NewStateDB(dir, 128, statedb.TypeBatchBuilder, 32)
  73. require.NoError(t, err)
  74. // same values than in the js test
  75. users := generateJsUsers(t)
  76. l1Txs := []common.L1Tx{
  77. {
  78. FromIdx: 0,
  79. DepositAmount: big.NewInt(16000000),
  80. Amount: big.NewInt(0),
  81. TokenID: 1,
  82. FromBJJ: users[0].BJJ.Public().Compress(),
  83. FromEthAddr: users[0].Addr,
  84. ToIdx: 0,
  85. Type: common.TxTypeCreateAccountDeposit,
  86. UserOrigin: true,
  87. },
  88. }
  89. l2Txs := []common.PoolL2Tx{
  90. {
  91. FromIdx: 256,
  92. ToIdx: 256,
  93. TokenID: 1,
  94. Amount: big.NewInt(1000),
  95. Nonce: 0,
  96. Fee: 126,
  97. Type: common.TxTypeTransfer,
  98. },
  99. }
  100. chainID := uint16(0)
  101. config := Config{
  102. NLevels: 32,
  103. MaxFeeTx: 8,
  104. MaxTx: 32,
  105. MaxL1Tx: 16,
  106. ChainID: chainID,
  107. }
  108. tp := NewTxProcessor(sdb, config)
  109. ptOut, err := tp.ProcessTxs(nil, l1Txs, nil, l2Txs)
  110. require.NoError(t, err)
  111. // check expected account keys values from tx inputs
  112. acc, err := sdb.GetAccount(common.Idx(256))
  113. require.NoError(t, err)
  114. assert.Equal(t, users[0].BJJ.Public().Compress().String(), acc.BJJ.String())
  115. assert.Equal(t, users[0].Addr.Hex(), acc.EthAddr.Hex())
  116. // check that there no exist more accounts
  117. _, err = sdb.GetAccount(common.Idx(257))
  118. require.NotNil(t, err)
  119. ptOut.ZKInputs.FeeIdxs[0] = common.Idx(256).BigInt()
  120. toHash, err := ptOut.ZKInputs.ToHashGlobalData()
  121. assert.NoError(t, err)
  122. // value from js test vector
  123. expectedToHash := "0000000000ff000000000100000000000000000000000000000000000000000000000000000000000000000015ba488d749f6b891d29d0bf3a72481ec812e4d4ecef2bf7a3fc64f3c010444200000000000000000000000000000000000000000000000000000000000000007e5f4552091a69125d5dfcb7b8c2659029395bdf21b0a1688b37f77b1d1d5539ec3b826db5ac78b2513f574a04c50a7d4f8246d700000000000028a00000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000010003e87e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000001"
  124. // checks are splitted to find the difference easier
  125. assert.Equal(t, expectedToHash[:1000], hex.EncodeToString(toHash)[:1000])
  126. assert.Equal(t, expectedToHash[1000:2000], hex.EncodeToString(toHash)[1000:2000])
  127. assert.Equal(t, expectedToHash[2000:], hex.EncodeToString(toHash)[2000:])
  128. h, err := ptOut.ZKInputs.HashGlobalData()
  129. require.NoError(t, err)
  130. // value from js test vector
  131. assert.Equal(t, "4356692423721763303547321618014315464040324829724049399065961225345730555597", h.String())
  132. }
  133. func TestZKInputsHashTestVector1(t *testing.T) {
  134. dir, err := ioutil.TempDir("", "tmpdb")
  135. require.NoError(t, err)
  136. defer assert.Nil(t, os.RemoveAll(dir))
  137. sdb, err := statedb.NewStateDB(dir, 128, statedb.TypeBatchBuilder, 32)
  138. require.NoError(t, err)
  139. // same values than in the js test
  140. users := generateJsUsers(t)
  141. l1Txs := []common.L1Tx{
  142. {
  143. FromIdx: 0,
  144. DepositAmount: big.NewInt(16000000),
  145. Amount: big.NewInt(0),
  146. TokenID: 1,
  147. FromBJJ: users[0].BJJ.Public().Compress(),
  148. FromEthAddr: users[0].Addr,
  149. ToIdx: 0,
  150. Type: common.TxTypeCreateAccountDeposit,
  151. UserOrigin: true,
  152. },
  153. {
  154. FromIdx: 0,
  155. DepositAmount: big.NewInt(16000000),
  156. Amount: big.NewInt(0),
  157. TokenID: 1,
  158. FromBJJ: users[1].BJJ.Public().Compress(),
  159. FromEthAddr: users[1].Addr,
  160. ToIdx: 0,
  161. Type: common.TxTypeCreateAccountDeposit,
  162. UserOrigin: true,
  163. },
  164. }
  165. l2Txs := []common.PoolL2Tx{
  166. {
  167. FromIdx: 257,
  168. ToIdx: 256,
  169. TokenID: 1,
  170. Amount: big.NewInt(1000),
  171. Nonce: 0,
  172. Fee: 137,
  173. Type: common.TxTypeTransfer,
  174. },
  175. }
  176. chainID := uint16(0)
  177. config := Config{
  178. NLevels: 32,
  179. MaxFeeTx: 8,
  180. MaxTx: 32,
  181. MaxL1Tx: 16,
  182. ChainID: chainID,
  183. }
  184. tp := NewTxProcessor(sdb, config)
  185. ptOut, err := tp.ProcessTxs(nil, l1Txs, nil, l2Txs)
  186. require.NoError(t, err)
  187. // check expected account keys values from tx inputs
  188. acc, err := sdb.GetAccount(common.Idx(256))
  189. require.NoError(t, err)
  190. assert.Equal(t, users[0].BJJ.Public().Compress().String(), acc.BJJ.String())
  191. assert.Equal(t, users[0].Addr.Hex(), acc.EthAddr.Hex())
  192. acc, err = sdb.GetAccount(common.Idx(257))
  193. require.NoError(t, err)
  194. assert.Equal(t, users[1].BJJ.Public().Compress().String(), acc.BJJ.String())
  195. assert.Equal(t, users[1].Addr.Hex(), acc.EthAddr.Hex())
  196. // check that there no exist more accounts
  197. _, err = sdb.GetAccount(common.Idx(258))
  198. require.NotNil(t, err)
  199. ptOut.ZKInputs.FeeIdxs[0] = common.Idx(257).BigInt()
  200. toHash, err := ptOut.ZKInputs.ToHashGlobalData()
  201. assert.NoError(t, err)
  202. // value from js test vector
  203. expectedToHash := "0000000000ff0000000001010000000000000000000000000000000000000000000000000000000000000000304a3f3aef4f416cca887aab7265227449077627138345c2eb25bf8ff946b09500000000000000000000000000000000000000000000000000000000000000007e5f4552091a69125d5dfcb7b8c2659029395bdf21b0a1688b37f77b1d1d5539ec3b826db5ac78b2513f574a04c50a7d4f8246d700000000000028a00000000000010000000000002b5ad5c4795c026514f8317c7a215e218dccd6cf093985b1993d9f743f9d7d943ed56f38601cb8b196db025f79650c4007c3054d00000000000028a000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010000010003e889000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000000001"
  204. // checks are splitted to find the difference easier
  205. assert.Equal(t, expectedToHash[:1000], hex.EncodeToString(toHash)[:1000])
  206. assert.Equal(t, expectedToHash[1000:2000], hex.EncodeToString(toHash)[1000:2000])
  207. assert.Equal(t, expectedToHash[2000:], hex.EncodeToString(toHash)[2000:])
  208. h, err := ptOut.ZKInputs.HashGlobalData()
  209. require.NoError(t, err)
  210. // value from js test vector
  211. assert.Equal(t, "20293112365009290386650039345314592436395562810005523677125576447132206192598", h.String())
  212. }
  213. // TestZKInputsEmpty:
  214. // tests:
  215. // - L1: empty
  216. // - L2: empty
  217. func TestZKInputsEmpty(t *testing.T) {
  218. dir, err := ioutil.TempDir("", "tmpdb")
  219. require.NoError(t, err)
  220. defer assert.Nil(t, os.RemoveAll(dir))
  221. nLevels := 16
  222. sdb, err := statedb.NewStateDB(dir, 128, statedb.TypeBatchBuilder, nLevels)
  223. require.NoError(t, err)
  224. chainID := uint16(0)
  225. config := Config{
  226. NLevels: uint32(nLevels),
  227. MaxTx: 3,
  228. MaxL1Tx: 2,
  229. MaxFeeTx: 2,
  230. ChainID: chainID,
  231. }
  232. tp := NewTxProcessor(sdb, config)
  233. // 0. Generate a batch from the empty state with no transactions
  234. coordIdxs := []common.Idx{}
  235. l1UserTxs := []common.L1Tx{}
  236. l1CoordTxs := []common.L1Tx{}
  237. l2Txs := []common.PoolL2Tx{}
  238. ptOut, err := tp.ProcessTxs(coordIdxs, l1UserTxs, l1CoordTxs, l2Txs)
  239. require.NoError(t, err)
  240. assert.Equal(t, "0", sdb.MT.Root().BigInt().String())
  241. assert.Equal(t, "0", ptOut.ZKInputs.Metadata.NewExitRootRaw.BigInt().String())
  242. // check that there are no accounts
  243. accs, err := sdb.GetAccounts()
  244. require.NoError(t, err)
  245. assert.Equal(t, 0, len(accs))
  246. h, err := ptOut.ZKInputs.HashGlobalData()
  247. require.NoError(t, err)
  248. assert.Equal(t, "3188598899537193557996756147565812826329089180539076403761918575055837892421", h.String())
  249. toHash, err := ptOut.ZKInputs.ToHashGlobalData()
  250. require.NoError(t, err)
  251. assert.Equal(t, "0000000000ff0000000000ff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", hex.EncodeToString(toHash))
  252. // printZKInputs(t, ptOut.ZKInputs)
  253. s, err := json.Marshal(ptOut.ZKInputs)
  254. require.NoError(t, err)
  255. // the 'expected' data has been checked with the circom circuits
  256. expected := `{"auxFromIdx":["0","0","0"],"auxToIdx":["0","0","0"],"ay1":["0","0","0"],"ay2":["0","0","0"],"ay3":["0","0"],"balance1":["0","0","0"],"balance2":["0","0","0"],"balance3":["0","0"],"currentNumBatch":"1","ethAddr1":["0","0","0"],"ethAddr2":["0","0","0"],"ethAddr3":["0","0"],"feeIdxs":["0","0"],"feePlanTokens":["0","0"],"fromBjjCompressed":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"fromEthAddr":["0","0","0"],"fromIdx":["0","0","0"],"globalChainID":"0","imAccFeeOut":[["0","0"],["0","0"]],"imExitRoot":["0","0"],"imFinalAccFee":["0","0"],"imInitStateRootFee":"0","imOnChain":["0","0"],"imOutIdx":["255","255"],"imStateRoot":["0","0"],"imStateRootFee":["0"],"isOld0_1":["0","0","0"],"isOld0_2":["0","0","0"],"loadAmountF":["0","0","0"],"maxNumBatch":["0","0","0"],"newAccount":["0","0","0"],"newExit":["0","0","0"],"nonce1":["0","0","0"],"nonce2":["0","0","0"],"nonce3":["0","0"],"oldKey1":["0","0","0"],"oldKey2":["0","0","0"],"oldLastIdx":"255","oldStateRoot":"0","oldValue1":["0","0","0"],"oldValue2":["0","0","0"],"onChain":["0","0","0"],"r8x":["0","0","0"],"r8y":["0","0","0"],"rqOffset":["0","0","0"],"rqToBjjAy":["0","0","0"],"rqToEthAddr":["0","0","0"],"rqTxCompressedDataV2":["0","0","0"],"s":["0","0","0"],"siblings1":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings2":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings3":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"sign1":["0","0","0"],"sign2":["0","0","0"],"sign3":["0","0"],"toBjjAy":["0","0","0"],"toEthAddr":["0","0","0"],"toIdx":["0","0","0"],"tokenID1":["0","0","0"],"tokenID2":["0","0","0"],"tokenID3":["0","0"],"txCompressedData":["3322668559","3322668559","3322668559"],"txCompressedDataV2":["0","0","0"]}`
  257. assert.Equal(t, expected, string(s))
  258. // 1. Generate a batch with two transactions that create one account
  259. // so that the state tree is not empty (same transactions as
  260. // TestZKInputs0)
  261. // same values than in the js test
  262. users := generateJsUsers(t)
  263. l1UserTxs = []common.L1Tx{
  264. {
  265. FromIdx: 0,
  266. DepositAmount: big.NewInt(16000000),
  267. Amount: big.NewInt(0),
  268. TokenID: 1,
  269. FromBJJ: users[0].BJJ.Public().Compress(),
  270. FromEthAddr: users[0].Addr,
  271. ToIdx: 0,
  272. Type: common.TxTypeCreateAccountDeposit,
  273. UserOrigin: true,
  274. },
  275. }
  276. l2Txs = []common.PoolL2Tx{
  277. {
  278. FromIdx: 256,
  279. ToIdx: 256,
  280. TokenID: 1,
  281. Amount: big.NewInt(1000),
  282. Nonce: 0,
  283. Fee: 0,
  284. Type: common.TxTypeTransfer,
  285. },
  286. }
  287. toSign, err := l2Txs[0].HashToSign(tp.config.ChainID)
  288. require.NoError(t, err)
  289. sig := users[0].BJJ.SignPoseidon(toSign)
  290. l2Txs[0].Signature = sig.Compress()
  291. ptOut, err = tp.ProcessTxs(nil, l1UserTxs, nil, l2Txs)
  292. require.NoError(t, err)
  293. rootNonZero := sdb.MT.Root()
  294. // check that there is 1 account
  295. accs, err = sdb.GetAccounts()
  296. require.NoError(t, err)
  297. assert.Equal(t, 1, len(accs))
  298. h, err = ptOut.ZKInputs.HashGlobalData()
  299. require.NoError(t, err)
  300. assert.Equal(t, "3310178391322068804285093727572639741003903261273589212922632857075167683076", h.String())
  301. toHash, err = ptOut.ZKInputs.ToHashGlobalData()
  302. require.NoError(t, err)
  303. assert.Equal(t, "0000000000ff0000000001000000000000000000000000000000000000000000000000000000000000000000071a61ed5a1ac052b0d1086a330c540b55318a07f6b7989573b9bbbb5380d1a900000000000000000000000000000000000000000000000000000000000000007e5f4552091a69125d5dfcb7b8c2659029395bdf21b0a1688b37f77b1d1d5539ec3b826db5ac78b2513f574a04c50a7d4f8246d700000000000028a0000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100010003e8000000000000000000000000000000000002", hex.EncodeToString(toHash))
  304. // 2. Generate a batch from a non-empty state with no transactions
  305. coordIdxs = []common.Idx{}
  306. l1UserTxs = []common.L1Tx{}
  307. l1CoordTxs = []common.L1Tx{}
  308. l2Txs = []common.PoolL2Tx{}
  309. ptOut, err = tp.ProcessTxs(coordIdxs, l1UserTxs, l1CoordTxs, l2Txs)
  310. require.NoError(t, err)
  311. assert.Equal(t, rootNonZero, sdb.MT.Root())
  312. assert.Equal(t, "0", ptOut.ZKInputs.Metadata.NewExitRootRaw.BigInt().String())
  313. // check that there is still 1 account
  314. accs, err = sdb.GetAccounts()
  315. require.NoError(t, err)
  316. assert.Equal(t, 1, len(accs))
  317. // printZKInputs(t, ptOut.ZKInputs)
  318. h, err = ptOut.ZKInputs.HashGlobalData()
  319. require.NoError(t, err)
  320. assert.Equal(t, "19357487518263066850851765738275153101092738034836476310547111817256740018046", h.String())
  321. toHash, err = ptOut.ZKInputs.ToHashGlobalData()
  322. require.NoError(t, err)
  323. assert.Equal(t, "000000000100000000000100071a61ed5a1ac052b0d1086a330c540b55318a07f6b7989573b9bbbb5380d1a9071a61ed5a1ac052b0d1086a330c540b55318a07f6b7989573b9bbbb5380d1a9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003", hex.EncodeToString(toHash))
  324. s, err = json.Marshal(ptOut.ZKInputs)
  325. require.NoError(t, err)
  326. // the 'expected' data has been checked with the circom circuits
  327. expected = `{"auxFromIdx":["0","0","0"],"auxToIdx":["0","0","0"],"ay1":["0","0","0"],"ay2":["0","0","0"],"ay3":["0","0"],"balance1":["0","0","0"],"balance2":["0","0","0"],"balance3":["0","0"],"currentNumBatch":"3","ethAddr1":["0","0","0"],"ethAddr2":["0","0","0"],"ethAddr3":["0","0"],"feeIdxs":["0","0"],"feePlanTokens":["0","0"],"fromBjjCompressed":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"fromEthAddr":["0","0","0"],"fromIdx":["0","0","0"],"globalChainID":"0","imAccFeeOut":[["0","0"],["0","0"]],"imExitRoot":["0","0"],"imFinalAccFee":["0","0"],"imInitStateRootFee":"3212803832159212591526550848126062808026208063555125878245901046146545013161","imOnChain":["0","0"],"imOutIdx":["256","256"],"imStateRoot":["3212803832159212591526550848126062808026208063555125878245901046146545013161","3212803832159212591526550848126062808026208063555125878245901046146545013161"],"imStateRootFee":["3212803832159212591526550848126062808026208063555125878245901046146545013161"],"isOld0_1":["0","0","0"],"isOld0_2":["0","0","0"],"loadAmountF":["0","0","0"],"maxNumBatch":["0","0","0"],"newAccount":["0","0","0"],"newExit":["0","0","0"],"nonce1":["0","0","0"],"nonce2":["0","0","0"],"nonce3":["0","0"],"oldKey1":["0","0","0"],"oldKey2":["0","0","0"],"oldLastIdx":"256","oldStateRoot":"3212803832159212591526550848126062808026208063555125878245901046146545013161","oldValue1":["0","0","0"],"oldValue2":["0","0","0"],"onChain":["0","0","0"],"r8x":["0","0","0"],"r8y":["0","0","0"],"rqOffset":["0","0","0"],"rqToBjjAy":["0","0","0"],"rqToEthAddr":["0","0","0"],"rqTxCompressedDataV2":["0","0","0"],"s":["0","0","0"],"siblings1":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings2":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings3":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"sign1":["0","0","0"],"sign2":["0","0","0"],"sign3":["0","0"],"toBjjAy":["0","0","0"],"toEthAddr":["0","0","0"],"toIdx":["0","0","0"],"tokenID1":["0","0","0"],"tokenID2":["0","0","0"],"tokenID3":["0","0"],"txCompressedData":["3322668559","3322668559","3322668559"],"txCompressedDataV2":["0","0","0"]}`
  328. assert.Equal(t, expected, string(s))
  329. }
  330. // TestZKInputs0:
  331. // tests:
  332. // - L1: CreateAccountDeposit
  333. // - L2: Transfer (without fees)
  334. // no Coordinator Idxs defined to receive the fees
  335. func TestZKInputs0(t *testing.T) {
  336. dir, err := ioutil.TempDir("", "tmpdb")
  337. require.NoError(t, err)
  338. defer assert.Nil(t, os.RemoveAll(dir))
  339. nLevels := 16
  340. sdb, err := statedb.NewStateDB(dir, 128, statedb.TypeBatchBuilder, nLevels)
  341. require.NoError(t, err)
  342. // same values than in the js test
  343. users := generateJsUsers(t)
  344. l1Txs := []common.L1Tx{
  345. {
  346. FromIdx: 0,
  347. DepositAmount: big.NewInt(16000000),
  348. Amount: big.NewInt(0),
  349. TokenID: 1,
  350. FromBJJ: users[0].BJJ.Public().Compress(),
  351. FromEthAddr: users[0].Addr,
  352. ToIdx: 0,
  353. Type: common.TxTypeCreateAccountDeposit,
  354. UserOrigin: true,
  355. },
  356. }
  357. l2Txs := []common.PoolL2Tx{
  358. {
  359. FromIdx: 256,
  360. ToIdx: 256,
  361. TokenID: 1,
  362. Amount: big.NewInt(1000),
  363. Nonce: 0,
  364. Fee: 0,
  365. Type: common.TxTypeTransfer,
  366. },
  367. }
  368. chainID := uint16(0)
  369. toSign, err := l2Txs[0].HashToSign(chainID)
  370. require.NoError(t, err)
  371. sig := users[0].BJJ.SignPoseidon(toSign)
  372. l2Txs[0].Signature = sig.Compress()
  373. config := Config{
  374. NLevels: uint32(nLevels),
  375. MaxTx: 3,
  376. MaxL1Tx: 2,
  377. MaxFeeTx: 2,
  378. ChainID: chainID,
  379. }
  380. tp := NewTxProcessor(sdb, config)
  381. ptOut, err := tp.ProcessTxs(nil, l1Txs, nil, l2Txs)
  382. require.NoError(t, err)
  383. // check expected account keys values from tx inputs
  384. acc, err := sdb.GetAccount(common.Idx(256))
  385. require.NoError(t, err)
  386. assert.Equal(t, users[0].BJJ.Public().Compress().String(), acc.BJJ.String())
  387. assert.Equal(t, users[0].Addr.Hex(), acc.EthAddr.Hex())
  388. // check that there no exist more accounts
  389. _, err = sdb.GetAccount(common.Idx(257))
  390. require.NotNil(t, err)
  391. // printZKInputs(t, ptOut.ZKInputs)
  392. h, err := ptOut.ZKInputs.HashGlobalData()
  393. require.NoError(t, err)
  394. assert.Equal(t, "10273997725311869157325593477103834352520120955255334791164183491223442653056", h.String())
  395. toHash, err := ptOut.ZKInputs.ToHashGlobalData()
  396. require.NoError(t, err)
  397. assert.Equal(t, "0000000000ff0000000001000000000000000000000000000000000000000000000000000000000000000000071a61ed5a1ac052b0d1086a330c540b55318a07f6b7989573b9bbbb5380d1a900000000000000000000000000000000000000000000000000000000000000007e5f4552091a69125d5dfcb7b8c2659029395bdf21b0a1688b37f77b1d1d5539ec3b826db5ac78b2513f574a04c50a7d4f8246d700000000000028a0000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100010003e8000000000000000000000000000000000001", hex.EncodeToString(toHash))
  398. s, err := json.Marshal(ptOut.ZKInputs)
  399. require.NoError(t, err)
  400. // the 'expected' data has been checked with the circom circuits
  401. expected := `{"auxFromIdx":["256","0","0"],"auxToIdx":["0","0","0"],"ay1":["15238403086306505038849621710779816852318505119327426213168494964113886299863","15238403086306505038849621710779816852318505119327426213168494964113886299863","0"],"ay2":["0","15238403086306505038849621710779816852318505119327426213168494964113886299863","0"],"ay3":["0","0"],"balance1":["16000000","16000000","0"],"balance2":["0","15999000","0"],"balance3":["0","0"],"currentNumBatch":"1","ethAddr1":["721457446580647751014191829380889690493307935711","721457446580647751014191829380889690493307935711","0"],"ethAddr2":["0","721457446580647751014191829380889690493307935711","0"],"ethAddr3":["0","0"],"feeIdxs":["0","0"],"feePlanTokens":["0","0"],"fromBjjCompressed":[["1","1","1","0","1","0","1","1","0","1","1","0","0","0","1","0","0","1","0","0","0","0","0","1","1","1","1","1","0","0","1","0","1","0","1","1","1","1","1","0","0","1","0","1","0","0","0","0","1","0","1","0","0","0","1","1","0","0","1","0","0","0","0","0","0","1","0","1","0","0","1","0","1","1","1","0","1","0","1","0","1","1","1","1","1","1","0","0","1","0","0","0","1","0","1","0","0","1","0","0","1","1","0","1","0","0","0","1","1","1","1","0","0","0","1","1","0","1","0","1","1","0","1","0","1","1","0","1","1","0","1","1","0","1","1","0","0","1","0","0","0","0","0","1","1","1","0","1","1","1","0","0","0","0","1","1","0","1","1","1","1","0","0","1","1","1","0","0","1","0","1","0","1","0","1","0","1","0","1","1","1","0","0","0","1","0","1","1","1","0","0","0","1","1","0","1","1","1","1","0","1","1","1","0","1","1","1","1","1","1","1","0","1","1","0","0","1","1","0","1","0","0","0","1","0","0","0","1","0","1","1","0","1","0","0","0","0","1","0","1","0","0","0","0","1","1","0","1","1","0","0","0","0","1","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"fromEthAddr":["721457446580647751014191829380889690493307935711","0","0"],"fromIdx":["0","256","0"],"globalChainID":"0","imAccFeeOut":[["0","0"],["0","0"]],"imExitRoot":["0","0"],"imFinalAccFee":["0","0"],"imInitStateRootFee":"3212803832159212591526550848126062808026208063555125878245901046146545013161","imOnChain":["1","0"],"imOutIdx":["256","256"],"imStateRoot":["2999178063326948609414231200730958862089790119006655219527433501846141543551","3212803832159212591526550848126062808026208063555125878245901046146545013161"],"imStateRootFee":["3212803832159212591526550848126062808026208063555125878245901046146545013161"],"isOld0_1":["1","0","0"],"isOld0_2":["0","0","0"],"loadAmountF":["10400","0","0"],"maxNumBatch":["0","0","0"],"newAccount":["1","0","0"],"newExit":["0","0","0"],"nonce1":["0","0","0"],"nonce2":["0","1","0"],"nonce3":["0","0"],"oldKey1":["0","0","0"],"oldKey2":["0","0","0"],"oldLastIdx":"255","oldStateRoot":"0","oldValue1":["0","0","0"],"oldValue2":["0","0","0"],"onChain":["1","0","0"],"r8x":["0","13339118088097183560380359255316479838355724395928453439485234854234470298884","0"],"r8y":["0","12062876403986777372637801733000285846673058725183957648593976028822138986587","0"],"rqOffset":["0","0","0"],"rqToBjjAy":["0","0","0"],"rqToEthAddr":["0","0","0"],"rqTxCompressedDataV2":["0","0","0"],"s":["0","1429292460142966038093363510339656828866419125109324886747095533117015974779","0"],"siblings1":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings2":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings3":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"sign1":["0","0","0"],"sign2":["0","0","0"],"sign3":["0","0"],"toBjjAy":["0","0","0"],"toEthAddr":["0","0","0"],"toIdx":["0","256","0"],"tokenID1":["1","1","0"],"tokenID2":["0","1","0"],"tokenID3":["0","0"],"txCompressedData":["1461501637330902918203684832716283019659255211535","1483802382529433561627630154640673862706524841487","3322668559"],"txCompressedDataV2":["0","5271525021049092038181634317484288","0"]}`
  402. assert.Equal(t, expected, string(s))
  403. }
  404. // TestZKInputs1:
  405. // tests:
  406. // - L1: CreateAccountDeposit
  407. // - L2: Transfer (with fees)
  408. func TestZKInputs1(t *testing.T) {
  409. dir, err := ioutil.TempDir("", "tmpdb")
  410. require.NoError(t, err)
  411. defer assert.Nil(t, os.RemoveAll(dir))
  412. nLevels := 16
  413. sdb, err := statedb.NewStateDB(dir, 128, statedb.TypeBatchBuilder, nLevels)
  414. require.NoError(t, err)
  415. // same values than in the js test
  416. users := generateJsUsers(t)
  417. l1Txs := []common.L1Tx{
  418. {
  419. FromIdx: 0,
  420. DepositAmount: big.NewInt(16000000),
  421. Amount: big.NewInt(0),
  422. TokenID: 1,
  423. FromBJJ: users[0].BJJ.Public().Compress(),
  424. FromEthAddr: users[0].Addr,
  425. ToIdx: 0,
  426. Type: common.TxTypeCreateAccountDeposit,
  427. UserOrigin: true,
  428. },
  429. {
  430. FromIdx: 0,
  431. DepositAmount: big.NewInt(16000000),
  432. Amount: big.NewInt(0),
  433. TokenID: 1,
  434. FromBJJ: users[1].BJJ.Public().Compress(),
  435. FromEthAddr: users[1].Addr,
  436. ToIdx: 0,
  437. Type: common.TxTypeCreateAccountDeposit,
  438. UserOrigin: true,
  439. },
  440. }
  441. l2Txs := []common.PoolL2Tx{
  442. {
  443. FromIdx: 256,
  444. ToIdx: 256,
  445. TokenID: 1,
  446. Amount: big.NewInt(1000),
  447. Nonce: 0,
  448. Fee: 126,
  449. Type: common.TxTypeTransfer,
  450. },
  451. }
  452. chainID := uint16(0)
  453. toSign, err := l2Txs[0].HashToSign(chainID)
  454. require.NoError(t, err)
  455. sig := users[0].BJJ.SignPoseidon(toSign)
  456. l2Txs[0].Signature = sig.Compress()
  457. config := Config{
  458. NLevels: uint32(nLevels),
  459. MaxTx: 3,
  460. MaxL1Tx: 2,
  461. MaxFeeTx: 2,
  462. ChainID: chainID,
  463. }
  464. tp := NewTxProcessor(sdb, config)
  465. coordIdxs := []common.Idx{257}
  466. ptOut, err := tp.ProcessTxs(coordIdxs, l1Txs, nil, l2Txs)
  467. require.NoError(t, err)
  468. // check expected account keys values from tx inputs
  469. acc, err := sdb.GetAccount(common.Idx(256))
  470. require.NoError(t, err)
  471. assert.Equal(t, users[0].BJJ.Public().Compress().String(), acc.BJJ.String())
  472. assert.Equal(t, users[0].Addr.Hex(), acc.EthAddr.Hex())
  473. assert.Equal(t, "15999899", acc.Balance.String())
  474. acc, err = sdb.GetAccount(common.Idx(257))
  475. require.NoError(t, err)
  476. assert.Equal(t, users[1].BJJ.Public().Compress().String(), acc.BJJ.String())
  477. assert.Equal(t, users[1].Addr.Hex(), acc.EthAddr.Hex())
  478. assert.Equal(t, "16000101", acc.Balance.String())
  479. // check that there no exist more accounts
  480. _, err = sdb.GetAccount(common.Idx(258))
  481. require.NotNil(t, err)
  482. // printZKInputs(t, ptOut.ZKInputs)
  483. h, err := ptOut.ZKInputs.HashGlobalData()
  484. require.NoError(t, err)
  485. assert.Equal(t, "11039366437749764484706691779656824178800407917434257418748834397596260744468", h.String())
  486. toHash, err := ptOut.ZKInputs.ToHashGlobalData()
  487. require.NoError(t, err)
  488. assert.Equal(t, "0000000000ff0000000001010000000000000000000000000000000000000000000000000000000000000000036d607b790b93bb1768d5390803b5a4a1f77e46755f57900930b14454faf95c00000000000000000000000000000000000000000000000000000000000000007e5f4552091a69125d5dfcb7b8c2659029395bdf21b0a1688b37f77b1d1d5539ec3b826db5ac78b2513f574a04c50a7d4f8246d700000000000028a00000000000010000000000002b5ad5c4795c026514f8317c7a215e218dccd6cf093985b1993d9f743f9d7d943ed56f38601cb8b196db025f79650c4007c3054d00000000000028a000000000000100000000000000000000000000000000000000000100010003e87e01010000000000000001", hex.EncodeToString(toHash))
  489. s, err := json.Marshal(ptOut.ZKInputs)
  490. require.NoError(t, err)
  491. // the 'expected' data has been checked with the circom circuits
  492. expected := `{"auxFromIdx":["256","257","0"],"auxToIdx":["0","0","0"],"ay1":["15238403086306505038849621710779816852318505119327426213168494964113886299863","4172448640254579435434214421479401747968866348490029667576411173067925161293","15238403086306505038849621710779816852318505119327426213168494964113886299863"],"ay2":["0","0","15238403086306505038849621710779816852318505119327426213168494964113886299863"],"ay3":["4172448640254579435434214421479401747968866348490029667576411173067925161293","0"],"balance1":["16000000","16000000","16000000"],"balance2":["0","0","15998899"],"balance3":["16000000","0"],"currentNumBatch":"1","ethAddr1":["721457446580647751014191829380889690493307935711","247512291986854564435551364600938690683113101007","721457446580647751014191829380889690493307935711"],"ethAddr2":["0","0","721457446580647751014191829380889690493307935711"],"ethAddr3":["247512291986854564435551364600938690683113101007","0"],"feeIdxs":["257","0"],"feePlanTokens":["1","0"],"fromBjjCompressed":[["1","1","1","0","1","0","1","1","0","1","1","0","0","0","1","0","0","1","0","0","0","0","0","1","1","1","1","1","0","0","1","0","1","0","1","1","1","1","1","0","0","1","0","1","0","0","0","0","1","0","1","0","0","0","1","1","0","0","1","0","0","0","0","0","0","1","0","1","0","0","1","0","1","1","1","0","1","0","1","0","1","1","1","1","1","1","0","0","1","0","0","0","1","0","1","0","0","1","0","0","1","1","0","1","0","0","0","1","1","1","1","0","0","0","1","1","0","1","0","1","1","0","1","0","1","1","0","1","1","0","1","1","0","1","1","0","0","1","0","0","0","0","0","1","1","1","0","1","1","1","0","0","0","0","1","1","0","1","1","1","1","0","0","1","1","1","0","0","1","0","1","0","1","0","1","0","1","0","1","1","1","0","0","0","1","0","1","1","1","0","0","0","1","1","0","1","1","1","1","0","1","1","1","0","1","1","1","1","1","1","1","0","1","1","0","0","1","1","0","1","0","0","0","1","0","0","0","1","0","1","1","0","1","0","0","0","0","1","0","1","0","0","0","0","1","1","0","1","1","0","0","0","0","1","0","0"],["1","0","1","1","0","0","1","0","1","0","1","0","0","0","0","0","1","1","0","0","0","0","1","1","1","1","1","0","0","0","0","0","0","0","0","0","0","0","1","0","0","0","1","1","0","0","0","0","1","0","1","0","0","1","1","0","1","0","0","1","1","1","1","0","1","1","1","1","1","0","1","0","0","1","0","0","0","0","0","0","1","1","0","1","1","0","1","1","0","1","1","0","1","0","0","1","1","0","0","0","1","1","0","1","0","0","0","1","1","1","0","1","0","0","1","1","1","0","0","0","0","0","0","0","0","1","1","0","0","0","0","1","1","1","0","0","1","1","1","1","0","1","1","0","1","0","1","0","1","0","1","1","0","1","1","1","1","1","0","0","0","0","1","0","1","0","0","1","1","0","1","1","1","1","1","0","1","0","1","1","1","0","0","1","1","1","1","1","1","1","0","0","0","0","1","0","1","1","1","0","1","1","1","1","1","0","0","1","1","0","1","1","1","1","0","0","1","0","0","1","1","0","0","1","1","0","0","0","1","1","0","1","1","0","1","0","0","0","0","1","1","0","0","1","1","1","0","0","1","0","0","1","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"fromEthAddr":["721457446580647751014191829380889690493307935711","247512291986854564435551364600938690683113101007","0"],"fromIdx":["0","0","256"],"globalChainID":"0","imAccFeeOut":[["0","0"],["0","0"]],"imExitRoot":["0","0"],"imFinalAccFee":["101","0"],"imInitStateRootFee":"10660728613879129016661596154319504485937170756181586060561759832613498905432","imOnChain":["1","1"],"imOutIdx":["256","257"],"imStateRoot":["2999178063326948609414231200730958862089790119006655219527433501846141543551","13160175861809095962915811919507877524206523306071085047160493107056995190544"],"imStateRootFee":["1550190772280924834409423240867892593473592863918771212295716656664630983004"],"isOld0_1":["1","0","0"],"isOld0_2":["0","0","0"],"loadAmountF":["10400","10400","0"],"maxNumBatch":["0","0","0"],"newAccount":["1","1","0"],"newExit":["0","0","0"],"nonce1":["0","0","0"],"nonce2":["0","0","1"],"nonce3":["0","0"],"oldKey1":["0","256","0"],"oldKey2":["0","0","0"],"oldLastIdx":"255","oldStateRoot":"0","oldValue1":["0","9733782510199048326382833205201407219982604211594942097825192094127807440165","0"],"oldValue2":["0","0","0"],"onChain":["1","1","0"],"r8x":["0","0","16795818329006817411605347777151783287113601795569690834743955502344582990059"],"r8y":["0","0","21153110871938011270027204820675751452345817312713349225139208384264949654114"],"rqOffset":["0","0","0"],"rqToBjjAy":["0","0","0"],"rqToEthAddr":["0","0","0"],"rqTxCompressedDataV2":["0","0","0"],"s":["0","0","1550352334297856444344240780544275542131334387040150478134835458055364079268"],"siblings1":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["6975841694765113541634698345295957238501610055097872059913911260522365532165","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings2":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["6975841694765113541634698345295957238501610055097872059913911260522365532165","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings3":[["9827704113668630072730115158977131501210702363656902211840117643154933433410","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"sign1":["0","0","0"],"sign2":["0","0","0"],"sign3":["0","0"],"toBjjAy":["0","0","0"],"toEthAddr":["0","0","0"],"toIdx":["0","0","256"],"tokenID1":["1","1","1"],"tokenID2":["0","0","1"],"tokenID3":["1","0"],"txCompressedData":["1461501637330902918203684832716283019659255211535","1461501637330902918203684832716283019659255211535","869620039695611037216780722449287736442401358123623346624340758723552783"],"txCompressedDataV2":["0","0","3089511010385631938450432878260044363267416251956459471104"]}`
  493. assert.Equal(t, expected, string(s))
  494. }
  495. // TestZKInputs2:
  496. // Similar to TestZKInputs1, but with bigger circuit
  497. // tests:
  498. // - L1: CreateAccountDeposit
  499. // - L2: Transfer (with fees)
  500. func TestZKInputs2(t *testing.T) {
  501. dir, err := ioutil.TempDir("", "tmpdb")
  502. require.NoError(t, err)
  503. defer assert.Nil(t, os.RemoveAll(dir))
  504. nLevels := 16
  505. sdb, err := statedb.NewStateDB(dir, 128, statedb.TypeBatchBuilder, nLevels)
  506. require.NoError(t, err)
  507. // same values than in the js test
  508. users := generateJsUsers(t)
  509. l1Txs := []common.L1Tx{
  510. {
  511. FromIdx: 0,
  512. DepositAmount: big.NewInt(16000000),
  513. Amount: big.NewInt(0),
  514. TokenID: 1,
  515. FromBJJ: users[0].BJJ.Public().Compress(),
  516. FromEthAddr: users[0].Addr,
  517. ToIdx: 0,
  518. Type: common.TxTypeCreateAccountDeposit,
  519. UserOrigin: true,
  520. },
  521. {
  522. FromIdx: 0,
  523. DepositAmount: big.NewInt(16000000),
  524. Amount: big.NewInt(0),
  525. TokenID: 1,
  526. FromBJJ: users[1].BJJ.Public().Compress(),
  527. FromEthAddr: users[1].Addr,
  528. ToIdx: 0,
  529. Type: common.TxTypeCreateAccountDeposit,
  530. UserOrigin: true,
  531. },
  532. {
  533. FromIdx: 0,
  534. DepositAmount: big.NewInt(16000000),
  535. Amount: big.NewInt(0),
  536. TokenID: 1,
  537. FromBJJ: users[2].BJJ.Public().Compress(),
  538. FromEthAddr: users[2].Addr,
  539. ToIdx: 0,
  540. Type: common.TxTypeCreateAccountDeposit,
  541. UserOrigin: true,
  542. },
  543. {
  544. FromIdx: 0,
  545. DepositAmount: big.NewInt(16000000),
  546. Amount: big.NewInt(0),
  547. TokenID: 1,
  548. FromBJJ: users[3].BJJ.Public().Compress(),
  549. FromEthAddr: users[3].Addr,
  550. ToIdx: 0,
  551. Type: common.TxTypeCreateAccountDeposit,
  552. UserOrigin: true,
  553. },
  554. }
  555. l2Txs := []common.PoolL2Tx{
  556. {
  557. FromIdx: 256,
  558. ToIdx: 258,
  559. TokenID: 1,
  560. Amount: big.NewInt(1000),
  561. Nonce: 0,
  562. Fee: 126,
  563. Type: common.TxTypeTransfer,
  564. },
  565. {
  566. FromIdx: 256,
  567. ToIdx: 259,
  568. TokenID: 1,
  569. Amount: big.NewInt(1000),
  570. Nonce: 1,
  571. Fee: 126,
  572. Type: common.TxTypeTransfer,
  573. },
  574. }
  575. chainID := uint16(0)
  576. l2Txs[0] = signL2Tx(t, chainID, users[0], l2Txs[0])
  577. l2Txs[1] = signL2Tx(t, chainID, users[0], l2Txs[1])
  578. config := Config{
  579. NLevels: uint32(nLevels),
  580. MaxTx: 10,
  581. MaxL1Tx: 4,
  582. MaxFeeTx: 2,
  583. ChainID: chainID,
  584. }
  585. tp := NewTxProcessor(sdb, config)
  586. coordIdxs := []common.Idx{257}
  587. ptOut, err := tp.ProcessTxs(coordIdxs, l1Txs, nil, l2Txs)
  588. require.NoError(t, err)
  589. // check expected account keys values from tx inputs
  590. acc, err := sdb.GetAccount(common.Idx(256))
  591. require.NoError(t, err)
  592. assert.Equal(t, users[0].BJJ.Public().Compress().String(), acc.BJJ.String())
  593. assert.Equal(t, users[0].Addr.Hex(), acc.EthAddr.Hex())
  594. assert.Equal(t, "15997798", acc.Balance.String())
  595. acc, err = sdb.GetAccount(common.Idx(257))
  596. require.NoError(t, err)
  597. assert.Equal(t, users[1].BJJ.Public().Compress().String(), acc.BJJ.String())
  598. assert.Equal(t, users[1].Addr.Hex(), acc.EthAddr.Hex())
  599. assert.Equal(t, "16000202", acc.Balance.String())
  600. acc, err = sdb.GetAccount(common.Idx(258))
  601. require.NoError(t, err)
  602. assert.Equal(t, users[2].BJJ.Public().Compress().String(), acc.BJJ.String())
  603. assert.Equal(t, users[2].Addr.Hex(), acc.EthAddr.Hex())
  604. assert.Equal(t, "16001000", acc.Balance.String())
  605. acc, err = sdb.GetAccount(common.Idx(259))
  606. require.NoError(t, err)
  607. assert.Equal(t, users[3].BJJ.Public().Compress().String(), acc.BJJ.String())
  608. assert.Equal(t, users[3].Addr.Hex(), acc.EthAddr.Hex())
  609. assert.Equal(t, "16001000", acc.Balance.String())
  610. // check that there no exist more accounts
  611. _, err = sdb.GetAccount(common.Idx(260))
  612. require.NotNil(t, err)
  613. // printZKInputs(t, ptOut.ZKInputs)
  614. h, err := ptOut.ZKInputs.HashGlobalData()
  615. require.NoError(t, err)
  616. assert.Equal(t, "12526925720009671154604304301604163669184748177914925908444300255027382653822", h.String())
  617. toHash, err := ptOut.ZKInputs.ToHashGlobalData()
  618. require.NoError(t, err)
  619. assert.Equal(t, "0000000000ff00000000010300000000000000000000000000000000000000000000000000000000000000000916786f85a645e04f50cb0304768196730037209eebf2625661f060a9b2496800000000000000000000000000000000000000000000000000000000000000007e5f4552091a69125d5dfcb7b8c2659029395bdf21b0a1688b37f77b1d1d5539ec3b826db5ac78b2513f574a04c50a7d4f8246d700000000000028a00000000000010000000000002b5ad5c4795c026514f8317c7a215e218dccd6cf093985b1993d9f743f9d7d943ed56f38601cb8b196db025f79650c4007c3054d00000000000028a00000000000010000000000006813eb9362372eef6200f3b1dbc3f819671cba6911fe412a6f9b7532ff9263f16c4062892406e203252a952aeb62457202a0ff3800000000000028a00000000000010000000000001eff47bc3a10a45d4b230b5d10e37751fe6aa7180b764f45f5aded093b1a347515c0335275e28f44d3fcfba77fbe901140e619c700000000000028a0000000000001000000000000000000000000000000000000000000000000000000000000000000000100010203e87e0100010303e87e0000000000000000000000000000000000000000000000000000000001010000000000000001", hex.EncodeToString(toHash))
  620. s, err := json.Marshal(ptOut.ZKInputs)
  621. require.NoError(t, err)
  622. // the 'expected' data has been checked with the circom circuits
  623. expected := `{"auxFromIdx":["256","257","258","259","0","0","0","0","0","0"],"auxToIdx":["0","0","0","0","0","0","0","0","0","0"],"ay1":["15238403086306505038849621710779816852318505119327426213168494964113886299863","4172448640254579435434214421479401747968866348490029667576411173067925161293","8138547337953155637712635674046872799144091023272207542905444721067900862264","5184476412130556544090991668866402222418200486089222951317185404775371774407","15238403086306505038849621710779816852318505119327426213168494964113886299863","15238403086306505038849621710779816852318505119327426213168494964113886299863","0","0","0","0"],"ay2":["0","0","0","0","8138547337953155637712635674046872799144091023272207542905444721067900862264","5184476412130556544090991668866402222418200486089222951317185404775371774407","0","0","0","0"],"ay3":["4172448640254579435434214421479401747968866348490029667576411173067925161293","0"],"balance1":["16000000","16000000","16000000","16000000","16000000","15998899","0","0","0","0"],"balance2":["0","0","0","0","16000000","16000000","0","0","0","0"],"balance3":["16000000","0"],"currentNumBatch":"1","ethAddr1":["721457446580647751014191829380889690493307935711","247512291986854564435551364600938690683113101007","594179275863704165266696689399235767493667371625","176962662172908264953938498278848696642639144728","721457446580647751014191829380889690493307935711","721457446580647751014191829380889690493307935711","0","0","0","0"],"ethAddr2":["0","0","0","0","594179275863704165266696689399235767493667371625","176962662172908264953938498278848696642639144728","0","0","0","0"],"ethAddr3":["247512291986854564435551364600938690683113101007","0"],"feeIdxs":["257","0"],"feePlanTokens":["1","0"],"fromBjjCompressed":[["1","1","1","0","1","0","1","1","0","1","1","0","0","0","1","0","0","1","0","0","0","0","0","1","1","1","1","1","0","0","1","0","1","0","1","1","1","1","1","0","0","1","0","1","0","0","0","0","1","0","1","0","0","0","1","1","0","0","1","0","0","0","0","0","0","1","0","1","0","0","1","0","1","1","1","0","1","0","1","0","1","1","1","1","1","1","0","0","1","0","0","0","1","0","1","0","0","1","0","0","1","1","0","1","0","0","0","1","1","1","1","0","0","0","1","1","0","1","0","1","1","0","1","0","1","1","0","1","1","0","1","1","0","1","1","0","0","1","0","0","0","0","0","1","1","1","0","1","1","1","0","0","0","0","1","1","0","1","1","1","1","0","0","1","1","1","0","0","1","0","1","0","1","0","1","0","1","0","1","1","1","0","0","0","1","0","1","1","1","0","0","0","1","1","0","1","1","1","1","0","1","1","1","0","1","1","1","1","1","1","1","0","1","1","0","0","1","1","0","1","0","0","0","1","0","0","0","1","0","1","1","0","1","0","0","0","0","1","0","1","0","0","0","0","1","1","0","1","1","0","0","0","0","1","0","0"],["1","0","1","1","0","0","1","0","1","0","1","0","0","0","0","0","1","1","0","0","0","0","1","1","1","1","1","0","0","0","0","0","0","0","0","0","0","0","1","0","0","0","1","1","0","0","0","0","1","0","1","0","0","1","1","0","1","0","0","1","1","1","1","0","1","1","1","1","1","0","1","0","0","1","0","0","0","0","0","0","1","1","0","1","1","0","1","1","0","1","1","0","1","0","0","1","1","0","0","0","1","1","0","1","0","0","0","1","1","1","0","1","0","0","1","1","1","0","0","0","0","0","0","0","0","1","1","0","0","0","0","1","1","1","0","0","1","1","1","1","0","1","1","0","1","0","1","0","1","0","1","1","0","1","1","1","1","1","0","0","0","0","1","0","1","0","0","1","1","0","1","1","1","1","1","0","1","0","1","1","1","0","0","1","1","1","1","1","1","1","0","0","0","0","1","0","1","1","1","0","1","1","1","1","1","0","0","1","1","0","1","1","1","1","0","0","1","0","0","1","1","0","0","1","1","0","0","0","1","1","0","1","1","0","1","0","0","0","0","1","1","0","0","1","1","1","0","0","1","0","0","1","0","0","0","0"],["0","0","0","1","1","1","0","0","1","1","1","1","1","1","1","1","0","0","0","0","0","1","0","1","0","1","0","0","0","0","0","0","0","1","0","0","1","1","1","0","1","0","1","0","0","0","1","0","0","1","0","0","0","1","1","0","1","1","0","1","0","1","1","1","0","1","0","1","0","1","0","0","1","0","1","0","1","0","0","1","0","1","0","1","0","1","0","0","1","0","1","0","0","1","0","0","1","1","0","0","0","0","0","0","0","1","0","0","0","1","1","1","0","1","1","0","0","0","0","0","0","0","1","0","0","1","0","0","1","0","0","1","0","0","0","1","0","1","0","0","0","1","1","0","0","0","0","0","0","0","1","0","0","0","1","1","0","1","1","0","1","0","0","0","1","1","1","1","1","1","0","0","0","1","1","0","0","1","0","0","1","0","0","1","1","1","1","1","1","1","1","1","0","1","0","0","1","1","0","0","1","0","1","0","1","1","1","0","1","1","0","1","1","0","0","1","1","1","1","1","0","1","1","0","0","1","0","1","0","1","0","0","1","0","0","0","0","0","1","0","0","1","1","1","1","1","1","1","1","0","0","0","1","0","0","0"],["1","1","1","0","0","0","1","1","1","0","0","1","1","0","0","0","0","1","1","0","0","1","1","1","0","0","0","0","0","0","1","0","1","0","0","0","1","0","0","0","0","0","0","0","1","0","0","1","0","1","1","1","1","1","0","1","1","1","1","1","1","1","1","0","1","1","1","0","0","1","0","1","1","1","0","1","1","1","1","1","0","0","1","1","1","1","1","1","1","1","0","0","1","0","1","1","0","0","1","0","0","0","1","0","1","1","1","1","0","0","0","1","0","1","0","0","0","1","1","1","1","0","1","0","1","1","1","0","0","1","0","0","1","0","1","0","1","1","0","0","1","1","0","0","0","0","0","0","0","0","1","1","1","0","1","0","1","0","0","0","1","0","1","0","1","1","1","0","0","0","1","0","1","1","0","0","0","1","0","1","1","0","0","0","1","1","0","1","1","1","0","0","1","0","0","1","0","0","0","0","1","0","1","1","0","1","1","1","1","0","1","1","0","1","0","1","1","0","1","0","1","1","1","1","1","0","1","0","0","0","1","0","1","1","1","1","0","0","1","0","0","1","1","0","1","1","1","0","1","1","0","1","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"fromEthAddr":["721457446580647751014191829380889690493307935711","247512291986854564435551364600938690683113101007","594179275863704165266696689399235767493667371625","176962662172908264953938498278848696642639144728","0","0","0","0","0","0"],"fromIdx":["0","0","0","0","256","256","0","0","0","0"],"globalChainID":"0","imAccFeeOut":[["0","0"],["0","0"],["0","0"],["0","0"],["101","0"],["202","0"],["202","0"],["202","0"],["202","0"]],"imExitRoot":["0","0","0","0","0","0","0","0","0"],"imFinalAccFee":["202","0"],"imInitStateRootFee":"11102416505971276127293972570397361714598994868311229974249826487060684688197","imOnChain":["1","1","1","1","0","0","0","0","0"],"imOutIdx":["256","257","258","259","259","259","259","259","259"],"imStateRoot":["2999178063326948609414231200730958862089790119006655219527433501846141543551","13160175861809095962915811919507877524206523306071085047160493107056995190544","6981081575125964439064848745251852976562872673661163359815312764236115200222","12287200745694319621025881114682538954756900570406181328753188227270350941803","10250910571353243150359059549936965649098556707015028714542118863411160731635","11102416505971276127293972570397361714598994868311229974249826487060684688197","11102416505971276127293972570397361714598994868311229974249826487060684688197","11102416505971276127293972570397361714598994868311229974249826487060684688197","11102416505971276127293972570397361714598994868311229974249826487060684688197"],"imStateRootFee":["4110517488865152389773850641074094192962655219669746287253968903130252986728"],"isOld0_1":["1","0","0","0","0","0","0","0","0","0"],"isOld0_2":["0","0","0","0","0","0","0","0","0","0"],"loadAmountF":["10400","10400","10400","10400","0","0","0","0","0","0"],"maxNumBatch":["0","0","0","0","0","0","0","0","0","0"],"newAccount":["1","1","1","1","0","0","0","0","0","0"],"newExit":["0","0","0","0","0","0","0","0","0","0"],"nonce1":["0","0","0","0","0","1","0","0","0","0"],"nonce2":["0","0","0","0","0","0","0","0","0","0"],"nonce3":["0","0"],"oldKey1":["0","256","256","257","0","0","0","0","0","0"],"oldKey2":["0","0","0","0","0","0","0","0","0","0"],"oldLastIdx":"255","oldStateRoot":"0","oldValue1":["0","9733782510199048326382833205201407219982604211594942097825192094127807440165","9733782510199048326382833205201407219982604211594942097825192094127807440165","17760137544353091380819593442189011627672167337464348873007461140156851422987","0","0","0","0","0","0"],"oldValue2":["0","0","0","0","0","0","0","0","0","0"],"onChain":["1","1","1","1","0","0","0","0","0","0"],"r8x":["0","0","0","0","5214090684236684851573641059575591118676476987573336170365486786637312665141","17818752874555175254292826108469784891786151976165952117435881323396526148981","0","0","0","0"],"r8y":["0","0","0","0","3568441662719387930655444674281943536423464418783443425289988425360036364264","7870851773538784486620881929410103548804126936780372631545590676485414360508","0","0","0","0"],"rqOffset":["0","0","0","0","0","0","0","0","0","0"],"rqToBjjAy":["0","0","0","0","0","0","0","0","0","0"],"rqToEthAddr":["0","0","0","0","0","0","0","0","0","0"],"rqTxCompressedDataV2":["0","0","0","0","0","0","0","0","0","0"],"s":["0","0","0","0","974535875596637445705358386750029200510091659451458393452031111972389260285","383599574514235269420771702006588662767158113271594446015439990815783784544","0","0","0","0"],"siblings1":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["6975841694765113541634698345295957238501610055097872059913911260522365532165","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["16340650608214686026509819657637793341613276710241727968165631912246770201551","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["20096881635736058727699182872953735227378445790497970658442161994753383780529","16179075207476077480163273158757030768504935550886919319708484674028389406807","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["20096881635736058727699182872953735227378445790497970658442161994753383780529","9666104145689704191764010810632978949926547298995332970899083004213180315751","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings2":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["20096881635736058727699182872953735227378445790497970658442161994753383780529","18206494837933532633746175540777421367331523385545468990813257189787137445167","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["9141974547200611535034738074275487715083927494193481815706633586422651686652","6975841694765113541634698345295957238501610055097872059913911260522365532165","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings3":[["9141974547200611535034738074275487715083927494193481815706633586422651686652","3300045819699360541652863975392028819717279937342922306336031453914844695187","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"sign1":["0","0","0","0","0","0","0","0","0","0"],"sign2":["0","0","0","0","0","0","0","0","0","0"],"sign3":["0","0"],"toBjjAy":["0","0","0","0","0","0","0","0","0","0"],"toEthAddr":["0","0","0","0","0","0","0","0","0","0"],"toIdx":["0","0","0","0","258","259","0","0","0","0"],"tokenID1":["1","1","1","1","1","1","0","0","0","0"],"tokenID2":["0","0","0","0","1","1","0","0","0","0"],"tokenID3":["1","0"],"txCompressedData":["1461501637330902918203684832716283019659255211535","1461501637330902918203684832716283019659255211535","1461501637330902918203684832716283019659255211535","1461501637330902918203684832716283019659255211535","869620039695611037216780722449287736442401516579948375153015945811453455","869620039695617314318516109130051572231824803474526991772798003389916687","3322668559","3322668559","3322668559","3322668559"],"txCompressedDataV2":["0","0","0","0","3089511010385631938450432878260044363267416814906412892416","3089511010385654239195631408883185898985689744742895583488","0","0","0","0"]}`
  624. assert.Equal(t, expected, string(s))
  625. }
  626. // TestZKInputs3:
  627. // tests:
  628. // - L1: CreateAccountDeposit, CreateAccountDepositTransfer
  629. // - L2: Transfer
  630. func TestZKInputs3(t *testing.T) {
  631. dir, err := ioutil.TempDir("", "tmpdb")
  632. require.NoError(t, err)
  633. defer assert.Nil(t, os.RemoveAll(dir))
  634. nLevels := 16
  635. sdb, err := statedb.NewStateDB(dir, 128, statedb.TypeBatchBuilder, nLevels)
  636. require.NoError(t, err)
  637. // same values than in the js test
  638. users := generateJsUsers(t)
  639. l1Txs := []common.L1Tx{
  640. {
  641. FromIdx: 0,
  642. DepositAmount: big.NewInt(16000000),
  643. Amount: big.NewInt(0),
  644. TokenID: 1,
  645. FromBJJ: users[0].BJJ.Public().Compress(),
  646. FromEthAddr: users[0].Addr,
  647. ToIdx: 0,
  648. Type: common.TxTypeCreateAccountDeposit,
  649. UserOrigin: true,
  650. },
  651. {
  652. FromIdx: 0,
  653. DepositAmount: big.NewInt(16000000),
  654. Amount: big.NewInt(0),
  655. TokenID: 1,
  656. FromBJJ: users[1].BJJ.Public().Compress(),
  657. FromEthAddr: users[1].Addr,
  658. ToIdx: 0,
  659. Type: common.TxTypeCreateAccountDeposit,
  660. UserOrigin: true,
  661. },
  662. {
  663. FromIdx: 0,
  664. DepositAmount: big.NewInt(16000000),
  665. Amount: big.NewInt(0),
  666. TokenID: 1,
  667. FromBJJ: users[2].BJJ.Public().Compress(),
  668. FromEthAddr: users[2].Addr,
  669. ToIdx: 0,
  670. Type: common.TxTypeCreateAccountDeposit,
  671. UserOrigin: true,
  672. },
  673. {
  674. FromIdx: 0,
  675. DepositAmount: big.NewInt(16000000),
  676. Amount: big.NewInt(1000),
  677. TokenID: 1,
  678. FromBJJ: users[3].BJJ.Public().Compress(),
  679. FromEthAddr: users[3].Addr,
  680. ToIdx: 258,
  681. Type: common.TxTypeCreateAccountDepositTransfer,
  682. UserOrigin: true,
  683. },
  684. }
  685. l2Txs := []common.PoolL2Tx{
  686. {
  687. FromIdx: 256,
  688. ToIdx: 258,
  689. TokenID: 1,
  690. Amount: big.NewInt(1000),
  691. Nonce: 0,
  692. Fee: 126,
  693. Type: common.TxTypeTransfer,
  694. },
  695. {
  696. FromIdx: 256,
  697. ToIdx: 259,
  698. TokenID: 1,
  699. Amount: big.NewInt(1000),
  700. Nonce: 1,
  701. Fee: 126,
  702. Type: common.TxTypeTransfer,
  703. },
  704. }
  705. chainID := uint16(0)
  706. l2Txs[0] = signL2Tx(t, chainID, users[0], l2Txs[0])
  707. l2Txs[1] = signL2Tx(t, chainID, users[0], l2Txs[1])
  708. config := Config{
  709. NLevels: uint32(nLevels),
  710. MaxTx: 10,
  711. MaxL1Tx: 4,
  712. MaxFeeTx: 2,
  713. ChainID: chainID,
  714. }
  715. tp := NewTxProcessor(sdb, config)
  716. coordIdxs := []common.Idx{257}
  717. ptOut, err := tp.ProcessTxs(coordIdxs, l1Txs, nil, l2Txs)
  718. require.NoError(t, err)
  719. // check expected account keys values from tx inputs
  720. acc, err := sdb.GetAccount(common.Idx(256))
  721. require.NoError(t, err)
  722. assert.Equal(t, users[0].BJJ.Public().Compress().String(), acc.BJJ.String())
  723. assert.Equal(t, users[0].Addr.Hex(), acc.EthAddr.Hex())
  724. assert.Equal(t, "15997798", acc.Balance.String())
  725. acc, err = sdb.GetAccount(common.Idx(257))
  726. require.NoError(t, err)
  727. assert.Equal(t, users[1].BJJ.Public().Compress().String(), acc.BJJ.String())
  728. assert.Equal(t, users[1].Addr.Hex(), acc.EthAddr.Hex())
  729. assert.Equal(t, "16000202", acc.Balance.String())
  730. acc, err = sdb.GetAccount(common.Idx(258))
  731. require.NoError(t, err)
  732. assert.Equal(t, users[2].BJJ.Public().Compress().String(), acc.BJJ.String())
  733. assert.Equal(t, users[2].Addr.Hex(), acc.EthAddr.Hex())
  734. assert.Equal(t, "16002000", acc.Balance.String())
  735. acc, err = sdb.GetAccount(common.Idx(259))
  736. require.NoError(t, err)
  737. assert.Equal(t, users[3].BJJ.Public().Compress().String(), acc.BJJ.String())
  738. assert.Equal(t, users[3].Addr.Hex(), acc.EthAddr.Hex())
  739. assert.Equal(t, "16000000", acc.Balance.String())
  740. // check that there no exist more accounts
  741. _, err = sdb.GetAccount(common.Idx(260))
  742. require.NotNil(t, err)
  743. // printZKInputs(t, ptOut.ZKInputs)
  744. h, err := ptOut.ZKInputs.HashGlobalData()
  745. require.NoError(t, err)
  746. assert.Equal(t, "1682933724803327922788366889801787496427567332311306715504283480759105793769", h.String())
  747. toHash, err := ptOut.ZKInputs.ToHashGlobalData()
  748. require.NoError(t, err)
  749. assert.Equal(t, "0000000000ff00000000010300000000000000000000000000000000000000000000000000000000000000000750abd49c5e7d53127c396ef371f280ee1ed7b2ca719fd356b625abe87478ab00000000000000000000000000000000000000000000000000000000000000007e5f4552091a69125d5dfcb7b8c2659029395bdf21b0a1688b37f77b1d1d5539ec3b826db5ac78b2513f574a04c50a7d4f8246d700000000000028a00000000000010000000000002b5ad5c4795c026514f8317c7a215e218dccd6cf093985b1993d9f743f9d7d943ed56f38601cb8b196db025f79650c4007c3054d00000000000028a00000000000010000000000006813eb9362372eef6200f3b1dbc3f819671cba6911fe412a6f9b7532ff9263f16c4062892406e203252a952aeb62457202a0ff3800000000000028a00000000000010000000000001eff47bc3a10a45d4b230b5d10e37751fe6aa7180b764f45f5aded093b1a347515c0335275e28f44d3fcfba77fbe901140e619c700000000000028a003e8000000010000000001020000000000000000000000000000000000000000000000010203e8000100010203e87e0100010303e87e0000000000000000000000000000000000000000000000000000000001010000000000000001", hex.EncodeToString(toHash))
  750. s, err := json.Marshal(ptOut.ZKInputs)
  751. require.NoError(t, err)
  752. // the 'expected' data has been checked with the circom circuits
  753. expected := `{"auxFromIdx":["256","257","258","259","0","0","0","0","0","0"],"auxToIdx":["0","0","0","0","0","0","0","0","0","0"],"ay1":["15238403086306505038849621710779816852318505119327426213168494964113886299863","4172448640254579435434214421479401747968866348490029667576411173067925161293","8138547337953155637712635674046872799144091023272207542905444721067900862264","5184476412130556544090991668866402222418200486089222951317185404775371774407","15238403086306505038849621710779816852318505119327426213168494964113886299863","15238403086306505038849621710779816852318505119327426213168494964113886299863","0","0","0","0"],"ay2":["0","0","0","8138547337953155637712635674046872799144091023272207542905444721067900862264","8138547337953155637712635674046872799144091023272207542905444721067900862264","5184476412130556544090991668866402222418200486089222951317185404775371774407","0","0","0","0"],"ay3":["4172448640254579435434214421479401747968866348490029667576411173067925161293","0"],"balance1":["16000000","16000000","16000000","16000000","16000000","15998899","0","0","0","0"],"balance2":["0","0","0","16000000","16001000","15999000","0","0","0","0"],"balance3":["16000000","0"],"currentNumBatch":"1","ethAddr1":["721457446580647751014191829380889690493307935711","247512291986854564435551364600938690683113101007","594179275863704165266696689399235767493667371625","176962662172908264953938498278848696642639144728","721457446580647751014191829380889690493307935711","721457446580647751014191829380889690493307935711","0","0","0","0"],"ethAddr2":["0","0","0","594179275863704165266696689399235767493667371625","594179275863704165266696689399235767493667371625","176962662172908264953938498278848696642639144728","0","0","0","0"],"ethAddr3":["247512291986854564435551364600938690683113101007","0"],"feeIdxs":["257","0"],"feePlanTokens":["1","0"],"fromBjjCompressed":[["1","1","1","0","1","0","1","1","0","1","1","0","0","0","1","0","0","1","0","0","0","0","0","1","1","1","1","1","0","0","1","0","1","0","1","1","1","1","1","0","0","1","0","1","0","0","0","0","1","0","1","0","0","0","1","1","0","0","1","0","0","0","0","0","0","1","0","1","0","0","1","0","1","1","1","0","1","0","1","0","1","1","1","1","1","1","0","0","1","0","0","0","1","0","1","0","0","1","0","0","1","1","0","1","0","0","0","1","1","1","1","0","0","0","1","1","0","1","0","1","1","0","1","0","1","1","0","1","1","0","1","1","0","1","1","0","0","1","0","0","0","0","0","1","1","1","0","1","1","1","0","0","0","0","1","1","0","1","1","1","1","0","0","1","1","1","0","0","1","0","1","0","1","0","1","0","1","0","1","1","1","0","0","0","1","0","1","1","1","0","0","0","1","1","0","1","1","1","1","0","1","1","1","0","1","1","1","1","1","1","1","0","1","1","0","0","1","1","0","1","0","0","0","1","0","0","0","1","0","1","1","0","1","0","0","0","0","1","0","1","0","0","0","0","1","1","0","1","1","0","0","0","0","1","0","0"],["1","0","1","1","0","0","1","0","1","0","1","0","0","0","0","0","1","1","0","0","0","0","1","1","1","1","1","0","0","0","0","0","0","0","0","0","0","0","1","0","0","0","1","1","0","0","0","0","1","0","1","0","0","1","1","0","1","0","0","1","1","1","1","0","1","1","1","1","1","0","1","0","0","1","0","0","0","0","0","0","1","1","0","1","1","0","1","1","0","1","1","0","1","0","0","1","1","0","0","0","1","1","0","1","0","0","0","1","1","1","0","1","0","0","1","1","1","0","0","0","0","0","0","0","0","1","1","0","0","0","0","1","1","1","0","0","1","1","1","1","0","1","1","0","1","0","1","0","1","0","1","1","0","1","1","1","1","1","0","0","0","0","1","0","1","0","0","1","1","0","1","1","1","1","1","0","1","0","1","1","1","0","0","1","1","1","1","1","1","1","0","0","0","0","1","0","1","1","1","0","1","1","1","1","1","0","0","1","1","0","1","1","1","1","0","0","1","0","0","1","1","0","0","1","1","0","0","0","1","1","0","1","1","0","1","0","0","0","0","1","1","0","0","1","1","1","0","0","1","0","0","1","0","0","0","0"],["0","0","0","1","1","1","0","0","1","1","1","1","1","1","1","1","0","0","0","0","0","1","0","1","0","1","0","0","0","0","0","0","0","1","0","0","1","1","1","0","1","0","1","0","0","0","1","0","0","1","0","0","0","1","1","0","1","1","0","1","0","1","1","1","0","1","0","1","0","1","0","0","1","0","1","0","1","0","0","1","0","1","0","1","0","1","0","0","1","0","1","0","0","1","0","0","1","1","0","0","0","0","0","0","0","1","0","0","0","1","1","1","0","1","1","0","0","0","0","0","0","0","1","0","0","1","0","0","1","0","0","1","0","0","0","1","0","1","0","0","0","1","1","0","0","0","0","0","0","0","1","0","0","0","1","1","0","1","1","0","1","0","0","0","1","1","1","1","1","1","0","0","0","1","1","0","0","1","0","0","1","0","0","1","1","1","1","1","1","1","1","1","0","1","0","0","1","1","0","0","1","0","1","0","1","1","1","0","1","1","0","1","1","0","0","1","1","1","1","1","0","1","1","0","0","1","0","1","0","1","0","0","1","0","0","0","0","0","1","0","0","1","1","1","1","1","1","1","1","0","0","0","1","0","0","0"],["1","1","1","0","0","0","1","1","1","0","0","1","1","0","0","0","0","1","1","0","0","1","1","1","0","0","0","0","0","0","1","0","1","0","0","0","1","0","0","0","0","0","0","0","1","0","0","1","0","1","1","1","1","1","0","1","1","1","1","1","1","1","1","0","1","1","1","0","0","1","0","1","1","1","0","1","1","1","1","1","0","0","1","1","1","1","1","1","1","1","0","0","1","0","1","1","0","0","1","0","0","0","1","0","1","1","1","1","0","0","0","1","0","1","0","0","0","1","1","1","1","0","1","0","1","1","1","0","0","1","0","0","1","0","1","0","1","1","0","0","1","1","0","0","0","0","0","0","0","0","1","1","1","0","1","0","1","0","0","0","1","0","1","0","1","1","1","0","0","0","1","0","1","1","0","0","0","1","0","1","1","0","0","0","1","1","0","1","1","1","0","0","1","0","0","1","0","0","0","0","1","0","1","1","0","1","1","1","1","0","1","1","0","1","0","1","1","0","1","0","1","1","1","1","1","0","1","0","0","0","1","0","1","1","1","1","0","0","1","0","0","1","1","0","1","1","1","0","1","1","0","1","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"fromEthAddr":["721457446580647751014191829380889690493307935711","247512291986854564435551364600938690683113101007","594179275863704165266696689399235767493667371625","176962662172908264953938498278848696642639144728","0","0","0","0","0","0"],"fromIdx":["0","0","0","0","256","256","0","0","0","0"],"globalChainID":"0","imAccFeeOut":[["0","0"],["0","0"],["0","0"],["0","0"],["101","0"],["202","0"],["202","0"],["202","0"],["202","0"]],"imExitRoot":["0","0","0","0","0","0","0","0","0"],"imFinalAccFee":["202","0"],"imInitStateRootFee":"660298296221720587715464107871363519814014167794571411274660805654406132224","imOnChain":["1","1","1","1","0","0","0","0","0"],"imOutIdx":["256","257","258","259","259","259","259","259","259"],"imStateRoot":["2999178063326948609414231200730958862089790119006655219527433501846141543551","13160175861809095962915811919507877524206523306071085047160493107056995190544","6981081575125964439064848745251852976562872673661163359815312764236115200222","18742699641842024218518539644585365065319339031637650525643349677415413836215","5553837031118563569913065891794973669972647936447393968697314204773427982499","660298296221720587715464107871363519814014167794571411274660805654406132224","660298296221720587715464107871363519814014167794571411274660805654406132224","660298296221720587715464107871363519814014167794571411274660805654406132224","660298296221720587715464107871363519814014167794571411274660805654406132224"],"imStateRootFee":["3308723635866718333423423656393176054575538143139845302701731186303921584299"],"isOld0_1":["1","0","0","0","0","0","0","0","0","0"],"isOld0_2":["0","0","0","0","0","0","0","0","0","0"],"loadAmountF":["10400","10400","10400","10400","0","0","0","0","0","0"],"maxNumBatch":["0","0","0","0","0","0","0","0","0","0"],"newAccount":["1","1","1","1","0","0","0","0","0","0"],"newExit":["0","0","0","0","0","0","0","0","0","0"],"nonce1":["0","0","0","0","0","1","0","0","0","0"],"nonce2":["0","0","0","0","0","0","0","0","0","0"],"nonce3":["0","0"],"oldKey1":["0","256","256","257","0","0","0","0","0","0"],"oldKey2":["0","0","0","0","0","0","0","0","0","0"],"oldLastIdx":"255","oldStateRoot":"0","oldValue1":["0","9733782510199048326382833205201407219982604211594942097825192094127807440165","9733782510199048326382833205201407219982604211594942097825192094127807440165","17760137544353091380819593442189011627672167337464348873007461140156851422987","0","0","0","0","0","0"],"oldValue2":["0","0","0","0","0","0","0","0","0","0"],"onChain":["1","1","1","1","0","0","0","0","0","0"],"r8x":["0","0","0","0","5214090684236684851573641059575591118676476987573336170365486786637312665141","17818752874555175254292826108469784891786151976165952117435881323396526148981","0","0","0","0"],"r8y":["0","0","0","0","3568441662719387930655444674281943536423464418783443425289988425360036364264","7870851773538784486620881929410103548804126936780372631545590676485414360508","0","0","0","0"],"rqOffset":["0","0","0","0","0","0","0","0","0","0"],"rqToBjjAy":["0","0","0","0","0","0","0","0","0","0"],"rqToEthAddr":["0","0","0","0","0","0","0","0","0","0"],"rqTxCompressedDataV2":["0","0","0","0","0","0","0","0","0","0"],"s":["0","0","0","0","974535875596637445705358386750029200510091659451458393452031111972389260285","383599574514235269420771702006588662767158113271594446015439990815783784544","0","0","0","0"],"siblings1":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["6975841694765113541634698345295957238501610055097872059913911260522365532165","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["16340650608214686026509819657637793341613276710241727968165631912246770201551","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["3906683858335927171613201671293906040747641928097999623324892263219255592303","9666104145689704191764010810632978949926547298995332970899083004213180315751","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["3906683858335927171613201671293906040747641928097999623324892263219255592303","10205751785764748733130453523485784457289835445766998152121354177086045667438","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings2":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["3906683858335927171613201671293906040747641928097999623324892263219255592303","2999178063326948609414231200730958862089790119006655219527433501846141543551","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["3906683858335927171613201671293906040747641928097999623324892263219255592303","18206494837933532633746175540777421367331523385545468990813257189787137445167","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["19231347822404684635111199148554673409332133388988820416302079819214156093396","6975841694765113541634698345295957238501610055097872059913911260522365532165","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings3":[["19231347822404684635111199148554673409332133388988820416302079819214156093396","13541302049513296336003438340864405238868193605138313566457322174991540205948","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"sign1":["0","0","0","0","0","0","0","0","0","0"],"sign2":["0","0","0","0","0","0","0","0","0","0"],"sign3":["0","0"],"toBjjAy":["0","0","0","0","0","0","0","0","0","0"],"toEthAddr":["0","0","0","0","0","0","0","0","0","0"],"toIdx":["0","0","0","258","258","259","0","0","0","0"],"tokenID1":["1","1","1","1","1","1","0","0","0","0"],"tokenID2":["0","0","0","1","1","1","0","0","0","0"],"tokenID3":["1","0"],"txCompressedData":["1461501637330902918203684832716283019659255211535","1461501637330902918203684832716283019659255211535","1461501637330902918203684832716283019659255211535","1483802382529433561786086479669130480299574814223","869620039695611037216780722449287736442401516579948375153015945811453455","869620039695617314318516109130051572231824803474526991772798003389916687","3322668559","3322668559","3322668559","3322668559"],"txCompressedDataV2":["0","0","0","0","3089511010385631938450432878260044363267416814906412892416","3089511010385654239195631408883185898985689744742895583488","0","0","0","0"]}`
  754. assert.Equal(t, expected, string(s))
  755. }
  756. // TestZKInputs4:
  757. // tests:
  758. // - L1: CreateAccountDeposit, CreateAccountDepositTransfer, DepositTransfer
  759. // - L2: Transfer
  760. func TestZKInputs4(t *testing.T) {
  761. dir, err := ioutil.TempDir("", "tmpdb")
  762. require.NoError(t, err)
  763. defer assert.Nil(t, os.RemoveAll(dir))
  764. nLevels := 16
  765. sdb, err := statedb.NewStateDB(dir, 128, statedb.TypeBatchBuilder, nLevels)
  766. require.NoError(t, err)
  767. // same values than in the js test
  768. users := generateJsUsers(t)
  769. l1Txs := []common.L1Tx{
  770. {
  771. FromIdx: 0,
  772. DepositAmount: big.NewInt(16000000),
  773. Amount: big.NewInt(0),
  774. TokenID: 1,
  775. FromBJJ: users[0].BJJ.Public().Compress(),
  776. FromEthAddr: users[0].Addr,
  777. ToIdx: 0,
  778. Type: common.TxTypeCreateAccountDeposit,
  779. UserOrigin: true,
  780. },
  781. {
  782. FromIdx: 0,
  783. DepositAmount: big.NewInt(16000000),
  784. Amount: big.NewInt(0),
  785. TokenID: 1,
  786. FromBJJ: users[1].BJJ.Public().Compress(),
  787. FromEthAddr: users[1].Addr,
  788. ToIdx: 0,
  789. Type: common.TxTypeCreateAccountDeposit,
  790. UserOrigin: true,
  791. },
  792. {
  793. FromIdx: 0,
  794. DepositAmount: big.NewInt(16000000),
  795. Amount: big.NewInt(0),
  796. TokenID: 1,
  797. FromBJJ: users[2].BJJ.Public().Compress(),
  798. FromEthAddr: users[2].Addr,
  799. ToIdx: 0,
  800. Type: common.TxTypeCreateAccountDeposit,
  801. UserOrigin: true,
  802. },
  803. {
  804. FromIdx: 0,
  805. DepositAmount: big.NewInt(16000000),
  806. Amount: big.NewInt(1000),
  807. TokenID: 1,
  808. FromBJJ: users[3].BJJ.Public().Compress(),
  809. FromEthAddr: users[3].Addr,
  810. ToIdx: 258,
  811. Type: common.TxTypeCreateAccountDepositTransfer,
  812. UserOrigin: true,
  813. },
  814. {
  815. FromIdx: 258,
  816. DepositAmount: big.NewInt(16000000),
  817. Amount: big.NewInt(1000),
  818. TokenID: 1,
  819. FromEthAddr: users[2].Addr,
  820. ToIdx: 259,
  821. Type: common.TxTypeDepositTransfer,
  822. UserOrigin: true,
  823. },
  824. }
  825. l2Txs := []common.PoolL2Tx{
  826. {
  827. FromIdx: 256,
  828. ToIdx: 258,
  829. TokenID: 1,
  830. Amount: big.NewInt(1000),
  831. Nonce: 0,
  832. Fee: 126,
  833. Type: common.TxTypeTransfer,
  834. },
  835. {
  836. FromIdx: 256,
  837. ToIdx: 259,
  838. TokenID: 1,
  839. Amount: big.NewInt(1000),
  840. Nonce: 1,
  841. Fee: 126,
  842. Type: common.TxTypeTransfer,
  843. },
  844. }
  845. chainID := uint16(0)
  846. l2Txs[0] = signL2Tx(t, chainID, users[0], l2Txs[0])
  847. l2Txs[1] = signL2Tx(t, chainID, users[0], l2Txs[1])
  848. config := Config{
  849. NLevels: uint32(nLevels),
  850. MaxTx: 10,
  851. MaxL1Tx: 5,
  852. MaxFeeTx: 2,
  853. ChainID: chainID,
  854. }
  855. tp := NewTxProcessor(sdb, config)
  856. coordIdxs := []common.Idx{257}
  857. ptOut, err := tp.ProcessTxs(coordIdxs, l1Txs, nil, l2Txs)
  858. require.NoError(t, err)
  859. // check expected account keys values from tx inputs
  860. acc, err := sdb.GetAccount(common.Idx(256))
  861. require.NoError(t, err)
  862. assert.Equal(t, users[0].BJJ.Public().Compress().String(), acc.BJJ.String())
  863. assert.Equal(t, users[0].Addr.Hex(), acc.EthAddr.Hex())
  864. assert.Equal(t, "15997798", acc.Balance.String())
  865. acc, err = sdb.GetAccount(common.Idx(257))
  866. require.NoError(t, err)
  867. assert.Equal(t, users[1].BJJ.Public().Compress().String(), acc.BJJ.String())
  868. assert.Equal(t, users[1].Addr.Hex(), acc.EthAddr.Hex())
  869. assert.Equal(t, "16000202", acc.Balance.String())
  870. acc, err = sdb.GetAccount(common.Idx(258))
  871. require.NoError(t, err)
  872. assert.Equal(t, users[2].BJJ.Public().Compress().String(), acc.BJJ.String())
  873. assert.Equal(t, users[2].Addr.Hex(), acc.EthAddr.Hex())
  874. assert.Equal(t, "32001000", acc.Balance.String())
  875. acc, err = sdb.GetAccount(common.Idx(259))
  876. require.NoError(t, err)
  877. assert.Equal(t, users[3].BJJ.Public().Compress().String(), acc.BJJ.String())
  878. assert.Equal(t, users[3].Addr.Hex(), acc.EthAddr.Hex())
  879. assert.Equal(t, "16001000", acc.Balance.String())
  880. // check that there no exist more accounts
  881. _, err = sdb.GetAccount(common.Idx(260))
  882. require.NotNil(t, err)
  883. // printZKInputs(t, ptOut.ZKInputs)
  884. h, err := ptOut.ZKInputs.HashGlobalData()
  885. require.NoError(t, err)
  886. assert.Equal(t, "8056737004368088257329554655788232667874156671353906753220094018422125420753", h.String())
  887. toHash, err := ptOut.ZKInputs.ToHashGlobalData()
  888. require.NoError(t, err)
  889. assert.Equal(t, "0000000000ff000000000103000000000000000000000000000000000000000000000000000000000000000026b29b88d97f2474acc89cea43a2a695b2850083bf5ae33e59f09d061923106600000000000000000000000000000000000000000000000000000000000000007e5f4552091a69125d5dfcb7b8c2659029395bdf21b0a1688b37f77b1d1d5539ec3b826db5ac78b2513f574a04c50a7d4f8246d700000000000028a00000000000010000000000002b5ad5c4795c026514f8317c7a215e218dccd6cf093985b1993d9f743f9d7d943ed56f38601cb8b196db025f79650c4007c3054d00000000000028a00000000000010000000000006813eb9362372eef6200f3b1dbc3f819671cba6911fe412a6f9b7532ff9263f16c4062892406e203252a952aeb62457202a0ff3800000000000028a00000000000010000000000001eff47bc3a10a45d4b230b5d10e37751fe6aa7180b764f45f5aded093b1a347515c0335275e28f44d3fcfba77fbe901140e619c700000000000028a003e8000000010000000001026813eb9362372eef6200f3b1dbc3f819671cba69000000000000000000000000000000000000000000000000000000000000000000000000010228a003e8000000010000000001030000000000000000000000000000000000000000000000010203e8000102010303e8000100010203e87e0100010303e87e00000000000000000000000000000000000000000001010000000000000001", hex.EncodeToString(toHash))
  890. s, err := json.Marshal(ptOut.ZKInputs)
  891. require.NoError(t, err)
  892. // the 'expected' data has been checked with the circom circuits
  893. expected := `{"auxFromIdx":["256","257","258","259","0","0","0","0","0","0"],"auxToIdx":["0","0","0","0","0","0","0","0","0","0"],"ay1":["15238403086306505038849621710779816852318505119327426213168494964113886299863","4172448640254579435434214421479401747968866348490029667576411173067925161293","8138547337953155637712635674046872799144091023272207542905444721067900862264","5184476412130556544090991668866402222418200486089222951317185404775371774407","8138547337953155637712635674046872799144091023272207542905444721067900862264","15238403086306505038849621710779816852318505119327426213168494964113886299863","15238403086306505038849621710779816852318505119327426213168494964113886299863","0","0","0"],"ay2":["0","0","0","8138547337953155637712635674046872799144091023272207542905444721067900862264","5184476412130556544090991668866402222418200486089222951317185404775371774407","8138547337953155637712635674046872799144091023272207542905444721067900862264","5184476412130556544090991668866402222418200486089222951317185404775371774407","0","0","0"],"ay3":["4172448640254579435434214421479401747968866348490029667576411173067925161293","0"],"balance1":["16000000","16000000","16000000","16000000","16001000","16000000","15998899","0","0","0"],"balance2":["0","0","0","16000000","15999000","32000000","16000000","0","0","0"],"balance3":["16000000","0"],"currentNumBatch":"1","ethAddr1":["721457446580647751014191829380889690493307935711","247512291986854564435551364600938690683113101007","594179275863704165266696689399235767493667371625","176962662172908264953938498278848696642639144728","594179275863704165266696689399235767493667371625","721457446580647751014191829380889690493307935711","721457446580647751014191829380889690493307935711","0","0","0"],"ethAddr2":["0","0","0","594179275863704165266696689399235767493667371625","176962662172908264953938498278848696642639144728","594179275863704165266696689399235767493667371625","176962662172908264953938498278848696642639144728","0","0","0"],"ethAddr3":["247512291986854564435551364600938690683113101007","0"],"feeIdxs":["257","0"],"feePlanTokens":["1","0"],"fromBjjCompressed":[["1","1","1","0","1","0","1","1","0","1","1","0","0","0","1","0","0","1","0","0","0","0","0","1","1","1","1","1","0","0","1","0","1","0","1","1","1","1","1","0","0","1","0","1","0","0","0","0","1","0","1","0","0","0","1","1","0","0","1","0","0","0","0","0","0","1","0","1","0","0","1","0","1","1","1","0","1","0","1","0","1","1","1","1","1","1","0","0","1","0","0","0","1","0","1","0","0","1","0","0","1","1","0","1","0","0","0","1","1","1","1","0","0","0","1","1","0","1","0","1","1","0","1","0","1","1","0","1","1","0","1","1","0","1","1","0","0","1","0","0","0","0","0","1","1","1","0","1","1","1","0","0","0","0","1","1","0","1","1","1","1","0","0","1","1","1","0","0","1","0","1","0","1","0","1","0","1","0","1","1","1","0","0","0","1","0","1","1","1","0","0","0","1","1","0","1","1","1","1","0","1","1","1","0","1","1","1","1","1","1","1","0","1","1","0","0","1","1","0","1","0","0","0","1","0","0","0","1","0","1","1","0","1","0","0","0","0","1","0","1","0","0","0","0","1","1","0","1","1","0","0","0","0","1","0","0"],["1","0","1","1","0","0","1","0","1","0","1","0","0","0","0","0","1","1","0","0","0","0","1","1","1","1","1","0","0","0","0","0","0","0","0","0","0","0","1","0","0","0","1","1","0","0","0","0","1","0","1","0","0","1","1","0","1","0","0","1","1","1","1","0","1","1","1","1","1","0","1","0","0","1","0","0","0","0","0","0","1","1","0","1","1","0","1","1","0","1","1","0","1","0","0","1","1","0","0","0","1","1","0","1","0","0","0","1","1","1","0","1","0","0","1","1","1","0","0","0","0","0","0","0","0","1","1","0","0","0","0","1","1","1","0","0","1","1","1","1","0","1","1","0","1","0","1","0","1","0","1","1","0","1","1","1","1","1","0","0","0","0","1","0","1","0","0","1","1","0","1","1","1","1","1","0","1","0","1","1","1","0","0","1","1","1","1","1","1","1","0","0","0","0","1","0","1","1","1","0","1","1","1","1","1","0","0","1","1","0","1","1","1","1","0","0","1","0","0","1","1","0","0","1","1","0","0","0","1","1","0","1","1","0","1","0","0","0","0","1","1","0","0","1","1","1","0","0","1","0","0","1","0","0","0","0"],["0","0","0","1","1","1","0","0","1","1","1","1","1","1","1","1","0","0","0","0","0","1","0","1","0","1","0","0","0","0","0","0","0","1","0","0","1","1","1","0","1","0","1","0","0","0","1","0","0","1","0","0","0","1","1","0","1","1","0","1","0","1","1","1","0","1","0","1","0","1","0","0","1","0","1","0","1","0","0","1","0","1","0","1","0","1","0","0","1","0","1","0","0","1","0","0","1","1","0","0","0","0","0","0","0","1","0","0","0","1","1","1","0","1","1","0","0","0","0","0","0","0","1","0","0","1","0","0","1","0","0","1","0","0","0","1","0","1","0","0","0","1","1","0","0","0","0","0","0","0","1","0","0","0","1","1","0","1","1","0","1","0","0","0","1","1","1","1","1","1","0","0","0","1","1","0","0","1","0","0","1","0","0","1","1","1","1","1","1","1","1","1","0","1","0","0","1","1","0","0","1","0","1","0","1","1","1","0","1","1","0","1","1","0","0","1","1","1","1","1","0","1","1","0","0","1","0","1","0","1","0","0","1","0","0","0","0","0","1","0","0","1","1","1","1","1","1","1","1","0","0","0","1","0","0","0"],["1","1","1","0","0","0","1","1","1","0","0","1","1","0","0","0","0","1","1","0","0","1","1","1","0","0","0","0","0","0","1","0","1","0","0","0","1","0","0","0","0","0","0","0","1","0","0","1","0","1","1","1","1","1","0","1","1","1","1","1","1","1","1","0","1","1","1","0","0","1","0","1","1","1","0","1","1","1","1","1","0","0","1","1","1","1","1","1","1","1","0","0","1","0","1","1","0","0","1","0","0","0","1","0","1","1","1","1","0","0","0","1","0","1","0","0","0","1","1","1","1","0","1","0","1","1","1","0","0","1","0","0","1","0","1","0","1","1","0","0","1","1","0","0","0","0","0","0","0","0","1","1","1","0","1","0","1","0","0","0","1","0","1","0","1","1","1","0","0","0","1","0","1","1","0","0","0","1","0","1","1","0","0","0","1","1","0","1","1","1","0","0","1","0","0","1","0","0","0","0","1","0","1","1","0","1","1","1","1","0","1","1","0","1","0","1","1","0","1","0","1","1","1","1","1","0","1","0","0","0","1","0","1","1","1","1","0","0","1","0","0","1","1","0","1","1","1","0","1","1","0","1","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"fromEthAddr":["721457446580647751014191829380889690493307935711","247512291986854564435551364600938690683113101007","594179275863704165266696689399235767493667371625","176962662172908264953938498278848696642639144728","594179275863704165266696689399235767493667371625","0","0","0","0","0"],"fromIdx":["0","0","0","0","258","256","256","0","0","0"],"globalChainID":"0","imAccFeeOut":[["0","0"],["0","0"],["0","0"],["0","0"],["0","0"],["101","0"],["202","0"],["202","0"],["202","0"]],"imExitRoot":["0","0","0","0","0","0","0","0","0"],"imFinalAccFee":["202","0"],"imInitStateRootFee":"19127107215286374489054211636116456191505636617421358644027585051020512265397","imOnChain":["1","1","1","1","1","0","0","0","0"],"imOutIdx":["256","257","258","259","259","259","259","259","259"],"imStateRoot":["2999178063326948609414231200730958862089790119006655219527433501846141543551","13160175861809095962915811919507877524206523306071085047160493107056995190544","6981081575125964439064848745251852976562872673661163359815312764236115200222","18742699641842024218518539644585365065319339031637650525643349677415413836215","12450029416789389340587057106517708645555412334757679179127991480936342868234","9062679461210901741949618163007900980517139479732174224282858950730924649772","19127107215286374489054211636116456191505636617421358644027585051020512265397","19127107215286374489054211636116456191505636617421358644027585051020512265397","19127107215286374489054211636116456191505636617421358644027585051020512265397"],"imStateRootFee":["17503460483836245082648104569654226931139598404908736640553354492264851902566"],"isOld0_1":["1","0","0","0","0","0","0","0","0","0"],"isOld0_2":["0","0","0","0","0","0","0","0","0","0"],"loadAmountF":["10400","10400","10400","10400","10400","0","0","0","0","0"],"maxNumBatch":["0","0","0","0","0","0","0","0","0","0"],"newAccount":["1","1","1","1","0","0","0","0","0","0"],"newExit":["0","0","0","0","0","0","0","0","0","0"],"nonce1":["0","0","0","0","0","0","1","0","0","0"],"nonce2":["0","0","0","0","0","0","0","0","0","0"],"nonce3":["0","0"],"oldKey1":["0","256","256","257","0","0","0","0","0","0"],"oldKey2":["0","0","0","0","0","0","0","0","0","0"],"oldLastIdx":"255","oldStateRoot":"0","oldValue1":["0","9733782510199048326382833205201407219982604211594942097825192094127807440165","9733782510199048326382833205201407219982604211594942097825192094127807440165","17760137544353091380819593442189011627672167337464348873007461140156851422987","0","0","0","0","0","0"],"oldValue2":["0","0","0","0","0","0","0","0","0","0"],"onChain":["1","1","1","1","1","0","0","0","0","0"],"r8x":["0","0","0","0","0","5214090684236684851573641059575591118676476987573336170365486786637312665141","17818752874555175254292826108469784891786151976165952117435881323396526148981","0","0","0"],"r8y":["0","0","0","0","0","3568441662719387930655444674281943536423464418783443425289988425360036364264","7870851773538784486620881929410103548804126936780372631545590676485414360508","0","0","0"],"rqOffset":["0","0","0","0","0","0","0","0","0","0"],"rqToBjjAy":["0","0","0","0","0","0","0","0","0","0"],"rqToEthAddr":["0","0","0","0","0","0","0","0","0","0"],"rqTxCompressedDataV2":["0","0","0","0","0","0","0","0","0","0"],"s":["0","0","0","0","0","974535875596637445705358386750029200510091659451458393452031111972389260285","383599574514235269420771702006588662767158113271594446015439990815783784544","0","0","0"],"siblings1":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["6975841694765113541634698345295957238501610055097872059913911260522365532165","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["16340650608214686026509819657637793341613276710241727968165631912246770201551","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["3906683858335927171613201671293906040747641928097999623324892263219255592303","2999178063326948609414231200730958862089790119006655219527433501846141543551","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["20096881635736058727699182872953735227378445790497970658442161994753383780529","476205581462021258184147478768312291576908749487032129047494531212082933081","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["20096881635736058727699182872953735227378445790497970658442161994753383780529","16893334234253053720093742955968168216011006581323207865868490858492517292573","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings2":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["3906683858335927171613201671293906040747641928097999623324892263219255592303","2999178063326948609414231200730958862089790119006655219527433501846141543551","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["2807926424545569764245984927776116213792987738212436789693535738467461609868","6975841694765113541634698345295957238501610055097872059913911260522365532165","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["20096881635736058727699182872953735227378445790497970658442161994753383780529","18206494837933532633746175540777421367331523385545468990813257189787137445167","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["2447280569512576776802400099129945371731124894833437434856318969971955351358","6975841694765113541634698345295957238501610055097872059913911260522365532165","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings3":[["2447280569512576776802400099129945371731124894833437434856318969971955351358","3300045819699360541652863975392028819717279937342922306336031453914844695187","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"sign1":["0","0","0","0","0","0","0","0","0","0"],"sign2":["0","0","0","0","0","0","0","0","0","0"],"sign3":["0","0"],"toBjjAy":["0","0","0","0","0","0","0","0","0","0"],"toEthAddr":["0","0","0","0","0","0","0","0","0","0"],"toIdx":["0","0","0","258","259","258","259","0","0","0"],"tokenID1":["1","1","1","1","1","1","1","0","0","0"],"tokenID2":["0","0","0","1","1","1","1","0","0","0"],"tokenID3":["1","0"],"txCompressedData":["1461501637330902918203684832716283019659255211535","1461501637330902918203684832716283019659255211535","1461501637330902918203684832716283019659255211535","1483802382529433561786086479669130480299574814223","1483802382529433561865314642183467438437110113807","869620039695611037216780722449287736442401516579948375153015945811453455","869620039695617314318516109130051572231824803474526991772798003389916687","3322668559","3322668559","3322668559"],"txCompressedDataV2":["0","0","0","0","0","3089511010385631938450432878260044363267416814906412892416","3089511010385654239195631408883185898985689744742895583488","0","0","0"]}`
  894. assert.Equal(t, expected, string(s))
  895. }
  896. // TestZKInputs5:
  897. // tests:
  898. // - L1: CreateAccountDeposit, ForceExit
  899. // - L2: Transfer, Exit
  900. func TestZKInputs5(t *testing.T) {
  901. dir, err := ioutil.TempDir("", "tmpdb")
  902. require.NoError(t, err)
  903. defer assert.Nil(t, os.RemoveAll(dir))
  904. nLevels := 16
  905. sdb, err := statedb.NewStateDB(dir, 128, statedb.TypeBatchBuilder, nLevels)
  906. require.NoError(t, err)
  907. // same values than in the js test
  908. users := generateJsUsers(t)
  909. l1Txs := []common.L1Tx{
  910. {
  911. FromIdx: 0,
  912. DepositAmount: big.NewInt(16000000),
  913. Amount: big.NewInt(0),
  914. TokenID: 1,
  915. FromBJJ: users[0].BJJ.Public().Compress(),
  916. FromEthAddr: users[0].Addr,
  917. ToIdx: 0,
  918. Type: common.TxTypeCreateAccountDeposit,
  919. UserOrigin: true,
  920. },
  921. {
  922. FromIdx: 0,
  923. DepositAmount: big.NewInt(16000000),
  924. Amount: big.NewInt(0),
  925. TokenID: 1,
  926. FromBJJ: users[1].BJJ.Public().Compress(),
  927. FromEthAddr: users[1].Addr,
  928. ToIdx: 0,
  929. Type: common.TxTypeCreateAccountDeposit,
  930. UserOrigin: true,
  931. },
  932. {
  933. FromIdx: 257,
  934. DepositAmount: big.NewInt(0),
  935. Amount: big.NewInt(1000),
  936. TokenID: 1,
  937. FromBJJ: users[1].BJJ.Public().Compress(),
  938. FromEthAddr: users[1].Addr,
  939. ToIdx: 1,
  940. Type: common.TxTypeForceExit,
  941. UserOrigin: true,
  942. },
  943. }
  944. l2Txs := []common.PoolL2Tx{
  945. {
  946. FromIdx: 256,
  947. ToIdx: 257,
  948. TokenID: 1,
  949. Amount: big.NewInt(1000),
  950. Nonce: 0,
  951. Fee: 126,
  952. Type: common.TxTypeTransfer,
  953. },
  954. {
  955. FromIdx: 256,
  956. ToIdx: 1,
  957. TokenID: 1,
  958. Amount: big.NewInt(1000),
  959. Nonce: 1,
  960. Fee: 126,
  961. Type: common.TxTypeExit,
  962. },
  963. }
  964. chainID := uint16(0)
  965. l2Txs[0] = signL2Tx(t, chainID, users[0], l2Txs[0])
  966. l2Txs[1] = signL2Tx(t, chainID, users[0], l2Txs[1])
  967. config := Config{
  968. NLevels: uint32(nLevels),
  969. MaxTx: 10,
  970. MaxL1Tx: 5,
  971. MaxFeeTx: 2,
  972. ChainID: chainID,
  973. }
  974. tp := NewTxProcessor(sdb, config)
  975. coordIdxs := []common.Idx{257}
  976. ptOut, err := tp.ProcessTxs(coordIdxs, l1Txs, nil, l2Txs)
  977. require.NoError(t, err)
  978. assert.Equal(t, "9004936174112171168716185012590576631374182232656264130522697453639057968430", sdb.MT.Root().BigInt().String())
  979. assert.Equal(t, "13150113024143718339322897969767386088676980172693068463217180231955278216962", ptOut.ZKInputs.Metadata.NewExitRootRaw.BigInt().String())
  980. // check expected account keys values from tx inputs
  981. acc, err := sdb.GetAccount(common.Idx(256))
  982. require.NoError(t, err)
  983. assert.Equal(t, users[0].BJJ.Public().Compress().String(), acc.BJJ.String())
  984. assert.Equal(t, users[0].Addr.Hex(), acc.EthAddr.Hex())
  985. assert.Equal(t, "15997798", acc.Balance.String())
  986. acc, err = sdb.GetAccount(common.Idx(257))
  987. require.NoError(t, err)
  988. assert.Equal(t, users[1].BJJ.Public().Compress().String(), acc.BJJ.String())
  989. assert.Equal(t, users[1].Addr.Hex(), acc.EthAddr.Hex())
  990. assert.Equal(t, "16000202", acc.Balance.String())
  991. // check that there no exist more accounts
  992. _, err = sdb.GetAccount(common.Idx(258))
  993. require.NotNil(t, err)
  994. // printZKInputs(t, ptOut.ZKInputs)
  995. h, err := ptOut.ZKInputs.HashGlobalData()
  996. require.NoError(t, err)
  997. assert.Equal(t, "16951671328133875992199593650633118863725536261940818900185939564479066062602", h.String())
  998. toHash, err := ptOut.ZKInputs.ToHashGlobalData()
  999. require.NoError(t, err)
  1000. assert.Equal(t, "0000000000ff000000000101000000000000000000000000000000000000000000000000000000000000000013e89cfe6f8671eba1068d525999487d18f49fc7312cef3f8b4b40989a828d2e1d12b3411d27a9fc1b759d1fed6ec756aa0e487806ad486a161451127aac3f027e5f4552091a69125d5dfcb7b8c2659029395bdf21b0a1688b37f77b1d1d5539ec3b826db5ac78b2513f574a04c50a7d4f8246d700000000000028a00000000000010000000000002b5ad5c4795c026514f8317c7a215e218dccd6cf093985b1993d9f743f9d7d943ed56f38601cb8b196db025f79650c4007c3054d00000000000028a00000000000010000000000002b5ad5c4795c026514f8317c7a215e218dccd6cf093985b1993d9f743f9d7d943ed56f38601cb8b196db025f79650c4007c3054d000000000101000003e80000000100000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101000103e8000100010103e87e0100000103e87e000000000000000000000000000000000000000000000000000000000000000000000001010000000000000001", hex.EncodeToString(toHash))
  1001. s, err := json.Marshal(ptOut.ZKInputs)
  1002. require.NoError(t, err)
  1003. // the 'expected' data has been checked with the circom circuits
  1004. expected := `{"auxFromIdx":["256","257","0","0","0","0","0","0","0","0"],"auxToIdx":["0","0","0","0","0","0","0","0","0","0"],"ay1":["15238403086306505038849621710779816852318505119327426213168494964113886299863","4172448640254579435434214421479401747968866348490029667576411173067925161293","4172448640254579435434214421479401747968866348490029667576411173067925161293","15238403086306505038849621710779816852318505119327426213168494964113886299863","15238403086306505038849621710779816852318505119327426213168494964113886299863","0","0","0","0","0"],"ay2":["0","0","4172448640254579435434214421479401747968866348490029667576411173067925161293","4172448640254579435434214421479401747968866348490029667576411173067925161293","15238403086306505038849621710779816852318505119327426213168494964113886299863","0","0","0","0","0"],"ay3":["4172448640254579435434214421479401747968866348490029667576411173067925161293","0"],"balance1":["16000000","16000000","16000000","16000000","15998899","0","0","0","0","0"],"balance2":["0","0","1000","15999000","1000","0","0","0","0","0"],"balance3":["16000000","0"],"currentNumBatch":"1","ethAddr1":["721457446580647751014191829380889690493307935711","247512291986854564435551364600938690683113101007","247512291986854564435551364600938690683113101007","721457446580647751014191829380889690493307935711","721457446580647751014191829380889690493307935711","0","0","0","0","0"],"ethAddr2":["0","0","247512291986854564435551364600938690683113101007","247512291986854564435551364600938690683113101007","721457446580647751014191829380889690493307935711","0","0","0","0","0"],"ethAddr3":["247512291986854564435551364600938690683113101007","0"],"feeIdxs":["257","0"],"feePlanTokens":["1","0"],"fromBjjCompressed":[["1","1","1","0","1","0","1","1","0","1","1","0","0","0","1","0","0","1","0","0","0","0","0","1","1","1","1","1","0","0","1","0","1","0","1","1","1","1","1","0","0","1","0","1","0","0","0","0","1","0","1","0","0","0","1","1","0","0","1","0","0","0","0","0","0","1","0","1","0","0","1","0","1","1","1","0","1","0","1","0","1","1","1","1","1","1","0","0","1","0","0","0","1","0","1","0","0","1","0","0","1","1","0","1","0","0","0","1","1","1","1","0","0","0","1","1","0","1","0","1","1","0","1","0","1","1","0","1","1","0","1","1","0","1","1","0","0","1","0","0","0","0","0","1","1","1","0","1","1","1","0","0","0","0","1","1","0","1","1","1","1","0","0","1","1","1","0","0","1","0","1","0","1","0","1","0","1","0","1","1","1","0","0","0","1","0","1","1","1","0","0","0","1","1","0","1","1","1","1","0","1","1","1","0","1","1","1","1","1","1","1","0","1","1","0","0","1","1","0","1","0","0","0","1","0","0","0","1","0","1","1","0","1","0","0","0","0","1","0","1","0","0","0","0","1","1","0","1","1","0","0","0","0","1","0","0"],["1","0","1","1","0","0","1","0","1","0","1","0","0","0","0","0","1","1","0","0","0","0","1","1","1","1","1","0","0","0","0","0","0","0","0","0","0","0","1","0","0","0","1","1","0","0","0","0","1","0","1","0","0","1","1","0","1","0","0","1","1","1","1","0","1","1","1","1","1","0","1","0","0","1","0","0","0","0","0","0","1","1","0","1","1","0","1","1","0","1","1","0","1","0","0","1","1","0","0","0","1","1","0","1","0","0","0","1","1","1","0","1","0","0","1","1","1","0","0","0","0","0","0","0","0","1","1","0","0","0","0","1","1","1","0","0","1","1","1","1","0","1","1","0","1","0","1","0","1","0","1","1","0","1","1","1","1","1","0","0","0","0","1","0","1","0","0","1","1","0","1","1","1","1","1","0","1","0","1","1","1","0","0","1","1","1","1","1","1","1","0","0","0","0","1","0","1","1","1","0","1","1","1","1","1","0","0","1","1","0","1","1","1","1","0","0","1","0","0","1","1","0","0","1","1","0","0","0","1","1","0","1","1","0","1","0","0","0","0","1","1","0","0","1","1","1","0","0","1","0","0","1","0","0","0","0"],["1","0","1","1","0","0","1","0","1","0","1","0","0","0","0","0","1","1","0","0","0","0","1","1","1","1","1","0","0","0","0","0","0","0","0","0","0","0","1","0","0","0","1","1","0","0","0","0","1","0","1","0","0","1","1","0","1","0","0","1","1","1","1","0","1","1","1","1","1","0","1","0","0","1","0","0","0","0","0","0","1","1","0","1","1","0","1","1","0","1","1","0","1","0","0","1","1","0","0","0","1","1","0","1","0","0","0","1","1","1","0","1","0","0","1","1","1","0","0","0","0","0","0","0","0","1","1","0","0","0","0","1","1","1","0","0","1","1","1","1","0","1","1","0","1","0","1","0","1","0","1","1","0","1","1","1","1","1","0","0","0","0","1","0","1","0","0","1","1","0","1","1","1","1","1","0","1","0","1","1","1","0","0","1","1","1","1","1","1","1","0","0","0","0","1","0","1","1","1","0","1","1","1","1","1","0","0","1","1","0","1","1","1","1","0","0","1","0","0","1","1","0","0","1","1","0","0","0","1","1","0","1","1","0","1","0","0","0","0","1","1","0","0","1","1","1","0","0","1","0","0","1","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"fromEthAddr":["721457446580647751014191829380889690493307935711","247512291986854564435551364600938690683113101007","247512291986854564435551364600938690683113101007","0","0","0","0","0","0","0"],"fromIdx":["0","0","257","256","256","0","0","0","0","0"],"globalChainID":"0","imAccFeeOut":[["0","0"],["0","0"],["0","0"],["101","0"],["202","0"],["202","0"],["202","0"],["202","0"],["202","0"]],"imExitRoot":["0","0","15113551174181131002458155929083094803636342713620925500154902553188452967723","15113551174181131002458155929083094803636342713620925500154902553188452967723","13150113024143718339322897969767386088676980172693068463217180231955278216962","13150113024143718339322897969767386088676980172693068463217180231955278216962","13150113024143718339322897969767386088676980172693068463217180231955278216962","13150113024143718339322897969767386088676980172693068463217180231955278216962","13150113024143718339322897969767386088676980172693068463217180231955278216962"],"imFinalAccFee":["202","0"],"imInitStateRootFee":"9613727628923763144036402071154968334137401166500556370159010076062685768496","imOnChain":["1","1","1","0","0","0","0","0","0"],"imOutIdx":["256","257","257","257","257","257","257","257","257"],"imStateRoot":["2999178063326948609414231200730958862089790119006655219527433501846141543551","13160175861809095962915811919507877524206523306071085047160493107056995190544","18329209406553022761679227986529674784516469819376621817750821323774238711751","3690178825271720012663633183291856847981843295851769874179245020746738552351","9613727628923763144036402071154968334137401166500556370159010076062685768496","9613727628923763144036402071154968334137401166500556370159010076062685768496","9613727628923763144036402071154968334137401166500556370159010076062685768496","9613727628923763144036402071154968334137401166500556370159010076062685768496","9613727628923763144036402071154968334137401166500556370159010076062685768496"],"imStateRootFee":["9004936174112171168716185012590576631374182232656264130522697453639057968430"],"isOld0_1":["1","0","0","0","0","0","0","0","0","0"],"isOld0_2":["0","0","1","0","0","0","0","0","0","0"],"loadAmountF":["10400","10400","0","0","0","0","0","0","0","0"],"maxNumBatch":["0","0","0","0","0","0","0","0","0","0"],"newAccount":["1","1","0","0","0","0","0","0","0","0"],"newExit":["0","0","1","0","1","0","0","0","0","0"],"nonce1":["0","0","0","0","1","0","0","0","0","0"],"nonce2":["0","0","0","0","0","0","0","0","0","0"],"nonce3":["0","0"],"oldKey1":["0","256","0","0","0","0","0","0","0","0"],"oldKey2":["0","0","0","0","257","0","0","0","0","0"],"oldLastIdx":"255","oldStateRoot":"0","oldValue1":["0","9733782510199048326382833205201407219982604211594942097825192094127807440165","0","0","0","0","0","0","0","0"],"oldValue2":["0","0","0","0","1321905978366742801526079282634745616644967252474273161740186384129043490004","0","0","0","0","0"],"onChain":["1","1","1","0","0","0","0","0","0","0"],"r8x":["0","0","0","21866069362303334754705967992284812681414720313777842941818990564691665974706","10385899866949013738446141130588224389448419060831450943717283733270769541673","0","0","0","0","0"],"r8y":["0","0","0","8161164862399339301953140132511699534761447837662845009028853083383916740840","13656260309192947110726378285601635254714377815750000021119696180600460145845","0","0","0","0","0"],"rqOffset":["0","0","0","0","0","0","0","0","0","0"],"rqToBjjAy":["0","0","0","0","0","0","0","0","0","0"],"rqToEthAddr":["0","0","0","0","0","0","0","0","0","0"],"rqTxCompressedDataV2":["0","0","0","0","0","0","0","0","0","0"],"s":["0","0","0","917203591853393674451581842743986504926217885723848085172949612934849937782","1578713319885150969153996052434970232464211993679257852379270056501708806302","0","0","0","0","0"],"siblings1":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["2999178063326948609414231200730958862089790119006655219527433501846141543551","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["11279990388494833286198556001199775823962972503915172009203378468347881508894","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["6975841694765113541634698345295957238501610055097872059913911260522365532165","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings2":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["18206494837933532633746175540777421367331523385545468990813257189787137445167","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings3":[["18217919661438562246423754072112686562705548970555156767842923363070658026697","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"sign1":["0","0","0","0","0","0","0","0","0","0"],"sign2":["0","0","0","0","0","0","0","0","0","0"],"sign3":["0","0"],"toBjjAy":["0","0","0","0","0","0","0","0","0","0"],"toEthAddr":["0","0","0","0","0","0","0","0","0","0"],"toIdx":["0","0","1","257","1","0","0","0","0","0"],"tokenID1":["1","1","1","1","1","0","0","0","0","0"],"tokenID2":["0","0","1","1","1","0","0","0","0","0"],"tokenID3":["1","0"],"txCompressedData":["1461501637330902918203684832716283019659255211535","1461501637330902918203684832716283019659255211535","1483802382529433541424448713503268057827794216463","869620039695611037216780722449287736442401437351785860888678352267503119","869620039695617314318516109130051572231804362608598311573698869050729999","3322668559","3322668559","3322668559","3322668559","3322668559"],"txCompressedDataV2":["0","0","0","3089511010385631938450432878260044363267416533431436181760","3089511010385654239195631408883185898985617124198904234240","0","0","0","0","0"]}`
  1005. assert.Equal(t, expected, string(s))
  1006. }
  1007. // TestZKInputs6:
  1008. // Tests ZKInputs generated by the batches generated by
  1009. // til.SetBlockchainMinimumFlow0
  1010. func TestZKInputs6(t *testing.T) {
  1011. dir, err := ioutil.TempDir("", "tmpdb")
  1012. require.NoError(t, err)
  1013. defer assert.Nil(t, os.RemoveAll(dir))
  1014. nLevels := 16
  1015. sdb, err := statedb.NewStateDB(dir, 128, statedb.TypeBatchBuilder, nLevels)
  1016. require.NoError(t, err)
  1017. chainID := uint16(0)
  1018. config := Config{
  1019. NLevels: uint32(nLevels),
  1020. MaxTx: 11,
  1021. MaxL1Tx: 5,
  1022. MaxFeeTx: 4,
  1023. ChainID: chainID,
  1024. }
  1025. tp := NewTxProcessor(sdb, config)
  1026. tc := til.NewContext(0, common.RollupConstMaxL1UserTx)
  1027. blocks, err := tc.GenerateBlocks(til.SetBlockchainMinimumFlow0)
  1028. require.NoError(t, err)
  1029. // restart nonces of TilContext, as will be set by generating directly
  1030. // the PoolL2Txs for each specific batch with tc.GeneratePoolL2Txs
  1031. tc.RestartNonces()
  1032. log.Debug("block:0 batch:1")
  1033. ptOut, err := tp.ProcessTxs(nil, nil, blocks[0].Rollup.Batches[0].L1CoordinatorTxs, nil)
  1034. require.NoError(t, err)
  1035. assert.Equal(t, "0", sdb.MT.Root().BigInt().String())
  1036. assert.Equal(t, "0", ptOut.ZKInputs.Metadata.NewExitRootRaw.BigInt().String())
  1037. h, err := ptOut.ZKInputs.HashGlobalData()
  1038. require.NoError(t, err)
  1039. assert.Equal(t, "13455172459391462575046981999736782481395845908117945897613676281408039723698", h.String())
  1040. s, err := json.Marshal(ptOut.ZKInputs)
  1041. require.NoError(t, err)
  1042. // the 'expected' data has been checked with the circom circuits
  1043. expected := `{"auxFromIdx":["0","0","0","0","0","0","0","0","0","0","0"],"auxToIdx":["0","0","0","0","0","0","0","0","0","0","0"],"ay1":["0","0","0","0","0","0","0","0","0","0","0"],"ay2":["0","0","0","0","0","0","0","0","0","0","0"],"ay3":["0","0","0","0"],"balance1":["0","0","0","0","0","0","0","0","0","0","0"],"balance2":["0","0","0","0","0","0","0","0","0","0","0"],"balance3":["0","0","0","0"],"currentNumBatch":"1","ethAddr1":["0","0","0","0","0","0","0","0","0","0","0"],"ethAddr2":["0","0","0","0","0","0","0","0","0","0","0"],"ethAddr3":["0","0","0","0"],"feeIdxs":["0","0","0","0"],"feePlanTokens":["0","0","0","0"],"fromBjjCompressed":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"fromEthAddr":["0","0","0","0","0","0","0","0","0","0","0"],"fromIdx":["0","0","0","0","0","0","0","0","0","0","0"],"globalChainID":"0","imAccFeeOut":[["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"]],"imExitRoot":["0","0","0","0","0","0","0","0","0","0"],"imFinalAccFee":["0","0","0","0"],"imInitStateRootFee":"0","imOnChain":["0","0","0","0","0","0","0","0","0","0"],"imOutIdx":["255","255","255","255","255","255","255","255","255","255"],"imStateRoot":["0","0","0","0","0","0","0","0","0","0"],"imStateRootFee":["0","0","0"],"isOld0_1":["0","0","0","0","0","0","0","0","0","0","0"],"isOld0_2":["0","0","0","0","0","0","0","0","0","0","0"],"loadAmountF":["0","0","0","0","0","0","0","0","0","0","0"],"maxNumBatch":["0","0","0","0","0","0","0","0","0","0","0"],"newAccount":["0","0","0","0","0","0","0","0","0","0","0"],"newExit":["0","0","0","0","0","0","0","0","0","0","0"],"nonce1":["0","0","0","0","0","0","0","0","0","0","0"],"nonce2":["0","0","0","0","0","0","0","0","0","0","0"],"nonce3":["0","0","0","0"],"oldKey1":["0","0","0","0","0","0","0","0","0","0","0"],"oldKey2":["0","0","0","0","0","0","0","0","0","0","0"],"oldLastIdx":"255","oldStateRoot":"0","oldValue1":["0","0","0","0","0","0","0","0","0","0","0"],"oldValue2":["0","0","0","0","0","0","0","0","0","0","0"],"onChain":["0","0","0","0","0","0","0","0","0","0","0"],"r8x":["0","0","0","0","0","0","0","0","0","0","0"],"r8y":["0","0","0","0","0","0","0","0","0","0","0"],"rqOffset":["0","0","0","0","0","0","0","0","0","0","0"],"rqToBjjAy":["0","0","0","0","0","0","0","0","0","0","0"],"rqToEthAddr":["0","0","0","0","0","0","0","0","0","0","0"],"rqTxCompressedDataV2":["0","0","0","0","0","0","0","0","0","0","0"],"s":["0","0","0","0","0","0","0","0","0","0","0"],"siblings1":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings2":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings3":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"sign1":["0","0","0","0","0","0","0","0","0","0","0"],"sign2":["0","0","0","0","0","0","0","0","0","0","0"],"sign3":["0","0","0","0"],"toBjjAy":["0","0","0","0","0","0","0","0","0","0","0"],"toEthAddr":["0","0","0","0","0","0","0","0","0","0","0"],"toIdx":["0","0","0","0","0","0","0","0","0","0","0"],"tokenID1":["0","0","0","0","0","0","0","0","0","0","0"],"tokenID2":["0","0","0","0","0","0","0","0","0","0","0"],"tokenID3":["0","0","0","0"],"txCompressedData":["3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559"],"txCompressedDataV2":["0","0","0","0","0","0","0","0","0","0","0"]}`
  1044. assert.Equal(t, expected, string(s))
  1045. // printZKInputs(t, ptOut.ZKInputs)
  1046. log.Debug("block:0 batch:2")
  1047. l1UserTxs := []common.L1Tx{}
  1048. l2Txs := common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[1].L2Txs)
  1049. ptOut, err = tp.ProcessTxs(nil, l1UserTxs, blocks[0].Rollup.Batches[1].L1CoordinatorTxs, l2Txs)
  1050. require.NoError(t, err)
  1051. assert.Equal(t, "0", sdb.MT.Root().BigInt().String())
  1052. assert.Equal(t, "0", ptOut.ZKInputs.Metadata.NewExitRootRaw.BigInt().String())
  1053. h, err = ptOut.ZKInputs.HashGlobalData()
  1054. require.NoError(t, err)
  1055. assert.Equal(t, "16630658335821421195775007290449840271984491392105448667005738900875813468648", h.String())
  1056. s, err = json.Marshal(ptOut.ZKInputs)
  1057. require.NoError(t, err)
  1058. // the 'expected' data has been checked with the circom circuits
  1059. expected = `{"auxFromIdx":["0","0","0","0","0","0","0","0","0","0","0"],"auxToIdx":["0","0","0","0","0","0","0","0","0","0","0"],"ay1":["0","0","0","0","0","0","0","0","0","0","0"],"ay2":["0","0","0","0","0","0","0","0","0","0","0"],"ay3":["0","0","0","0"],"balance1":["0","0","0","0","0","0","0","0","0","0","0"],"balance2":["0","0","0","0","0","0","0","0","0","0","0"],"balance3":["0","0","0","0"],"currentNumBatch":"2","ethAddr1":["0","0","0","0","0","0","0","0","0","0","0"],"ethAddr2":["0","0","0","0","0","0","0","0","0","0","0"],"ethAddr3":["0","0","0","0"],"feeIdxs":["0","0","0","0"],"feePlanTokens":["0","0","0","0"],"fromBjjCompressed":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"fromEthAddr":["0","0","0","0","0","0","0","0","0","0","0"],"fromIdx":["0","0","0","0","0","0","0","0","0","0","0"],"globalChainID":"0","imAccFeeOut":[["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"]],"imExitRoot":["0","0","0","0","0","0","0","0","0","0"],"imFinalAccFee":["0","0","0","0"],"imInitStateRootFee":"0","imOnChain":["0","0","0","0","0","0","0","0","0","0"],"imOutIdx":["255","255","255","255","255","255","255","255","255","255"],"imStateRoot":["0","0","0","0","0","0","0","0","0","0"],"imStateRootFee":["0","0","0"],"isOld0_1":["0","0","0","0","0","0","0","0","0","0","0"],"isOld0_2":["0","0","0","0","0","0","0","0","0","0","0"],"loadAmountF":["0","0","0","0","0","0","0","0","0","0","0"],"maxNumBatch":["0","0","0","0","0","0","0","0","0","0","0"],"newAccount":["0","0","0","0","0","0","0","0","0","0","0"],"newExit":["0","0","0","0","0","0","0","0","0","0","0"],"nonce1":["0","0","0","0","0","0","0","0","0","0","0"],"nonce2":["0","0","0","0","0","0","0","0","0","0","0"],"nonce3":["0","0","0","0"],"oldKey1":["0","0","0","0","0","0","0","0","0","0","0"],"oldKey2":["0","0","0","0","0","0","0","0","0","0","0"],"oldLastIdx":"255","oldStateRoot":"0","oldValue1":["0","0","0","0","0","0","0","0","0","0","0"],"oldValue2":["0","0","0","0","0","0","0","0","0","0","0"],"onChain":["0","0","0","0","0","0","0","0","0","0","0"],"r8x":["0","0","0","0","0","0","0","0","0","0","0"],"r8y":["0","0","0","0","0","0","0","0","0","0","0"],"rqOffset":["0","0","0","0","0","0","0","0","0","0","0"],"rqToBjjAy":["0","0","0","0","0","0","0","0","0","0","0"],"rqToEthAddr":["0","0","0","0","0","0","0","0","0","0","0"],"rqTxCompressedDataV2":["0","0","0","0","0","0","0","0","0","0","0"],"s":["0","0","0","0","0","0","0","0","0","0","0"],"siblings1":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings2":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings3":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"sign1":["0","0","0","0","0","0","0","0","0","0","0"],"sign2":["0","0","0","0","0","0","0","0","0","0","0"],"sign3":["0","0","0","0"],"toBjjAy":["0","0","0","0","0","0","0","0","0","0","0"],"toEthAddr":["0","0","0","0","0","0","0","0","0","0","0"],"toIdx":["0","0","0","0","0","0","0","0","0","0","0"],"tokenID1":["0","0","0","0","0","0","0","0","0","0","0"],"tokenID2":["0","0","0","0","0","0","0","0","0","0","0"],"tokenID3":["0","0","0","0"],"txCompressedData":["3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559"],"txCompressedDataV2":["0","0","0","0","0","0","0","0","0","0","0"]}`
  1060. assert.Equal(t, expected, string(s))
  1061. // printZKInputs(t, ptOut.ZKInputs)
  1062. log.Debug("block:0 batch:3")
  1063. l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[2].Batch.ForgeL1TxsNum])
  1064. l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[2].L2Txs)
  1065. ptOut, err = tp.ProcessTxs(nil, l1UserTxs, blocks[0].Rollup.Batches[2].L1CoordinatorTxs, l2Txs)
  1066. require.NoError(t, err)
  1067. assert.Equal(t, "13644148972047617726265275926674266298636745191961029124811988256139761111521", sdb.MT.Root().BigInt().String())
  1068. h, err = ptOut.ZKInputs.HashGlobalData()
  1069. require.NoError(t, err)
  1070. assert.Equal(t, "1670704242063372281093296382582161352954915652327042738049529469112013123279", h.String())
  1071. s, err = json.Marshal(ptOut.ZKInputs)
  1072. require.NoError(t, err)
  1073. // the 'expected' data has been checked with the circom circuits
  1074. expected = `{"auxFromIdx":["256","257","0","0","0","0","0","0","0","0","0"],"auxToIdx":["0","0","0","0","0","0","0","0","0","0","0"],"ay1":["14382649545529405976710664157356364657039027681269256663271478725131562622080","20534271334408079873799448508761237599936782740731511933526664305820108254173","0","0","0","0","0","0","0","0","0"],"ay2":["0","0","0","0","0","0","0","0","0","0","0"],"ay3":["0","0","0","0"],"balance1":["500","0","0","0","0","0","0","0","0","0","0"],"balance2":["0","0","0","0","0","0","0","0","0","0","0"],"balance3":["0","0","0","0"],"currentNumBatch":"3","ethAddr1":["721457446580647751014191829380889690493307935711","594179275863704165266696689399235767493667371625","0","0","0","0","0","0","0","0","0"],"ethAddr2":["0","0","0","0","0","0","0","0","0","0","0"],"ethAddr3":["0","0","0","0"],"feeIdxs":["0","0","0","0"],"feePlanTokens":["0","0","0","0"],"fromBjjCompressed":[["0","0","0","0","0","0","0","1","0","0","1","1","1","0","0","1","1","1","0","0","1","0","0","0","1","1","1","1","0","0","1","0","1","0","1","1","1","0","1","0","1","1","1","1","0","0","1","0","0","0","0","1","1","0","1","1","0","1","1","1","0","1","0","0","0","1","0","1","0","0","1","0","1","1","1","1","1","1","0","0","1","1","0","1","0","1","1","1","1","1","1","0","0","1","1","1","1","1","1","0","0","0","0","1","1","1","1","0","0","1","0","1","1","0","0","0","0","0","1","1","0","0","0","0","1","1","1","0","1","0","0","0","0","1","1","0","1","0","0","0","0","1","0","0","0","0","0","1","1","1","1","1","1","1","1","0","1","1","0","1","0","1","0","1","0","0","1","1","1","0","0","0","1","1","0","0","0","1","0","1","1","0","1","0","1","0","1","1","1","0","0","1","1","1","0","1","1","1","1","1","1","0","0","1","0","0","0","1","0","0","0","1","1","0","0","0","1","1","0","0","1","0","0","1","1","0","0","1","0","0","0","1","0","1","0","1","0","0","1","0","0","0","1","1","0","0","1","1","1","1","1","1","1","0","0","0"],["1","0","1","1","1","0","1","1","1","1","0","1","0","1","1","1","0","1","1","1","1","0","1","0","1","0","0","0","1","0","1","1","1","0","0","0","1","0","1","1","1","1","1","0","0","0","0","1","1","1","1","1","1","1","0","1","1","1","1","1","1","0","0","1","0","0","1","1","1","1","0","1","1","1","0","0","0","0","0","0","0","0","0","1","0","0","1","0","0","1","0","1","0","1","1","1","0","1","0","0","1","0","1","1","0","1","1","1","0","0","0","1","1","1","1","0","0","0","1","0","0","0","1","1","0","1","1","0","1","1","1","1","0","0","1","0","1","0","1","0","1","0","0","0","0","1","0","0","1","0","1","0","0","0","1","1","1","1","1","1","1","0","1","1","1","1","1","0","0","0","1","0","1","0","0","0","1","1","0","1","0","0","1","0","1","0","0","1","0","0","0","1","1","0","1","1","0","1","1","0","1","0","1","0","1","1","1","0","1","1","1","1","0","1","0","1","1","0","1","0","1","0","1","0","1","1","1","0","1","0","1","0","0","0","1","1","1","1","1","1","1","0","1","0","0","1","1","0","1","0","1","1","0","1","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"fromEthAddr":["721457446580647751014191829380889690493307935711","594179275863704165266696689399235767493667371625","0","0","0","0","0","0","0","0","0"],"fromIdx":["0","0","0","0","0","0","0","0","0","0","0"],"globalChainID":"0","imAccFeeOut":[["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"]],"imExitRoot":["0","0","0","0","0","0","0","0","0","0"],"imFinalAccFee":["0","0","0","0"],"imInitStateRootFee":"13644148972047617726265275926674266298636745191961029124811988256139761111521","imOnChain":["1","1","0","0","0","0","0","0","0","0"],"imOutIdx":["256","257","257","257","257","257","257","257","257","257"],"imStateRoot":["9216021070646464493278943416860172056385331920568566628971539484254800425455","13644148972047617726265275926674266298636745191961029124811988256139761111521","13644148972047617726265275926674266298636745191961029124811988256139761111521","13644148972047617726265275926674266298636745191961029124811988256139761111521","13644148972047617726265275926674266298636745191961029124811988256139761111521","13644148972047617726265275926674266298636745191961029124811988256139761111521","13644148972047617726265275926674266298636745191961029124811988256139761111521","13644148972047617726265275926674266298636745191961029124811988256139761111521","13644148972047617726265275926674266298636745191961029124811988256139761111521","13644148972047617726265275926674266298636745191961029124811988256139761111521"],"imStateRootFee":["13644148972047617726265275926674266298636745191961029124811988256139761111521","13644148972047617726265275926674266298636745191961029124811988256139761111521","13644148972047617726265275926674266298636745191961029124811988256139761111521"],"isOld0_1":["1","0","0","0","0","0","0","0","0","0","0"],"isOld0_2":["0","0","0","0","0","0","0","0","0","0","0"],"loadAmountF":["500","0","0","0","0","0","0","0","0","0","0"],"maxNumBatch":["0","0","0","0","0","0","0","0","0","0","0"],"newAccount":["1","1","0","0","0","0","0","0","0","0","0"],"newExit":["0","0","0","0","0","0","0","0","0","0","0"],"nonce1":["0","0","0","0","0","0","0","0","0","0","0"],"nonce2":["0","0","0","0","0","0","0","0","0","0","0"],"nonce3":["0","0","0","0"],"oldKey1":["0","256","0","0","0","0","0","0","0","0","0"],"oldKey2":["0","0","0","0","0","0","0","0","0","0","0"],"oldLastIdx":"255","oldStateRoot":"0","oldValue1":["0","5670500023224938494373508967563482401915383574161439638646368077694942647568","0","0","0","0","0","0","0","0","0"],"oldValue2":["0","0","0","0","0","0","0","0","0","0","0"],"onChain":["1","1","0","0","0","0","0","0","0","0","0"],"r8x":["0","0","0","0","0","0","0","0","0","0","0"],"r8y":["0","0","0","0","0","0","0","0","0","0","0"],"rqOffset":["0","0","0","0","0","0","0","0","0","0","0"],"rqToBjjAy":["0","0","0","0","0","0","0","0","0","0","0"],"rqToEthAddr":["0","0","0","0","0","0","0","0","0","0","0"],"rqTxCompressedDataV2":["0","0","0","0","0","0","0","0","0","0","0"],"s":["0","0","0","0","0","0","0","0","0","0","0"],"siblings1":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings2":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings3":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"sign1":["0","0","0","0","0","0","0","0","0","0","0"],"sign2":["0","0","0","0","0","0","0","0","0","0","0"],"sign3":["0","0","0","0"],"toBjjAy":["0","0","0","0","0","0","0","0","0","0","0"],"toEthAddr":["0","0","0","0","0","0","0","0","0","0","0"],"toIdx":["0","0","0","0","0","0","0","0","0","0","0"],"tokenID1":["0","1","0","0","0","0","0","0","0","0","0"],"tokenID2":["0","0","0","0","0","0","0","0","0","0","0"],"tokenID3":["0","0","0","0"],"txCompressedData":["3322668559","1461501637330902918203684832716283019659255211535","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559"],"txCompressedDataV2":["0","0","0","0","0","0","0","0","0","0","0"]}`
  1075. assert.Equal(t, expected, string(s))
  1076. // printZKInputs(t, ptOut.ZKInputs)
  1077. log.Debug("block:0 batch:4")
  1078. l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[3].Batch.ForgeL1TxsNum])
  1079. l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[3].L2Txs)
  1080. ptOut, err = tp.ProcessTxs(nil, l1UserTxs, blocks[0].Rollup.Batches[3].L1CoordinatorTxs, l2Txs)
  1081. require.NoError(t, err)
  1082. assert.Equal(t, "12433441613247342495680642890662773367605896324555599297255745922589338651261", sdb.MT.Root().BigInt().String())
  1083. h, err = ptOut.ZKInputs.HashGlobalData()
  1084. require.NoError(t, err)
  1085. assert.Equal(t, "18025306888039625192272656711531201830132882488353118068367301553878599782320", h.String())
  1086. s, err = json.Marshal(ptOut.ZKInputs)
  1087. require.NoError(t, err)
  1088. // the 'expected' data has been checked with the circom circuits
  1089. expected = `{"auxFromIdx":["258","0","0","0","0","0","0","0","0","0","0"],"auxToIdx":["0","0","0","0","0","0","0","0","0","0","0"],"ay1":["14382649545529405976710664157356364657039027681269256663271478725131562622080","0","0","0","0","0","0","0","0","0","0"],"ay2":["0","0","0","0","0","0","0","0","0","0","0"],"ay3":["0","0","0","0"],"balance1":["500","0","0","0","0","0","0","0","0","0","0"],"balance2":["0","0","0","0","0","0","0","0","0","0","0"],"balance3":["0","0","0","0"],"currentNumBatch":"4","ethAddr1":["721457446580647751014191829380889690493307935711","0","0","0","0","0","0","0","0","0","0"],"ethAddr2":["0","0","0","0","0","0","0","0","0","0","0"],"ethAddr3":["0","0","0","0"],"feeIdxs":["0","0","0","0"],"feePlanTokens":["0","0","0","0"],"fromBjjCompressed":[["0","0","0","0","0","0","0","1","0","0","1","1","1","0","0","1","1","1","0","0","1","0","0","0","1","1","1","1","0","0","1","0","1","0","1","1","1","0","1","0","1","1","1","1","0","0","1","0","0","0","0","1","1","0","1","1","0","1","1","1","0","1","0","0","0","1","0","1","0","0","1","0","1","1","1","1","1","1","0","0","1","1","0","1","0","1","1","1","1","1","1","0","0","1","1","1","1","1","1","0","0","0","0","1","1","1","1","0","0","1","0","1","1","0","0","0","0","0","1","1","0","0","0","0","1","1","1","0","1","0","0","0","0","1","1","0","1","0","0","0","0","1","0","0","0","0","0","1","1","1","1","1","1","1","1","0","1","1","0","1","0","1","0","1","0","0","1","1","1","0","0","0","1","1","0","0","0","1","0","1","1","0","1","0","1","0","1","1","1","0","0","1","1","1","0","1","1","1","1","1","1","0","0","1","0","0","0","1","0","0","0","1","1","0","0","0","1","1","0","0","1","0","0","1","1","0","0","1","0","0","0","1","0","1","0","1","0","0","1","0","0","0","1","1","0","0","1","1","1","1","1","1","1","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"fromEthAddr":["721457446580647751014191829380889690493307935711","0","0","0","0","0","0","0","0","0","0"],"fromIdx":["0","0","0","0","0","0","0","0","0","0","0"],"globalChainID":"0","imAccFeeOut":[["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"]],"imExitRoot":["0","0","0","0","0","0","0","0","0","0"],"imFinalAccFee":["0","0","0","0"],"imInitStateRootFee":"12433441613247342495680642890662773367605896324555599297255745922589338651261","imOnChain":["1","0","0","0","0","0","0","0","0","0"],"imOutIdx":["258","258","258","258","258","258","258","258","258","258"],"imStateRoot":["12433441613247342495680642890662773367605896324555599297255745922589338651261","12433441613247342495680642890662773367605896324555599297255745922589338651261","12433441613247342495680642890662773367605896324555599297255745922589338651261","12433441613247342495680642890662773367605896324555599297255745922589338651261","12433441613247342495680642890662773367605896324555599297255745922589338651261","12433441613247342495680642890662773367605896324555599297255745922589338651261","12433441613247342495680642890662773367605896324555599297255745922589338651261","12433441613247342495680642890662773367605896324555599297255745922589338651261","12433441613247342495680642890662773367605896324555599297255745922589338651261","12433441613247342495680642890662773367605896324555599297255745922589338651261"],"imStateRootFee":["12433441613247342495680642890662773367605896324555599297255745922589338651261","12433441613247342495680642890662773367605896324555599297255745922589338651261","12433441613247342495680642890662773367605896324555599297255745922589338651261"],"isOld0_1":["0","0","0","0","0","0","0","0","0","0","0"],"isOld0_2":["0","0","0","0","0","0","0","0","0","0","0"],"loadAmountF":["500","0","0","0","0","0","0","0","0","0","0"],"maxNumBatch":["0","0","0","0","0","0","0","0","0","0","0"],"newAccount":["1","0","0","0","0","0","0","0","0","0","0"],"newExit":["0","0","0","0","0","0","0","0","0","0","0"],"nonce1":["0","0","0","0","0","0","0","0","0","0","0"],"nonce2":["0","0","0","0","0","0","0","0","0","0","0"],"nonce3":["0","0","0","0"],"oldKey1":["256","0","0","0","0","0","0","0","0","0","0"],"oldKey2":["0","0","0","0","0","0","0","0","0","0","0"],"oldLastIdx":"257","oldStateRoot":"13644148972047617726265275926674266298636745191961029124811988256139761111521","oldValue1":["5670500023224938494373508967563482401915383574161439638646368077694942647568","0","0","0","0","0","0","0","0","0","0"],"oldValue2":["0","0","0","0","0","0","0","0","0","0","0"],"onChain":["1","0","0","0","0","0","0","0","0","0","0"],"r8x":["0","0","0","0","0","0","0","0","0","0","0"],"r8y":["0","0","0","0","0","0","0","0","0","0","0"],"rqOffset":["0","0","0","0","0","0","0","0","0","0","0"],"rqToBjjAy":["0","0","0","0","0","0","0","0","0","0","0"],"rqToEthAddr":["0","0","0","0","0","0","0","0","0","0","0"],"rqTxCompressedDataV2":["0","0","0","0","0","0","0","0","0","0","0"],"s":["0","0","0","0","0","0","0","0","0","0","0"],"siblings1":[["7195104960595501408205939515167377857306285954201660092415422277455221721819","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings2":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings3":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"sign1":["0","0","0","0","0","0","0","0","0","0","0"],"sign2":["0","0","0","0","0","0","0","0","0","0","0"],"sign3":["0","0","0","0"],"toBjjAy":["0","0","0","0","0","0","0","0","0","0","0"],"toEthAddr":["0","0","0","0","0","0","0","0","0","0","0"],"toIdx":["0","0","0","0","0","0","0","0","0","0","0"],"tokenID1":["1","0","0","0","0","0","0","0","0","0","0"],"tokenID2":["0","0","0","0","0","0","0","0","0","0","0"],"tokenID3":["0","0","0","0"],"txCompressedData":["1461501637330902918203684832716283019659255211535","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559"],"txCompressedDataV2":["0","0","0","0","0","0","0","0","0","0","0"]}`
  1090. assert.Equal(t, expected, string(s))
  1091. // printZKInputs(t, ptOut.ZKInputs)
  1092. log.Debug("block:0 batch:5")
  1093. l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[4].Batch.ForgeL1TxsNum])
  1094. l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[4].L2Txs)
  1095. ptOut, err = tp.ProcessTxs(nil, l1UserTxs, blocks[0].Rollup.Batches[4].L1CoordinatorTxs, l2Txs)
  1096. require.NoError(t, err)
  1097. assert.Equal(t, "12433441613247342495680642890662773367605896324555599297255745922589338651261", sdb.MT.Root().BigInt().String())
  1098. h, err = ptOut.ZKInputs.HashGlobalData()
  1099. require.NoError(t, err)
  1100. assert.Equal(t, "8373442259151225575373771804554814568228547717479774557650166758556193375898", h.String())
  1101. s, err = json.Marshal(ptOut.ZKInputs)
  1102. require.NoError(t, err)
  1103. // the 'expected' data has been checked with the circom circuits
  1104. expected = `{"auxFromIdx":["0","0","0","0","0","0","0","0","0","0","0"],"auxToIdx":["0","0","0","0","0","0","0","0","0","0","0"],"ay1":["0","0","0","0","0","0","0","0","0","0","0"],"ay2":["0","0","0","0","0","0","0","0","0","0","0"],"ay3":["0","0","0","0"],"balance1":["0","0","0","0","0","0","0","0","0","0","0"],"balance2":["0","0","0","0","0","0","0","0","0","0","0"],"balance3":["0","0","0","0"],"currentNumBatch":"5","ethAddr1":["0","0","0","0","0","0","0","0","0","0","0"],"ethAddr2":["0","0","0","0","0","0","0","0","0","0","0"],"ethAddr3":["0","0","0","0"],"feeIdxs":["0","0","0","0"],"feePlanTokens":["0","0","0","0"],"fromBjjCompressed":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"fromEthAddr":["0","0","0","0","0","0","0","0","0","0","0"],"fromIdx":["0","0","0","0","0","0","0","0","0","0","0"],"globalChainID":"0","imAccFeeOut":[["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"]],"imExitRoot":["0","0","0","0","0","0","0","0","0","0"],"imFinalAccFee":["0","0","0","0"],"imInitStateRootFee":"12433441613247342495680642890662773367605896324555599297255745922589338651261","imOnChain":["0","0","0","0","0","0","0","0","0","0"],"imOutIdx":["258","258","258","258","258","258","258","258","258","258"],"imStateRoot":["12433441613247342495680642890662773367605896324555599297255745922589338651261","12433441613247342495680642890662773367605896324555599297255745922589338651261","12433441613247342495680642890662773367605896324555599297255745922589338651261","12433441613247342495680642890662773367605896324555599297255745922589338651261","12433441613247342495680642890662773367605896324555599297255745922589338651261","12433441613247342495680642890662773367605896324555599297255745922589338651261","12433441613247342495680642890662773367605896324555599297255745922589338651261","12433441613247342495680642890662773367605896324555599297255745922589338651261","12433441613247342495680642890662773367605896324555599297255745922589338651261","12433441613247342495680642890662773367605896324555599297255745922589338651261"],"imStateRootFee":["12433441613247342495680642890662773367605896324555599297255745922589338651261","12433441613247342495680642890662773367605896324555599297255745922589338651261","12433441613247342495680642890662773367605896324555599297255745922589338651261"],"isOld0_1":["0","0","0","0","0","0","0","0","0","0","0"],"isOld0_2":["0","0","0","0","0","0","0","0","0","0","0"],"loadAmountF":["0","0","0","0","0","0","0","0","0","0","0"],"maxNumBatch":["0","0","0","0","0","0","0","0","0","0","0"],"newAccount":["0","0","0","0","0","0","0","0","0","0","0"],"newExit":["0","0","0","0","0","0","0","0","0","0","0"],"nonce1":["0","0","0","0","0","0","0","0","0","0","0"],"nonce2":["0","0","0","0","0","0","0","0","0","0","0"],"nonce3":["0","0","0","0"],"oldKey1":["0","0","0","0","0","0","0","0","0","0","0"],"oldKey2":["0","0","0","0","0","0","0","0","0","0","0"],"oldLastIdx":"258","oldStateRoot":"12433441613247342495680642890662773367605896324555599297255745922589338651261","oldValue1":["0","0","0","0","0","0","0","0","0","0","0"],"oldValue2":["0","0","0","0","0","0","0","0","0","0","0"],"onChain":["0","0","0","0","0","0","0","0","0","0","0"],"r8x":["0","0","0","0","0","0","0","0","0","0","0"],"r8y":["0","0","0","0","0","0","0","0","0","0","0"],"rqOffset":["0","0","0","0","0","0","0","0","0","0","0"],"rqToBjjAy":["0","0","0","0","0","0","0","0","0","0","0"],"rqToEthAddr":["0","0","0","0","0","0","0","0","0","0","0"],"rqTxCompressedDataV2":["0","0","0","0","0","0","0","0","0","0","0"],"s":["0","0","0","0","0","0","0","0","0","0","0"],"siblings1":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings2":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings3":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"sign1":["0","0","0","0","0","0","0","0","0","0","0"],"sign2":["0","0","0","0","0","0","0","0","0","0","0"],"sign3":["0","0","0","0"],"toBjjAy":["0","0","0","0","0","0","0","0","0","0","0"],"toEthAddr":["0","0","0","0","0","0","0","0","0","0","0"],"toIdx":["0","0","0","0","0","0","0","0","0","0","0"],"tokenID1":["0","0","0","0","0","0","0","0","0","0","0"],"tokenID2":["0","0","0","0","0","0","0","0","0","0","0"],"tokenID3":["0","0","0","0"],"txCompressedData":["3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559"],"txCompressedDataV2":["0","0","0","0","0","0","0","0","0","0","0"]}`
  1105. assert.Equal(t, expected, string(s))
  1106. // printZKInputs(t, ptOut.ZKInputs)
  1107. log.Debug("block:0 batch:6")
  1108. l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[5].Batch.ForgeL1TxsNum])
  1109. l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[5].L2Txs)
  1110. ptOut, err = tp.ProcessTxs(nil, l1UserTxs, blocks[0].Rollup.Batches[5].L1CoordinatorTxs, l2Txs)
  1111. require.NoError(t, err)
  1112. assert.Equal(t, "4191361650490017591061467288209836928064232431729236465872209988325272262963", sdb.MT.Root().BigInt().String())
  1113. h, err = ptOut.ZKInputs.HashGlobalData()
  1114. require.NoError(t, err)
  1115. assert.Equal(t, "5120300732181596060630968574166921385030718089806947646824763025681325973874", h.String())
  1116. s, err = json.Marshal(ptOut.ZKInputs)
  1117. require.NoError(t, err)
  1118. // the 'expected' data has been checked with the circom circuits
  1119. expected = `{"auxFromIdx":["259","0","0","0","0","0","0","0","0","0","0"],"auxToIdx":["0","0","0","0","0","0","0","0","0","0","0"],"ay1":["21759653464180282217133439550283093276794317614482080451288933258136700169296","0","0","0","0","0","0","0","0","0","0"],"ay2":["14382649545529405976710664157356364657039027681269256663271478725131562622080","0","0","0","0","0","0","0","0","0","0"],"ay3":["0","0","0","0"],"balance1":["500","0","0","0","0","0","0","0","0","0","0"],"balance2":["500","0","0","0","0","0","0","0","0","0","0"],"balance3":["0","0","0","0"],"currentNumBatch":"6","ethAddr1":["247512291986854564435551364600938690683113101007","0","0","0","0","0","0","0","0","0","0"],"ethAddr2":["721457446580647751014191829380889690493307935711","0","0","0","0","0","0","0","0","0","0"],"ethAddr3":["0","0","0","0"],"feeIdxs":["0","0","0","0"],"feePlanTokens":["0","0","0","0"],"fromBjjCompressed":[["0","0","0","0","1","0","1","0","0","0","1","1","0","1","0","1","1","0","0","0","0","1","0","0","0","1","1","1","0","0","1","1","0","1","1","1","0","0","1","1","0","0","1","1","0","1","1","0","1","0","0","1","1","0","0","0","0","1","0","1","1","0","1","0","1","0","0","0","0","1","1","1","1","1","1","1","0","1","0","0","0","1","1","1","0","1","0","0","1","1","1","0","0","1","1","0","0","0","0","0","0","0","0","0","1","0","0","0","1","0","0","0","0","0","1","0","0","0","0","1","1","1","1","0","1","1","0","1","1","0","0","1","0","1","0","0","1","0","0","1","0","1","1","0","1","0","1","0","0","1","1","1","1","0","0","1","0","0","0","0","1","0","1","0","0","1","1","0","0","1","1","0","0","1","1","0","1","1","0","0","0","0","1","0","1","1","0","0","1","1","1","0","1","0","1","1","1","0","1","0","1","0","0","1","1","1","1","0","1","0","0","0","0","1","1","0","1","0","0","1","0","1","0","1","0","0","1","0","0","0","0","0","1","1","1","0","0","0","0","1","1","1","0","1","1","0","0","0","0","0","0","0","1","1","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"fromEthAddr":["247512291986854564435551364600938690683113101007","0","0","0","0","0","0","0","0","0","0"],"fromIdx":["0","0","0","0","0","0","0","0","0","0","0"],"globalChainID":"0","imAccFeeOut":[["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"]],"imExitRoot":["0","0","0","0","0","0","0","0","0","0"],"imFinalAccFee":["0","0","0","0"],"imInitStateRootFee":"4191361650490017591061467288209836928064232431729236465872209988325272262963","imOnChain":["1","0","0","0","0","0","0","0","0","0"],"imOutIdx":["259","259","259","259","259","259","259","259","259","259"],"imStateRoot":["4191361650490017591061467288209836928064232431729236465872209988325272262963","4191361650490017591061467288209836928064232431729236465872209988325272262963","4191361650490017591061467288209836928064232431729236465872209988325272262963","4191361650490017591061467288209836928064232431729236465872209988325272262963","4191361650490017591061467288209836928064232431729236465872209988325272262963","4191361650490017591061467288209836928064232431729236465872209988325272262963","4191361650490017591061467288209836928064232431729236465872209988325272262963","4191361650490017591061467288209836928064232431729236465872209988325272262963","4191361650490017591061467288209836928064232431729236465872209988325272262963","4191361650490017591061467288209836928064232431729236465872209988325272262963"],"imStateRootFee":["4191361650490017591061467288209836928064232431729236465872209988325272262963","4191361650490017591061467288209836928064232431729236465872209988325272262963","4191361650490017591061467288209836928064232431729236465872209988325272262963"],"isOld0_1":["0","0","0","0","0","0","0","0","0","0","0"],"isOld0_2":["0","0","0","0","0","0","0","0","0","0","0"],"loadAmountF":["500","0","0","0","0","0","0","0","0","0","0"],"maxNumBatch":["0","0","0","0","0","0","0","0","0","0","0"],"newAccount":["1","0","0","0","0","0","0","0","0","0","0"],"newExit":["0","0","0","0","0","0","0","0","0","0","0"],"nonce1":["0","0","0","0","0","0","0","0","0","0","0"],"nonce2":["0","0","0","0","0","0","0","0","0","0","0"],"nonce3":["0","0","0","0"],"oldKey1":["257","0","0","0","0","0","0","0","0","0","0"],"oldKey2":["0","0","0","0","0","0","0","0","0","0","0"],"oldLastIdx":"258","oldStateRoot":"12433441613247342495680642890662773367605896324555599297255745922589338651261","oldValue1":["6774577090139950487931919055648421581625010983146127207471638825290459396578","0","0","0","0","0","0","0","0","0","0"],"oldValue2":["0","0","0","0","0","0","0","0","0","0","0"],"onChain":["1","0","0","0","0","0","0","0","0","0","0"],"r8x":["0","0","0","0","0","0","0","0","0","0","0"],"r8y":["0","0","0","0","0","0","0","0","0","0","0"],"rqOffset":["0","0","0","0","0","0","0","0","0","0","0"],"rqToBjjAy":["0","0","0","0","0","0","0","0","0","0","0"],"rqToEthAddr":["0","0","0","0","0","0","0","0","0","0","0"],"rqTxCompressedDataV2":["0","0","0","0","0","0","0","0","0","0","0"],"s":["0","0","0","0","0","0","0","0","0","0","0"],"siblings1":[["3899211834644517301453202511811761166962548726770865239028744137997429134684","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings2":[["14702727384972627447581863847088138237366866855227546744468112739379263276481","7755948646429398821291100070846833855251175245082486192823550499586555278525","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings3":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"sign1":["0","0","0","0","0","0","0","0","0","0","0"],"sign2":["0","0","0","0","0","0","0","0","0","0","0"],"sign3":["0","0","0","0"],"toBjjAy":["0","0","0","0","0","0","0","0","0","0","0"],"toEthAddr":["0","0","0","0","0","0","0","0","0","0","0"],"toIdx":["256","0","0","0","0","0","0","0","0","0","0"],"tokenID1":["0","0","0","0","0","0","0","0","0","0","0"],"tokenID2":["0","0","0","0","0","0","0","0","0","0","0"],"tokenID3":["0","0","0","0"],"txCompressedData":["2230074519853082596563175478935260101171996175","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559"],"txCompressedDataV2":["0","0","0","0","0","0","0","0","0","0","0"]}`
  1120. assert.Equal(t, expected, string(s))
  1121. // printZKInputs(t, ptOut.ZKInputs)
  1122. log.Debug("block:0 batch:7")
  1123. // simulate the PoolL2Txs of the batch6
  1124. batchPoolL2 := `
  1125. Type: PoolL2
  1126. PoolTransferToEthAddr(1) A-B: 200 (126)
  1127. PoolTransferToEthAddr(0) B-C: 100 (126)`
  1128. poolL2Txs, err := tc.GeneratePoolL2Txs(batchPoolL2)
  1129. require.NoError(t, err)
  1130. // Coordinator Idx where to send the fees
  1131. coordIdxs := []common.Idx{261, 262}
  1132. l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[6].Batch.ForgeL1TxsNum])
  1133. l2Txs = poolL2Txs
  1134. ptOut, err = tp.ProcessTxs(coordIdxs, l1UserTxs, blocks[0].Rollup.Batches[6].L1CoordinatorTxs, l2Txs)
  1135. require.NoError(t, err)
  1136. assert.Equal(t, "7614010373759339299470010949167613050707822522530721724565424494781010548240", sdb.MT.Root().BigInt().String())
  1137. h, err = ptOut.ZKInputs.HashGlobalData()
  1138. require.NoError(t, err)
  1139. assert.Equal(t, "5839022641582087945268607236681139065201234733115287223848844591982391942946", h.String())
  1140. s, err = json.Marshal(ptOut.ZKInputs)
  1141. require.NoError(t, err)
  1142. // the 'expected' data has been checked with the circom circuits
  1143. expected = `{"auxFromIdx":["260","261","262","263","264","0","0","0","0","0","0"],"auxToIdx":["0","0","0","0","0","263","264","0","0","0","0"],"ay1":["7299054315324763317564375227723527917820889071879589087797584828752306403468","13127348242808033949662858905093082484882988923889598397206419708399907983738","13127348242808033949662858905093082484882988923889598397206419708399907983738","21759653464180282217133439550283093276794317614482080451288933258136700169296","20534271334408079873799448508761237599936782740731511933526664305820108254173","14382649545529405976710664157356364657039027681269256663271478725131562622080","21759653464180282217133439550283093276794317614482080451288933258136700169296","0","0","0","0"],"ay2":["0","0","0","0","0","21759653464180282217133439550283093276794317614482080451288933258136700169296","20534271334408079873799448508761237599936782740731511933526664305820108254173","0","0","0","0"],"ay3":["13127348242808033949662858905093082484882988923889598397206419708399907983738","13127348242808033949662858905093082484882988923889598397206419708399907983738","0","0"],"balance1":["800","0","0","0","0","500","400","0","0","0","0"],"balance2":["0","0","0","0","0","0","0","0","0","0","0"],"balance3":["0","0","0","0"],"currentNumBatch":"7","ethAddr1":["1288347612158191397270705234830805381732297126518","176962662172908264953938498278848696642639144728","176962662172908264953938498278848696642639144728","247512291986854564435551364600938690683113101007","594179275863704165266696689399235767493667371625","721457446580647751014191829380889690493307935711","247512291986854564435551364600938690683113101007","0","0","0","0"],"ethAddr2":["0","0","0","0","0","247512291986854564435551364600938690683113101007","594179275863704165266696689399235767493667371625","0","0","0","0"],"ethAddr3":["176962662172908264953938498278848696642639144728","176962662172908264953938498278848696642639144728","0","0"],"feeIdxs":["261","262","0","0"],"feePlanTokens":["1","0","0","0"],"fromBjjCompressed":[["0","0","1","1","0","0","0","1","0","0","0","1","1","1","1","0","0","0","1","1","1","0","1","0","1","1","0","0","0","1","1","0","1","1","0","0","0","0","0","1","1","1","0","1","1","0","0","0","1","1","0","0","0","1","1","1","0","1","1","0","1","0","0","0","1","0","0","1","1","1","1","0","0","1","1","0","1","1","1","1","1","1","0","0","1","0","1","1","0","1","0","0","1","1","0","1","0","0","0","0","1","1","0","0","1","0","1","1","0","0","0","0","1","1","0","0","1","1","1","1","0","1","0","0","1","0","0","1","1","1","1","1","0","0","1","0","1","0","0","0","0","1","1","1","0","0","0","1","1","0","0","0","1","1","1","1","1","0","0","1","0","1","0","0","1","0","1","1","0","1","1","0","1","1","0","1","0","0","1","0","0","1","0","1","1","1","1","0","1","0","1","0","0","1","1","1","1","1","0","1","1","0","1","1","0","0","0","1","1","0","1","0","0","1","0","0","1","1","0","1","1","0","0","1","1","1","0","1","0","0","1","0","0","1","1","1","1","0","0","0","1","1","0","0","0","1","0","0","0","0","0","0","1","0","0","0"],["0","1","0","1","1","1","1","0","1","0","0","0","1","0","1","0","1","1","0","1","1","0","1","0","0","0","1","0","1","0","1","0","0","0","0","0","0","1","1","1","0","1","1","1","1","1","1","0","1","1","0","0","1","1","0","1","1","0","1","0","1","0","0","0","1","1","1","1","1","0","1","1","1","1","0","1","1","1","0","0","1","1","1","0","0","1","0","0","0","0","0","0","0","1","1","0","0","1","1","1","1","0","0","0","1","0","0","0","0","1","1","0","0","1","0","1","0","1","1","0","0","1","1","0","1","1","1","0","0","0","0","0","0","0","1","0","0","0","0","0","1","0","1","0","1","1","0","1","0","0","0","0","1","1","0","1","0","0","1","0","0","1","1","1","1","0","1","0","0","0","0","1","1","0","0","0","0","1","1","0","1","0","0","1","0","1","1","0","1","1","0","1","1","0","1","0","0","0","1","1","0","0","0","1","1","1","0","1","1","1","0","0","0","0","1","1","1","0","0","0","1","1","1","0","0","0","0","1","1","0","1","1","0","0","0","0","1","0","1","1","1","0","1","0","0","0","0","0","1","0","1","1","1","0","0","0"],["0","1","0","1","1","1","1","0","1","0","0","0","1","0","1","0","1","1","0","1","1","0","1","0","0","0","1","0","1","0","1","0","0","0","0","0","0","1","1","1","0","1","1","1","1","1","1","0","1","1","0","0","1","1","0","1","1","0","1","0","1","0","0","0","1","1","1","1","1","0","1","1","1","1","0","1","1","1","0","0","1","1","1","0","0","1","0","0","0","0","0","0","0","1","1","0","0","1","1","1","1","0","0","0","1","0","0","0","0","1","1","0","0","1","0","1","0","1","1","0","0","1","1","0","1","1","1","0","0","0","0","0","0","0","1","0","0","0","0","0","1","0","1","0","1","1","0","1","0","0","0","0","1","1","0","1","0","0","1","0","0","1","1","1","1","0","1","0","0","0","0","1","1","0","0","0","0","1","1","0","1","0","0","1","0","1","1","0","1","1","0","1","1","0","1","0","0","0","1","1","0","0","0","1","1","1","0","1","1","1","0","0","0","0","1","1","1","0","0","0","1","1","1","0","0","0","0","1","1","0","1","1","0","0","0","0","1","0","1","1","1","0","1","0","0","0","0","0","1","0","1","1","1","0","0","0"],["0","0","0","0","1","0","1","0","0","0","1","1","0","1","0","1","1","0","0","0","0","1","0","0","0","1","1","1","0","0","1","1","0","1","1","1","0","0","1","1","0","0","1","1","0","1","1","0","1","0","0","1","1","0","0","0","0","1","0","1","1","0","1","0","1","0","0","0","0","1","1","1","1","1","1","1","0","1","0","0","0","1","1","1","0","1","0","0","1","1","1","0","0","1","1","0","0","0","0","0","0","0","0","0","1","0","0","0","1","0","0","0","0","0","1","0","0","0","0","1","1","1","1","0","1","1","0","1","1","0","0","1","0","1","0","0","1","0","0","1","0","1","1","0","1","0","1","0","0","1","1","1","1","0","0","1","0","0","0","0","1","0","1","0","0","1","1","0","0","1","1","0","0","1","1","0","1","1","0","0","0","0","1","0","1","1","0","0","1","1","1","0","1","0","1","1","1","0","1","0","1","0","0","1","1","1","1","0","1","0","0","0","0","1","1","0","1","0","0","1","0","1","0","1","0","0","1","0","0","0","0","0","1","1","1","0","0","0","0","1","1","1","0","1","1","0","0","0","0","0","0","0","1","1","0","0"],["1","0","1","1","1","0","1","1","1","1","0","1","0","1","1","1","0","1","1","1","1","0","1","0","1","0","0","0","1","0","1","1","1","0","0","0","1","0","1","1","1","1","1","0","0","0","0","1","1","1","1","1","1","1","0","1","1","1","1","1","1","0","0","1","0","0","1","1","1","1","0","1","1","1","0","0","0","0","0","0","0","0","0","1","0","0","1","0","0","1","0","1","0","1","1","1","0","1","0","0","1","0","1","1","0","1","1","1","0","0","0","1","1","1","1","0","0","0","1","0","0","0","1","1","0","1","1","0","1","1","1","1","0","0","1","0","1","0","1","0","1","0","0","0","0","1","0","0","1","0","1","0","0","0","1","1","1","1","1","1","1","0","1","1","1","1","1","0","0","0","1","0","1","0","0","0","1","1","0","1","0","0","1","0","1","0","0","1","0","0","0","1","1","0","1","1","0","1","1","0","1","0","1","0","1","1","1","0","1","1","1","1","0","1","0","1","1","0","1","0","1","0","1","0","1","1","1","0","1","0","1","0","0","0","1","1","1","1","1","1","1","0","1","0","0","1","1","0","1","0","1","1","0","1","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"fromEthAddr":["1288347612158191397270705234830805381732297126518","176962662172908264953938498278848696642639144728","176962662172908264953938498278848696642639144728","247512291986854564435551364600938690683113101007","594179275863704165266696689399235767493667371625","0","0","0","0","0","0"],"fromIdx":["0","0","0","0","0","258","259","0","0","0","0"],"globalChainID":"0","imAccFeeOut":[["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["20","0","0","0"],["20","10","0","0"],["20","10","0","0"],["20","10","0","0"],["20","10","0","0"]],"imExitRoot":["0","0","0","0","0","0","0","0","0","0"],"imFinalAccFee":["20","10","0","0"],"imInitStateRootFee":"17741644249720402517735354152654759145987366769089413837433826972022950589304","imOnChain":["1","1","1","1","1","0","0","0","0","0"],"imOutIdx":["260","261","262","263","264","264","264","264","264","264"],"imStateRoot":["11375405969189785436571038561744799436720118954545130018926124278584645552009","20761828456315245186363918358765162254367904851823005328100794592627856251563","20683071053329687036585598804929492993106084088768747535886020881876454022021","13211450525259994050757489737763719242472356251694780567329817940037761147970","12984515017081128973218030836709674039727502968904287295435743487213425590204","10885997071306224132441222238945079082948044938920047568939839726053890597466","17741644249720402517735354152654759145987366769089413837433826972022950589304","17741644249720402517735354152654759145987366769089413837433826972022950589304","17741644249720402517735354152654759145987366769089413837433826972022950589304","17741644249720402517735354152654759145987366769089413837433826972022950589304"],"imStateRootFee":["15372740088722269568981304869679570041947213481887811354093054725880296533807","7614010373759339299470010949167613050707822522530721724565424494781010548240","7614010373759339299470010949167613050707822522530721724565424494781010548240"],"isOld0_1":["0","0","0","0","0","0","0","0","0","0","0"],"isOld0_2":["0","0","0","0","0","0","0","0","0","0","0"],"loadAmountF":["800","0","0","0","0","0","0","0","0","0","0"],"maxNumBatch":["0","0","0","0","0","0","0","0","0","0","0"],"newAccount":["1","1","1","1","1","0","0","0","0","0","0"],"newExit":["0","0","0","0","0","0","0","0","0","0","0"],"nonce1":["0","0","0","0","0","0","0","0","0","0","0"],"nonce2":["0","0","0","0","0","0","0","0","0","0","0"],"nonce3":["0","0","0","0"],"oldKey1":["256","257","258","259","256","0","0","0","0","0","0"],"oldKey2":["0","0","0","0","0","0","0","0","0","0","0"],"oldLastIdx":"259","oldStateRoot":"4191361650490017591061467288209836928064232431729236465872209988325272262963","oldValue1":["14159146138870948981261628221580446593202964471927496245700570744023673652474","6774577090139950487931919055648421581625010983146127207471638825290459396578","1106214737817091318645489315075349905399026405819131857636808390170688240891","6365535023187825208144764514320453191756697986786433153095322086019182201501","14159146138870948981261628221580446593202964471927496245700570744023673652474","0","0","0","0","0","0"],"oldValue2":["0","0","0","0","0","0","0","0","0","0","0"],"onChain":["1","1","1","1","1","0","0","0","0","0","0"],"r8x":["0","0","0","0","0","7496010381881039453810906160954949205969149154991897404626421970025600748606","12412813678590716324822125467835894130850861085920452009989908739280369340912","0","0","0","0"],"r8y":["0","0","0","0","0","11631916565927785458375232001241369217503737572415535094856786494343840799609","8617084456479991705566575703284446140648314135305395774775327309366404118358","0","0","0","0"],"rqOffset":["0","0","0","0","0","0","0","0","0","0","0"],"rqToBjjAy":["0","0","0","0","0","0","0","0","0","0","0"],"rqToEthAddr":["0","0","0","0","0","0","0","0","0","0","0"],"rqTxCompressedDataV2":["0","0","0","0","0","0","0","0","0","0","0"],"s":["0","0","0","0","0","2244658176446706345881885064621733241041747847281667518518641998865566917689","1245020638656422663407771664013416623461145525662703276316748380644180555333","0","0","0","0"],"siblings1":[["14702727384972627447581863847088138237366866855227546744468112739379263276481","7755948646429398821291100070846833855251175245082486192823550499586555278525","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["422199898889517613773982452129175087794072674457596910115858401817745125087","9079219535628010802071615345017476015917327958180108304569920662380819715325","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["15963808519288332945100074956800941932891521513722256092452458226793661883439","13596469854260548245460464538907772795199071172335307364067604409489666713808","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["6641006922974242781187020959943175411644919098478945890590741303508582052174","8277462191940829160994253060600781337287134966993677168749738055372168723417","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["1430107289797654332594935046521303932591278391806211197879745902735754312017","8853256284722484432770613897148402041479732000135754418353724770254323724262","1896469934887461766883159186626893893033601055582184372745933005320239919257","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["1430107289797654332594935046521303932591278391806211197879745902735754312017","8169393177379580923879468365756966210425762441160838354073772366742304729161","5382398532681355214670751476014675615126592187643469995744136997804810983012","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["7970081877061293125567456914968226799852065596816151493394367169124561694168","8277462191940829160994253060600781337287134966993677168749738055372168723417","6798307836511598148989787750017964412301436567592227000632679070896941097262","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings2":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["7970081877061293125567456914968226799852065596816151493394367169124561694168","8277462191940829160994253060600781337287134966993677168749738055372168723417","9079219535628010802071615345017476015917327958180108304569920662380819715325","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["13379353288396803661771402768331793579361513022431906050038119556697190004965","17006057853090300543509722277521228505250073488096856010633171696288410716187","1896469934887461766883159186626893893033601055582184372745933005320239919257","5005552321103115684351512413816798199662130591336895010681875123316537292286","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings3":[["164417911685474032311018462366110177149395854292781808471280295036938986288","15104543998488417037552688729720798428790501838278429747707303574893391327720","7195104960595501408205939515167377857306285954201660092415422277455221721819","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["14858259083622605424845070215009923157748763974354346023689066336657378128652","16693021330410093402006897689327915928070310067296860093884561600318561121725","10003809248135499411338663665262869546473082762019120646574426182569460233447","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"sign1":["0","0","0","0","0","0","0","0","0","0","0"],"sign2":["0","0","0","0","0","0","0","0","0","0","0"],"sign3":["0","0","0","0"],"toBjjAy":["0","0","0","0","0","0","0","0","0","0","0"],"toEthAddr":["0","0","0","0","0","247512291986854564435551364600938690683113101007","594179275863704165266696689399235767493667371625","0","0","0","0"],"toIdx":["0","0","0","0","0","0","0","0","0","0","0"],"tokenID1":["0","1","0","1","0","1","0","0","0","0","0"],"tokenID2":["0","0","0","0","0","1","0","0","0","0","0"],"tokenID3":["1","0","0","0"],"txCompressedData":["3322668559","1461501637330902918203684832716283019659255211535","3322668559","1461501637330902918203684832716283019659255211535","3322668559","869620039695611037216780704608691577617882562485445076835790556641355279","869620039695611037216779240876979726861902044647040533288216225087481359","3322668559","3322668559","3322668559","3322668559"],"txCompressedDataV2":["0","0","0","0","0","3089511010385631938450432814877514351855874119527261274370","3089511010385631938450427614657839565601811829676537020675","0","0","0","0"]}`
  1144. assert.Equal(t, expected, string(s))
  1145. // printZKInputs(t, ptOut.ZKInputs)
  1146. log.Debug("block:0 batch:8")
  1147. // simulate the PoolL2Txs of the batch7
  1148. batchPoolL2 = `
  1149. Type: PoolL2
  1150. PoolTransfer(0) A-B: 100 (126)
  1151. PoolTransfer(0) C-A: 50 (126)
  1152. PoolTransfer(1) B-C: 100 (126)
  1153. PoolExit(0) A: 100 (126)`
  1154. poolL2Txs, err = tc.GeneratePoolL2Txs(batchPoolL2)
  1155. require.NoError(t, err)
  1156. l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[7].Batch.ForgeL1TxsNum])
  1157. l2Txs = poolL2Txs
  1158. ptOut, err = tp.ProcessTxs(coordIdxs, l1UserTxs, blocks[0].Rollup.Batches[7].L1CoordinatorTxs, l2Txs)
  1159. require.NoError(t, err)
  1160. assert.Equal(t, "21231789250434471575486264439945776732824482207853465397552873521865656677689", sdb.MT.Root().BigInt().String())
  1161. h, err = ptOut.ZKInputs.HashGlobalData()
  1162. require.NoError(t, err)
  1163. assert.Equal(t, "7945511370633877134826811902525886329505172247289807873325660574683152064729", h.String())
  1164. s, err = json.Marshal(ptOut.ZKInputs)
  1165. require.NoError(t, err)
  1166. // the 'expected' data has been checked with the circom circuits
  1167. expected = `{"auxFromIdx":["0","0","0","0","0","0","0","0","0","0","0"],"auxToIdx":["0","0","0","0","0","0","0","0","0","0","0"],"ay1":["14382649545529405976710664157356364657039027681269256663271478725131562622080","20534271334408079873799448508761237599936782740731511933526664305820108254173","21759653464180282217133439550283093276794317614482080451288933258136700169296","14382649545529405976710664157356364657039027681269256663271478725131562622080","0","0","0","0","0","0","0"],"ay2":["21759653464180282217133439550283093276794317614482080451288933258136700169296","14382649545529405976710664157356364657039027681269256663271478725131562622080","20534271334408079873799448508761237599936782740731511933526664305820108254173","14382649545529405976710664157356364657039027681269256663271478725131562622080","0","0","0","0","0","0","0"],"ay3":["13127348242808033949662858905093082484882988923889598397206419708399907983738","13127348242808033949662858905093082484882988923889598397206419708399907983738","0","0"],"balance1":["600","100","200","540","0","0","0","0","0","0","0"],"balance2":["290","490","0","100","0","0","0","0","0","0","0"],"balance3":["20","10","0","0"],"currentNumBatch":"8","ethAddr1":["721457446580647751014191829380889690493307935711","594179275863704165266696689399235767493667371625","247512291986854564435551364600938690683113101007","721457446580647751014191829380889690493307935711","0","0","0","0","0","0","0"],"ethAddr2":["247512291986854564435551364600938690683113101007","721457446580647751014191829380889690493307935711","594179275863704165266696689399235767493667371625","721457446580647751014191829380889690493307935711","0","0","0","0","0","0","0"],"ethAddr3":["176962662172908264953938498278848696642639144728","176962662172908264953938498278848696642639144728","0","0"],"feeIdxs":["261","262","0","0"],"feePlanTokens":["1","0","0","0"],"fromBjjCompressed":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"fromEthAddr":["0","0","0","0","0","0","0","0","0","0","0"],"fromIdx":["256","264","263","256","0","0","0","0","0","0","0"],"globalChainID":"0","imAccFeeOut":[["0","10","0","0"],["0","15","0","0"],["10","15","0","0"],["10","25","0","0"],["10","25","0","0"],["10","25","0","0"],["10","25","0","0"],["10","25","0","0"],["10","25","0","0"],["10","25","0","0"]],"imExitRoot":["0","0","0","601907123714740672507543219135850785231457721026220266509483476465720317012","601907123714740672507543219135850785231457721026220266509483476465720317012","601907123714740672507543219135850785231457721026220266509483476465720317012","601907123714740672507543219135850785231457721026220266509483476465720317012","601907123714740672507543219135850785231457721026220266509483476465720317012","601907123714740672507543219135850785231457721026220266509483476465720317012","601907123714740672507543219135850785231457721026220266509483476465720317012"],"imFinalAccFee":["10","25","0","0"],"imInitStateRootFee":"12760054728514276895824286193046360661251072723537606100990608929494815633915","imOnChain":["0","0","0","0","0","0","0","0","0","0"],"imOutIdx":["264","264","264","264","264","264","264","264","264","264"],"imStateRoot":["4095313121700763260992299209972328389318149914511603250351488629121356104462","26684680114125386896510978247568143772745320786724096019161499677475926380","655916081409006806099393800203972610575984499723428411343658955804125053678","12760054728514276895824286193046360661251072723537606100990608929494815633915","12760054728514276895824286193046360661251072723537606100990608929494815633915","12760054728514276895824286193046360661251072723537606100990608929494815633915","12760054728514276895824286193046360661251072723537606100990608929494815633915","12760054728514276895824286193046360661251072723537606100990608929494815633915","12760054728514276895824286193046360661251072723537606100990608929494815633915","12760054728514276895824286193046360661251072723537606100990608929494815633915"],"imStateRootFee":["9982864286691633551138759039613660831792376104794709174072260054392044402998","21231789250434471575486264439945776732824482207853465397552873521865656677689","21231789250434471575486264439945776732824482207853465397552873521865656677689"],"isOld0_1":["0","0","0","0","0","0","0","0","0","0","0"],"isOld0_2":["0","0","0","1","0","0","0","0","0","0","0"],"loadAmountF":["0","0","0","0","0","0","0","0","0","0","0"],"maxNumBatch":["0","0","0","0","0","0","0","0","0","0","0"],"newAccount":["0","0","0","0","0","0","0","0","0","0","0"],"newExit":["0","0","0","1","0","0","0","0","0","0","0"],"nonce1":["0","0","0","1","0","0","0","0","0","0","0"],"nonce2":["1","1","0","0","0","0","0","0","0","0","0"],"nonce3":["0","0","0","0"],"oldKey1":["0","0","0","0","0","0","0","0","0","0","0"],"oldKey2":["0","0","0","0","0","0","0","0","0","0","0"],"oldLastIdx":"264","oldStateRoot":"7614010373759339299470010949167613050707822522530721724565424494781010548240","oldValue1":["0","0","0","0","0","0","0","0","0","0","0"],"oldValue2":["0","0","0","0","0","0","0","0","0","0","0"],"onChain":["0","0","0","0","0","0","0","0","0","0","0"],"r8x":["1030113466663339290570909073865513208647154640741180264981208954567737161623","20030185759423826569745253078278519200885890064258281238637990644547294605799","12998222528638742961611915086894811475885914026245710683562900488152354033424","16036271468141351385264444594143607369599748236531852469802627724557802944248","0","0","0","0","0","0","0"],"r8y":["4876461925756745626455661922340339089695965726545402439739802981656343733054","6053621615057180351411375641507360762786448895094854330217212344945287807468","15989744994796295055006927129959217537448751504322400341855217841327945907814","6483490902247272899490507424055147054694449056761334618798323752905544649881","0","0","0","0","0","0","0"],"rqOffset":["0","0","0","0","0","0","0","0","0","0","0"],"rqToBjjAy":["0","0","0","0","0","0","0","0","0","0","0"],"rqToEthAddr":["0","0","0","0","0","0","0","0","0","0","0"],"rqTxCompressedDataV2":["0","0","0","0","0","0","0","0","0","0","0"],"s":["2404949979054627101134878547215562240541208699668007786604115260842836989960","1048774877431078900030494479869865235710279028244910402924387460312520684406","1520574536423093398144521790001733676090791498843310983172142201888876325595","668687206113063777775010963584460432292222033121244995065687692646007642522","0","0","0","0","0","0","0"],"siblings1":[["14858259083622605424845070215009923157748763974354346023689066336657378128652","9945334704454468804704021542060300136657746048344686921064336688272728705386","1896469934887461766883159186626893893033601055582184372745933005320239919257","14928062784714212388574444926403183233259391614313737527921306713567129759275","0","0","0","0","0","0","0","0","0","0","0","0","0"],["18256399978271684839247258739620372788446465660473485954019140383576047199180","9945334704454468804704021542060300136657746048344686921064336688272728705386","1896469934887461766883159186626893893033601055582184372745933005320239919257","41409158839371443310554332763951312445359770706998982330645982059426589507","0","0","0","0","0","0","0","0","0","0","0","0","0"],["13061949231875034152770336552273184107384834696467516774607389008575508905987","14220982247160675817975753357745166071193319878564798230246975238540328065705","18551935540673424903680681888979869954080246520613893105090167811375742628506","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["14836394450849765347329048233146392679189179676750334562469686848143772489453","9945334704454468804704021542060300136657746048344686921064336688272728705386","1896469934887461766883159186626893893033601055582184372745933005320239919257","19255220320188070600429523371759180355284982739790485865480486371951760060146","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings2":[["7123960019033227326067507571111342432768004902984040602655801239590339644336","14220982247160675817975753357745166071193319878564798230246975238540328065705","6798307836511598148989787750017964412301436567592227000632679070896941097262","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["18256399978271684839247258739620372788446465660473485954019140383576047199180","9945334704454468804704021542060300136657746048344686921064336688272728705386","1896469934887461766883159186626893893033601055582184372745933005320239919257","19255220320188070600429523371759180355284982739790485865480486371951760060146","0","0","0","0","0","0","0","0","0","0","0","0","0"],["13061949231875034152770336552273184107384834696467516774607389008575508905987","9419168499172110492698465067441716212593642867489109115186391804296798931589","2884181024430050428349458819340160955583781475208866887226091023657982879662","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings3":[["4594616630980000280519303920211012046189821482303232894397282320224440966711","9419168499172110492698465067441716212593642867489109115186391804296798931589","6469516525926811793349987969506596648165191405651772226777931395917128484544","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["17868619801713928720384574350608823741045305450040704391319226428612304765106","8572108324721811903005674780452555594782159245842946387691178741602543415354","10003809248135499411338663665262869546473082762019120646574426182569460233447","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"sign1":["0","0","0","0","0","0","0","0","0","0","0"],"sign2":["0","0","0","0","0","0","0","0","0","0","0"],"sign3":["0","0","0","0"],"toBjjAy":["21759653464180282217133439550283093276794317614482080451288933258136700169296","14382649545529405976710664157356364657039027681269256663271478725131562622080","20534271334408079873799448508761237599936782740731511933526664305820108254173","0","0","0","0","0","0","0","0"],"toEthAddr":["247512291986854564435551364600938690683113101007","721457446580647751014191829380889690493307935711","594179275863704165266696689399235767493667371625","0","0","0","0","0","0","0","0"],"toIdx":["259","256","257","1","0","0","0","0","0","0","0"],"tokenID1":["0","0","1","0","0","0","0","0","0","0","0"],"tokenID2":["0","0","1","0","0","0","0","0","0","0","0"],"tokenID3":["1","0","0","0"],"txCompressedData":["869620039695611037216779240876979726861922564741131727750808528040486415","869620039695611037216779239761942466935391169979858271327629471923299855","869620039695611037216780702378617057764840609969639415507123321722103311","869620039695617314318514627557743562651325331541619149907153857735812623","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559"],"txCompressedDataV2":["3089511010385631938450427614657839565601884731695505080576","3089511010385631938450427610696431439888667007593377431816","3089511010385631938450432806954698100429512699241880879367","3089511010385654239195626145280981101320084759513019711744","0","0","0","0","0","0","0"]}`
  1168. assert.Equal(t, expected, string(s))
  1169. // printZKInputs(t, ptOut.ZKInputs)
  1170. log.Debug("(batch9) block:1 batch:1")
  1171. // simulate the PoolL2Txs of the block1,batch0
  1172. batchPoolL2 = `
  1173. Type: PoolL2
  1174. PoolTransfer(0) D-A: 300 (126)
  1175. PoolTransfer(0) B-D: 100 (126)`
  1176. poolL2Txs, err = tc.GeneratePoolL2Txs(batchPoolL2)
  1177. require.NoError(t, err)
  1178. l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[1].Rollup.Batches[0].Batch.ForgeL1TxsNum])
  1179. l2Txs = poolL2Txs
  1180. coordIdxs = []common.Idx{262}
  1181. ptOut, err = tp.ProcessTxs(coordIdxs, l1UserTxs, blocks[1].Rollup.Batches[0].L1CoordinatorTxs, l2Txs)
  1182. require.NoError(t, err)
  1183. assert.Equal(t, "11289313644810782435120113035387729451095637380468777086895109386127538554246", sdb.MT.Root().BigInt().String())
  1184. h, err = ptOut.ZKInputs.HashGlobalData()
  1185. require.NoError(t, err)
  1186. assert.Equal(t, "16119440808320608822131370043082979464334273340463007580270756129998780590265", h.String())
  1187. s, err = json.Marshal(ptOut.ZKInputs)
  1188. require.NoError(t, err)
  1189. // the 'expected' data has been checked with the circom circuits
  1190. expected = `{"auxFromIdx":["0","0","0","0","0","0","0","0","0","0","0"],"auxToIdx":["0","0","0","0","0","0","0","0","0","0","0"],"ay1":["20534271334408079873799448508761237599936782740731511933526664305820108254173","20534271334408079873799448508761237599936782740731511933526664305820108254173","7299054315324763317564375227723527917820889071879589087797584828752306403468","21759653464180282217133439550283093276794317614482080451288933258136700169296","7299054315324763317564375227723527917820889071879589087797584828752306403468","21759653464180282217133439550283093276794317614482080451288933258136700169296","0","0","0","0","0"],"ay2":["0","7299054315324763317564375227723527917820889071879589087797584828752306403468","21759653464180282217133439550283093276794317614482080451288933258136700169296","21759653464180282217133439550283093276794317614482080451288933258136700169296","14382649545529405976710664157356364657039027681269256663271478725131562622080","7299054315324763317564375227723527917820889071879589087797584828752306403468","0","0","0","0","0"],"ay3":["13127348242808033949662858905093082484882988923889598397206419708399907983738","0","0","0"],"balance1":["45","545","900","590","700","490","0","0","0","0","0"],"balance2":["0","800","390","100","430","370","0","0","0","0","0"],"balance3":["35","0","0","0"],"currentNumBatch":"9","ethAddr1":["594179275863704165266696689399235767493667371625","594179275863704165266696689399235767493667371625","1288347612158191397270705234830805381732297126518","247512291986854564435551364600938690683113101007","1288347612158191397270705234830805381732297126518","247512291986854564435551364600938690683113101007","0","0","0","0","0"],"ethAddr2":["0","1288347612158191397270705234830805381732297126518","247512291986854564435551364600938690683113101007","247512291986854564435551364600938690683113101007","721457446580647751014191829380889690493307935711","1288347612158191397270705234830805381732297126518","0","0","0","0","0"],"ethAddr3":["176962662172908264953938498278848696642639144728","0","0","0"],"feeIdxs":["262","0","0","0"],"feePlanTokens":["0","0","0","0"],"fromBjjCompressed":[["1","0","1","1","1","0","1","1","1","1","0","1","0","1","1","1","0","1","1","1","1","0","1","0","1","0","0","0","1","0","1","1","1","0","0","0","1","0","1","1","1","1","1","0","0","0","0","1","1","1","1","1","1","1","0","1","1","1","1","1","1","0","0","1","0","0","1","1","1","1","0","1","1","1","0","0","0","0","0","0","0","0","0","1","0","0","1","0","0","1","0","1","0","1","1","1","0","1","0","0","1","0","1","1","0","1","1","1","0","0","0","1","1","1","1","0","0","0","1","0","0","0","1","1","0","1","1","0","1","1","1","1","0","0","1","0","1","0","1","0","1","0","0","0","0","1","0","0","1","0","1","0","0","0","1","1","1","1","1","1","1","0","1","1","1","1","1","0","0","0","1","0","1","0","0","0","1","1","0","1","0","0","1","0","1","0","0","1","0","0","0","1","1","0","1","1","0","1","1","0","1","0","1","0","1","1","1","0","1","1","1","1","0","1","0","1","1","0","1","0","1","0","1","0","1","1","1","0","1","0","1","0","0","0","1","1","1","1","1","1","1","0","1","0","0","1","1","0","1","0","1","1","0","1","0","0"],["1","0","1","1","1","0","1","1","1","1","0","1","0","1","1","1","0","1","1","1","1","0","1","0","1","0","0","0","1","0","1","1","1","0","0","0","1","0","1","1","1","1","1","0","0","0","0","1","1","1","1","1","1","1","0","1","1","1","1","1","1","0","0","1","0","0","1","1","1","1","0","1","1","1","0","0","0","0","0","0","0","0","0","1","0","0","1","0","0","1","0","1","0","1","1","1","0","1","0","0","1","0","1","1","0","1","1","1","0","0","0","1","1","1","1","0","0","0","1","0","0","0","1","1","0","1","1","0","1","1","1","1","0","0","1","0","1","0","1","0","1","0","0","0","0","1","0","0","1","0","1","0","0","0","1","1","1","1","1","1","1","0","1","1","1","1","1","0","0","0","1","0","1","0","0","0","1","1","0","1","0","0","1","0","1","0","0","1","0","0","0","1","1","0","1","1","0","1","1","0","1","0","1","0","1","1","1","0","1","1","1","1","0","1","0","1","1","0","1","0","1","0","1","0","1","1","1","0","1","0","1","0","0","0","1","1","1","1","1","1","1","0","1","0","0","1","1","0","1","0","1","1","0","1","0","0"],["0","0","1","1","0","0","0","1","0","0","0","1","1","1","1","0","0","0","1","1","1","0","1","0","1","1","0","0","0","1","1","0","1","1","0","0","0","0","0","1","1","1","0","1","1","0","0","0","1","1","0","0","0","1","1","1","0","1","1","0","1","0","0","0","1","0","0","1","1","1","1","0","0","1","1","0","1","1","1","1","1","1","0","0","1","0","1","1","0","1","0","0","1","1","0","1","0","0","0","0","1","1","0","0","1","0","1","1","0","0","0","0","1","1","0","0","1","1","1","1","0","1","0","0","1","0","0","1","1","1","1","1","0","0","1","0","1","0","0","0","0","1","1","1","0","0","0","1","1","0","0","0","1","1","1","1","1","0","0","1","0","1","0","0","1","0","1","1","0","1","1","0","1","1","0","1","0","0","1","0","0","1","0","1","1","1","1","0","1","0","1","0","0","1","1","1","1","1","0","1","1","0","1","1","0","0","0","1","1","0","1","0","0","1","0","0","1","1","0","1","1","0","0","1","1","1","0","1","0","0","1","0","0","1","1","1","1","0","0","0","1","1","0","0","0","1","0","0","0","0","0","0","1","0","0","0"],["0","0","0","0","1","0","1","0","0","0","1","1","0","1","0","1","1","0","0","0","0","1","0","0","0","1","1","1","0","0","1","1","0","1","1","1","0","0","1","1","0","0","1","1","0","1","1","0","1","0","0","1","1","0","0","0","0","1","0","1","1","0","1","0","1","0","0","0","0","1","1","1","1","1","1","1","0","1","0","0","0","1","1","1","0","1","0","0","1","1","1","0","0","1","1","0","0","0","0","0","0","0","0","0","1","0","0","0","1","0","0","0","0","0","1","0","0","0","0","1","1","1","1","0","1","1","0","1","1","0","0","1","0","1","0","0","1","0","0","1","0","1","1","0","1","0","1","0","0","1","1","1","1","0","0","1","0","0","0","0","1","0","1","0","0","1","1","0","0","1","1","0","0","1","1","0","1","1","0","0","0","0","1","0","1","1","0","0","1","1","1","0","1","0","1","1","1","0","1","0","1","0","0","1","1","1","1","0","1","0","0","0","0","1","1","0","1","0","0","1","0","1","0","1","0","0","1","0","0","0","0","0","1","1","1","0","0","0","0","1","1","1","0","1","1","0","0","0","0","0","0","0","1","1","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"fromEthAddr":["594179275863704165266696689399235767493667371625","594179275863704165266696689399235767493667371625","1288347612158191397270705234830805381732297126518","247512291986854564435551364600938690683113101007","0","0","0","0","0","0","0"],"fromIdx":["264","264","260","259","260","259","0","0","0","0","0"],"globalChainID":"0","imAccFeeOut":[["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["30","0","0","0"],["40","0","0","0"],["40","0","0","0"],["40","0","0","0"],["40","0","0","0"],["40","0","0","0"]],"imExitRoot":["0","0","0","3693509449952508471253768893986124537733323965962206920194801469639603916469","3693509449952508471253768893986124537733323965962206920194801469639603916469","3693509449952508471253768893986124537733323965962206920194801469639603916469","3693509449952508471253768893986124537733323965962206920194801469639603916469","3693509449952508471253768893986124537733323965962206920194801469639603916469","3693509449952508471253768893986124537733323965962206920194801469639603916469","3693509449952508471253768893986124537733323965962206920194801469639603916469"],"imFinalAccFee":["40","0","0","0"],"imInitStateRootFee":"6771832994614373673910207929122966731141032816947691382941208351605204060862","imOnChain":["1","1","1","1","0","0","0","0","0","0"],"imOutIdx":["264","264","264","264","264","264","264","264","264","264"],"imStateRoot":["15025743479069066110865954881225956477307743913617535111543459344252883110028","15321274923252882328699607364430786719906450172286729545919924665504630807581","5010797101923013813768514921226054531318365538391308499806754058016303829601","7911976485468361648930261478656702185777179946107234047981899300238704688768","7804126926143097298532642314694587242555205994190769506766756666205385077727","6771832994614373673910207929122966731141032816947691382941208351605204060862","6771832994614373673910207929122966731141032816947691382941208351605204060862","6771832994614373673910207929122966731141032816947691382941208351605204060862","6771832994614373673910207929122966731141032816947691382941208351605204060862","6771832994614373673910207929122966731141032816947691382941208351605204060862"],"imStateRootFee":["11289313644810782435120113035387729451095637380468777086895109386127538554246","11289313644810782435120113035387729451095637380468777086895109386127538554246","11289313644810782435120113035387729451095637380468777086895109386127538554246"],"isOld0_1":["0","0","0","0","0","0","0","0","0","0","0"],"isOld0_2":["0","0","0","1","0","0","0","0","0","0","0"],"loadAmountF":["500","400","0","0","0","0","0","0","0","0","0"],"maxNumBatch":["0","0","0","0","0","0","0","0","0","0","0"],"newAccount":["0","0","0","0","0","0","0","0","0","0","0"],"newExit":["0","0","0","1","0","0","0","0","0","0","0"],"nonce1":["1","1","0","1","0","1","0","0","0","0","0"],"nonce2":["0","0","1","0","2","1","0","0","0","0","0"],"nonce3":["0","0","0","0"],"oldKey1":["0","0","0","0","0","0","0","0","0","0","0"],"oldKey2":["0","0","0","0","0","0","0","0","0","0","0"],"oldLastIdx":"264","oldStateRoot":"21231789250434471575486264439945776732824482207853465397552873521865656677689","oldValue1":["0","0","0","0","0","0","0","0","0","0","0"],"oldValue2":["0","0","0","0","0","0","0","0","0","0","0"],"onChain":["1","1","1","1","0","0","0","0","0","0","0"],"r8x":["0","0","0","0","14435111512223236594568238575331749060893129997322274479035658279027902992935","4019539604182107596241278718883278909711569557640049880620248193063494915426","0","0","0","0","0"],"r8y":["0","0","0","0","14203929552121405353665231779052744636882502255540522297330552277594266597590","1742381984187534974279730204675815174699318169687732399634947101622450111068","0","0","0","0","0"],"rqOffset":["0","0","0","0","0","0","0","0","0","0","0"],"rqToBjjAy":["0","0","0","0","0","0","0","0","0","0","0"],"rqToEthAddr":["0","0","0","0","0","0","0","0","0","0","0"],"rqTxCompressedDataV2":["0","0","0","0","0","0","0","0","0","0","0"],"s":["0","0","0","0","40326442701727013917383417859836303474959356948096060787584632935118662625","793121945758629515410980780923759431353190688439841145090830211284173299766","0","0","0","0","0"],"siblings1":[["17868619801713928720384574350608823741045305450040704391319226428612304765106","5201866259206652394294896407496152062971989047505760382685953871497594800664","1896469934887461766883159186626893893033601055582184372745933005320239919257","191927637935950862011324121009108814666832364504737363993980072149308902135","0","0","0","0","0","0","0","0","0","0","0","0","0"],["17868619801713928720384574350608823741045305450040704391319226428612304765106","5201866259206652394294896407496152062971989047505760382685953871497594800664","1896469934887461766883159186626893893033601055582184372745933005320239919257","191927637935950862011324121009108814666832364504737363993980072149308902135","0","0","0","0","0","0","0","0","0","0","0","0","0"],["17868619801713928720384574350608823741045305450040704391319226428612304765106","5201866259206652394294896407496152062971989047505760382685953871497594800664","21649277803964107591811091568493844434254164995721951967521845203423516699117","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["10826443784093799826307850012518158488814628946336321248426300464634260615842","10995196015618128725799894803089419388072117538842455131388703694732104335869","20171488249746299523942354620495391665697566498209421749702529863492938981834","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["19932447914922269771526051666918781151881065509161419388133363769167005916367","5201866259206652394294896407496152062971989047505760382685953871497594800664","21649277803964107591811091568493844434254164995721951967521845203423516699117","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["7364566745182610474048807439595242425259156658286275653144321548891778579405","10995196015618128725799894803089419388072117538842455131388703694732104335869","20171488249746299523942354620495391665697566498209421749702529863492938981834","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings2":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["17868619801713928720384574350608823741045305450040704391319226428612304765106","5201866259206652394294896407496152062971989047505760382685953871497594800664","21649277803964107591811091568493844434254164995721951967521845203423516699117","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["10826443784093799826307850012518158488814628946336321248426300464634260615842","10995196015618128725799894803089419388072117538842455131388703694732104335869","20171488249746299523942354620495391665697566498209421749702529863492938981834","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["19932447914922269771526051666918781151881065509161419388133363769167005916367","5201866259206652394294896407496152062971989047505760382685953871497594800664","11884436728518963690893984601346219713195365259115561555344766652676285879605","2071259344832817464557769199207636634742640646025860191044200199388423664892","0","0","0","0","0","0","0","0","0","0","0","0","0"],["6974033339689609905985251357377304439072231464278686669018741854036271497005","5201866259206652394294896407496152062971989047505760382685953871497594800664","6920557071135458162173269591150749281846566640309554280455815483913220171237","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings3":[["6974033339689609905985251357377304439072231464278686669018741854036271497005","1098096012010164148353974817690754778106319666901812409007051290851873386975","10003809248135499411338663665262869546473082762019120646574426182569460233447","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"sign1":["0","0","0","0","0","0","0","0","0","0","0"],"sign2":["0","0","0","0","0","0","0","0","0","0","0"],"sign3":["0","0","0","0"],"toBjjAy":["0","0","0","0","14382649545529405976710664157356364657039027681269256663271478725131562622080","7299054315324763317564375227723527917820889071879589087797584828752306403468","0","0","0","0","0"],"toEthAddr":["0","0","0","0","721457446580647751014191829380889690493307935711","1288347612158191397270705234830805381732297126518","0","0","0","0","0"],"toIdx":["0","260","259","1","256","260","0","0","0","0","0"],"tokenID1":["0","0","0","0","0","0","0","0","0","0","0"],"tokenID2":["0","0","0","0","0","0","0","0","0","0","0"],"tokenID3":["0","0","0","0"],"txCompressedData":["74309397174281743","2230074519853082913475825536066919869199410703","4460149039706145148401234849066292526346659343","2230074519853062393381734341602075766432720399","869620039695611037216779245337128766568046955363787839488593948511561231","869620039695617314318514627557743562651345851635710344371435010549081615","3322668559","3322668559","3322668559","3322668559","3322668559"],"txCompressedDataV2":["0","0","0","0","3089511010385631938450427630503472068454751405979365015812","3089511010385654239195626145280981101320157661531987771651","0","0","0","0","0"]}`
  1191. assert.Equal(t, expected, string(s))
  1192. // printZKInputs(t, ptOut.ZKInputs)
  1193. log.Debug("(batch10) block:1 batch:2")
  1194. // simulate the PoolL2Txs of the block1,batch0
  1195. l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[1].Rollup.Batches[1].Batch.ForgeL1TxsNum])
  1196. l2Txs = []common.PoolL2Tx{}
  1197. coordIdxs = []common.Idx{}
  1198. ptOut, err = tp.ProcessTxs(coordIdxs, l1UserTxs, blocks[1].Rollup.Batches[1].L1CoordinatorTxs, l2Txs)
  1199. require.NoError(t, err)
  1200. assert.Equal(t, "10342681351319338354912862547249967104198317571995055517008223832276478908482", sdb.MT.Root().BigInt().String())
  1201. h, err = ptOut.ZKInputs.HashGlobalData()
  1202. require.NoError(t, err)
  1203. assert.Equal(t, "20426501470066267736573207861406376916216204377009060500539628007266488591819", h.String())
  1204. s, err = json.Marshal(ptOut.ZKInputs)
  1205. require.NoError(t, err)
  1206. // the 'expected' data has been checked with the circom circuits
  1207. expected = `{"auxFromIdx":["265","0","0","0","0","0","0","0","0","0","0"],"auxToIdx":["0","0","0","0","0","0","0","0","0","0","0"],"ay1":["14399896874050294773416960703887603710722794411453238547230464125238466395720","0","0","0","0","0","0","0","0","0","0"],"ay2":["0","0","0","0","0","0","0","0","0","0","0"],"ay3":["0","0","0","0"],"balance1":["0","0","0","0","0","0","0","0","0","0","0"],"balance2":["0","0","0","0","0","0","0","0","0","0","0"],"balance3":["0","0","0","0"],"currentNumBatch":"10","ethAddr1":["1310124058894944929521848911038157567604058624321","0","0","0","0","0","0","0","0","0","0"],"ethAddr2":["0","0","0","0","0","0","0","0","0","0","0"],"ethAddr3":["0","0","0","0"],"feeIdxs":["0","0","0","0"],"feePlanTokens":["0","0","0","0"],"fromBjjCompressed":[["0","0","0","1","0","0","1","0","0","1","1","1","1","1","0","0","1","0","1","1","0","0","1","1","1","1","0","1","0","0","0","0","0","0","0","0","1","0","0","1","1","0","1","1","0","0","0","0","1","1","1","1","0","1","1","1","0","0","0","0","1","0","0","0","0","0","1","1","0","0","1","0","0","0","0","1","1","0","0","1","1","0","1","1","1","0","0","1","0","1","1","1","1","0","0","0","0","1","1","1","1","0","0","1","0","1","1","0","0","1","1","1","0","0","1","1","0","0","1","0","0","0","1","0","1","0","0","0","0","0","0","1","1","0","1","1","0","0","1","1","1","1","0","0","1","0","1","1","1","1","1","1","1","1","1","0","0","0","1","1","1","0","0","0","0","1","1","1","0","0","0","1","1","0","0","0","0","0","1","0","0","0","0","1","0","0","0","0","1","0","0","0","0","1","0","1","1","0","0","0","0","0","1","0","1","0","1","1","1","1","1","1","1","1","1","0","1","1","0","1","0","0","0","1","0","0","1","0","0","0","0","1","1","0","1","1","0","0","0","0","0","1","1","0","1","0","1","1","1","1","1","1","1","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"fromEthAddr":["1310124058894944929521848911038157567604058624321","0","0","0","0","0","0","0","0","0","0"],"fromIdx":["0","0","0","0","0","0","0","0","0","0","0"],"globalChainID":"0","imAccFeeOut":[["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"],["0","0","0","0"]],"imExitRoot":["0","0","0","0","0","0","0","0","0","0"],"imFinalAccFee":["0","0","0","0"],"imInitStateRootFee":"10342681351319338354912862547249967104198317571995055517008223832276478908482","imOnChain":["1","0","0","0","0","0","0","0","0","0"],"imOutIdx":["265","265","265","265","265","265","265","265","265","265"],"imStateRoot":["10342681351319338354912862547249967104198317571995055517008223832276478908482","10342681351319338354912862547249967104198317571995055517008223832276478908482","10342681351319338354912862547249967104198317571995055517008223832276478908482","10342681351319338354912862547249967104198317571995055517008223832276478908482","10342681351319338354912862547249967104198317571995055517008223832276478908482","10342681351319338354912862547249967104198317571995055517008223832276478908482","10342681351319338354912862547249967104198317571995055517008223832276478908482","10342681351319338354912862547249967104198317571995055517008223832276478908482","10342681351319338354912862547249967104198317571995055517008223832276478908482","10342681351319338354912862547249967104198317571995055517008223832276478908482"],"imStateRootFee":["10342681351319338354912862547249967104198317571995055517008223832276478908482","10342681351319338354912862547249967104198317571995055517008223832276478908482","10342681351319338354912862547249967104198317571995055517008223832276478908482"],"isOld0_1":["0","0","0","0","0","0","0","0","0","0","0"],"isOld0_2":["0","0","0","0","0","0","0","0","0","0","0"],"loadAmountF":["0","0","0","0","0","0","0","0","0","0","0"],"maxNumBatch":["0","0","0","0","0","0","0","0","0","0","0"],"newAccount":["1","0","0","0","0","0","0","0","0","0","0"],"newExit":["0","0","0","0","0","0","0","0","0","0","0"],"nonce1":["0","0","0","0","0","0","0","0","0","0","0"],"nonce2":["0","0","0","0","0","0","0","0","0","0","0"],"nonce3":["0","0","0","0"],"oldKey1":["257","0","0","0","0","0","0","0","0","0","0"],"oldKey2":["0","0","0","0","0","0","0","0","0","0","0"],"oldLastIdx":"264","oldStateRoot":"11289313644810782435120113035387729451095637380468777086895109386127538554246","oldValue1":["2321131058204661256853487065750307888236544076227333118102282395775628673438","0","0","0","0","0","0","0","0","0","0"],"oldValue2":["0","0","0","0","0","0","0","0","0","0","0"],"onChain":["1","0","0","0","0","0","0","0","0","0","0"],"r8x":["0","0","0","0","0","0","0","0","0","0","0"],"r8y":["0","0","0","0","0","0","0","0","0","0","0"],"rqOffset":["0","0","0","0","0","0","0","0","0","0","0"],"rqToBjjAy":["0","0","0","0","0","0","0","0","0","0","0"],"rqToEthAddr":["0","0","0","0","0","0","0","0","0","0","0"],"rqTxCompressedDataV2":["0","0","0","0","0","0","0","0","0","0","0"],"s":["0","0","0","0","0","0","0","0","0","0","0"],"siblings1":[["16812757183458702921648567114837317447291604326148922125692067274722808363398","21818721441073036202930982900505209377975896923127222912920652508220396520845","5744650662490093220476904886912011388702189154555463005563195290050755598301","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings2":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"siblings3":[["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"]],"sign1":["0","0","0","0","0","0","0","0","0","0","0"],"sign2":["0","0","0","0","0","0","0","0","0","0","0"],"sign3":["0","0","0","0"],"toBjjAy":["0","0","0","0","0","0","0","0","0","0","0"],"toEthAddr":["0","0","0","0","0","0","0","0","0","0","0"],"toIdx":["0","0","0","0","0","0","0","0","0","0","0"],"tokenID1":["0","0","0","0","0","0","0","0","0","0","0"],"tokenID2":["0","0","0","0","0","0","0","0","0","0","0"],"tokenID3":["0","0","0","0"],"txCompressedData":["3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559","3322668559"],"txCompressedDataV2":["0","0","0","0","0","0","0","0","0","0","0"]}`
  1208. assert.Equal(t, expected, string(s))
  1209. // printZKInputs(t, ptOut.ZKInputs)
  1210. }