Commit Graph

69 Commits

Author SHA1 Message Date
Adam Babik 717d0fbadb
Fix another round of flaky tests (#996) 2018-05-29 13:24:23 +02:00
Ivan Danyliuk 953c26e8cf
Move signal logic into signal package 2018-05-03 09:35:58 +02:00
Adrià Cidre e277ae8b2d
Mockgen import cycle not allowed && recover missing mockgens (#824) 2018-04-13 15:10:37 +02:00
Dmitry Shulyak b71b7eeadb Use web3code from separate repo and remove static 2018-04-09 15:42:36 +02:00
Alex Kohler 5fbacb49e1 Remove GetObjectValue from JailCell interface #691 (#693) 2018-03-01 17:48:30 +01:00
Pedro Pombeiro 2993dcc3db
Fix a couple race conditions in tests (#689)
* Fix race condition on `LoopSuite`
* Fix race condition in the access to a Otto.Value in tests (quick fix, need to improve approach in the future)
2018-02-21 13:18:32 +01:00
Alex Kohler 228bda9fb3 Remove //nolint: gas directives from fmt.Fprintf #590 (#656)
Summary:
Filter out gas linter error checks for fmt.Fprintf commands. This required defining a custom linter around gas that additionally included the offending code.

Notes:

Gas format, without piping it through gometalinter, gives output like this:

$ gas -fmt=csv geth/jail/console/console.go
geth/jail/console/console.go,21,Errors unhandled.,LOW,HIGH,"fmt.Fprintf(w, ""%s: %s"", consoleEventName, formatForConsole(fn.ArgumentList))"
Gometalinter, by default, does not grab the line of code when it filters gas errors. To resolve this, I created a wrapper around gas (I wasn't sure what to call this "gas wrapper", I opted for gasv2, open to other names).

The first part of the regular expression was taken directly from gometalinter (see https://github.com/alecthomas/gometalinter/blob/master/linters.go#L236), and I then appended ,\".*\" to additionally grab the line of code of the offending line. Lastly, I excluded ".*Errors unhandled.*fmt.Fprintf.*" to filter out only fmt.Fprintf errors around omitted errors.

Also as a result of this change, gas lint output will now include the offending code.

Closes #590
2018-02-14 19:58:20 +02:00
Alex Kohler 365bc662a2 Enable gometalinter on tests and fix static analysis issues #631 (#644)
* Enable gometalinter on tests and fix static analysis issues

* Remove unneeded change

* Fix additional lint errors

* Add nolint directives and error checks

* Add error assertions instead of nolint directives

* Go back to using lint directive for loop.Run goroutine

* Add error check to loop.Run
2018-02-12 13:16:06 +02:00
Pedro Pombeiro 8c3aa9a619
Fix a couple of lint warnings 2018-02-09 10:28:27 +01:00
Adrià Cidre 3c83c93039 Update jail README (#626) 2018-02-09 02:25:17 +02:00
Dmitry Shulyak 4cddc362ac
Fix all data races in jail package (#632)
* Rework how loop is stopped

* Use atomic int32 for DummyTask

* Close loop channel only once

* Rename closeChan to closedChan
2018-02-08 15:03:04 +02:00
Azer Koçulu 5bea85fa9b Improve `fetch` tests in Cell (#627) 2018-02-08 12:41:07 +01:00
Adrià Cidre 00df3ff9f8 [#618] Jail.Call to return valid JSON string based results (#619) 2018-02-08 12:25:01 +01:00
Adam Babik 89d89681a3
Add support for metrics (#558)
It adds support for metrics (expvar and Prometheus) along with docker-compose files to run a Whisper test cluster.
2018-01-30 12:51:48 +01:00
Daniel Nephin 755a646bd4 Use gometalinter config instead of makefile (#560) 2018-01-24 00:25:28 -08:00
F. Eugene Aumson 83763e0401 Make gas linter happy (#544) 2018-01-17 17:46:21 +01:00
Adrià Cidre 7ab6a062ec [#516] Fix panic based on wrong error in setImmediate function (#535)
Additionally, this change clean ups and improves organization of `geth/jail/internal/timers` package.
2018-01-10 10:42:40 +01:00
Igor Mandrigin 21132a441f Remove creating global `_status_catalog` variable 2018-01-09 17:53:33 +01:00
Donnie Adams 373fc86d1e Change Loop API to prevent it from accepting tasks when the loop is closed #415 (#448) 2017-12-28 22:50:36 +02:00
Caner Çıdam 34df7e8abb CreateAndInitCell should allow reinitializing a cell #497 (#500)
Changes Jail.createCell to Jail.obtainCell, which alters the error-throwing behaviour for better Jail.CreateAndInitCell

This PR allows cells to be reinitialized without being recreated.

Important changes:
- Calling with same cell ID won't cause any errors.
- Consecutive calls with same cell ID only reinitialize existing cell.
- Parse in library.go uses StatusAPI.CreateAndInitCell.
2017-12-08 22:32:30 +07:00
b00ris 6bf980a1a7 Issue/fix dataraces in jail tests#457 (#460) 2017-11-27 22:56:52 +01:00
Adam Babik a22638f421 be consistent with comments 2017-11-23 13:51:52 +01:00
Adam Babik 47d16bffd0 fix Parse 2017-11-23 13:47:20 +01:00
Adam Babik 98b3f330af bring back Parse binding 2017-11-23 13:37:59 +01:00
Adam Babik 086747a695 Refactor jail part 2 (#401)
Refactor jail so that it's more self-descriptive and easier to understand by newcomers. Also, the test coverage has been improved.

Changes requiring status-react team actions:
* Replace Parse calls with new CreateAndInitCell and ExecuteJS bindings,
* Make sure web3.isConnected is ok as its response change to boolean value.
2017-11-07 12:36:42 -05:00
Adam Babik a19e502686 Remove go.rice in favour of go generate (#444)
As fetch.go was the only consumer of go.rice, it could be safely removed in favour of go-bindata and go generate.
Motivation to do that was the fact that go.rice throws panic in iOS when compiled with gomobile.
2017-11-03 18:11:37 -04:00
Ivan Tomilov 39cc60b8a7 Fixed make lint 2017-10-24 19:48:31 +03:00
b00ris e911666b5d Fix make lint warnings (#417)
fixed make lint warnings
cleared linter_exclude_list.txt
removed some commented code
fixed comments from #388
2017-10-20 12:06:22 +03:00
Oleg Raev 240149786f Jail.RemoveCells before logout and switching account (#382)
Called jail.Stop upon SwitchAccount and Logout to ensure all jail cells have been terminated.
2017-10-17 00:07:42 +03:00
Ivan Tomilov 16741f9517 Fixed jail.cells nil assignment (#398)
jail.cells is now re-created upon Jail.Stop, not assigned to nil. Assigning it to nil led to runtime panic when a node was stopped and started again.
2017-10-13 15:13:20 +03:00
Adam Babik 12412b3f58 Put int64 as the first word in Loop (#396)
Fix a bug with ARM and x86-32 and use of atomic operations on 64-bit values. More https://golang.org/pkg/sync/atomic/#pkg-note-BUG
2017-10-12 17:01:04 +02:00
Ivan Daniluk d4496332f9 Check for callback in makeAsyncHandler (#395)
This PR fixes regression from 3540972 and adds check for callback validity before putting it into event loop for sendAsync calls.
2017-10-12 12:15:07 +03:00
Adam Babik 281b304edb Extract e2e tests to a separate package (#375)
This change moves our e2e tests into a separate package to make room for proper unit and integration tests.

This is Phase 1 described in #371.

Changes:

Makefile has separate directives to run unit/integration tests and e2e tests,
CI runs unit/integration tests first and then e2e tests,
E2e tests are in reliability order, i.e. the least reliable tests are run in the end to be sure that nothing else is broken,
Some tests are fixed or quarantined.
2017-10-11 17:20:51 +03:00
Ivan Daniluk 3540972f0e Refactor and cleanup Jail (#368)
Refactor and clean up Jail package:

 Removes account.Manager and txqueue.Manager from Jail as they are not used anymore
 Removes messageID related code from Jail.Send
 Simplifies Jail.Send to be a wrapper around RPC client's CallRaw
 Renames jail_cell* to cell*
 Related cleanups
2017-10-06 19:52:26 +03:00
Ivan Daniluk 9cc5fd2112 Move transaction queue code into separate package (#365) 2017-09-27 02:50:41 +02:00
Ivan Daniluk 93492cf606 Move accounts to separate package (#360) 2017-09-26 15:44:26 +02:00
Ivan Daniluk 2acf1a1a6a Refactor/signals package (#359)
Move signals code to the separate package.
2017-09-25 20:22:57 +02:00
Ivan Tomilov fc8f59e121 Fixed eth_sendTransaction routing to the local node (#351)
* Fixed eth_sendTransaction routing to the local node
* Add local RPC handlers for eth_accounts and eth_sendTransaction
2017-09-25 18:04:40 +02:00
Ivan Tomilov 5f19c9cd0a Implemented sendAsync for js commands with a callback (#321)
Geth js commands coming through jail with a callback will now be executed truly asynchronously blocking jail only when an actual interaction with VM is performed.

Technically, it registers a new handler jeth.sendAsync which executes functions with callbacks asynchronously.

Changes include:

1. Send and SendAsync now use cell.VM instead of otto.Otto providing proper locking.
2. Unmarshalling in ExecuionPolicy.ExecuteWithClient is now done into var result interface{} instead of var result json.RawMessage because test case 0 of TestJailWhisper failed providing byte codes instead of 5.0.
3. Due to the asynchronous nature of web3 calls new weird timeouts in tests have been introduced. They may fail sometimes but I gave up trying to implement a more reliable and readable solution.
2017-09-18 15:13:32 +03:00
Ivan Daniluk cf7a9949a3 Add some docs/readmes (#329)
Updates and adds some package docs.

It also provides autogenerated README's using https://github.com/jimmyfrasche/autoreadme tool. To use it, make sure it's installed on your system, and every time you update documentation, run go generate to update the README.md file.
2017-09-15 19:00:00 +03:00
Ivan Danyliuk 704d271c64
Update README for jail. 2017-09-15 14:16:50 +02:00
Adam Babik 8153d935d2 Improve geth/api tests (#328)
The goal of this PR is to make geth/api tests to finally pass from the beginning to the end. I tried to achieve it here by:

Removing calls to common.PanicAfter so that we know which tests fail the most,
Better sync of some tests using channels,
Small test improvements.
2017-09-15 13:35:31 +03:00
Ivan Daniluk 9a5c1774c3 Refactor RPC client #304 (#311)
This PR refactors RPC subsystem for status-go:

cleans up two different RPC client implementations (RPCManager and rpc.Client)
creates new package under geth/rpc
moves routing logic into this package (rpc.(*router))
add tests for routing
cleans up NodeManager
2017-09-14 23:14:31 +03:00
Roman Volosovskyi 03b868402c jail: sendSignal handler (#310) 2017-09-14 13:43:01 +03:00
Ivan Daniluk 01448d53fc Update jail docs (#313) 2017-09-13 17:27:19 +03:00
Ivan Daniluk 6a096607cf Add FetchAPI support and fix loop race [upd] #289 (#293)
This PR adds Fetch API and fixes #289 by using concurrency safe Otto VM wrapper wherever it's possible. This involves new package geth/jail/vm that is used by jail and by our forked ottoext/{fetch/timers/loop} packages.

It also adds more tests that are supposed to be run with --race flag of go test.
2017-09-08 14:55:17 +03:00
Ewetumo Alexander 792cd1d9c5 Route geth requests to the upstream or local node correctly (#276)
Geth requests have been revised and if the upstream is enabled, only queries regarding working Ethereum protocol are routed to upstream.
Whisper, most web3 requests and various utility methods are still routed to the local node as well as requests for accounts.
2017-09-07 10:49:40 +03:00
Adam Babik 8fb2424ea5 Port the transactions queue from go-ethereum to status-go (#261)
Now all transactions in both cases are waiting for CompleteTransaction or DiscardTransaction to proceed independently from their destination: upstream of local
2017-09-04 15:56:58 +03:00
Ivan Tomilov beb552d13c Refactoring (#290), closes #247
* 3. Removed extra `jail` prefix in the jail package

* Removed sendMessage and showSuggestions handlers because they're already set in registerHandlers()

* Remove extra asserts

* Changed assertions everywhere to testify

* Exposed JailCell.Call and removed Jail.Cell duplicate method

* Fixed review comments
2017-09-02 20:04:23 +03:00
Ivan Daniluk 75398a19d5 Fix "Slow CreateAccount" #251 (#283) 2017-09-02 03:17:34 +07:00