|
@ -77,8 +77,10 @@ func TestRollupAddToken(t *testing.T) { |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
_, err = rollupClient.RollupAddToken(tokenHEZAddressConst, feeAddToken, deadline) |
|
|
_, err = rollupClient.RollupAddToken(tokenHEZAddressConst, feeAddToken, deadline) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
currentBlockNum, _ := rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err := rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
assert.Equal(t, tokenHEZAddressConst, rollupEvents.AddToken[0].TokenAddress) |
|
|
assert.Equal(t, tokenHEZAddressConst, rollupEvents.AddToken[0].TokenAddress) |
|
|
assert.Equal(t, registerTokensCount, common.TokenID(rollupEvents.AddToken[0].TokenID).BigInt()) |
|
|
assert.Equal(t, registerTokensCount, common.TokenID(rollupEvents.AddToken[0].TokenID).BigInt()) |
|
@ -106,7 +108,8 @@ func TestRollupForgeBatch(t *testing.T) { |
|
|
|
|
|
|
|
|
// Add Blocks
|
|
|
// Add Blocks
|
|
|
blockNum := int64(int(blocksPerSlot)*int(currentSlot+4) + int(genesisBlock)) |
|
|
blockNum := int64(int(blocksPerSlot)*int(currentSlot+4) + int(genesisBlock)) |
|
|
currentBlockNum, _ := auctionClient.client.EthLastBlock() |
|
|
|
|
|
|
|
|
currentBlockNum, err := auctionClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
blocksToAdd := blockNum - currentBlockNum |
|
|
blocksToAdd := blockNum - currentBlockNum |
|
|
addBlocks(blocksToAdd, ethClientDialURL) |
|
|
addBlocks(blocksToAdd, ethClientDialURL) |
|
|
|
|
|
|
|
@ -155,8 +158,10 @@ func TestRollupForgeBatch(t *testing.T) { |
|
|
_, err = rollupClient.RollupForgeBatch(argsForge) |
|
|
_, err = rollupClient.RollupForgeBatch(argsForge) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
currentBlockNum, _ = rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err = rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
assert.Equal(t, int64(1), rollupEvents.ForgeBatch[0].BatchNum) |
|
|
assert.Equal(t, int64(1), rollupEvents.ForgeBatch[0].BatchNum) |
|
|
ethHashForge = rollupEvents.ForgeBatch[0].EthTxHash |
|
|
ethHashForge = rollupEvents.ForgeBatch[0].EthTxHash |
|
@ -181,8 +186,10 @@ func TestRollupUpdateForgeL1L2BatchTimeout(t *testing.T) { |
|
|
_, err := rollupClient.RollupUpdateForgeL1L2BatchTimeout(newForgeL1L2BatchTimeout) |
|
|
_, err := rollupClient.RollupUpdateForgeL1L2BatchTimeout(newForgeL1L2BatchTimeout) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
currentBlockNum, _ := rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err := rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
assert.Equal(t, newForgeL1L2BatchTimeout, rollupEvents.UpdateForgeL1L2BatchTimeout[0].NewForgeL1L2BatchTimeout) |
|
|
assert.Equal(t, newForgeL1L2BatchTimeout, rollupEvents.UpdateForgeL1L2BatchTimeout[0].NewForgeL1L2BatchTimeout) |
|
|
} |
|
|
} |
|
@ -192,8 +199,10 @@ func TestRollupUpdateFeeAddToken(t *testing.T) { |
|
|
_, err := rollupClient.RollupUpdateFeeAddToken(newFeeAddToken) |
|
|
_, err := rollupClient.RollupUpdateFeeAddToken(newFeeAddToken) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
currentBlockNum, _ := rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err := rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
assert.Equal(t, newFeeAddToken, rollupEvents.UpdateFeeAddToken[0].NewFeeAddToken) |
|
|
assert.Equal(t, newFeeAddToken, rollupEvents.UpdateFeeAddToken[0].NewFeeAddToken) |
|
|
} |
|
|
} |
|
@ -217,8 +226,10 @@ func TestRollupL1UserTxETHCreateAccountDeposit(t *testing.T) { |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDUint32, toIdxInt64) |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDUint32, toIdxInt64) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
currentBlockNum, _ := rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err := rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
@ -245,8 +256,10 @@ func TestRollupL1UserTxERC20CreateAccountDeposit(t *testing.T) { |
|
|
_, err = rollupClientAux2.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenHEZID, toIdxInt64) |
|
|
_, err = rollupClientAux2.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenHEZID, toIdxInt64) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
currentBlockNum, _ := rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err := rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
@ -273,8 +286,10 @@ func TestRollupL1UserTxERC20PermitCreateAccountDeposit(t *testing.T) { |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20Permit(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDERC777, toIdxInt64, deadline) |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20Permit(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDERC777, toIdxInt64, deadline) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
currentBlockNum, _ := rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err := rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
@ -302,8 +317,10 @@ func TestRollupL1UserTxETHDeposit(t *testing.T) { |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDUint32, toIdxInt64) |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDUint32, toIdxInt64) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
currentBlockNum, _ := rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err := rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
@ -330,8 +347,10 @@ func TestRollupL1UserTxERC20Deposit(t *testing.T) { |
|
|
_, err = rollupClientAux2.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenHEZID, toIdxInt64) |
|
|
_, err = rollupClientAux2.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenHEZID, toIdxInt64) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
currentBlockNum, _ := rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err := rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
@ -358,8 +377,10 @@ func TestRollupL1UserTxERC20PermitDeposit(t *testing.T) { |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20Permit(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDERC777, toIdxInt64, deadline) |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20Permit(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDERC777, toIdxInt64, deadline) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
currentBlockNum, _ := rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err := rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
@ -387,8 +408,10 @@ func TestRollupL1UserTxETHDepositTransfer(t *testing.T) { |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDUint32, toIdxInt64) |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDUint32, toIdxInt64) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
currentBlockNum, _ := rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err := rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
@ -415,8 +438,10 @@ func TestRollupL1UserTxERC20DepositTransfer(t *testing.T) { |
|
|
_, err = rollupClientAux2.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenHEZID, toIdxInt64) |
|
|
_, err = rollupClientAux2.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenHEZID, toIdxInt64) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
currentBlockNum, _ := rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err := rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
@ -443,8 +468,10 @@ func TestRollupL1UserTxERC20PermitDepositTransfer(t *testing.T) { |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20Permit(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDERC777, toIdxInt64, deadline) |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20Permit(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDERC777, toIdxInt64, deadline) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
currentBlockNum, _ := rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err := rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
@ -472,8 +499,10 @@ func TestRollupL1UserTxETHCreateAccountDepositTransfer(t *testing.T) { |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDUint32, toIdxInt64) |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDUint32, toIdxInt64) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
currentBlockNum, _ := rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err := rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
@ -500,8 +529,10 @@ func TestRollupL1UserTxERC20CreateAccountDepositTransfer(t *testing.T) { |
|
|
_, err = rollupClientAux2.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenHEZID, toIdxInt64) |
|
|
_, err = rollupClientAux2.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenHEZID, toIdxInt64) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
currentBlockNum, _ := rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err := rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
@ -528,8 +559,10 @@ func TestRollupL1UserTxERC20PermitCreateAccountDepositTransfer(t *testing.T) { |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20Permit(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDERC777, toIdxInt64, deadline) |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20Permit(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDERC777, toIdxInt64, deadline) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
currentBlockNum, _ := rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err := rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
@ -557,8 +590,10 @@ func TestRollupL1UserTxETHForceTransfer(t *testing.T) { |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDUint32, toIdxInt64) |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDUint32, toIdxInt64) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
currentBlockNum, _ := rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err := rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
@ -585,8 +620,10 @@ func TestRollupL1UserTxERC20ForceTransfer(t *testing.T) { |
|
|
_, err = rollupClientAux2.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenHEZID, toIdxInt64) |
|
|
_, err = rollupClientAux2.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenHEZID, toIdxInt64) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
currentBlockNum, _ := rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err := rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
@ -613,8 +650,10 @@ func TestRollupL1UserTxERC20PermitForceTransfer(t *testing.T) { |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20Permit(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDERC777, toIdxInt64, deadline) |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20Permit(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDERC777, toIdxInt64, deadline) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
currentBlockNum, _ := rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err := rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
@ -642,8 +681,10 @@ func TestRollupL1UserTxETHForceExit(t *testing.T) { |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDUint32, toIdxInt64) |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDUint32, toIdxInt64) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
currentBlockNum, _ := rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err := rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
@ -670,8 +711,10 @@ func TestRollupL1UserTxERC20ForceExit(t *testing.T) { |
|
|
_, err = rollupClientAux2.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenHEZID, toIdxInt64) |
|
|
_, err = rollupClientAux2.RollupL1UserTxERC20ETH(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenHEZID, toIdxInt64) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
currentBlockNum, _ := rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err := rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
@ -700,8 +743,10 @@ func TestRollupL1UserTxERC20PermitForceExit(t *testing.T) { |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20Permit(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDERC777, toIdxInt64, deadline) |
|
|
_, err = rollupClientAux.RollupL1UserTxERC20Permit(l1Tx.FromBJJ, fromIdxInt64, l1Tx.LoadAmount, l1Tx.Amount, tokenIDERC777, toIdxInt64, deadline) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
currentBlockNum, _ := rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err := rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.FromBJJ, rollupEvents.L1UserTx[0].L1UserTx.FromBJJ) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.ToIdx, rollupEvents.L1UserTx[0].L1UserTx.ToIdx) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
|
assert.Equal(t, l1Tx.LoadAmount, rollupEvents.L1UserTx[0].L1UserTx.LoadAmount) |
|
@ -748,8 +793,10 @@ func TestRollupForgeBatch2(t *testing.T) { |
|
|
_, err = rollupClient.RollupForgeBatch(argsForge) |
|
|
_, err = rollupClient.RollupForgeBatch(argsForge) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
currentBlockNum, _ := rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err := rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
assert.Equal(t, int64(2), rollupEvents.ForgeBatch[0].BatchNum) |
|
|
assert.Equal(t, int64(2), rollupEvents.ForgeBatch[0].BatchNum) |
|
|
ethHashForge = rollupEvents.ForgeBatch[0].EthTxHash |
|
|
ethHashForge = rollupEvents.ForgeBatch[0].EthTxHash |
|
@ -775,9 +822,9 @@ func TestRollupWithdrawMerkleProof(t *testing.T) { |
|
|
numExitRoot := int64(2) |
|
|
numExitRoot := int64(2) |
|
|
fromIdx := int64(256) |
|
|
fromIdx := int64(256) |
|
|
amount := big.NewInt(10) |
|
|
amount := big.NewInt(10) |
|
|
// siblingBytes0, _ := new(big.Int).SetString("19508838618377323910556678335932426220272947530531646682154552299216398748115", 10)
|
|
|
|
|
|
|
|
|
// siblingBytes0, err := new(big.Int).SetString("19508838618377323910556678335932426220272947530531646682154552299216398748115", 10)
|
|
|
// require.Nil(t, err)
|
|
|
// require.Nil(t, err)
|
|
|
// siblingBytes1, _ := new(big.Int).SetString("15198806719713909654457742294233381653226080862567104272457668857208564789571", 10)
|
|
|
|
|
|
|
|
|
// siblingBytes1, err := new(big.Int).SetString("15198806719713909654457742294233381653226080862567104272457668857208564789571", 10)
|
|
|
// require.Nil(t, err)
|
|
|
// require.Nil(t, err)
|
|
|
var siblings []*big.Int |
|
|
var siblings []*big.Int |
|
|
// siblings = append(siblings, siblingBytes0)
|
|
|
// siblings = append(siblings, siblingBytes0)
|
|
@ -787,8 +834,10 @@ func TestRollupWithdrawMerkleProof(t *testing.T) { |
|
|
_, err = rollupClientAux.RollupWithdrawMerkleProof(pk, tokenID, numExitRoot, fromIdx, amount, siblings, instantWithdraw) |
|
|
_, err = rollupClientAux.RollupWithdrawMerkleProof(pk, tokenID, numExitRoot, fromIdx, amount, siblings, instantWithdraw) |
|
|
require.Nil(t, err) |
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
currentBlockNum, _ := rollupClient.client.EthLastBlock() |
|
|
|
|
|
rollupEvents, _, _ := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
|
|
|
currentBlockNum, err := rollupClient.client.EthLastBlock() |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
rollupEvents, _, err := rollupClient.RollupEventsByBlock(currentBlockNum) |
|
|
|
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
|
assert.Equal(t, uint64(fromIdx), rollupEvents.Withdraw[0].Idx) |
|
|
assert.Equal(t, uint64(fromIdx), rollupEvents.Withdraw[0].Idx) |
|
|
assert.Equal(t, instantWithdraw, rollupEvents.Withdraw[0].InstantWithdraw) |
|
|
assert.Equal(t, instantWithdraw, rollupEvents.Withdraw[0].InstantWithdraw) |
|
|