Commit Graph

294 Commits

Author SHA1 Message Date
ToniRamirezM
93d67ff699 HistoryDB TXs til test 2020-11-16 16:27:18 +01:00
laisolizq
1925110fda Add til test l2db 2020-11-16 13:35:24 +01:00
Eduard S
457ff94bfa Test synchronizer reorg 2020-11-16 11:35:15 +01:00
Eduard S
e731b79e96 Fix exit table, set delayed_withdrawn in exits
- In exit table, `instant_withdrawn`, `delayed_withdraw_request`, and
  `delayed_withdrawn` were referencing batch_num.  But these actions happen
  outside a batch, so they should reference a block_num.
- Process delayed withdrawns:
    - In Synchronizer, first match a Rollup delayed withdrawn request, with the
      WDelayer deposit (via TxHash), and store the owner and token associated
      with the delayed withdrawn.
    - In HistoryDB: store the owner and token of a delayed withdrawal request
      in the exit_tree, and set delayed_withdrawn when the withdraw is done in
      the WDelayer.
- Update dependency of sqlx to master
    - Last release of sqlx is from 2018 October, and it doesn't support
      `NamedQuery` with a slice of structs, which is used in this commit.
2020-11-13 16:53:16 +01:00
arnau
8cc165f562 Merge pull request #275 from hermeznetwork/feature/api-db-tests-til
Feature/api db tests til
2020-11-11 15:54:41 +01:00
Arnau B
bed25d424a Use til for batches and blocks at historydb 2020-11-11 14:00:19 +01:00
arnaucube
a9f112c4ce Cmptbility test for Root StateDB Accounts tree
Checked with commonjs version:
c8414bd205
2020-11-10 17:45:42 +01:00
laisolizq
43e9bee9db API state endpoint test 2020-11-10 13:47:18 +01:00
Toni Ramírez
6ec7a0b55d Merge pull request #271 from hermeznetwork/feature/api-state-fee
API State RecommendedFee
2020-11-09 18:03:50 +01:00
laisolizq
9edf9d2168 API State RecommendedFee 2020-11-09 17:57:23 +01:00
a_bennassar
e8148e66ff Merge pull request #269 from hermeznetwork/feature/integration12
Process withdrawals in HistoryDB, test withdrawals and vars in sync
2020-11-09 17:27:04 +01:00
Eduard S
9f5af0aa07 Process withdrawals in HistoryDB, test withdrawals and vars in sync 2020-11-09 17:13:53 +01:00
a_bennassar
a1b9720e77 Merge pull request #270 from hermeznetwork/feature/api-state-metrics
API State Metrics
2020-11-09 16:54:25 +01:00
ToniRamirezM
55a78fbd72 API State Metrics 2020-11-09 16:50:15 +01:00
Eduard S
8190755d49 Merge pull request #268 from hermeznetwork/feature/wrapped-in-struct
Refactor api pagination
2020-11-09 15:32:28 +01:00
a_bennassar
a473070f65 Merge pull request #267 from hermeznetwork/feature/api-state
API add get state
2020-11-09 14:13:01 +01:00
laisolizq
cc6446e019 API add get state 2020-11-09 13:01:28 +01:00
Arnau B
d2e9196fba Refactor api pagination 2020-11-09 12:58:09 +01:00
arnaucube
900494fd8e StateDB group Fee txs and ZKInputs gen of Fee txs 2020-11-06 16:41:03 +01:00
Eduard S
5b6639a947 Add DebugAPI to Node, fix StateDB
- Allow starting the DebugAPI from the node via config
- In StateDB:
    - Make checkpoints when ProcessTxs() succeeds
    - Remove extra hardcoded `statedb` path that was redundant
    - Replace hardcoded `[:4]` by `[:]` when parsing idx, which failed because
      idx is 6 bytes length now.
- Extra: In node, use waitgroup instead of `stoppedXXX` channels to wait for
syncrhonizer goroutines to finish.
2020-11-06 13:00:11 +01:00
arnau
fd9b247120 Merge pull request #261 from hermeznetwork/feature/til-extra
Move logic to extend til blocks to til
2020-11-06 11:46:49 +01:00
laisolizq
22f0a45118 ItemID to uint64 & check timestamp 2020-11-06 10:40:57 +01:00
ToniRamirezM
b840ceb57a Account API 2020-11-06 09:30:32 +01:00
Eduard S
5ebf46e045 Move logic to extend til blocks to til
Previously, the synchronizer test was extending the output from til to
precalculate many fields to compare it with the synchronizer and BD output.
Since this is useful outside of the syncrhonizer testing: move this
functionality to til via a function that extends the output
(til.Context.FillBlocksExtra).

Also, add new functionality: calculate fee idxs dynamically by setting a user
name, and calculate collected fees.
2020-11-05 18:09:12 +01:00
Eduard S
e8aabab2de Merge pull request #255 from hermeznetwork/feature/zkinputs0
ZKInputs update:
2020-11-05 18:07:28 +01:00
laisolizq
5012b82914 API add slots endpoints 2020-11-05 15:59:27 +01:00
arnaucube
7af6371f1d ZKInputs update:
- Add ZKInputs parser to JSON
- Update ProcessTxs to last go-merkletree version changes
- Add StateDB test to generate ZKInputs to check inside a circom circuit
- Small fix at Til CoordinatorTx.LoadAmount=0
2020-11-04 16:40:55 +01:00
Eduard S
6e4b9b4b70 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
2020-11-04 15:12:51 +01:00
arnau
11dbf67377 Merge pull request #250 from hermeznetwork/feature/integration9
Reorganize smart contract types, udate eth tests, etc.
2020-11-04 12:36:42 +01:00
Eduard S
e6fb0a03de 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.
2020-11-04 12:06:28 +01:00
a_bennassar
91ef32693c Merge pull request #252 from hermeznetwork/feature/api-exits-update
API add pending withdraws filter on GET /exits
2020-11-03 16:19:31 +01:00
laisolizq
04d969c274 API add pending withdraws filter on GET /exits 2020-11-03 16:12:58 +01:00
Eduard S
fe23361037 Update fee tables 2020-11-03 11:26:23 +01:00
Arnau B
233ecc4704 Refactor api exits 2020-11-02 14:00:42 +01:00
Arnau B
8c9d13ffa5 Refactor account creation auth endpoints 2020-11-02 13:58:42 +01:00
Eduard S
8c6f5f2950 Merge pull request #247 from hermeznetwork/feature/til-sets
Add Til set w minimum flow, add balances tests at StateDB ProcessTxs, small fixes at StateDB
2020-11-02 12:55:43 +01:00
arnaucube
f65a6047b4 Add Til set w minimum flow, small fixes at StateDB 2020-11-02 12:47:34 +01:00
Arnau B
cbeca0f76e Insert ETH as HistoryDB token 2020-11-02 12:09:09 +01:00
Eduard S
04276a4d2a Merge pull request #241 from hermeznetwork/feature/statedb-tests-up
ProcessTxs fees collct update & tests, and other:
2020-10-30 14:22:52 +01:00
laisolizq
aa6cb6f818 API add bids endpoint 2020-10-28 18:11:52 +01:00
arnaucube
2338b6b90b ProcessTxs fees collct update & tests, and other:
- Update StateDB ProcessTxs fees collection
- Update ProcessTxs tests to last StateDB & Til changes
- Til Blockchain L2Txs remove Nonce generation, update tests accordingly
- Update Til Set to test fees
2020-10-28 17:21:12 +01:00
Eduard S
90db8a1106 Merge pull request #236 from hermeznetwork/refactor/api-txs
Refactor/api txs
2020-10-28 14:48:44 +01:00
Eduard S
4eb2972b1b Add collectedFees in TxProcessor, update sync test
- In Synchronizer test, test all tx types
2020-10-28 14:24:14 +01:00
Arnau B
a329d894d2 Refactor api txs 2020-10-28 12:16:35 +01:00
laisolizq
decc4996ee Merge pull request #235 from hermeznetwork/feature/api-coordinator-refactor
API Coordinator Refactor
2020-10-28 10:20:44 +01:00
Eduard S
558de2737e Test L2Txs, ExitTree in synchronizer 2020-10-27 17:59:18 +01:00
ToniRamirezM
b521a77fc5 API Coordinator Refactor 2020-10-27 17:44:22 +01:00
arnaucube
1203ab3865 TxSelector include L1CoordinatorTxs in selections 2020-10-27 17:25:41 +01:00
arnaucube
aaa71a6b11 StateDB store Idxs with TokenID at the db-key 2020-10-27 17:24:10 +01:00
Eduard S
d6d1a9c898 Merge pull request #231 from hermeznetwork/feature/statedb-createdaccounts
ProcessTxs return an array of created accounts
2020-10-27 13:51:45 +01:00