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:
Eduard S
2020-12-09 15:22:32 +01:00
parent a7e4e8ff6c
commit 20b8d0561f
16 changed files with 543 additions and 198 deletions

View File

@@ -1,6 +1,10 @@
package common
import ethCommon "github.com/ethereum/go-ethereum/common"
import (
"math/big"
ethCommon "github.com/ethereum/go-ethereum/common"
)
// WDelayerConstants are the constants of the Withdrawal Delayer Smart Contract
type WDelayerConstants struct {
@@ -12,6 +16,16 @@ type WDelayerConstants struct {
HermezRollup ethCommon.Address `json:"hermezRollup"`
}
// WDelayerEscapeHatchWithdrawal is an escape hatch withdrawal of the
// Withdrawal Delayer Smart Contract
type WDelayerEscapeHatchWithdrawal struct {
EthBlockNum int64 `json:"ethereumBlockNum" meddler:"eth_block_num"`
Who ethCommon.Address `json:"who" meddler:"who_addr"`
To ethCommon.Address `json:"to" meddler:"to_addr"`
TokenAddr ethCommon.Address `json:"tokenAddr" meddler:"token_addr"`
Amount *big.Int `json:"amount" meddler:"amount,bigint"`
}
// WDelayerVariables are the variables of the Withdrawal Delayer Smart Contract
type WDelayerVariables struct {
EthBlockNum int64 `json:"ethereumBlockNum" meddler:"eth_block_num"`