Update Synchronizer (node) implementation

- node:
    - Extend config to add initial variables of the smart contracts used as
      defaults before they are changed via events.
    - In stopped channels, set size 1 so that panics are not witheld until the
      node stops completely.
- common:
    - In Smart Contract variables, comment:
      - `WDelayerVariables.HermezRollupAddress` because it's not needed.
      - `RollupVariables.Buckets` because there are no events for it, and for
        now it's not used.
- historydb:
    - Add functions to get and set smart contract variables.
- db:
    - Add `Rollback` function in `utils.go` to reduce boilerplate in sql
      transaction rollbacks in defers in db functions.
    - Update `rollup_vars` and `auction_vars` (renamed from `consensus_vars`)
      table, and add `wdelayer_vars` table.
- synchronizer:
    - Synchronize WDelayer
    - Handle SC variables properly
- test/ethclient:
    - Add essential implementation of WDelayer
This commit is contained in:
Eduard S
2020-10-28 16:09:05 +01:00
parent 11dbf67377
commit 6e4b9b4b70
20 changed files with 671 additions and 153 deletions

View File

@@ -516,23 +516,31 @@ FOR EACH ROW EXECUTE PROCEDURE forge_l1_user_txs();
CREATE TABLE rollup_vars (
eth_block_num BIGINT PRIMARY KEY REFERENCES block (eth_block_num) ON DELETE CASCADE,
forge_l1_timeout BYTEA NOT NULL,
fee_l1_user_tx BYTEA NOT NULL,
fee_add_token BYTEA NOT NULL,
tokens_hez BYTEA NOT NULL,
governance BYTEA NOT NULL
forge_l1_timeout BYTEA NOT NULL,
withdrawal_delay BIGINT NOT NULL
);
CREATE TABLE consensus_vars (
CREATE TABLE auction_vars (
eth_block_num BIGINT PRIMARY KEY REFERENCES block (eth_block_num) ON DELETE CASCADE,
slot_deadline INT NOT NULL,
close_auction_slots INT NOT NULL,
open_auction_slots INT NOT NULL,
min_bid_slots VARCHAR(200) NOT NULL,
outbidding INT NOT NULL,
donation_address BYTEA NOT NULL,
governance_address BYTEA NOT NULL,
allocation_ratio VARCHAR(200)
boot_coordinator BYTEA NOT NULL,
default_slot_set_bid BYTEA NOT NULL,
closed_auction_slots INT NOT NULL,
open_auction_slots INT NOT NULL,
allocation_ratio VARCHAR(200),
outbidding INT NOT NULL,
slot_deadline INT NOT NULL
);
CREATE TABLE wdelayer_vars (
eth_block_num BIGINT PRIMARY KEY REFERENCES block (eth_block_num) ON DELETE CASCADE,
govdao_address BYTEA NOT NULL,
whg_address BYTEA NOT NULL,
keeper_address BYTEA NOT NULL,
withdrawal_delay BIGINT NOT NULL,
emergency_start_time BIGINT NOT NULL,
emergency_mode BOOLEAN NOT NULL
);
-- L2
@@ -606,8 +614,9 @@ DROP FUNCTION set_pool_tx;
-- drop tables
DROP TABLE account_creation_auth;
DROP TABLE tx_pool;
DROP TABLE consensus_vars;
DROP TABLE auction_vars;
DROP TABLE rollup_vars;
DROP TABLE wdelayer_vars;
DROP TABLE tx;
DROP TABLE exit_tree;
DROP TABLE account;