mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-06 19:06:42 +01:00
Add PoolL2Tx.Info about the status of the tx
PoolL2Tx.Info contains information about the status & State of the transaction. As for example, if the Tx has not been selected in the last batch due not enough Balance at the Sender account, this reason would appear at this parameter. This will help the client (wallet, batchexplorer, etc) to reason why a L2Tx is not selected in the forged batches.
This commit is contained in:
@@ -152,7 +152,7 @@ func TestTxSelectorBatchBuilderZKInputs(t *testing.T) {
|
||||
l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[i].Batch.ForgeL1TxsNum])
|
||||
}
|
||||
// TxSelector select the transactions for the next Batch
|
||||
coordIdxs, _, oL1UserTxs, oL1CoordTxs, oL2Txs, err := txsel.GetL1L2TxSelection(selectionConfig, l1UserTxs)
|
||||
coordIdxs, _, oL1UserTxs, oL1CoordTxs, oL2Txs, _, err := txsel.GetL1L2TxSelection(selectionConfig, l1UserTxs)
|
||||
require.NoError(t, err)
|
||||
// BatchBuilder build Batch
|
||||
zki, err := bb.BuildBatch(coordIdxs, configBatch, oL1UserTxs, oL1CoordTxs, oL2Txs)
|
||||
@@ -175,7 +175,7 @@ func TestTxSelectorBatchBuilderZKInputs(t *testing.T) {
|
||||
addL2Txs(t, l2DBTxSel, l2Txs) // Add L2s to TxSelector.L2DB
|
||||
l1UserTxs := til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[6].Batch.ForgeL1TxsNum])
|
||||
// TxSelector select the transactions for the next Batch
|
||||
coordIdxs, _, oL1UserTxs, oL1CoordTxs, oL2Txs, err := txsel.GetL1L2TxSelection(selectionConfig, l1UserTxs)
|
||||
coordIdxs, _, oL1UserTxs, oL1CoordTxs, oL2Txs, discardedL2Txs, err := txsel.GetL1L2TxSelection(selectionConfig, l1UserTxs)
|
||||
require.NoError(t, err)
|
||||
// BatchBuilder build Batch
|
||||
zki, err := bb.BuildBatch(coordIdxs, configBatch, oL1UserTxs, oL1CoordTxs, oL2Txs)
|
||||
@@ -184,6 +184,8 @@ func TestTxSelectorBatchBuilderZKInputs(t *testing.T) {
|
||||
sendProofAndCheckResp(t, zki)
|
||||
err = l2DBTxSel.StartForging(common.TxIDsFromPoolL2Txs(oL2Txs), txsel.LocalAccountsDB().CurrentBatch())
|
||||
require.NoError(t, err)
|
||||
err = l2DBTxSel.UpdateTxsInfo(discardedL2Txs)
|
||||
require.NoError(t, err)
|
||||
|
||||
log.Debug("block:0 batch:8")
|
||||
// simulate the PoolL2Txs of the batch8
|
||||
@@ -198,7 +200,7 @@ func TestTxSelectorBatchBuilderZKInputs(t *testing.T) {
|
||||
addL2Txs(t, l2DBTxSel, l2Txs) // Add L2s to TxSelector.L2DB
|
||||
l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[7].Batch.ForgeL1TxsNum])
|
||||
// TxSelector select the transactions for the next Batch
|
||||
coordIdxs, _, oL1UserTxs, oL1CoordTxs, oL2Txs, err = txsel.GetL1L2TxSelection(selectionConfig, l1UserTxs)
|
||||
coordIdxs, _, oL1UserTxs, oL1CoordTxs, oL2Txs, discardedL2Txs, err = txsel.GetL1L2TxSelection(selectionConfig, l1UserTxs)
|
||||
require.NoError(t, err)
|
||||
// BatchBuilder build Batch
|
||||
zki, err = bb.BuildBatch(coordIdxs, configBatch, oL1UserTxs, oL1CoordTxs, oL2Txs)
|
||||
@@ -207,6 +209,8 @@ func TestTxSelectorBatchBuilderZKInputs(t *testing.T) {
|
||||
sendProofAndCheckResp(t, zki)
|
||||
err = l2DBTxSel.StartForging(common.TxIDsFromPoolL2Txs(l2Txs), txsel.LocalAccountsDB().CurrentBatch())
|
||||
require.NoError(t, err)
|
||||
err = l2DBTxSel.UpdateTxsInfo(discardedL2Txs)
|
||||
require.NoError(t, err)
|
||||
|
||||
log.Debug("(batch9) block:1 batch:1")
|
||||
// simulate the PoolL2Txs of the batch9
|
||||
@@ -219,7 +223,7 @@ func TestTxSelectorBatchBuilderZKInputs(t *testing.T) {
|
||||
addL2Txs(t, l2DBTxSel, l2Txs) // Add L2s to TxSelector.L2DB
|
||||
l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[1].Rollup.Batches[0].Batch.ForgeL1TxsNum])
|
||||
// TxSelector select the transactions for the next Batch
|
||||
coordIdxs, _, oL1UserTxs, oL1CoordTxs, oL2Txs, err = txsel.GetL1L2TxSelection(selectionConfig, l1UserTxs)
|
||||
coordIdxs, _, oL1UserTxs, oL1CoordTxs, oL2Txs, discardedL2Txs, err = txsel.GetL1L2TxSelection(selectionConfig, l1UserTxs)
|
||||
require.NoError(t, err)
|
||||
// BatchBuilder build Batch
|
||||
zki, err = bb.BuildBatch(coordIdxs, configBatch, oL1UserTxs, oL1CoordTxs, oL2Txs)
|
||||
@@ -228,12 +232,14 @@ func TestTxSelectorBatchBuilderZKInputs(t *testing.T) {
|
||||
sendProofAndCheckResp(t, zki)
|
||||
err = l2DBTxSel.StartForging(common.TxIDsFromPoolL2Txs(l2Txs), txsel.LocalAccountsDB().CurrentBatch())
|
||||
require.NoError(t, err)
|
||||
err = l2DBTxSel.UpdateTxsInfo(discardedL2Txs)
|
||||
require.NoError(t, err)
|
||||
|
||||
log.Debug("(batch10) block:1 batch:2")
|
||||
l2Txs = []common.PoolL2Tx{}
|
||||
l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[1].Rollup.Batches[1].Batch.ForgeL1TxsNum])
|
||||
// TxSelector select the transactions for the next Batch
|
||||
coordIdxs, _, oL1UserTxs, oL1CoordTxs, oL2Txs, err = txsel.GetL1L2TxSelection(selectionConfig, l1UserTxs)
|
||||
coordIdxs, _, oL1UserTxs, oL1CoordTxs, oL2Txs, discardedL2Txs, err = txsel.GetL1L2TxSelection(selectionConfig, l1UserTxs)
|
||||
require.NoError(t, err)
|
||||
// BatchBuilder build Batch
|
||||
zki, err = bb.BuildBatch(coordIdxs, configBatch, oL1UserTxs, oL1CoordTxs, oL2Txs)
|
||||
@@ -244,4 +250,6 @@ func TestTxSelectorBatchBuilderZKInputs(t *testing.T) {
|
||||
sendProofAndCheckResp(t, zki)
|
||||
err = l2DBTxSel.StartForging(common.TxIDsFromPoolL2Txs(l2Txs), txsel.LocalAccountsDB().CurrentBatch())
|
||||
require.NoError(t, err)
|
||||
err = l2DBTxSel.UpdateTxsInfo(discardedL2Txs)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user