Reorganize smart contract types, udate eth tests, etc.

- Move smart contract constants and structs for variables to
  common/{ethrollup.go, ethauction.go, ethwdelayer.go}:
    - This removes repeated code of the structs for variables
    - Allows reusing the constants and variables from all modules without
      import cycles
- Remove unused common/scvars.go
- In common.BlockData, split data from each smart contract into a sepparate
  field (Rollup, Auction, WDelayer).  This affects the structures that til uses
  as output, and HistoryDB in the AddBlockSCData.
- In Synchronizer:
    - Pass starting block of each smart contract as config, instead of
      incorrectly using the genesis block found in the acution constant (which
      has a very different meaning)
    - Use variable structs from common instead of an internal copy
    - Synchronize more stuff (resolve some TODOs)
    - Fix some issues found after initial testing with ganache
- In eth:
    - In auction.go: Add method to get constants
    - Update README to use ganache instead of buidlerevm as local blockchain
      for testing
    - Update env variables and test vectors to pass the tests with the
      deployment in the ganache testnet.
    - Use ethereum keys derived from paths (hdwallet) in testing to avoid
      hardcoding private keys and generate the same keys from a mnemonic used
      in the ganache tesnet.
This commit is contained in:
Eduard S
2020-10-28 16:09:05 +01:00
parent 954b24020c
commit e6fb0a03de
36 changed files with 1006 additions and 722 deletions

37
cli/node/cfg.buidler.toml Normal file
View File

@@ -0,0 +1,37 @@
[StateDB]
Path = "/tmp/iden3-test/hermez/statedb"
[PostgreSQL]
Port = 5432
Host = "localhost"
User = "hermez"
Password = "yourpasswordhere"
Name = "hermez"
[L2DB]
SafetyPeriod = 10
MaxTxs = 512
TTL = "24h"
[Web3]
URL = "http://localhost:8545"
[Synchronizer]
SyncLoopInterval = "1s"
[Synchronizer.StartBlockNum]
Rollup = 1
Auction = 1
WDelayer = 1
[SmartContracts]
Rollup = "0xD6C850aeBFDC46D7F4c207e445cC0d6B0919BDBe"
Auction = "0x038B86d9d8FAFdd0a02ebd1A476432877b0107C8"
TokenHEZ = "0xf4e77E5Da47AC3125140c470c71cBca77B5c638c"
TokenHEZName = "Hermez Network Token"
[EthClient]
CallGasLimit = 300000
DeployGasLimit = 1000000
GasPriceDiv = 100
ReceiptTimeout = "60s"
IntervalReceiptLoop = "200ms"