Commit Graph

562 Commits

Author SHA1 Message Date
Arnau B
bc5fa92898 Add bootCoord to coord table, get coord by forgerAddr 2020-12-23 11:03:21 +01:00
Eduard S
cd1a193dcd Merge pull request #405 from hermeznetwork/fix/api-nonce
Fix API nonces
2020-12-22 17:43:24 +01:00
Eduard S
a50bda3f59 Update packr dependency
Update packr to 2.8.1 which fixes this issue:
https://github.com/gobuffalo/packr/issues/261 which I encountered while running
a test with `-race`
2020-12-22 17:27:38 +01:00
Eduard S
6a990376b4 Implement Pipeline.prepareForgeBatchArgs()
- Implement Pipeline.prepareForgeBatchArgs()
- Add a minimal stress test for the coordinator (that also runs the
  synchronizer)
- Update txprocessor.ProcessTxs() to return valid results for batches without
  transactions
  	- Add the boilerplate for the corresponding test, leaving as TODO the
	  zkInput values
- Update prover client to use the same point format as proof server (projective)
- Update interface of TxSelector.GetCoordIdxs to also return the authorizations
  to create accounts that go with the l1CoordinatorTxs.
2020-12-22 17:27:34 +01:00
arnau
c61c4f3376 Merge pull request #402 from hermeznetwork/feature/testpurger
Test purger, fix some nonces
2020-12-22 17:15:16 +01:00
Arnau B
a7394cdb2a Fix API nonces 2020-12-22 16:36:51 +01:00
Eduard S
a8ac35059a Test purger, fix some nonces
- Test all the purger functions
- Fix nonces set by til (previously til started with nonce 1 for pool l2txs,
  but the correct implementation is to start with nonce 0)
- Rename L2DB.CheckNonces to L2DB.invalidateOldNoncesQuery
- Rename L2DB.checkNoncesQuery to L2DB.InvalidateOldNonces

Related https://github.com/hermeznetwork/hermez-node/issues/392 (Fix checkNoncesQuery)
Resolve https://github.com/hermeznetwork/hermez-node/issues/396
2020-12-22 12:00:12 +01:00
a_bennassar
8a2df8de0d Merge pull request #390 from hermeznetwork/feature/bjj-comp
Feature/bjj comp
2020-12-22 11:44:19 +01:00
arnaucube
4b10549822 mv of babyjub.PublicKey to babyjub.PublicKeyComp
Update usage of `*babyjub.PublicKey` to `babyjub.PublicKeyComp`
- when the key is not defined, internally is used `babyjub.EmptyBJJComp`, which is a `[32]byte` of zeroes of type `babyjub.PublicKeyComp`
- the API continues returning `nil` when the key is not defined
2020-12-22 11:29:47 +01:00
a_bennassar
0401ff6180 Merge pull request #385 from hermeznetwork/feature/integratepriceupdater
Update and integrate price updater
2020-12-21 09:56:07 +01:00
arnau
b9943182b8 Merge pull request #383 from hermeznetwork/feature/initvars
Use init SC vars and start block from events
2020-12-18 20:26:41 +01:00
Eduard S
92e34fb683 Merge pull request #387 from hermeznetwork/feature/fix-get-best-bid-coord
Fix historyDB GetBestBidCoordinator
2020-12-18 17:53:34 +01:00
laisolizq
bc29222341 Fix historyDB GetBestBidCoordinator 2020-12-18 17:47:41 +01:00
Eduard S
56fffdcee5 Update and integrate price updater
PriceUpdater:
    - Pass context so that it can be canceled during an update loop
    - Define APITypes to make it explicit which API we are using
2020-12-18 17:19:53 +01:00
Eduard S
b1a8384f27 Run go-instrument-errors to wrap errors 2020-12-18 13:39:42 +01:00
Eduard S
b59f790c04 Use init SC vars and start block from events
Previously the Synchronizer required the initial variables of the smart
contracts to be passed as a configuration parameter (that the node took from
the configuration file).  The same applied to the blockNumber.

The last update of the smart contracts introduced events for each smart
contract constructor (initializer), which allows querying the initial variables
as well as the initial block number for each smart contract.

Now the synchronizer uses this information, and thus the initial variables and
the starting block numbers have been removed from the configuration.
2020-12-18 13:39:06 +01:00
laisolizq
0bde608a1b Merge pull request #380 from hermeznetwork/feature/upgradecontracts
Upgrade contracts and parse init events
2020-12-18 11:28:40 +01:00
Eduard S
ac400bad77 Upgrade contracts and parse init events 2020-12-18 11:19:02 +01:00
Eduard S
d649dd3395 Merge pull request #379 from hermeznetwork/feature/upd-effamounts
Effective amounts add missing check
2020-12-17 18:18:21 +01:00
arnaucube
0bcf57603c Effective amounts add missing checks 2020-12-17 17:51:23 +01:00
Eduard S
cae69acecb Merge pull request #373 from hermeznetwork/feature/txsel-coordidx
TxSelector add CoordIdxDB, SelectionConfig, abstract filtering
2020-12-17 17:02:51 +01:00
arnaucube
004f852b44 TxSelector add CoordIdxDB, SelectionConfig, abstract filtering
TxTypeToEthAddr & TxTypeToBJJ

- TxSelector
	- Add SelectionConfig for each batch
	- Add CoordIdxDB key-value where the CoordinatorIdxs are stored
	- Separated method for filtering TxTypeToEthAddr & TxTypeToBJJ
2020-12-17 16:46:23 +01:00
a_bennassar
6ac033bdd6 Merge pull request #372 from hermeznetwork/feature/fixtxsorder
Fix order of L1UserTxs
2020-12-17 15:54:05 +01:00
Eduard S
8a59296cb8 Fix order of L1UserTxs
When the synchronizer queries the unforged L1UserTxs, sort them by position

Swap the order of calls setL1UserTxEffectiveAmounts and addBatch in
AddBlockSCData because otherwise, for reasons I dont understand, the item_id of
the txs doesn't follow the position of the txs.
2020-12-17 15:48:01 +01:00
arnau
8838bd62f9 Merge pull request #371 from hermeznetwork/feature/fixpanic1
Fix panic caused by nil batchInfo.ServerProof
2020-12-17 15:12:03 +01:00
Eduard S
7f0d2dfd43 Fix panic caused by nil batchInfo.ServerProof 2020-12-17 13:50:04 +01:00
Eduard S
a3d0765644 Merge pull request #370 from hermeznetwork/fix/pipeline-call
Fix coordinator pipeline forgeBatch call
2020-12-17 13:20:29 +01:00
arnaucube
d871ebc9d6 Fix coordinator pipeline forgeBatch call 2020-12-17 13:15:31 +01:00
arnau
d781b41fed Merge pull request #365 from hermeznetwork/feature/nodecfg
Merge node (sync-only) and coord config
2020-12-17 11:08:10 +01:00
arnau
ca25bd14d2 Merge pull request #363 from hermeznetwork/feature/coordinator1
Make coordinator more robust agains failed forges
2020-12-17 11:06:45 +01:00
Eduard S
12fba96eee Merge pull request #366 from hermeznetwork/fix/api-exit-response
Fix format of the MTP for exit endpoint
2020-12-17 11:02:31 +01:00
arnau
f58cadb34e Merge pull request #362 from hermeznetwork/feature/updatetxs
Update txs constructors and helpers
2020-12-17 10:53:12 +01:00
arnau
c047f2ffe8 Merge pull request #360 from hermeznetwork/feature/integration26
Add mock proof server
2020-12-17 10:17:12 +01:00
Arnau B
8083e4fec3 Fix format of the MTP for exit endpoint 2020-12-16 20:09:17 +01:00
Eduard S
885f584fd2 Add mock proof server 2020-12-16 18:44:48 +01:00
arnau
6dd766be4d Merge pull request #359 from hermeznetwork/feature/integration25
Extend Coordinator tests
2020-12-16 18:07:44 +01:00
Eduard S
11722c60ba Merge node (sync-only) and coord config 2020-12-16 17:30:30 +01:00
Eduard S
f3505000dd Make coordinator more robust agains failed forges 2020-12-16 15:56:54 +01:00
Eduard S
7a30294688 Update txs constructors and helpers
For each tx, move the logic of setting the Type and TxID to separate functions,
so that they can be called when necessary.

In synchronizer, set all the required fields using the `SetID` and `SetType`
for l2txs when needed.  This is necessary because the `ProcessTxs()` works with
`common.PoolL2Tx`, which misses some fields from `common.L2Tx`, and because
`ProcessTxs()` needs the Type to be set, but at the same time `ProcessTxs()`
sets the Nonce, which is required for the `TxID`.
2020-12-16 15:25:55 +01:00
Eduard S
61255d730c Merge pull request #358 from hermeznetwork/fix/api-accounts
Fix inconsistency between api doc and code: hermezEthereumAddress => …
2020-12-16 13:46:16 +01:00
Eduard S
7277dc1eb4 Merge pull request #357 from hermeznetwork/feature/chec-effamount
Update StateDB computeEffectiveAmounts
2020-12-16 13:44:52 +01:00
Eduard S
b53cf10b35 Merge pull request #353 from hermeznetwork/fix/process-l2txs
Add TxType before processing L2 tx
2020-12-16 13:31:41 +01:00
Eduard S
6a9b5ce420 Extend Coordinator tests 2020-12-16 13:13:40 +01:00
Arnau B
226c49f28f Fix inconsistency between api doc and code: hermezEthereumAddress => hezEthereumAddress 2020-12-16 12:29:46 +01:00
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