Abstract TxProcessor from StateDB

- Abstract TxProcessor from StateDB
- Upgrade to last version of go-merkletree for the key-value DB usage
This commit is contained in:
arnaucube
2020-12-28 16:57:13 +01:00
parent 025b56c8c3
commit 0cf1ed217b
23 changed files with 778 additions and 777 deletions

View File

@@ -14,6 +14,7 @@ import (
"github.com/hermeznetwork/hermez-node/db/statedb"
"github.com/hermeznetwork/hermez-node/eth"
"github.com/hermeznetwork/hermez-node/log"
"github.com/hermeznetwork/hermez-node/txprocessor"
"github.com/hermeznetwork/tracerr"
)
@@ -796,13 +797,16 @@ func (s *Synchronizer) rollupSync(ethBlock *common.Block) (*common.RollupData, e
// ProcessTxs updates poolL2Txs adding: Nonce (and also TokenID, but we don't use it).
//nolint:gomnd
ptc := statedb.ProcessTxsConfig{ // TODO TMP
tpc := txprocessor.Config{ // TODO TMP
NLevels: 32,
MaxFeeTx: 64,
MaxTx: 512,
MaxL1Tx: 64,
ChainID: uint16(0),
}
processTxsOut, err := s.stateDB.ProcessTxs(ptc, forgeBatchArgs.FeeIdxCoordinator,
tp := txprocessor.NewTxProcessor(s.stateDB, tpc)
processTxsOut, err := tp.ProcessTxs(forgeBatchArgs.FeeIdxCoordinator,
l1UserTxs, batchData.L1CoordinatorTxs, poolL2Txs)
if err != nil {
return nil, tracerr.Wrap(err)

View File

@@ -290,7 +290,7 @@ func newTestModules(t *testing.T) (*statedb.StateDB, *historydb.HistoryDB) {
require.NoError(t, err)
deleteme = append(deleteme, dir)
stateDB, err := statedb.NewStateDB(dir, 128, statedb.TypeSynchronizer, 32, chainID)
stateDB, err := statedb.NewStateDB(dir, 128, statedb.TypeSynchronizer, 32)
require.NoError(t, err)
// Init History DB