Abstract txs generation for ZKInputs tests

- TxProcessor move txCompressedDataEmpty inside the if of tp.zki!=nil
- Abstract generation of transactions for ZKInput tests to avoid code
repetition
  - used at txprocessor & test/zkproof tests
This commit is contained in:
arnaucube
2021-01-13 14:01:13 +01:00
parent 75f068baa8
commit a16ec1750e
9 changed files with 580 additions and 642 deletions

View File

@@ -20,6 +20,7 @@ import (
"github.com/hermeznetwork/hermez-node/log"
"github.com/hermeznetwork/hermez-node/test"
"github.com/hermeznetwork/hermez-node/test/til"
"github.com/hermeznetwork/hermez-node/test/txsets"
"github.com/hermeznetwork/hermez-node/txprocessor"
"github.com/iden3/go-iden3-crypto/babyjub"
"github.com/jmoiron/sqlx"
@@ -155,12 +156,12 @@ func checkSortedByNonce(t *testing.T, testAccNonces map[common.Idx]common.Nonce,
func TestGetL2TxSelectionMinimumFlow0(t *testing.T) {
chainID := uint16(0)
hermezContractAddr := ethCommon.HexToAddress("0xc344E203a046Da13b0B4467EB7B3629D0C99F6E6")
txsel, tc := initTest(t, chainID, hermezContractAddr, til.SetPool0)
txsel, tc := initTest(t, chainID, hermezContractAddr, txsets.SetPool0)
// generate test transactions, the L1CoordinatorTxs generated by Til
// will be ignored at this test, as will be the TxSelector who
// generates them when needed
blocks, err := tc.GenerateBlocks(til.SetBlockchainMinimumFlow0)
blocks, err := tc.GenerateBlocks(txsets.SetBlockchainMinimumFlow0)
assert.NoError(t, err)
// restart nonces of TilContext, as will be set by generating directly