Commit Graph

342 Commits

Author SHA1 Message Date
Dmitry Shulyak 9e65b5a6ae Dump peer infos as discovery summary 2018-05-15 13:11:28 +03:00
Adam Babik 9268f55d7d
Prevent Discovery from timeout when registering topics (#944)
When the node registers topics, Discovery V5 should never be stopped as otherwise, no peer will be able to find the node.
2018-05-15 11:16:25 +02:00
Andrea Franz 52cdcf8f0f
wallet compatibility (#858)
* update master key generations using "Bitcoin seed" as hmac key following BIP32

* use `"mnemonic" + passphrase` as salt for pbkdf2 following BIP39

* test generated addresses and compatibility with BIP44

* check generated public keys

* test children private keys

* update MasterKey to be a constant

* don't export salt and masterKey constants

* use `crypto.FromECDSA` to get the hex representation of the priv key

* use empty pwd for the generation of the BIP39 seed, keeping pwd to encrypt keys

* add comment before the seed generation with empty passphrase
2018-05-14 19:13:56 +02:00
Adam Babik 80be64a1ec
Fix flaky TestStatusNodeReconnectStaticPeers test (#945) 2018-05-14 15:16:45 +02:00
Dmitry Shulyak 938113882a
Add cluster for ropsten/mainnet (#929) 2018-05-14 08:24:49 +03:00
Adrià Cidre 08b4d515c6
[#ISSUE-937] : Move mail server implementation to status-go repo (#942)
* [#ISSUE-937] : Move mail server implementation to status-go repo

* Applying dep-ensure
2018-05-11 21:43:07 +02:00
Igor Mandrigin d7653beedd Fix deduplicator being created with nil db. 2018-05-11 09:58:21 +02:00
Igor Mandrigin a933885806 Deduplicator: add API to confirm received messages. 2018-05-10 15:28:48 +02:00
Dmitry Shulyak 375d5ec8c3
Explicitly disable discovery (#886)
* Make it possible to explicitly disable discovery

Discovery will be disabled in following cases:
- if there are not bootnodes - v5 server will be disabled
because there is no point in running it
- if user defined in config NoDiscovery=true this value will be preserved
even if we have bootnodes

So, basically discovery will be always enabled by default on mobile, unless
it is explicitly specified otherwise.

When statusd is used current behavior is that discovery is disabled by default.
I kept it in this change, but it would be better to change it.

* Fix leftovers

* Add wait group to peer pool to protect from races with p2p.Server

* Change fields only when all goroutines finished

* Turn off discovery after topic searches are stopped

* Don't set period to nil to avoid race with SearchTopic

* Close period chan only when all writers are finished
2018-05-10 14:45:51 +03:00
Andrea Franz c673148bf4
add `-status` flag to enable the Status service (#902)
* add `-status` flag to enable the Status service

* remove status from default APIModules and add it only from statusd if specified

* remove AddAPIModule method

* allow -status flag values to be http or ipc
2018-05-08 23:57:29 +02:00
Igor Mandrigin 31cf2297d2 Implement block filters API for the RPC mode.
Some operations (like deploying contracts) require filter APIs to work.
Since these operations aren't supported on Infura anymore, and we don't
run LES, a separate implemenation of filters is required.

Signed-off-by: Igor Mandrigin <i@mandrigin.ru>
2018-05-08 19:46:25 +02:00
Dmitry Shulyak 7aa508765e Set timesource from config (#915) 2018-05-08 13:38:54 +03:00
Dmitry Shulyak 707221954f
Make whisper tolerant to local time skews (#864)
This change adds adds an ability to use different source of time for whisper:

when envelope is created it is used to set expiry
to track when envelope needs to be expired
This time is then used to check validity of the envelope when it is received. Currently If we receive an envelope that is sent from future - peer will get disconnected. If envelope that was received has an expiry less then now it will be simply dropped, if expiry is less than now + 10*2 seconds peer will get dropped.

So, it is clear that whisper depends on time. And any time we get a skew with peers that is > 20s reliability will be grealy reduced.

In this change another source of time for whisper will be used. This time source will use ntp servers from pool.ntp.org to compute offset. When whisper queries time - this offset will be added/substracted from current time.

Query is executed every 2 mins, queries 5 different servers, cut offs min and max and the computes mean value. pool.ntp.org is resolved to different servers and according to documentation you will rarely hit the same.

Closes: #687
2018-05-04 11:23:38 +03:00
Adrià Cidre 8c9db81bec
Expose status specific methods (login/signup/joinpublicchannel) through the RPC api (#877) 2018-05-03 12:36:56 +02:00
Ivan Danyliuk 953c26e8cf
Move signal logic into signal package 2018-05-03 09:35:58 +02:00
Adam Babik 809c5a4db2
Limit time spent in fast mode and timeout Discovery V5 (#867) 2018-05-01 17:19:11 +02:00
Igor Mandrigin f4cd8d27b5 Add `shhext_getNewFilterMessages` function to RPC APIs.
This function returns only the new messages from the filter, never
returns the same message for the same user twice.
2018-04-27 15:24:37 +02:00
Frank Mueller c85e0802eb
Remove mention of DevMode (#869)
* Remove mention of DevMode

* Remove prodMode
2018-04-26 19:59:57 +02:00
Andrea Franz 5f45f6498d
Add LogEnabled attribute to NodeConfig to, used in the call from status-react (#866)
* add LogEnabled attribute to NodeConfig, used in the call from status-react

* fix use of OverrideRootLogin in tests

* enable logger in tests based on LogLevel

* move LogEnabled before LogFile
2018-04-26 18:28:42 +02:00
Frank Mueller b543d32a31
Move ssh_requestMessages to sshext_requestMessages (#862)
* Add RequestMessage to sshext

* E2E tests now use shhext_requestMessages

* Typo in comment

* Enhanced maintainability

* Drop former mailservice

* Code reorg after review

* Fix missed changes after update to 1.8.5
2018-04-26 07:56:19 +02:00
Dmitry Shulyak f3e2631c1d
Add signals for notifying react about discovery activity (#859)
* Add signal for notifying react on discovery activity

* Whitelist expected signals in e2e tests
2018-04-25 10:13:59 +03:00
Dmitry Shulyak b37fda7731
Update go-ethereum to 1.8.5 (#854)
* Rebase on 1.8.5

* Remove outdated patches and apply all others

* Use shh_post that returns hash

* Use bloom filter for request to mailserver

* Remove tests for sending messages without subbing first

* Fix deadlock in ethdb

* Expect null if receipt is not yet created

* Subscribe to messages before sending them in whisper test
2018-04-24 18:50:26 +03:00
Adam Babik 0473f29a8a
Fix race conditions in tests (#857) 2018-04-23 15:35:48 +02:00
Adam Babik b85e50cbc9
Remove any logic from api.go [breaking-change] (#851)
Deprecated `Notify` binding got removed.
2018-04-23 15:34:49 +02:00
Ivan Danyliuk 56292fb505 Make Limits type a struct 2018-04-21 00:03:40 +02:00
Adam Babik 07b2c3d750
Move concurrent backend test from e2e to unit (#849) 2018-04-20 17:39:53 +02:00
Dmitry Shulyak 2f2dfe16c0
Add default peer limits configuration (#830)
* Add default peer limits configuration

If discovery is enabled for a given cluster - we will set a default
expected number of peers for each enabled service. For example:

- if cluster is rinkeby has a discovery enabled we will
  check which services are enabled
- if whisper is enabled we will set min and max limits by default
- if les is enabled and infura is not used we will set limits too

When statusd is used - configuration must be provided using configuration
supported by statusd.


* Fix deadlock in les peer set
2018-04-20 15:23:18 +03:00
Adam Babik a45b05969a
Add a priority queue to TopicPool (#840) 2018-04-19 17:18:49 +02:00
Dmitry Shulyak fa526e7444 Prevent potential call on discv5 which became nil
It could happen when we found multiple relevant peers and they were
processed before discv5 closed. For example we have max limit of 1:
- found peer A and B in the same kademlia cycle
- process peer A
- max limit is reached -> closed discv5 and set it to nil
- process peer B
- panic!!!
2018-04-19 16:01:48 +03:00
Igor Mandrigin f0f55d408f Make sure that only `personal_sign` and `personal_ecRecover` are exported. 2018-04-18 18:22:21 +02:00
Frank Mueller 6598371dc0
Prepare tests for mainnet (#831)
* Start enabling to test Mainnet

* Minor corrections found during code scan

* Set mainnet blocker in E2E again

* Introduced securing of mainnet transaction tests

* Fix typing error

* Typo led to follow-up errors

* Linter problem

* Change to individual test skips after review

* More flexible skip control for mainnet and status chain

* Fix double space

* Change of skipping method and fixing wrong skipped networks
2018-04-18 17:13:27 +02:00
Igor Mandrigin 4cc6028d59 Implement `personal_sign`.
This commit implements `personal_sign` RPC or web3 personal.sign
methods.

NB! Contains breaking API changes.
2018-04-17 11:18:58 +02:00
Adam Babik 364f88efd9
Allow to start ephemeral StatusNode (#829)
This change will greatly simplify writing unit tests when a node is required but data persistence is irrelevant.

I also Introduced some refactoring and unit tests for `StatusNode`.
2018-04-16 14:36:09 +02:00
Adam Babik ef160e8720
Add CallPrivateRPC binding (#825)
This PR provides CallPrivateRPC binding, which can call both public and private bindings but should not be used in web3.js provider implementations.
2018-04-16 10:01:37 +02:00
Dmitry Shulyak 0b123ed407 Send an expiration signal when envelope wasn't delivered to any peer 2018-04-15 10:44:49 +03:00
Adrià Cidre e277ae8b2d
Mockgen import cycle not allowed && recover missing mockgens (#824) 2018-04-13 15:10:37 +02:00
Dmitry Shulyak 5014e4e3b0
Fix two race conditions in peerpool tests (#827)
Multiple concurrent topic pool stops could result in the close of the closed
quit channel. Fixed by using atomic compare and swap and closing only if swap
happened.

Added events feed to peer pool for tests purpose. Otherwise it is impossible to run
simulation with -race flag enabled. In the essence it happens because we are managing global
object , which is server.Discv5, but unfortunately there is no way around it.
2018-04-13 11:34:30 +03:00
Adam Babik 0d652c3851
Expose only public APIs in inproc RPC client [breaking-change] (#815)
`CallRPC` binding, which is used as a provider for web3.js, exposes only public or whitelisted APIs.
2018-04-12 18:17:10 +02:00
Dmitry Shulyak a7a2e01b4a
Peerpool failover (#801) 2018-04-12 16:08:49 +03:00
Andrea Franz ecd9762648
remove redundant "if" before "return" statement (#823) 2018-04-12 12:26:25 +02:00
Dmitry Shulyak ba9a25e284
Implement shh api extension that allows to confirm that message is sent (#814)
* Implement shh api extension that allows to confirm that message is sent

* Add a patch

* Fix linter

* Add readme

* Add tests for tracker

* Address review
2018-04-11 18:41:51 +03:00
Adrià Cidre e6610f3b15
Fix lint on unused method (#816) 2018-04-10 16:00:01 +02:00
Daniel Regeci e34af8d6eb Create status-go API to return a current revision (#804)
Change `BUILD_FLAGS` in Makefile and update `github.com/status-im/status-go/geth/params.VersionMeta` value with the current Git SHA.
2018-04-10 12:36:11 +02:00
Dmitry Shulyak 02309e81e9
Peer pool to manage v5 peers (#736) 2018-04-10 09:44:09 +03:00
Igor Mandrigin a9eb5a7d2b Generalize signing requests.
We need to be able to sign more than just transactions to make DApps
work properly. This change separates signing requests from the
transactions and make it more general to prepare to intoduce different
types of signing requests.

This change is designed to preserve status APIs, so it is
backward-comparible with the current API bindings.
2018-04-09 20:48:00 +02:00
Dmitry Shulyak b71b7eeadb Use web3code from separate repo and remove static 2018-04-09 15:42:36 +02:00
Dmitry Shulyak 4d00fa80b0 Ensure that To field is nil when contract is created 2018-04-09 14:41:50 +03:00
Dmitry Shulyak ced8335600 Remove admin,debug,db api from exposed modules 2018-04-09 12:32:39 +03:00
Adrià Cidre df35ad6dbe
[#797] Unify EnsureSync on t/utils/utils.go and StatusManager (#806) 2018-04-09 09:16:43 +02:00
Adrià Cidre 359b3621e9 [#797] Simplify node.Manager public api and rename it to StatusNode
- [x] [#797] : Remove unused methods PopulateStaticPeers, ReconnectStaticPeers, removeStaticPeers, removePeer
- [x] [#797] : Rename node.Manager to node. StatusNode and simplify its public api
- [x] [#797] : Rename all references to nodeManager to statusNode
2018-04-05 16:47:27 +02:00