mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-06 19:06:42 +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:
@@ -131,6 +131,7 @@ type rollupEventUpdateBucketsParametersAux struct {
|
||||
type RollupEventUpdateBucketsParameters struct {
|
||||
// ArrayBuckets [common.RollupConstNumBuckets][4]*big.Int
|
||||
ArrayBuckets [common.RollupConstNumBuckets]RollupUpdateBucketsParameters
|
||||
SafeMode bool
|
||||
}
|
||||
|
||||
// RollupEventUpdateTokenExchange is an event of the Rollup Smart Contract
|
||||
@@ -798,6 +799,20 @@ func (c *RollupClient) RollupEventsByBlock(blockNum int64) (*RollupEvents, *ethC
|
||||
case logHermezSafeMode:
|
||||
var safeMode RollupEventSafeMode
|
||||
rollupEvents.SafeMode = append(rollupEvents.SafeMode, safeMode)
|
||||
// Also add an UpdateBucketsParameter with
|
||||
// SafeMode=true to keep the order between `safeMode`
|
||||
// and `UpdateBucketsParameters`
|
||||
bucketsParameters := RollupEventUpdateBucketsParameters{
|
||||
SafeMode: true,
|
||||
}
|
||||
for i := range bucketsParameters.ArrayBuckets {
|
||||
bucketsParameters.ArrayBuckets[i].CeilUSD = big.NewInt(0)
|
||||
bucketsParameters.ArrayBuckets[i].Withdrawals = big.NewInt(0)
|
||||
bucketsParameters.ArrayBuckets[i].BlockWithdrawalRate = big.NewInt(0)
|
||||
bucketsParameters.ArrayBuckets[i].MaxWithdrawals = big.NewInt(0)
|
||||
}
|
||||
rollupEvents.UpdateBucketsParameters = append(rollupEvents.UpdateBucketsParameters,
|
||||
bucketsParameters)
|
||||
}
|
||||
}
|
||||
return &rollupEvents, blockHash, nil
|
||||
|
||||
Reference in New Issue
Block a user