Commit Graph

668 Commits

Author SHA1 Message Date
Arnau B
fcd6f56cec Add TxType before processing L2 tx 2020-12-16 12:08:41 +01:00
arnaucube
0955016049 Update StateDB computeEffectiveAmounts
For the case of tx.EthAddr!=tx.FromIdx.EthAddr
2020-12-16 11:55:53 +01:00
Eduard S
8e1bfd150d Merge pull request #352 from hermeznetwork/fix/historydb-norows
Fix queries when no rows
2020-12-15 16:29:03 +01:00
Arnau B
c7b7a85b85 Fix queries when no rows 2020-12-15 16:15:42 +01:00
Eduard S
d15721d28a Merge pull request #350 from hermeznetwork/feature/zkinputs6
Update ZKInputs generation:
2020-12-15 15:44:31 +01:00
arnau
872fc6a37e Merge pull request #349 from hermeznetwork/feature/integration23
Make coordinator more responsive
2020-12-15 15:33:39 +01:00
Eduard S
a7351992cd Make coordinator more responsive
- API:
	- Replace `emergencyModeStaringTime` by `emercengyModeStartingBlock`
- Synchronizer:
	- Track emergency mode starting block
- cli/node
	- Add working coordinator config
- coordinator:
	- Retry handler for synchronizer stats in case of error (instead of
	  waiting for the next block to try again)
	- On init, trigger an initial call to the handler for synced block
	  before waiting for the synchronizer, to force the coordinator to start
	  its logic even if there's no new block right after the node has been
	  started (very useful for running in testnet where the frequency of
	  blocks is variable)
	- Merge Msg for synced block and updated vars into one: `MsgSyncBlock`.
2020-12-15 15:15:25 +01:00
arnaucube
593a477e6c ZKInputs generation ISFinalAccFee update
- Update IntermediateState FinalAccFee values to fit in the Circom circuit expected inputs
- Add ZKInputs generation test with transactions generated by Til
(TestZKInputs6)
- BatchBuilder: remove redundant MakeCheckpoint call
2020-12-15 11:49:09 +01:00
Eduard S
a165bda17d Merge pull request #346 from hermeznetwork/feature/zkinputs5
StateDB Exit & ForceExit correct processing & ZKI
2020-12-11 12:43:31 +01:00
arnaucube
a4584499a4 StateDB Exit & ForceExit correct processing & ZKI
- Update tx processor of Exit & ForceExit types
- Update ZKInputs generation related to Exit transactions
- Add TestZKInputs5 which adds tests generation of ZKInputs compatible
with Circom circuits including Exit (L2) & ForceExit (L1) transaction types
- Add StateDB test to check max DepositAmount case
2020-12-11 12:39:05 +01:00
arnau
398f69e633 Merge pull request #345 from hermeznetwork/feature/integration22
Update synchronizer and DB with last contracts updates
2020-12-11 12:37:50 +01:00
Eduard S
d1ced80e62 Update API with new buckets synchronization 2020-12-10 18:00:17 +01:00
Eduard S
20b8d0561f 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.
2020-12-10 17:45:17 +01:00
Eduard S
a7e4e8ff6c Merge pull request #341 from hermeznetwork/feature/zkinputs3-4
Fix process L1Tx for correct ZKInputs generation
2020-12-10 13:18:17 +01:00
Eduard S
30c494b547 Merge pull request #333 from hermeznetwork/feature/client-prover
Update prover & add test
2020-12-10 13:03:44 +01:00
arnaucube
e7c8328df1 Fix process L1Tx for correct ZKInputs generation
- StateDB fix process txs of type CreateAccountDepositTransfer & DepositTransfer
- Add TestZKInputs3 & TestZKInputs4 which:
    - have a compatible check in js version to check Circom circuits
compatibility
    - adds test of tx type of CreateAccountDepositTransfer &
DepositTransfer
2020-12-10 12:59:01 +01:00
Eduard S
f5818711dc Simplify prover client, use big.Int in Proof 2020-12-10 12:53:35 +01:00
Eduard S
a05cecca80 Merge pull request #339 from hermeznetwork/feature/missing-deposit-name
Update missing LoadAmount to DepositAmount
2020-12-10 12:15:38 +01:00
a_bennassar
dbb2e957a5 Merge pull request #340 from hermeznetwork/jleebee-patch-1
Update swagger.yml
2020-12-10 11:01:54 +01:00
jleebee
2d85a4d6b9 Update swagger.yml 2020-12-09 19:22:55 +01:00
arnaucube
9d0b278d50 Update missing LoadAmount to DepositAmount
Related to 445f26ec9f
2020-12-09 18:34:01 +01:00
Eduard S
d5c753030a Merge pull request #338 from hermeznetwork/feature/api-amounts
Add amount success and load amount success
2020-12-09 17:20:21 +01:00
Arnau B
e1d34e3796 Add amount success and load amount success 2020-12-09 16:39:18 +01:00
Eduard S
d8050dd0a6 Update node and coordinator, fix linters 2020-12-09 16:22:31 +01:00
laisolizq
d5f579aec5 Merge pull request #336 from hermeznetwork/fix/api1
Fix/api1
2020-12-09 16:08:01 +01:00
laisolizq
4ad67a3d18 Update prover & add test 2020-12-09 16:07:45 +01:00
Eduard S
f229f49f0e Merge pull request #334 from hermeznetwork/feature/test-zkinputs2
Add zki.ISAccFeeOut generation for circuits compat
2020-12-09 15:34:07 +01:00
arnau
347d18878e Merge pull request #332 from hermeznetwork/feature/integration21
Integrate purger to node
2020-12-09 14:55:03 +01:00
Arnau B
039c7b29da Fix time sensitive test 2020-12-09 14:12:10 +01:00
Arnau B
a50ddbe4e0 Fix hez addr format for exits 2020-12-09 14:04:15 +01:00
Arnau B
87501276ce Fix errors when fromItem is not provided 2020-12-09 13:59:10 +01:00
arnaucube
c162563376 Add zki.ISAccFeeOut generation for circuits compat
- add IntermediateStates AccFeeOut correct generation for circuits
compatibility at ZKInputs
- Fix formatAccumulatedFees
- organize ZKInputs tests to check compatibility with Circom circuits
- Add TestZKInputs2
    - which checks ZKInputs for 4 L1 txs + 2 L2Txs with fees
    - tested with Hermez Circom circuits
2020-12-09 12:47:00 +01:00
Eduard S
900d1fb6ce Integrate purger to node
- Common
	- Add `IdxNonce` type used to track nonces in accounts to invalidate
	  l2txs in the pool
- Config
	- Update coordinator config will all the new configuration parameters
	  used in the coordinator
- Coordinator
	- Introduce the `Purger` to track how often to purge and do the job when
	  needed according to a configuration.
	- Implement the methods to invalidate l2txs transactions due to l2txs
	  selection in batches.  For now these functions are not used in favour
	  of the `Purger` methods, which check ALL the l2txs in the pool.
	- Call Invalidation and Purging methods of the purger both when the
	  node is forging (in the pipeline when starting a new batch) and when
	  the node is not forging (in coordinator when being notified about a
	  new synced block)
- L2DB:
	- Implement `GetPendingUniqueFromIdxs` to get all the unique idxs from
	  pending transactions (used to get their nonces and then invalidate
	  txs)
	- Redo `CheckNonces` with a single SQL query and using `common.IdxNonce`
	  instead of `common.Account`
- StateDB:
	- Expose GetIdx to check errors when invalidating pool txs
- Synchronizer:
	- Test forged L1UserTxs processed by TxProcessor
	- Improve checks of Effective values
- TxSelector:
	- Expose the internal LocalStateDB in order to check account nonces in
	  the coordinator when not forging.
2020-12-09 12:43:16 +01:00
Eduard S
8de7fe537a Merge pull request #330 from hermeznetwork/feature/zki4-fees
ZKInputs with Fee txs compatible with circom
2020-12-07 16:57:40 +01:00
arnaucube
c1fd0d6626 ZKInputs with Fee txs compatible with circom
- Separate ZKInputs tests at StateDB package
- Small fix at ZKInputs generation FeeIdxs length
- Fees related parameters at ZKInputs works properly
- Add ZKInputs generation test with fees (`TestZKInputs1`), which output
has been tested with circom to ensure compatibility
2020-12-07 12:54:18 +01:00
arnau
4771cf5084 Merge pull request #329 from hermeznetwork/feature/deposit-amount
Rename load amount to deposit amount
2020-12-07 12:21:26 +01:00
Arnau B
445f26ec9f Rename load amount to deposit amount 2020-12-04 16:13:41 +01:00
laisolizq
2dd6d82dbe Merge pull request #328 from hermeznetwork/feature/ganache-bug-workaround
syncrhonizer fix, ganache bug workaround
2020-12-04 12:58:46 +01:00
Eduard S
1370bcca03 Use a non-zero from address in eth calls 2020-12-04 12:44:29 +01:00
Eduard S
a4a193c7f2 Fix missing EthBlockNum in DB for Coordinator 2020-12-04 12:35:52 +01:00
Eduard S
897d7d5319 Merge pull request #326 from hermeznetwork/feature/effective-amount-update
Feature/effective amount update
2020-12-04 12:33:30 +01:00
Arnau B
5fd258ee07 Use flags for effective amounts in SQL schema 2020-12-04 12:17:09 +01:00
a_bennassar
0602332d88 Merge pull request #325 from hermeznetwork/feature/ethclient-up-ev
Update ethclient
2020-12-04 11:58:52 +01:00
laisolizq
75c6d8f14e Updates API to new changes 2020-12-04 11:22:12 +01:00
Eduard S
329d2796c6 Update some eth types, update eth dependencies to new changes 2020-12-03 18:05:33 +01:00
Arnau B
3e3eb3ffe6 Update API mock server URL for swagger UI 2020-12-03 17:47:16 +01:00
laisolizq
18031343ec Update ethclient 2020-12-03 14:19:38 +01:00
Eduard S
0bacd6052d Merge pull request #323 from hermeznetwork/feature/zkinputs3
StateDB ZKInputs generation compatible with circom
2020-12-03 13:28:35 +01:00
arnaucube
80cbac24f9 StateDB ZKInputs generation compatible with circom
- Add SignatureConstant to L1Tx.TxCompressedData
- ZKInputs generation works initial version working and compatible with circom Hermez circuit
    - Lots of small updates for circuits compatibility
- Update version (with new changes) of `go-iden3-crypto` & `go-merkletree`
2020-12-03 13:16:51 +01:00
arnau
d306f4890a Merge pull request #322 from hermeznetwork/feature/integration20
Advance coordinator implementation
2020-12-03 13:16:07 +01:00