mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 19:36:44 +01:00
Update synchronizer and DB with last contracts updates
- API - When updating network info, handle cases where no batches exists and where no forgers exists - cli/node - Update `cfg.buidler.toml` config file to a working version - common - Add new smart contract structs and extend some existing ones to reflect updates regarding events from the smart contracts - SQL - Add new tables and extend existing ones to reflect updates regarding events from the smart contracts - db/historydb - Add functions to insert new smart contract events data - Fix unclosed rows that led to inconsistent sql driver state (replace NamedQuery by NamedExec). This fixes the error: `pq: unexpected Parse response 'C'` - db/l2db - Close rows after usage - eth - In Rollup event, introduce a new UpdateBucketsParameter when there's a SafeMode event, with `SafeMode = true` - synchronizer - synchronize new events - avoid calling `auction.CanForge` before the genesisBlock to avoid getting a revert.
This commit is contained in:
@@ -78,7 +78,7 @@ func (p *Purger) InvalidateMaybe(l2DB *l2db.L2DB, stateDB *statedb.LocalStateDB,
|
||||
p.lastInvalidateBatch = batchNum
|
||||
log.Debugw("Purger: invalidating l2txs in pool", "block", blockNum, "batch", batchNum)
|
||||
err := poolMarkInvalidOldNonces(l2DB, stateDB, common.BatchNum(batchNum))
|
||||
return true, err
|
||||
return true, tracerr.Wrap(err)
|
||||
}
|
||||
|
||||
//nolint:unused,deadcode
|
||||
@@ -129,20 +129,20 @@ func poolMarkInvalidOldNonces(l2DB *l2db.L2DB, stateDB *statedb.LocalStateDB,
|
||||
batchNum common.BatchNum) error {
|
||||
idxs, err := l2DB.GetPendingUniqueFromIdxs()
|
||||
if err != nil {
|
||||
return err
|
||||
return tracerr.Wrap(err)
|
||||
}
|
||||
idxsNonce := make([]common.IdxNonce, len(idxs))
|
||||
lastIdx, err := stateDB.GetIdx()
|
||||
if err != nil {
|
||||
return err
|
||||
return tracerr.Wrap(err)
|
||||
}
|
||||
for i, idx := range idxs {
|
||||
acc, err := stateDB.GetAccount(idx)
|
||||
if err != nil {
|
||||
if tracerr.Unwrap(err) != db.ErrNotFound {
|
||||
return err
|
||||
return tracerr.Wrap(err)
|
||||
} else if idx <= lastIdx {
|
||||
return fmt.Errorf("account with idx %v not found: %w", idx, err)
|
||||
return tracerr.Wrap(fmt.Errorf("account with idx %v not found: %w", idx, err))
|
||||
}
|
||||
}
|
||||
idxsNonce[i].Idx = idx
|
||||
|
||||
Reference in New Issue
Block a user