Commit Graph

1367 Commits

Author SHA1 Message Date
Roman Volosovskyi dc31c818fc
bump to 0.40.0 2020-01-23 14:14:08 +02:00
Roman Volosovskyi a92a95cf83
status-im/status-react#9203 Faster tx fetching with less request
*** How it worked before this PR on multiaccount creation:
- On multiacc creation we scanned chain for eth and erc20 transfers. For
  each address of a new empty multiaccount this scan required
  1. two `eth_getBalance` requests to find out that there is no any
     balance change between zero and the last block, for eth transfers
  2. and `chain-size/100000` (currently ~100) `eth_getLogs` requests,
     for erc20 transfers
- For some reason we scanned an address of the chat account as well, and
  also accounts were not deduplicated. So even for an empty multiacc we
  scanned chain twice for each chat and main wallet addresses, in result
  app had to execute about 400 requests.
- As mentioned above, `eth_getBalance` requests were used to check if
  there were any eth transfers, and that caused empty history in case
  if user already used all available eth (so that both zero and latest
  blocks show 0 eth for an address). There might have been transactions
  but we wouldn't fetch/show them.
- There was no upper limit for the number of rpc requests during the
  scan, so it could require indefinite number of requests; the scanning
  algorithm was written so that we persisted the whole history of
  transactions or tried to scan form the beginning again in case of
  failure, giving up only after 10 minutes of failures. In result
  addresses with sufficient number of transactions would never be fully
  scanned and during these 10 minutes app could use gigabytes of
  internet data.
- Failures were caused by `eth_getBlockByNumber`/`eth_getBlockByHash`
  requests. These requests return significantly bigger responses than
  `eth_getBalance`/`eth_transactionsCount` and it is likely that
  execution of thousands of them in parallel caused failures for
  accounts with hundreds of transactions. Even for an account with 12k
  we could successfully determine blocks with transaction in a few
  minutes using `eth_getBalance` requests, but `eth_getBlock...`
  couldn't be processed for this acc.
- There was no caching for for `eth_getBalance` requests, and this
  caused in average 3-4 times more such requests than is needed.

*** How it works now on multiaccount creation:
- On multiacc creation we scan chain for last ~30 eth transactions and
  then check erc20 in the range where these eth transactions were found.
  For an empty address in multiacc this means:
  1. two `eth_getBalance` transactions to determine that there was no
     balance change between zero and the last block; two
     `eth_transactionsCount` requests to determine there are no outgoing
     transactions for this address; total 4 requests for eth transfers
  2. 20 `eth_getLogs` for erc20 transfers. This number can be lowered,
     but that's not a big deal
- Deduplication of addresses is added and also we don't scan chat
  account, so a new multiacc requires ~25 (we also request latest block
  number and probably execute a few other calls) request to determine
  that multiacc is empty (comparing to ~400 before)
- In case if address contains transactions we:
  1. determine the range which contains 20-25 outgoing eth/erc20
     transactions. This usually requires up to 10 `eth_transactionCount`
     requests
  2. then we scan chain for eth transfers using `eth_getBalance` and
     `eth_transactionCount` (for double checking zero balances)
  3. we make sure that we do not scan db for more than 30 blocks with
     transfers. That's important for accounts with mostly incoming
     transactions, because the range found on the first step might
     contain any number of incoming transfers, but only 20-25 outgoing
     transactions
  4. when we found ~30 blocks in a given range, we update initial
     range `from` block using the oldest found block
  5. and now we scan db for erc20transfers using `eth_getLogs`
     `oldest-found-eth-block`-`latest-block`, we make not more than 20 calls
  6. when all blocks which contain incoming/outgoing transfers for a
     given address are found, we save these blocks to db and mark that
     transfers from these blocks are still to be fetched
  7. Then we select latest ~30 (the number can be adjusted) blocks from
     these which were found and fetch transfers, this requires 3-4
     requests per transfer.
  8. we persist scanned range so that we know were to start next time
  9. we dispatch an event which tells client that transactions are found
  10. client fetches latest 20 transfers
- when user presses "fetch more" button we check if app's db contains next
  20 transfers, if not we scan chain again and return transfers after

small fixes
2020-01-23 10:36:11 +02:00
Andrea Maria Piana a4f88d0017
Fix ens names and contact (#1810)
Currently the wrong pk format was used to query the in-memory contacts,
this commit corrects the behavior.
2020-01-23 09:24:28 +01:00
Adam Babik 21c67f7296
bump to 0.39.10 2020-01-22 09:48:49 +01:00
Adam Babik bc2d018483
Add support for request messages by topics (#1805) 2020-01-21 08:11:24 +01:00
Adam Babik 3b81bd2878
bump to 0.39.9 2020-01-20 21:59:32 +01:00
Adam Babik 79b8112f89
Split shhext into shhext and wakuext (#1803) 2020-01-20 21:56:06 +01:00
Andrea Maria Piana 23a0e9266c
v0.39.8 (#1808) 2020-01-20 20:08:57 +01:00
Andrea Maria Piana 456bcfa022
Peg clock value to whisper timestamp (#1804)
This commit pegs the clock value to maximum + 120 seconds from the whisper
timestamp.
In this way the we avoid the scenario where a client makes the timestamp
increase arbitrarely.
2020-01-20 17:44:32 +01:00
Pedro Pombeiro 93975aa900 Working Nimbus branch with geth keystore 2020-01-20 13:15:17 +01:00
Pedro Pombeiro d4710faae2 In progress: Use Nimbus keystore 2020-01-20 13:15:17 +01:00
Pedro Pombeiro db01f0b3e4 Avoid passing node to subscriptions service 2020-01-20 13:15:17 +01:00
Pedro Pombeiro 6537cae606 Nimbus node support 2020-01-20 13:15:17 +01:00
Andrea Maria Piana 25d46c6d82
Fix waku tests & contact ens (#1802) 2020-01-17 13:39:09 +01:00
Pedro Pombeiro ae18729f59 Add go.formatFlags to VS Code settings 2020-01-16 13:18:36 +01:00
Pedro Pombeiro 7f45c43196 make lint-fix 2020-01-16 13:18:36 +01:00
yenda 0316f94907
addresses are stored as byte array not sting (#1801) 2020-01-15 21:33:15 +01:00
Andrea Maria Piana e11e0b5d6c
bump version 0.39.4 (#1795) 2020-01-15 09:38:28 +01:00
Andrea Maria Piana c569d8a4ed
Sync installation messages & contact requests (#1791) 2020-01-15 08:25:09 +01:00
yenda eb93bab35d
fix error when removing mnemonic (#1790) 2020-01-14 10:55:06 +01:00
Adam Babik 2aebfc744e
Update VERSION to 0.39.3 2020-01-14 08:36:49 +01:00
Adam Babik 87f1f8a965
Remove 24h time range validation from maislerver request (#1792) 2020-01-14 08:16:35 +01:00
Adam Babik 179e3e851e
Report correct number of pruned rows in Postgres mailserver (#1789) 2020-01-13 21:13:28 +01:00
Adam Babik 44aa313981
Make shhext and protocol work with Waku (#1777)
This change makes shhext and protocol submodule work with Waku and Whisper.
2020-01-13 20:17:30 +01:00
Jakub Sokołowski 330d177de6 specify gomarkdown/markdown version to fix conflicts
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-01-11 19:41:24 +01:00
Andrea Maria Piana 88a1d0111e
Add Commands (#1731)
This commit adds handling of Transaction commands.
2020-01-10 19:59:01 +01:00
Pedro Pombeiro cbe2d621f4 Fix Nimbus Post implementation 2020-01-10 16:27:31 +01:00
yenda d3de88f790 fix stickers persistence (#1779) 2020-01-10 16:12:09 +01:00
Adam Babik 41eaf0376c
bump version to 0.39.1 2020-01-10 14:06:24 +01:00
Adam Babik 26a64e57da
bump extkeys and waku submodules 2020-01-10 14:03:17 +01:00
Adam Babik 07989c6a57
bump version of submodules 2020-01-10 13:52:06 +01:00
Jakub Sokołowski 697b62c2f9 update readme with new PGConfig location
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-01-08 14:51:26 +01:00
Jakub Sokołowski d29c6aad50 use more descriptive names for systemd services
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-01-08 14:51:26 +01:00
Jakub Sokołowski fc841f884a add config for new eth.prod fleet
also move _assets/ci/update-fleet-config.sh to scripts

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-01-08 14:51:26 +01:00
Jakub Sokołowski 1aa751a427
bump to 0.39.0
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-01-08 12:30:14 +01:00
Adam Babik 37a508a97b
Integrate Waku service (#1759) 2020-01-08 12:12:23 +01:00
Pedro Pombeiro 86dcbcd90e Rename gofmt to lint-fix 2020-01-07 17:07:56 +01:00
Pedro Pombeiro c0c963bdaa Use eth-node `keystore` for `generator.go` 2020-01-06 15:45:31 +01:00
Pedro Pombeiro c8a911ebd1 Use goimports instead of gofmt 2020-01-06 10:17:23 +01:00
Pedro Pombeiro 3eaacaa2f4 Move keystore_geth.go to eth-node/bridge/geth 2020-01-06 10:17:23 +01:00
Pedro Pombeiro 527cd38e1f Address code review comments 2020-01-06 10:17:23 +01:00
Pedro Pombeiro 287e5cdf79 Abstract `accounts.Key` and geth `keystore` 2020-01-06 10:17:23 +01:00
Pedro Pombeiro 608de7fa2d Add `gofmt` Makefile target 2020-01-06 10:17:23 +01:00
yenda cf2d16d186
settings api fixes (#1758) 2020-01-02 18:01:38 +01:00
Jakub Sokołowski 1d4b3b9241 allow running systemd service as root
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-01-02 10:36:13 +01:00
Pedro Pombeiro 0ed66b98ae Fail build if `make vendor` hasn't been run 2019-12-30 13:25:12 +01:00
Pedro Pombeiro 41cba814c8 Run `make vendor` 2019-12-30 13:25:12 +01:00
Pedro Pombeiro 18af9175ac Prevent crash in TestWhisperTestSuite when run isolated 2019-12-30 12:56:05 +01:00
Adam Babik 1ac515f19e remove reSelectAccount from backend, SelectKeyPair and SelectedKeyPairID methods from Whisper 2019-12-30 12:56:05 +01:00
yenda 024f30f0b9 Put settings in a table with schema (#1746)
Move settings table schema from a key-value store to a one row table with many columns.

We now save the first row with initial data in saveAccountAndLogin and follow up saveSetting calls are only saving one setting at a time.

Co-authored-by: Adam Babik <a.babik@designfortress.com>
2019-12-27 10:58:25 +01:00