Commit Graph

459 Commits

Author SHA1 Message Date
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
Eduard S
482c94d374 Advance coordinator implementation
- Common
	- Move ErrTODO and ErrDone to common for usage where needed.
- Coordinator
	- Move prover types to prover package
	- Handle reorgs, stopping the pipeline when necessary
	- Handle ethereum transaction errors by stopping the pipeline
	- In case of ethereum transaction revert, check for known revert causes
	  (more revert causes can be added to handle more cases)
	- Fix skipped transactions in TxManager confirmation logic
	- Cancel and wait for provers to be ready
	- Connect L2DB to:
		- purge l2txs due to timeout
		- mark l2txs at the different states
	- Connect HistoryDB to query L1UserTxs to forge in an L1Batch
- L2DB
	- Skip update functions when the input slices have no values (to avoid a
	  query with no values that results in an SQL error)
- StateDB
	- In LocalStateDB, fix Reset when mt == nil
- Prover (new package)
	- Rename the interface to Prover
	- Rename the mock struct to Mock
	- Extend Prover interface methods to provide everything required by the
	  coordinator
	- Begin implementing required http client code to interact with server
	  proof (not tested)
- Synchronizer:
	- Add LastForgeL1TxsNum to Stats
- Test/Client
	- Update Auction logic to track slots in which there's no forge during
	  the time before the deadline (following the solidity implementation)
2020-12-03 13:00:06 +01:00
arnau
f58e79d21b Merge pull request #321 from hermeznetwork/feature/til-gen-from-instructions
Allow using til with instructions
2020-12-03 11:38:09 +01:00
Arnau B
d9121bf5a6 Allow using til with instructions 2020-12-02 16:01:17 +01:00
a_bennassar
7155743820 Merge pull request #316 from hermeznetwork/feature/set-effectives
Set EffectiveAmount and EffectiveLoadAmount of forged L1UserTxs
2020-11-30 16:54:03 +01:00
Eduard S
665e0829ec Set EffectiveAmount and EffectiveLoadAmount of forged L1UserTxs 2020-11-30 16:25:54 +01:00
Eduard S
16d04de489 Merge pull request #315 from hermeznetwork/feature/rm-ethvar
Rm unused ETHCLIENT_DIAL_URL
2020-11-30 15:59:16 +01:00
arnaucube
2d272548b2 Rm unused ETHCLIENT_DIAL_URL 2020-11-30 14:15:02 +01:00
a_bennassar
a8c9b7a604 Merge pull request #304 from hermeznetwork/feature/tracerr1
Wrap all errors with tracerr
2020-11-30 13:08:42 +01:00
Eduard S
ced42634da Wrap all errors with tracerr 2020-11-30 12:58:36 +01:00