Commit Graph

967 Commits

Author SHA1 Message Date
Andrea Franz 6c469299b6
fix default range value for shhext_requestMessages (#934)
* fix default range value for shhext_requestMessages

* use t.Run to run scenarions

* fix case when To - 24 hours is negative
2018-05-10 16:47:54 +02:00
Igor Mandrigin a933885806 Deduplicator: add API to confirm received messages. 2018-05-10 15:28:48 +02:00
Adrià Cidre 37a58a513d [#930] : False positive e2e test fix 2018-05-10 15:18:37 +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 f7dac0bcc4
add ipcfile flag to specify IPC file path (#896) 2018-05-10 01:59:05 +02:00
Igor Mandrigin 0241f95d6a Support chain diverges in block filters. 2018-05-09 18:07:26 +02:00
Ivan Danyliuk 6fec9fa653 Bump up Go version to 1.10 2018-05-09 16:13:34 +02:00
Igor Mandrigin 397bf83924 Add testcases for contract mining to the jail RPC tests. 2018-05-09 14:34:10 +02:00
Dmitry Shulyak 6c2a8ef1f9
Define shorter timeout for ntp calls (2s) and tolerate failures (#911)
* Define shorter timeout for ntp calls (2s) and tolerate failures

* Use allowed failures instead of tolerated errorss
2018-05-09 08:10:48 +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
Adrià Cidre 6e1fc99365
Notifier package to interact with gorush notifications (#910) 2018-05-08 16:30:03 +02:00
Dmitry Shulyak 7aa508765e Set timesource from config (#915) 2018-05-08 13:38:54 +03:00
Adam Babik b6851d8186 Run tests with race and coverage flags (#909) 2018-05-07 18:08:00 +03:00
Adrià Cidre 246c5321ac
Fix services mock generation (#901) 2018-05-07 10:22:38 +02:00
Pedro Pombeiro 1afb26c3f4 Use `make setup` on Travis CI 2018-05-06 22:59:36 +02:00
Igor Mandrigin 153d4160e1 Fix `make ci` if `dep` wasn't pre-installed. 2018-05-04 14:17:17 +02:00
Pedro Pombeiro 5d802abe9e Increase timeouts in order to accommodate `-race` flag
- Fixes https://jenkins.status.im/job/status-go/job/race-check/56/console
2018-05-04 14:02:13 +02:00
Dmitry Shulyak 84cb5ca917 Ensure that wg.Add is called before wg.Wait
Now if Add is to be called it will be called before Wait, this is achieved
by doing following:
- if cancel() gets lock first and closes channelCh before spawnSync is called
we will exit right away
- if not than we will ensure that we hold a lock until syncers are spawned
so that cancel() will be blocked for this time and it will prevent whole Terminate() from
progressing
2018-05-04 10:28:15 +02: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
Dmitry Shulyak 357786eeca Fix bloom filter expectations in group chat test
Every peer must be subscribed to the topic that is used to send messages.
In the test Alice was communicating with Bob and Charlie over custom topic, but
that topic wasn't added to a bloom filter, thus a certain flake was possible.

Normally it wasn't causing problems because syncAllowance in whisper, which is 10s:
- we set bloom filter to all zeros
- but we still will accept all envelopes for 10s
- in case we send first envelope into such channel after sync allowance - we will get an error such
that envelope doesn't match the bloom filter
2018-05-04 10:09:27 +03:00
Pedro Pombeiro acbf251a3c Fix race condition in `LDBDatabase.Close()`
- https://jenkins.status.im/job/status-go/job/race-check/54/consoleFull
2018-05-03 20:39:42 +03:00
Pedro Pombeiro 04fa765daf Increase timeout for Rinkeby sync on Travis CI.
- Fixes https://travis-ci.org/status-im/status-go/jobs/374296755
2018-05-03 13:16:56 +02: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
Dmitry Shulyak c8a553f9c1 Fix 0002 xgo patch which changed because metrics got forked 2018-05-02 22:59:54 +02:00
Pedro Pombeiro 4438d116b1 Ensure that Travis CI fails the build if the patches are incorrect 2018-05-02 13:28:39 +02:00
Dmitry Shulyak 7f81323fdc Remove download patch 0027 2018-05-02 12:04:17 +02:00
Frank Mueller 123382cdf1
LevelDB vendor has now the same version as used in go-ethereum 1.8.5 (#883)
* LevelDB version is now same as in go-ethereum

* make dep-ensure untracked LevelDB storage.go
2018-05-01 19:09:19 +02:00
Adam Babik 809c5a4db2
Limit time spent in fast mode and timeout Discovery V5 (#867) 2018-05-01 17:19:11 +02:00
Pedro Pombeiro 7074048fa5 Add patch to fix race condition in `Downloader.Cancel`
- Submitted patch upstream in https://github.com/ethereum/go-ethereum/pull/16585
- Fixes Jenkins build in https://jenkins.status.im/job/status-go/job/race-check/48/
2018-05-01 16:29:27 +02:00
Pedro Pombeiro 94da262a0b Add config required to debug statusd on VS Code 2018-05-01 14:15:43 +02:00
Frank Mueller 30cf19e0ae
Wrong command order (#879) 2018-04-30 23:36:28 +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 92e02189c7
Add doc for shhext_requestMessages (#872) 2018-04-27 13:59:01 +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
Pedro Pombeiro a23b607597 Fix race condition in `0016-fix-leveldb-issue.patch`
https://jenkins.status.im/job/status-go/job/race-check/45/
2018-04-26 17:19:32 +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
Alex Kohler 75471f2c27 #759 Codeclimate config (#843)
* Initial stab at CodeClimate configuration file

* Enabling everything to analyze usefulness of output

* Disabling some useless metrics

* Ignore static directory

* Disable similar code metric

* Exclude identical code in test files

* glob

* Reduce max file lines to 750

* Fix exclude pattern

* Exclude t/

* Up max file length + remove t directory

* Ignore t/ directory only for identical code metrics

* Exlcude patterns to exclude paths

* testing

* more testing

* reindent

* Revert back to excluding t directory
2018-04-23 15:55:21 +02: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
Adam Babik 5f075eeaba
Enable logs in tests (#852)
Pass `-log` option to `go test` in order to change the log level. By default, it's `INFO`.
2018-04-22 18:50:34 +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