792 Commits

Author SHA1 Message Date
ToniRamirezM
ce6a271448 Remove bigints from API 2021-01-12 11:05:13 +01:00
Eduard S
101a954775 Fix forging L1Batch too early
When scheduling an L1Batch, make sure the previous L1Batch has been
synchronized.  Otherwise, an L1Batch will be forged that may not contain all
the L1UserTxs that are supposed to be included.
2021-01-11 16:16:05 +01:00
a_bennassar
65a1057980 Merge pull request #473 from hermeznetwork/feature/buckets-update
Update buckets withdrawals on API
2021-01-11 15:43:00 +01:00
ToniRamirezM
0bb69c3f3e Update buckets withdrawals on API 2021-01-11 15:21:50 +01:00
Eduard S
0a461fe60c Merge pull request #471 from hermeznetwork/feature/zki6-comp
ZKInput with L2Txs compatible with circom circuits
2021-01-11 12:20:48 +01:00
arnaucube
b59710a149 ZKInput with L2Txs compatible with circom circuits
- Til
  - update Til users BJJ key generation for better js tests
    compatibility
- Common
  - PoolL2Tx to L2Tx use AuxToIdx in case that ToIdx is 0
  - Update ZKInputs parameter descriptions
- TxProcessor
  - Fix AccumulatedFees in case that there is no CoordIdx for that token
  - Fix zki.NewExit usage
  - Use same order for AccumulatedFees & FeeIdx & FeePlanTokens
  - Add Nonce usage to ExitLeafs
  - Update TestZKInput6 and check its compatibility with circom Hermez
circuits
2021-01-11 11:23:04 +01:00
arnau
b0e925fd71 Merge pull request #470 from hermeznetwork/feature/debug1
Add debug info in batch debug file
2021-01-08 18:13:26 +01:00
Eduard S
2ae936f2bd Merge pull request #469 from hermeznetwork/feature/swagger-imprvmnts
Swagger improvements
2021-01-08 17:57:26 +01:00
Arnau B
b4d8e68730 Swagger improvements 2021-01-08 15:47:44 +01:00
Eduard S
97908447b9 Add debug info in batch debug file
- Debug Batch File
    - Add details about why a batch is scheduled to be L1Batch or regular
    - Add timestamps in time and blockNumber of important events
    - Use a different naming for the files (batchNum + timestamp)
- Coordinator:
    - To make decisions and store debug info, always use the current block that
      is being mined, instead of the last mined block
2021-01-07 18:47:13 +01:00
Eduard S
423b67b707 Merge pull request #468 from hermeznetwork/fix/repeated-bids
Fix repeated items when coordinator is updated
2021-01-07 17:06:16 +01:00
Arnau B
c5e3fdad75 Fix repeated items when coordinator is updated 2021-01-07 16:30:36 +01:00
arnau
ef8a6d1397 Merge pull request #467 from hermeznetwork/feature/fixes2
Update node and apply some fixes
2021-01-07 16:13:42 +01:00
Eduard S
a79cb4edfd Update node and apply some fixes
- Node
	- Load Coordinator Fee Account from config
		- Sign the AccountCreationMsg to generate the
		  AccountCreationAuth
		- Resolve #465
	- Wait for synchronizer termination before stopping coordinator to avoid
	  getting stuck when closing in the following case:
		- The coordinator stops reading the synchronizer msg channel,
		  and the node gets stuck sending a message to that channel.
- Common
	- Move account creation auth signature code to common.
	- Update RollupConstInputSHAConstantBytes
- Coordinator
	- Set batch status in the debug file
	- Propagate SCVariables on reorg
	- Pipeline: Get SCVariables updates
		- Resolve #457
	- Fix off by 1 error in Pipeline.shouldL1L2Batch() (which shouldn't have
	  caused any problem, but it was not right)
- KVDB
	- Delete future checkpoints after reset
	- In `ResetFromSynchronizer`, remove all checkpoints first, and follow
	  the same logic as `reset()`.
- Cli
	- Add command to generate a BabyJubJub key pair (to be used for the
	  Coordinator Fee Account)
- Node
	- Adjust example config `Coordinator.L1BatchTimeoutPerc` to avoid
	  missing the L1Batch deadline with the following setup:
		- a block is mined every 2 seconds
		- single proof server that takes 2 seconds to calculate a proof
- TxProcessor
	- Close temporary pebble used for the exit tree after usage.
		- Resolve #463
2021-01-07 16:09:28 +01:00
Eduard S
580a18e7c6 Merge pull request #462 from hermeznetwork/feature/txselector2
Feature/txselector2
2021-01-05 17:42:16 +01:00
arnaucube
bf5ab12d0e Update Account.PublicKey to Account.BJJ
Update account.PublicKey to account.BJJ for naming consistency with the rest of the code
2021-01-05 15:34:50 +01:00
arnaucube
962b9e4712 Add checks to TxSelector & other:
- Upgrade go-merkletree version to include the last changes of Pebble
that fixes the cgo issues (which should fix #453), from:
c2b05f12d7
- TxSelector
	- Remove parameter batchNum for GetL2TxSelection & GetL1L2TxSelection
	- Add checks of ToBJJ & ToEthAddr when ToIdx>255
	- Avoid getting the sender account twice to get the TokenID of a l2tx
	- Add test to check that selected L2Txs are sorted by Nonce
	- Discard L2Tx that return error at ProcessL2Txs
- executed `go mod tidy`
2021-01-05 15:28:43 +01:00
Eduard S
6fa4a2e799 Merge pull request #450 from hermeznetwork/feature/l2db-maxtxs
Add max txs limit to tx pool
2021-01-05 12:42:22 +01:00
a_bennassar
44b0b8f778 Merge pull request #451 from hermeznetwork/feature/varchar-utf8
Sanitize varchars that may not be UTF-8
2021-01-05 12:33:08 +01:00
Arnau B
622e01e9af Add max txs limit to tx pool 2021-01-04 18:38:25 +01:00
Eduard S
6bd10fc009 Merge pull request #448 from hermeznetwork/feature/txselector0
Feature/txselector0
2021-01-04 16:56:38 +01:00
arnaucube
135144636a TxSelector Coord fees & Nonces checks & other
- Add missing Fees to CoordAccounts after processing PoolL2Txs
- Add Nonces checks for L2Txs (txs with incorrect nonces not included
in the selection)
- Add missing MakeCheckpoint() at the LocalAccountsDB once the
selection is done
- Add TxSelector test of full flow using Til.SetBlockchainMinimumFlow0
checking balances & parameters
2021-01-04 16:52:18 +01:00
arnaucube
48bdec1397 Fix TxProcessor TokenID use &updates at Til&Common
- Til
  - tests that were using `til.SetBlockchainMinimumFlow0` have been
updated, as now the L1CoordinatorTxs are placed simulating TxSelector
creation (when needed, not before)
  - Add `EthSk` to `tc.User` to allow to sign `AccoutCreationAuths` at
the tests flows
- TxProcessor
  - for L2Txs get TokenID from tx.FromIdx Account.TokenID instead than
  - update tests vectors for new values
from tx.TokenID (which not always is set)
- Common
  - move TxIDsFromL2Txs & TxIDsFromPoolL2Txs from `coordinator` to
`common` to allow usage from other packages
2021-01-04 15:28:04 +01:00
ToniRamirezM
e2d243a9b5 Sanitize varchars that may not be UTF-8 2021-01-04 13:06:53 +01:00
a_bennassar
926943cb71 Merge pull request #447 from hermeznetwork/feature/change-queries
Change queries that produced undesired meddler logs
2021-01-04 10:31:21 +01:00
a_bennassar
bc88987917 Merge pull request #445 from hermeznetwork/feature/configmeddlerdebug
Add config flag to enable/disable meddler logs
2021-01-04 10:25:05 +01:00
a_bennassar
65abdd408a Merge pull request #442 from hermeznetwork/feature/new-metrics-tests
Added new metrics tests
2021-01-04 10:23:17 +01:00
Eduard S
6c1c1fa80c Merge pull request #444 from hermeznetwork/feature/txsel-coordidxs-upd
Update TxSelector to return CoordIdxs used & other
2020-12-31 13:24:20 +01:00
arnaucube
79b3de7178 Update TxSelector to return CoordIdxs used & other
- StateDB
  - Update GetIdxByEthAddrBJJ to return ErrToIdxNotFound when idx not found, so can be checked at upper levels
- TxSelector
  - rm CoordIdxsDB that is no longer needed (also related methods)
  - add `getCoordIdx` method to get the Coordinator Idx for a given TokenID
  - Update coordinator account creation related to new TokenIDs from L2Txs
  - Reorganize GetL1L2TxSelection
  - return CoordIdxs used in the selection
- Update go-merkletree version which avoids marshaling Siblings to json
with 'null' value in case of empty array
2020-12-31 13:16:41 +01:00
ToniRamirezM
3e70551ac5 Added new metrics tests 2020-12-31 12:29:49 +01:00
Eduard S
f5d81ca8f8 Add config flag to enable/disable meddler logs
- In config, add Debug.MeddlerLogs to enable meddler debug logs.  This only
  affects the node started via cli, tests swill ran with `meddler.Debug = true`
- Remove unused ethereum client functions and config parameters
- Document all the config parameters
2020-12-31 11:00:05 +01:00
arnau
5c037e0a8f Merge pull request #441 from hermeznetwork/feature/configcircuits
Add circuit configuration to node config
2020-12-31 10:55:52 +01:00
Eduard S
18c854fbaa Add circuit configuration to node config
- Remove MaxL1CoordTxs parameter from the TxSelector because this parameter
  doesn't exist
- Use ChainID in l1tx byte encoding
- Pass txprocessor configuration to batch builder via an existing parameter
2020-12-31 10:44:19 +01:00
arnau
a9804dcc2b Merge pull request #439 from hermeznetwork/feature/cliwipesql
Add cli command to wipe the SQL DB
2020-12-31 10:38:47 +01:00
Eduard S
e5fc403451 Add cli command to wipe the SQL DB
- Refactor the migrations code so that packr is only called (via an init
  function in `db/utils.go`).
- When loading the migrations, make sure there is at least one migration,
  otherwise panic (this would happen if the node is built incorrectly)
2020-12-31 10:34:32 +01:00
arnau
2e51860c37 Merge pull request #437 from hermeznetwork/feature/ethprivkey
Load ethereum private key
2020-12-31 10:33:44 +01:00
ToniRamirezM
64b214061c Change queries that produced undesired meddler logs 2020-12-30 19:12:53 +01:00
Eduard S
fedbacaade Merge pull request #440 from hermeznetwork/fix/api-empty-arrays
empty array instead of 404
2020-12-30 13:56:03 +01:00
Arnau B
a32f75db78 empty array instead of 404 2020-12-30 12:41:53 +01:00
a_bennassar
c2dd982d26 Merge pull request #436 from hermeznetwork/feature/exit-proof-siblings
Update ExitProofs-Siblings padding
2020-12-30 11:13:22 +01:00
Eduard S
42791181a1 Load ethereum private key
Load an ethereum keystore when the node is started in coordinator mode.  The
private key corresponding to the forger address must be imported into the
keystore before running the node in coordinator mode.  You can see an examples
in `cli/node/load-sk-example.sh`.
2020-12-30 10:48:14 +01:00
arnaucube
ca5870e3ba Update ExitProofs-Siblings padding 2020-12-30 10:44:34 +01:00
Eduard S
88f924e9dd Merge pull request #435 from hermeznetwork/feature/addrs-in-exit-endpoints
Include addrs in exit responses
2020-12-29 18:01:46 +01:00
Eduard S
6e2cde8a31 Merge pull request #434 from hermeznetwork/fix/next-forgers-null
Fix next forgers when no bids
2020-12-29 17:59:18 +01:00
Arnau B
6cd292b937 Include addrs in exit responses 2020-12-29 17:35:20 +01:00
Eduard S
8c6dc6e3f8 Merge pull request #433 from hermeznetwork/feature/kvdb
Abstract KVDB from StateDB
2020-12-29 17:21:01 +01:00
Arnau B
d3c703ca75 Fix next forgers when no bids 2020-12-29 16:55:26 +01:00
arnaucube
68bfbff269 Abstract KVDB from StateDB
- KVDB contains the Checkpoint & Resets system
- StateDB uses KVDB and adds all the StateDB related methods
2020-12-29 16:48:01 +01:00
Eduard S
890b94a41a Merge pull request #428 from hermeznetwork/fix/api-next-forgers
Fix next forgers api response
2020-12-29 15:32:02 +01:00
Arnau B
6058d3c41a Fix next forgers api response 2020-12-29 15:17:55 +01:00