Commit Graph

233 Commits

Author SHA1 Message Date
Richard Ramos bf9abfc350
feat: make kdf iterations configurable when creating a multiaccount (#2796) 2022-09-27 16:27:20 -04:00
Sale Djenic d89c0c8d9e fix(keycard): convert to keycard action removes keystore and doesn't change the pass properly fixed 2022-09-27 12:13:50 +02:00
Anthony Laibe cdca3d86e2
feat(token): enable changing token address from the node config (#2848)
Co-authored-by: Jonathan Rainville <rainville.jonathan@gmail.com>
2022-09-13 11:30:52 +02:00
Samuel Hawksby-Robinson 9fda3a968e Added and integrated StartUpPairingServer
Also moved Mount() calls into the respective Server/Client send() funcs
2022-09-09 13:24:56 +01:00
saledjenic 2e51450393
fix: avoid imported wallet account deletion while converting it to keycard account (#2827)
- imported wallet accounts via seed phrase or private key are not deleted anymore
when migrating any of those key pairs to a keycard
2022-08-31 18:11:42 +02:00
Richard Ramos 86054875a4
fix: add mode build param and change ipfs gateway accordingly
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2022-08-26 18:57:55 +02:00
Samuel Hawksby-Robinson 26b33aa09d Added AccountType to enforce strict typing on Accounts
Also a tpyo was fixed, probably introduced by me.
2022-08-25 22:01:43 +01:00
Vitaliy Vlasov 3dee94e505 Wallet sync for generated accounts 2022-07-06 19:24:43 +03:00
Anthony Laibe 8c0f230644
feat: Simple transaction router (#2686) 2022-06-09 15:09:56 +02:00
Sale Djenic 82550fca34 the way of initializing networks list is updated 2022-05-26 16:21:06 +02:00
Anthony Laibe 7227ae1c8e
fix: merge node config allows overide (#2664) 2022-05-24 12:57:45 +02:00
Vitaliy Vlasov 011238b1d1 Wallet sync 2022-05-18 15:25:20 +03:00
Richard Ramos 0048aaebcc
feat: add IPFS rate limiter for downloading stickers and use http server for retrieving stickers (#2611) 2022-05-09 09:07:57 -04:00
Richard Ramos c71ccdb4e2
chore: test that login still works with 0.97.3 (#2661) 2022-05-04 10:46:49 -04:00
Pascal Precht 07c6808385 Make `GetNodeConfig` retrieve config from DB
Prior to this commit, this API returns the in memory `NodeConfig` which
might not be the latest state.
This is the case when for example clients update any `NodeConfig` and
retrieve it right afterwards via `GetNodeConfig`.
To get the latest state of `NodeConfig` it has to be fetched from DB
instead.
2022-05-04 10:25:00 +02:00
Richard Ramos 85ba54f24f fix: remove unneeded lock 2022-04-25 14:48:14 +04:00
Richard Ramos d21b89ccc6 fix: code climate warnings 2022-04-22 11:25:33 +04:00
Richard Ramos 1e29948a3d fix: saving config after updating it with defaults 2022-04-22 11:25:33 +04:00
Richard Ramos b537ff9f02 refactor: reuse nodeconfig instead of loading it from DB 2022-04-22 11:25:33 +04:00
Andrea Maria Piana 8a5f77dc37 Address linter issues 2022-03-28 13:14:12 +01:00
Samuel Hawksby-Robinson e67592d556
Sync Settings (#2478)
* Sync Settings

* Added valueHandlers and Database singleton

Some issues remain, need a way to comparing incoming sql.DB to check if the connection is to a different file or not. Maybe make singleton instance per filename

* Added functionality to check the sqlite filename

* Refactor of Database.SaveSyncSettings to be used as a handler

* Implemented inteface for setting sync protobuf factories

* Refactored and completed adhoc send setting sync

* Tidying up

* Immutability refactor

* Refactor settings into dedicated package

* Breakout structs

* Tidy up

* Refactor of bulk settings sync

* Bug fixes

* Addressing feedback

* Fix code dropped during rebase

* Fix for db closed

* Fix for node config related crashes

* Provisional fix for type assertion - issue 2

* Adding robust type assertion checks

* Partial fix for null literal db storage and json encoding

* Fix for passively handling nil sql.DB, and checking if elem has len and if len is 0

* Added test for preferred name behaviour

* Adding saved sync settings to MessengerResponse

* Completed granular initial sync and clock from network on save

* add Settings to isEmpty

* Refactor of protobufs, partially done

* Added syncSetting receiver handling, some bug fixes

* Fix for sticker packs

* Implement inactive flag on sync protobuf factory

* Refactor of types and structs

* Added SettingField.CanSync functionality

* Addressing rebase artifact

* Refactor of Setting SELECT queries

* Refactor of string return queries

* VERSION bump and migration index bump

* Deactiveate Sync Settings

* Deactiveated preferred_name and send_status_updates

Co-authored-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2022-03-23 18:47:00 +00:00
Richard Ramos de2b8df033 feat: switch fleet 2022-03-22 18:47:07 -04:00
Richard Ramos 41d523f205 fix: code review 2022-03-03 15:37:07 -04:00
flexsurfer 5925b3b7cc
http server for images (#2418)
Serve images over HTTPS

Co-authored-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
Co-authored-by: Michele Balistreri <michele@bitgamma.com>
2022-02-10 18:19:34 +01:00
Richard Ramos ee41e30881
feat: extract node config from settings to individual tables (#2470) 2022-01-12 16:04:43 -04:00
Richard Ramos 98784b752a
feat: desktop mailserver cycle (#2481) 2022-01-12 12:02:01 -04:00
Richard Ramos 91e9fb4804
fix: keystore path is incorrect after merge (#2472) 2021-12-22 12:08:09 -04:00
Richard Ramos 33250c9134
feat: desktop browser provider (#2465) 2021-12-21 11:44:37 -04:00
Richard Ramos b244188702
feat: LoginWithConfig (#2469)
Adds a new funtion to login with an account passing a node configuration that will override any specified attribute from the stored account nodeconfig
2021-12-21 10:27:18 -04:00
Richard Ramos 605a19ceb3
chore: log version and commit to log file (#2450) 2021-12-01 10:37:48 -04:00
Anthony Laibe c95c29bba5 feat: Push messages to telemetry server when receiving messages 2021-11-10 09:34:14 +01:00
Anthony Laibe 26bfeddad4
feat: Rpc client manage multiple eth client (#2359) 2021-09-22 13:49:20 -04:00
Andrea Maria Piana e63f6461ed Status public API 2021-09-01 15:52:09 +02:00
Samuel Hawksby-Robinson 78892847ee Removed unnecessary dependency from logutil package
util packages should have a few dependencies as possible, particularly from within the same repo, to prevent the application from creating import loops

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2021-08-19 11:35:40 +02:00
andrey bc63fa606e delete imported key 2021-08-18 12:56:53 +02:00
Bitgamma 6c2e9652d0
add account conversion (#2277) 2021-07-20 14:48:10 +03:00
Andrea Maria Piana a4701f41ee linting and remove unused code 2021-07-20 10:57:38 +02:00
Andrea Maria Piana bdf3775b0b Remove subs test
The test was relying on a method `UnlockAccount` which is not exported
anymore.
This method seems not something we should generally expose, and in any
case it does not seem to be used by the frontend.
2021-07-20 10:57:38 +02:00
Andrea Maria Piana b3a5455c46 Fix some tests & upgrade contracts 2021-07-20 10:57:38 +02:00
Andrea Maria Piana d84da4f515 Fix some tests and restore private/public RPC client 2021-07-20 10:57:38 +02:00
Andrea Maria Piana 1e8688ac56 Upgrade to london signer and cleanup 2021-07-20 10:57:38 +02:00
Andrea Maria Piana 4b0daeb47b Move services to status-node
Move all the services to status-node, as some of them were there, some
of them were in the geth backend and scattered around.
2021-07-20 10:57:38 +02:00
Andrea Maria Piana 799bd93451 Memove mailserver registry and update ierc20 contract bindings
This commit removes the mailserver contract registry, as not used
anymore, and upgrade the ERC20 contract bindings.
2021-07-20 10:57:38 +02:00
Shivek Khurana 81171ad9e6
Expose password reset function (#2223)
Handled edge-cases
2021-06-23 14:51:21 +05:30
RichΛrd 40359f9c1b
go-waku integration (#2247)
* Adding wakunode module
* Adding wakuv2 fleet files
* Add waku fleets to update-fleet-config script
* Adding config items for waku v2
* Conditionally start waku v2 node depending on config
* Adapting common code to use go-waku
* Setting log level to info
* update dependencies
* update fleet config to use WakuNodes instead of BootNodes
* send and receive messages
* use hash returned when publishing a message
* add waku store protocol
* trigger signal after receiving store messages
* exclude linting rule SA1019 to check deprecated packages
2021-06-16 16:19:45 -04:00
Andrea Maria Piana d50fee6bb2 Handle connection state 2021-05-21 07:22:58 +02:00
Andrea Maria Piana 566e9a3ade remove nimbus 2021-05-21 07:22:58 +02:00
Andrea Maria Piana 57b1bc193f Remove whisper 2021-05-21 07:22:58 +02:00
Andrea Maria Piana be01875d1d remove mailserver logic 2021-05-21 07:22:58 +02:00
Andrea Maria Piana cf6ef3171a Add mailserver logic 2021-05-21 07:22:58 +02:00
RichΛrd 244686e3a8
add GetNodeConfig() function to backend API (#2216) 2021-04-29 15:22:10 -04:00
Andrea Maria Piana ddc93981a7 Add V4 endpoints 2021-04-19 14:49:28 +02:00
Roman Volosovskyi f3ee49c110
[wallet] cleanup 2021-04-08 23:30:27 +03:00
Shivek Khurana 1097b14a7f
🎭 📊 Anonymous Metrics V0 (#2170)
* Migrations in place, how to run them?

* Remove down migrations and touch database.go

* Database and Database Test package in place, added functions to get and store app metrics

* make generate output

* Minor bug fix on app metrics insert and select

* Add a validation layer to restrict what can be saved in the database

* Make validation more terse, throw error if schema doesn't exist, expose appmetrics service

* service updates

* Compute all errors before sending them out

* Trying to bring a closjure to appmetrics go

* Expose appmetrics via an api, skip fancy

* Address value as Jason Dawt Rawmasage to ease parsing

* Introduce a buffered chan with magic cap of 8 to minimize writes to DB. Tests for service and API. Also expose GetAppMetrics function.

* Lint issues

* Remove autoincrement, undo waku.json changes, fix error being shadowed, return nil where nil ought to be returned, get rid of buffered channel

* Bump migration number

* Fix API factory usage

* Add comment re:json.RawMessage instead of strings

* Get rid of test vars, throw save error inside the loop

* Update version

Co-authored-by: Samuel Hawksby-Robinson <samuel@samyoul.com>
2021-03-17 18:09:28 +05:30
Roman Volosovskyi 3a408135d8
[wallet] RPC usage stats 2021-03-10 13:32:46 +02:00
Roman Volosovskyi 8268083008
[wallet] Merge blocks ranges when possible
- old existing ranges are merged when wallet service is started
- a new range is merged with an existing one if possible

This will decrease the number of entries in blocks_range table as
currently it can grow indefinitely (@flexsurfer reported 23307 entries).

This change is also needed for further optimisations of RPC usage.
2021-02-09 16:32:20 +02:00
Roman Volosovskyi e18050b87f
Make sure tokens balances can be fetched 2021-02-03 11:54:24 +02:00
Andrea Maria Piana b1a1a223c2
Add export/import methods 2021-01-26 09:39:54 +01:00
Roman Volosovskyi 79716227db
[wallet] Show PNs right after enabling 2021-01-13 12:33:09 +02:00
Andrea Maria Piana 7387049d4b Upgrade linter and address issues 2020-12-28 16:55:14 +01:00
Andrea Maria Piana c78e084eb9 Fix tests and lint 2020-12-17 14:10:00 +01:00
Samuel Hawksby-Robinson 829108c96f Changes to tests to include account where required for account injection 2020-12-17 14:10:00 +01:00
Samuel Hawksby-Robinson 8663d636d3 Reversed commented out error 2020-12-17 14:10:00 +01:00
Samuel Hawksby-Robinson 30c2b64cf5 Test condition MUST REVERT 2020-12-17 14:10:00 +01:00
Samuel Hawksby-Robinson 16fecf5520 Passing Master info to Messenger 2020-12-17 14:10:00 +01:00
Samuel Hawksby-Robinson 190b1a70f9 Removed usages of multiaccounts.Account.PhotoPath 2020-12-17 14:10:00 +01:00
Samuel Hawksby-Robinson 193ab30ada Refactor injecting multiaccounts into messenger and service 2020-12-17 14:10:00 +01:00
Samuel Hawksby-Robinson 4ddec82e49 Removed superfluous debug logging 2020-12-17 14:10:00 +01:00
Samuel Hawksby-Robinson d6c3153fe8 tweak to debug output for StoreII 2020-12-17 14:10:00 +01:00
Samuel Hawksby-Robinson 9545f8e306 Added log to debug an image store nil pointer panic 2020-12-17 14:10:00 +01:00
Samuel Hawksby-Robinson fcbd9285f6 Implemented API for full CRD of IdentityImages 2020-12-17 14:10:00 +01:00
Samuel Hawksby-Robinson 2960fc49d4 Implemented GetImages and StoreImages in API 2020-12-17 14:10:00 +01:00
Samuel Hawksby-Robinson 1b59d088d8 Integrated GetMimeType() 2020-12-17 14:10:00 +01:00
Samuel Hawksby-Robinson c8450586fd Moved profile image handling into geth_backend 2020-12-17 14:10:00 +01:00
Roman Volosovskyi 002f9a5597
[wallet] Reduce number of RPC requests
- Wallet service is not started on foreground event on status-go side
  anymore, it leaves a client side opportunity to decide whether new
  blocks should be watched.
- `watchNewBlocks` parameter is added to `StartWallet`.
- Some requests are removed/moved to the place where they are necessary.
2020-11-25 12:20:23 +02:00
Andrea Maria Piana 70414c90b9 Fix nil pointer local notifications 2020-11-17 17:07:43 +01:00
Gheorghe Pinzaru d04e54e54e
Local notifications service (#2026)
Also adds implementation for eth transactions notifications
2020-10-28 10:56:14 +03:00
Andrea Maria Piana 1a7a63a8e5 Log on db failure 2020-10-14 08:07:05 +02:00
Andrea Maria Piana 2aea867cee Migrate journals as well 2020-09-30 12:13:22 +02:00
Andrea Maria Piana 0ba4694f21 [Fix: #2027] Migrate db to shorter path name 2020-09-25 14:02:09 +02:00
Gheorghe Pinzaru 9e148eab89
Dont allow disabling waku (#2040) 2020-09-16 10:31:01 +03:00
Andrea Maria Piana 401d18e558
Enabled push notifications by default and add fleet 2020-08-27 18:54:06 +02:00
Roman Volosovskyi aa1b898fe4 Stop/start wallet methods 2020-08-17 12:53:37 +02:00
Roman Volosovskyi 0b3cdf7362
DeleteMultiaccount method 2020-07-13 16:20:02 +03:00
Roman Volosovskyi 6d5a93287b
Separate keystore directory per multiacc
This commit provides `MigrateKeyStoreDir` method which moves multiacc's
keys from a common keystore directory to multiacc specific directory.
2020-07-09 12:41:47 +03:00
Samuel Hawksby-Robinson 157f20a7c8
Added link to specs for key compression API (#1995) 2020-06-24 14:39:42 +01:00
Samuel Hawksby-Robinson c8f9dad554
Feature/key compression (#1990)
## What has changed?

I've introduced to the public binding functionality that will compress and decompress public keys of a variety of encoding and key types. This functionality supports all major byte encoding formats and the following EC public key types:

- `secp256k1` pks
- `bls12-381 g1` pks
- `bls12-381 g2` pks

## Why make the change?

We want shorter public (chat) keys and we want to be future proof and encoding agnostic. See the issue here https://github.com/status-im/status-go/issues/1937

---

* Added basic signature for compresspk and uncompresspk

* Added basic encoding information

* make vendor

* formatted imports for the linter

* Reformatted imports hoping linter likes it

* This linter is capricious

* Added check that the secp256k1 key is valid

* Added test for valid key

* Added multiformat/go-varint dep

* Added public key type handling

* Added key decompression with key type handling

* Added handling for '0x' type indentifying

* Added more robust testing

* Less lint for the linting gods

* make vendor for bls12_381

* Added bls12-381 compression tests

* Added decompress key expected results

* Refactor of typed and untyped keys in tests

* Lint god appeasment

* Refactor of sample public keys

* Implemented bls12-381 decompression

* gofmt

* Renamed decode/encode funcs to be more descriptive

* Added binary bindings for key de/compression

* Refactor of func parameters

gomobile is a bit tempermental using raw bytes as a parameter, so I've decided to use string only inputs and outputs

* gofmt

* Added function documentation

* Moved multiformat de/compression into api/multiformat ns

* Moved multiformat de/compression into api/multiformat ns

* Changed compress to serialize on API
2020-06-23 11:47:17 +01:00
Andrea Maria Piana 44272944ab Make sure WakuEnabled is respected on upgrade 2020-03-30 15:28:16 +02:00
Roman Volosovskyi 9d5684162a
Stop fetching new blocks while app is not active
Saves some traffic (blocks with transactions are heavy) and infura
requests.
2020-03-11 08:39:41 +02:00
Adam Babik f335d1cf7e
Prevent starting node without APIModules (#1876) 2020-02-26 20:35:47 +01:00
Roman Volosovskyi 6cc1365536
Start wallet services when log into keycard account 2020-02-26 18:23:04 +02:00
Adam Babik e4b0a97cc5
add bridge metrics to Whisper and Waku (#1864) 2020-02-19 15:36:16 +01:00
Adam Babik 76b5dc29dc
Integrate Whisper-Waku bridge in status-go (#1854) 2020-02-18 12:21:01 +01:00
Andrea Maria Piana 9c2c08d44c
Init protocol when shh is active (#1862) 2020-02-17 18:18:30 +01:00
Andrea Maria Piana 141f917e7c
Initialize protocol when waku active (#1832) 2020-02-17 15:38:59 +01:00
Jakub Sokołowski cca47ef6e1 rename gomarkdown/markdown to status-im/markdown
This resolves a dependency conflict we have with MatterBridge
which was using a newer version of the same package.
This resulted in a JSON marshalling bug that would crash the bridge.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2020-02-11 16:06:43 +01:00
Roman Volosovskyi 9cf640842b
[status-im/status-react#9942] Upgradable paths in configs
Storing absolute path for different configs breaks compatibility on iOS
as app's dir is changed after upgrade. The solution is to store relative
paths and to concatenate it with `backend.rootDataDir`. The only
exception is `LogFile` as it is stored outside `backend.rootDataDir` on
Android. `LogDir` config was added to allow adding of custom dir for log
file.
Configs concerned:
`DataDir`
`LogDir`
`LogFile`
`KeystoreDir`
`BackupDisabledDataDir`
2020-02-03 20:02:01 +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
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