Commit Graph

11 Commits

Author SHA1 Message Date
Arnau B
ac1fd9acf7 Add semaphore for API queries to SQL 2021-02-10 13:36:17 +01:00
Eduard S
e73499628c Use Warn instead of Error on get prices error 2021-02-01 11:19:10 +01:00
Eduard S
a0c8ace38d Add missing tracerr.Wrap 2020-12-24 13:39:27 +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
ced42634da Wrap all errors with tracerr 2020-11-30 12:58:36 +01:00
Eduard S
8f1cf2f145 Update coordinator, call all api update functions
- Common:
	- Rename Block.EthBlockNum to Block.Num to avoid unneeded repetition
- API:
	- Add UpdateNetworkInfoBlock to update just block information, to be
	  used when the node is not yet synchronized
- Node:
	- Call API.UpdateMetrics and UpdateRecommendedFee in a loop, with
	  configurable time intervals
- Synchronizer:
	- When mapping events by TxHash, use an array to support the possibility
	  of multiple calls of the same function happening in the same
	  transaction (for example, a smart contract in a single transaction
	  could call withdraw with delay twice, which would generate 2 withdraw
	  events, and 2 deposit events).
	- In Stats, keep entire LastBlock instead of just the blockNum
	- In Stats, add lastL1BatchBlock
	- Test Stats and SCVars
- Coordinator:
	- Enable writing the BatchInfo in every step of the pipeline to disk
	  (with JSON text files) for debugging purposes.
	- Move the Pipeline functionality from the Coordinator to its own struct
	  (Pipeline)
	- Implement shouldL1lL2Batch
	- In TxManager, implement logic to perform several attempts when doing
	  ethereum node RPC calls before considering the error. (Both for calls
	  to forgeBatch and transaction receipt)
	- In TxManager, reorganize the flow and note the specific points in
	  which actions are made when err != nil
- HistoryDB:
	- Implement GetLastL1BatchBlockNum: returns the blockNum of the latest
	  forged l1Batch, to help the coordinator decide when to forge an
	  L1Batch.
- EthereumClient and test.Client:
	- Update EthBlockByNumber to return the last block when the passed
	  number is -1.
2020-11-26 18:06:30 +01:00
Arnau B
cbeca0f76e Insert ETH as HistoryDB token 2020-11-02 12:09:09 +01:00
laisolizq
043710112d Add get tokens endpoint 2020-10-19 10:14:18 +02:00
Arnau B
f653ff8a73 Connect price updater to historydb 2020-10-02 10:13:48 +02:00
arnaucube
fd1e9c25ee Add linter checks to GHA & Fix code to pass lints
Add linter checks to GHA & Fix code to pass lints.
The linters added are:
- whitespace: Tool for detection of leading and trailing whitespace
- gosec: Inspects source code for security problems
- gci: Gci control golang package import order and make it always deterministic
- misspell: Finds commonly misspelled English words in comments
- gomnd: An analyzer to detect magic numbers

The file utils/utils.go is excluded from the checks of gomnd, as uses magic numbers through the code
2020-08-28 09:58:39 +02:00
arnau
2c247bf9c3 Priceupdater-v0 (#23)
* First price-updater implementation

* Lint corrections

* Structs revision

* Read Write Mutex

* Review price updater and apply small changes

Co-authored-by: Toni Ramírez <toni@iden3.com>
Co-authored-by: Eduard S <eduard@iden3.io>
2020-07-31 10:23:52 +02:00