Commit Graph

761 Commits

Author SHA1 Message Date
arnau
334eecc99e Merge pull request #645 from hermeznetwork/feature/newpolicy
Add config parameter  ForgeOncePerSlotIfTxs
2021-03-18 14:02:53 +01:00
arnau
b01d5d50ee Merge pull request #633 from hermeznetwork/feature/makefile
Create a Makefile for build using -ldflags and useful commands
2021-03-18 13:36:51 +01:00
a_bennassar
8018f348a7 Merge pull request #649 from hermeznetwork/feature/dbbigintsdecimal
Store *big.Int as DECIMAL in sql
2021-03-18 13:25:43 +01:00
Eduard S
91ffdc250b Store *big.Int as DECIMAL in sql 2021-03-18 12:53:46 +01:00
Eduard S
4ebe285912 Merge pull request #644 from hermeznetwork/feature/external-delete-not-count
Not count txs marked as external_delete to reach MaxTxsPool
2021-03-18 11:44:08 +01:00
arnaubennassar
c280b21b89 Not count txs marked as external_delete to reach MaxTxsPool 2021-03-18 11:35:51 +01:00
Eduard S
e78fd613c6 Merge pull request #641 from hermeznetwork/fix/avg-tx-price
Fix average transaction fee calculation
2021-03-18 10:24:25 +01:00
a_bennassar
9edbd135ef Merge pull request #647 from hermeznetwork/fix/apistatecollectedfees
Fix API /state collected fees unmarshal
2021-03-17 17:51:41 +01:00
Eduard S
009d0c5be1 Fix API /state collected fees unmarshal 2021-03-17 15:05:23 +01:00
Eduard S
777ca3d87e Merge pull request #646 from hermeznetwork/fix/forgerCommitment
Fix Synchronizer not setting slot.ForgerCommitment to true
2021-03-17 13:53:07 +01:00
Oleksandr Brezhniev
eb89ab84f2 Rename the variable to match the meaning 2021-03-17 14:41:06 +02:00
Pantani
234268028e create cli command to print the version and the build commit and date 2021-03-17 09:07:03 -03:00
Pantani
d7bab0c524 create a makefile to build, compile and run the binary using ldflags 2021-03-17 09:06:57 -03:00
Oleksandr Brezhniev
36c1ba84df Fix Synchronizer not setting slot.ForgerCommitment to true until fully synced and after reorgs 2021-03-17 13:21:27 +02:00
Eduard S
450fa08d80 Add config parameter ForgeOncePerSlotIfTxs
New configuration Coordinator configuration parameter `ForgeOncePerSlotIfTxs`:
ForgeOncePerSlotIfTxs will make the coordinator forge at most one batch per
slot, only if there are included txs in that batch, or pending l1UserTxs in the
smart contract.  Setting this parameter overrides `ForgeDelay`,
`ForgeNoTxsDelay`, `MustForgeAtSlotDeadline` and `IgnoreSlotCommitment`.

Also restructure a bit the functions that check policies to decide whether or
not to forge a batch.
2021-03-17 11:48:36 +01:00
arnaubennassar
578edc80bc Fix average transaction fee calculation 2021-03-16 11:50:43 +01:00
Eduard S
80f16201a2 Merge pull request #640 from hermeznetwork/feature/BatchCheck
separated the policy to decide if we forge batch or not
2021-03-15 18:00:41 +01:00
Mikelle
cd74f1fda3 separated the policy to decide if we forge batch or not 2021-03-15 19:23:28 +03:00
arnau
6c6d1ea7b8 Merge pull request #631 from hermeznetwork/feature/serveapicli2
Allow serving API only via new cli command
2021-03-15 15:41:36 +01:00
Eduard S
d625cc9287 Allow serving API only via new cli command
- Add new command to the cli/node: `serveapi` that alows serving the API just
  by connecting to the PostgreSQL database.  The mode flag should me passed in
  order to select whether we are connecting to a synchronizer database or a
  coordinator database.  If `coord` is chosen as mode, the coordinator
  endpoints can be activated in order to allow inserting l2txs and
  authorizations into the L2DB.

Summary of the implementation details
- New SQL table with 3 columns (plus `item_id` pk).  The table only contains a
  single row with `item_id` = 1.  Columns:
    - state: historydb.StateAPI in JSON.  This is the struct that is served via
      the `/state` API endpoint.  The node will periodically update this struct
      and store it int he DB.  The api server will query it from the DB to
      serve it.
    - config: historydb.NodeConfig in JSON.  This struct contains node
      configuration parameters that the API needs to be aware of.  It's updated
      once every time the node starts.
    - constants: historydb.Constants in JSON.  This struct contains all the
      hermez network constants gathered via the ethereum client by the node.
      It's written once every time the node starts.
- The HistoryDB contains methods to get and update each one of these columns
  individually.
- The HistoryDB contains all methods that query the DB and prepare objects that
  will appear in the StateAPI endpoint.
- The configuration used in for the `serveapi` cli/node command is defined in
  `config.APIServer`, and is a subset of `node.Config` in order to allow
  reusing the same configuration file of the node if desired.
- A new object is introduced in the api: `StateAPIUpdater`, which contains all
  the necessary information to update the StateAPI in the DB periodically by
  the node.

- Moved the types `SCConsts`, `SCVariables` and `SCVariablesPtr` from
  `syncrhonizer` to `common` for convenience.
2021-03-15 15:35:20 +01:00
Eduard S
ec9b0aadce Merge pull request #617 from hermeznetwork/fix/txsel-discard-processl2txerrs
Fix TxSel discard tx when ProcessL2Tx gives err
2021-03-15 13:45:46 +01:00
arnaucube
5d8579a609 Fix TxSel discard tx when ProcessL2Tx gives err
Refactor getL1L2TxSelection, which fixes some problems for certain
combinations of txs.
2021-03-15 13:36:15 +01:00
arnau
84b84ecc17 Merge pull request #614 from hermeznetwork/feature/forger-config-options
Add the option to forge batch at the slot deadline
2021-03-15 11:29:27 +01:00
Pantani
968fcc207e Add the option to force or not a forgeBatch at the beginning of the slot 2021-03-11 23:26:17 -03:00
Eduard S
a5dcc67a08 Merge pull request #629 from hermeznetwork/feature/indivisual-token-config
Allow price update configuration to be specified per token
2021-03-10 14:11:57 +01:00
arnaubennassar
97062afc90 Allow price update configuration to be specified per token 2021-03-10 14:04:00 +01:00
Eduard S
b724348ddc Merge pull request #630 from hermeznetwork/feature/update-poseidon
Update to last Poseidon & go-merkletree versions
2021-03-10 12:18:59 +01:00
arnau
0b6911052a Merge pull request #611 from hermeznetwork/feature/sync-l1-account-creation-auth
Synchronize the AccountCreationAuths from L1CoordinatorTxs
2021-03-09 17:24:54 +01:00
arnaucube
a39d880fd4 Update to last Poseidon & go-merkletree versions
Update to last Poseidon (go-iden3-crypto) & go-merkletree versions,
update the affected test vectors, and check ZKInputs compatibility with
last version of circuits.

Update to last Poseidon version (which includes the changes of the
reference implementation from
26ddaa91db)

Compatible with update at circomlib
(cf853c1cc9)
2021-03-09 14:43:08 +01:00
Pantani
efb23950db Synchronize the AccountCreationAuths from L1CoordinatorTxs 2021-03-08 14:41:19 -03:00
Eduard S
06b271fc47 Merge pull request #620 from hermeznetwork/feature/priceupdater-by-SC-addr
Add coingecko client to price updater
2021-03-08 16:42:07 +01:00
arnaubennassar
ac66ede917 Add coingecko client to price updater 2021-03-08 16:34:49 +01:00
Eduard S
7305a8d7f1 Merge pull request #615 from hermeznetwork/fix/l2txs-all-tonull
API doesnt accept pool txs without to
2021-03-08 15:24:35 +01:00
arnaubennassar
81690039da API doesnt accept pool txs without to 2021-03-08 15:16:49 +01:00
Eduard S
661da0d53e Merge pull request #619 from hermeznetwork/fix/floor-float40-helper
Fix NewFloat40Floor helper method
2021-03-08 15:16:45 +01:00
arnau
d0ace0773d Merge pull request #616 from hermeznetwork/fix/typos-and-lint
fix some code typos
2021-03-08 14:35:30 +01:00
arnaucube
4fd757a03c Fix NewFloat40Floor helper method 2021-03-08 14:32:05 +01:00
arnau
1778b08043 Merge pull request #618 from hermeznetwork/fix/poolL2-signature
Fix tx signature when toEthAddr starts with 0x0
2021-03-05 17:26:56 +01:00
arnaubennassar
dcd40f1943 Fix tx signature when toEthAddr starts with 0x0 2021-03-05 17:21:14 +01:00
Danilo Pantani
7833cb11de fix some code and comment typos 2021-03-04 18:26:00 -03:00
Danilo Pantani
d361abb8cd Add the config option to forge batch when the coordinator we are not the auction winner and reach the slot deadline 2021-03-04 13:55:06 -03:00
Eduard S
9e96bc89f0 Merge pull request #613 from hermeznetwork/fix/zkinputs-ISExitRoot-L1CoordTxs
Fix ZKInputs.ISExitRoot for case of L1CoordTxs
2021-03-04 16:44:43 +01:00
arnaucube
7bc83d7f70 Fix ZKInputs.ISExitRoot for case of L1CoordTxs
For the cases when there are Exit L1UserTxs and also there are
L1CoordinatorTxs, the ISExitRoot should have the expected value (!=0)
for the L1CoordinatorTxs slots.
2021-03-04 14:57:08 +01:00
Eduard S
6bf8584a82 Merge pull request #612 from hermeznetwork/fix/txselector-unselectedtx-nonce
Fix TxSel for unselected tx update internal Nonce
2021-03-04 14:14:00 +01:00
arnaucube
18e9e437da Fix TxSel for unselected tx update internal Nonce
Fix TxSelector for unselected tx update internal Nonce.
Also updated TxSelector config parameter.
2021-03-04 14:09:13 +01:00
Eduard S
e4343a73ad Merge pull request #610 from hermeznetwork/feature/float40-floor
Add NewFloor40Floor helper method
2021-03-03 12:07:50 +01:00
arnau
59558e5a4b Merge pull request #609 from hermeznetwork/feature/wipestatedb
Wipe StateDB in cli command wipesql
2021-03-03 12:02:21 +01:00
arnaucube
dfd49164f4 Add NewFloor40Floor helper method
Also added tracerr.Wrap(...) to missing places.
2021-03-03 11:58:17 +01:00
Eduard S
1050da350a Wipe StateDB in cli command wipesql
Also, in the cli commands `wipesql` and `discard`, always rebuild the current
checkpoint of the stateDBs to make sure it's in a consistent non-corrupted
state and do a reset afterwards.  These commands will allow reverting the
StateDB to a valid and consistent state in case a crash leaves the StateDB in a
corrupted state.
2021-03-03 11:33:22 +01:00
Eduard S
e460a7e58b Merge pull request #608 from hermeznetwork/feature/txprocessor-doc
Extend TxProcessor documentation and explanation
2021-03-02 14:19:49 +01:00