Commit Graph

270 Commits

Author SHA1 Message Date
Adam Babik ba963cc1bd estimate gas if missing in sending tx using upstream (#346)
I added a call to eth_estimateGas in case gas param is missing when using the upstream. This is a little bit ugly because I create an anonymous struct to match eth_call params. I spotted this struct in go-ethereum but I don't see it's exported.
2017-09-19 14:19:18 +03:00
Ivan Tomilov 9d01f7aa26 fixed that shh_newMessageFilter was erroneously routed to the upstream instead of local (#345)
An issue arose that shh_newMessageFilter was routed to the upstream instead of local node. This PR fixes that. It also revisits routing logic and makes all requests go to the local node by default.
2017-09-19 12:52:38 +03:00
Ivan Daniluk ca4bc5152f Add support for JSON-RPC batched calls (#341)
This PR introduces proper support for JSON-RPC batched requests (http://www.jsonrpc.org/specification#batch)
2017-09-18 17:24:35 +03: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
Adam Babik 79f744954c Prevent from completing tx multiple times (#330)
This commit prevents from completing (i.e. sending) the same transaction multiple times.
2017-09-18 11:53:08 +03:00
Ivan Daniluk 9eee21f1ca Add support for JSON-RPC array payload. (#335)
This PR introduces solution for #333 - it adds support for array JSON-RPC payload.

unmarshalMessage tries to unmarshal JSON paylod into *jsonrpcMessage object, and in case of failure, analyzes error and, if it's unmarshalling array error, tries to unmarshal it as an array.
2017-09-17 17:06:18 +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
Oskar Thorén f88de68f86 Push notifications: ability to trigger notifications via public API (#327)
This PR provides a way for status-react to trigger push notifications to contacts whose FCMToken they possess. It thus solves the basic user story as outlined in #326
2017-09-15 18:57:34 +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 1c9c0f08f4 Bugfix/eth accounts workaround #294 (#318)
This PR is dirty hack workaround for #294 issue. It starts LES service with sync disabled (by MaxPeers option set to 0), even if Upstream is enabled. This ensures that all RPC calls are registered in local node (they are registered during LES service initialization and do not exist if LES service is not activated).
2017-09-15 11:44: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
Ivan Daniluk fd8c110293 Add support for 'go test -v' flag for tests (#315)
Default log level for tests is now ERROR. If tests are invoked with -v, the log level becomes INFO.
2017-09-14 14:41:50 +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
Marin 4fb0faa061 Small NodeManager refactoring (#253)
Introduced `isNodeAvailable()`.
2017-09-11 17:07:35 +03:00
Ivan Tomilov c85525e139 Extended testGetDefaultConfig to support Rinkeby (#241)
This pull requests only extends testGetDefaultConfig to run against Rinkeby as well and fixes TestJailWhisper.
2017-09-08 15:32:02 +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
Ivan Tomilov 9463d3843a Updated CHT (#279)
Syncing for Ropsten should now start from something around block 1617921 and from 839680 for Rinkeby.
2017-09-07 10:54:33 +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
Ivan Daniluk 0c4603d825 Add file logger support (#269) 2017-09-02 01:44:50 +07:00
Ivan Daniluk fffd60d675 Add docs for Jail package (#285) 2017-09-02 01:18:09 +07:00
Adam Babik 9f57cf422f bugfix: properly handle no LES service (#272) 2017-08-26 15:42:34 +08:00
Adam Babik a4d2fdfa4a cht: remove downloading CHT from GH but embed it (#270) 2017-08-25 10:56:54 +01:00
Ivan Daniluk 4321f9b2e5 Fix log levels and enable ethereum-go logger (#256) 2017-08-24 15:50:16 +07:00
Ricardo Geraldes e6e05aff01 jail.go: removed import to go-ethereum log package 2017-08-15 14:52:09 +01:00
Ewetumo Alexander 1fb7d47c66 JSON RPC Proxy configuration (#193)
IMPORTANT: The known issue is that in case of configured UpstreamRPCServer transactions are sent immediately not waiting for CompleteTransaction or DiscardTransaction which brings inconsistency in behaviour and acts as a security breach.

* new UpstreamRPConfig in geth/params to provide upstream configuration
* conditional start of ethereum blockchain sequence based on NodeConfig.UpstreamConfig.Enabled flag state
2017-08-15 17:27:12 +07:00
Adam Babik 7433828a26 Validate JSON config (#240)
* exposed ValidateNodeConfig()
* extended NodeConfig interface with Validate() method
* added validate tag to some NodeConfig fields
2017-08-10 22:31:29 +07:00
Marin 3b316c0700 Beta/refactor logging#221 (#244)
Added a lightweight logger wrapper around go-ethereum/log which adds StatusIM prefix to all messages and allows to clearly distinguish between status-go and go-ethereum logs.

Logs under vendor/go-ethereum left unchanged because those pieces of code might undergo huge refactoring in the near term.
2017-08-10 20:35:58 +07:00
Ivan Tomilov 0270590646 Fixed develop functionality (#237)
* Fixed tests (only when they run one by one; they can still fail if run together)
* Fixed TestJailSendQueuedTransaction: the second command in case 4 was altering status.message_id and thus the test was failing. Earlier it had been working because cells were cloned during every Call
* Added a check into TestJailVMPersistence: now its concurrent-resiliency is asserted
* Fixed CallRPC: shh_version now return "5.0" instead of "0x5"
* Fixed TestWhisperFilterRace: there was changed Whisper API which should just be adhered to
* Fixed geth1.6.7 rebase consequences: primarily genesis blocks which now contain metropolishash
2017-08-07 17:48:14 +07:00
Ivan Tomilov ebd77aabe2 Merging bug/whisper-on-geth1.6.1 (#236) which acts like develop
* static: updates Whisper test (to work with Geth 1.6.1)
* jail: VM persistence implemented
* jail: sendMessage/showSuggestions minor fixes (to be squashed)
* node: CHT and boot nodes auto-load implemented
* Replaced CHT data file from farazdagi's to tiabc's
* Rewrote config_test.go using testify having reduced it twice in size
* Increased SyncTime and panic timeout in tests
* Fixed test - remove go default test to testify/suite (#207)
* Add flag setup for RPCEnabled and add comment (#225)
* jail: register method handlers before running initial js in jail (#226)
* Console Jail Mod #179 (#228)
* Added ./statusd-data into .gitignore
* Increased log level for the test node from INFO to ERROR
* Add call to loop.Run to evaluate all setTimeout/setIntervals methods. (#208)
* Rebase onto geth1.6.7 (#232)
* Got back sync duration from 60s to 30s, updated bindata.go
2017-08-04 23:14:17 +07:00
David Aaron c274cf5222 Fixed all typos on bootstrap spelling (#202)
Changed all typos on bootstrap spelling from "bootstap" to "bootstrap".
For example in function makeBootstrapNodes, line 326 now reads:
var bootstrapNodes []*discover.Node
2017-07-24 14:06:27 +07:00
Roman Volosovskyi 444a2d93b7 jail: sendMessage and showSuggestions handlers (#195)
Merging what's already implemented in bugs/whisper-on-geth.1.6.1
2017-07-18 21:26:24 +07:00
Ewetumo Alexander b50c46caa8 Add SetTimeout/SetInterval to JailCell otto.Otto, closes #189
* Commit initial change for settimeout/setinterval

* Add initial tests for jail setTimeout/setInterval

* Add ottoext dependency

* Add fetch jail test with function

* Add dependencies of fetch from ottoext

* Refactor with regards to PR review

* Refactor with regards to PR review

* Fix syntax errors

* Fix missing return statement
2017-07-13 18:04:47 +07:00
Ewetumo Alexander fb7738b1bb Add http enable flag for Node, closes #191
* Add http enable flag for Node

* Fix errors with json test data

* Refactor changes with regards to review comments

* Return appropriate errors for novalue set

* Update changes with regard to config

* Update tests timeout value for makefile ci

* Add RPCEnabled for json config in api test

* Resolve test with RPCEnabled changes

* Remove RPCEnabled flag from unconcerned tests
2017-07-13 13:54:10 +07:00
Victor Farazdagi b3a56eb00b version: starts 0.9.8-unstable 2017-05-29 19:43:48 +03:00
Victor Farazdagi c6bc012074 version: 0.9.7 released 2017-05-29 19:34:43 +03:00
Victor Farazdagi 402439c0f7 node: topic discovery boot nodes updated 2017-05-29 19:15:34 +03:00
Victor Farazdagi 823b5364b8 rpc manager: do not transform input JSON 2017-05-29 15:03:16 +03:00
Victor Farazdagi 6b3f7aabdf node: expose in-proc RPC (CallRPC), closes #144 2017-05-28 17:05:33 +03:00
Victor Farazdagi bc3ea62eca config: add CHT root URL, fixes #170 2017-05-27 23:42:03 +03:00
Victor Farazdagi 0e2839b705 node manager: make API async, fully cover with tests
- API is async
- Node manager, backend and API modules have more that 90% coverage
- For each level (node manager, backend, public API) random testing
  was used to ensure that we don't have race conditions
2017-05-27 23:42:02 +03:00
Victor Farazdagi 35eb15fed7 api: make is completely sequential 2017-05-25 15:34:13 +03:00
Victor Farazdagi 3c961473e1 node manager: fixes race when logging node stopping status 2017-05-25 14:23:34 +03:00
Victor Farazdagi b61f0d0000 fixes race condition in node stop method 2017-05-24 17:13:30 +03:00
Victor Farazdagi 349103de1a major refactoring: node manager, tx queue, accounts, jail
- node: signals and node reset, fixes #152
- tests update (testify is used)
- node manager refactored, race conditions fixed
- node wrapper has been removed, we rely on go-ethereum node now
- tx queue refactored
- jail refactored
- backend and API introduced
2017-05-24 00:29:20 +03:00
Victor Farazdagi c7ef35d414 node: allow CHT config per sub-cluster 2017-05-17 19:26:07 +03:00
Victor Farazdagi b0c3489d22 params: ropsten dev/prod config updated, fixes #167 2017-05-17 15:47:39 +03:00
Victor Farazdagi 82fe888853 whisper5: minor fixes 2017-05-16 11:02:34 +03:00
Victor Farazdagi 4f27a79d83 config: homestead and rinkeby confg + allow dev/prod modes 2017-05-16 10:51:11 +03:00
Victor Farazdagi 88394690c2 cmd/statusd: faucet sub-command added, refs #159 2017-05-16 10:51:11 +03:00
Victor Farazdagi 9a7caa6b58 config: expose bootstrap cluster config, closes #139 2017-05-16 10:51:11 +03:00
Victor Farazdagi 3e8f9076c1 VerifyAccountPassword: locate key file by traversing key store folder 2017-05-16 00:49:22 +03:00
Victor Farazdagi 68d4d20d66 cmd/statusd, geth: VerifyAccountPassword method exposed, closes #151 2017-05-15 13:48:27 +03:00
Victor Farazdagi 2f0c93fd3b refactor: linters + recommendations applied, closes #146 2017-05-15 08:19:46 +03:00
Victor Farazdagi 92afd0d47e vendor/whisper, statusd: push notifications implemented, closes #135 2017-05-03 16:09:48 +03:00
Victor Farazdagi ecea845d88 rebase: minor fixes to integrate with Geth 1.6.1 2017-05-03 16:00:36 +03:00
Victor Farazdagi a0fef0a0b6 rebase: logger is ported (Geth 1.6 logging) 2017-05-03 16:00:35 +03:00
Victor Farazdagi b0776a5092 version: starts 0.9.7-unstable 2017-05-03 01:10:05 +03:00
Victor Farazdagi 57ca661897 version: 0.9.6 released 2017-05-03 01:04:43 +03:00
Victor Farazdagi eab1458ba2 config: allow to specify keystore directory, closes #147 2017-04-28 11:50:12 +03:00
Victor Farazdagi 9a68fd211f whisper: `statusd wnode` sub-command, closes #140 2017-04-28 11:50:12 +03:00
Victor Farazdagi 21344af199 geth, jail: embed static resources, closes #131 2017-04-28 11:50:12 +03:00
Victor Farazdagi 1b31a5ca86 version: starts 0.9.6-unstable 2017-04-19 08:44:06 +03:00
Victor Farazdagi 0852facd09 version: 0.9.5 version bump 2017-04-19 08:40:27 +03:00
Victor Farazdagi 4f89422567 params: ssh/5 stand-alone nodes added to bootnodes 2017-04-03 14:57:51 +03:00
Victor Farazdagi 3ce913f661 geth, jail: Whisper ver.5 enabled, tests expanded 2017-04-03 14:57:51 +03:00
Victor Farazdagi b130d586ca cmd/statusd: expose LES, SHH, Swarm. Closes #128 2017-04-01 10:08:08 +03:00
Victor Farazdagi 5615ec40d6 geth, geth/params: customized logger implemented 2017-03-29 00:48:09 +03:00
Victor Farazdagi 8a96fc18c4 geth/params: stop transforming passed DataDir 2017-03-18 22:48:33 +03:00
Victor Farazdagi 704781b02f geth/params: status -> StatusIM 2017-03-18 18:21:20 +03:00
Victor Farazdagi 031eeb33b8 geth/params: node settings implemented #116 2017-03-17 17:38:22 +03:00
Victor Farazdagi 34b19e6af9 geth: optimizes tests 2017-03-16 10:40:17 +03:00
Victor Farazdagi 57fb99c4ca jail, params: moved into geth package, refactored 2017-03-16 10:40:17 +03:00
Victor Farazdagi 4159f97e74 cmd/status, geth/params: move version into separate file (starts 0.9.5) 2017-03-16 10:39:28 +03:00
Victor Farazdagi e69b6a5bc5 version: 0.9.4 version bump 2017-03-10 05:21:58 +03:00
Victor Farazdagi 908f34939a params, geth, cmd: Scaleway cluster enabled 2017-03-10 04:11:19 +03:00
Victor Farazdagi 3d80686783 geth: force peer population 2017-02-27 16:49:39 +03:00
Victor Farazdagi 34ea4e9c4c optimizes test parameters 2017-02-27 16:49:39 +03:00
Victor Farazdagi 772467c8a7 geth, jail: contract creation tx sending fixed 2017-02-27 16:49:39 +03:00
Victor Farazdagi caab90e62d geth,cmd/status: disable IPC and WS servers by default 2017-02-27 16:49:39 +03:00
Victor Farazdagi e38864fec2 geth,cmd/status: IPC-RPC server enabled 2017-02-27 16:49:39 +03:00
Victor Farazdagi cf7b8fb96c geth,cmd/status: WS-RPC server enabled 2017-02-27 16:49:39 +03:00
Victor Farazdagi fd36dcfdb4 geth,cmd/status: pause/resume node fixes #96 2017-02-27 16:49:39 +03:00
Victor Farazdagi a77c2362d5 adds ResetChainData() fixes #63 2017-02-27 16:49:39 +03:00
Victor Farazdagi 26841d91e7 geth: better error notification 2017-02-27 16:49:38 +03:00
Victor Farazdagi 1cc8259589 vendor: rebase fixes 2017-02-27 16:28:58 +03:00
Victor Farazdagi cd96e53442 vendor: rebase fixes 2017-02-23 20:28:45 +03:00
Victor Farazdagi 8952961703 vendor: rebase fixes 2017-02-23 05:12:48 +03:00
Victor Farazdagi 87e345c1cc fixes issue when non-originator can complete a tx 2017-02-01 20:08:03 +03:00
Victor Farazdagi 473d997849 refactors signal sending + localStorage.set() tests. Fixes #75 2016-12-19 03:32:20 +03:00
Roman Volosovskyi c1d2cfde08 local storage signal 2016-12-16 22:57:34 +03:00
Roman Volosovskyi ddfd949a71 fix signal sending on 64bit ios 2016-12-14 14:04:10 +02:00
Victor Farazdagi 0057d8f4cd node_manager: start/stop RPC server methods added 2016-12-11 17:19:53 +03:00
Victor Farazdagi 3832c457d8 version bump 2016-12-11 14:42:22 +03:00
Victor Farazdagi 53260608d7 version bump 2016-12-08 02:09:58 +03:00
Victor Farazdagi e5bb6a24f7 replaces dependency on go-ethereum "cmd/*" packages. Fixes #72 2016-12-08 01:04:09 +03:00
Victor Farazdagi ce56d7e9c8 geth: updates CLI docs in MakeNode 2016-12-01 20:03:33 +03:00
Roman Volosovskyi d707eb5f72 rename com.statusim to im.status.ethereum (status-im/status-react#452) 2016-11-28 11:00:12 +02:00
Victor Farazdagi 4415ee65f6 update bindings to work correctly w/ geth-1.5.3-unstable 2016-11-25 11:06:47 +03:00
Victor Farazdagi e87ad0705f Cover exposed methods (library.go) with tests. Fixes #57 2016-11-14 04:35:58 +03:00
Victor Farazdagi 1f6e59d160 DiscardTransactions() + CompleteTransactions(). Fixes #32 2016-11-12 21:26:33 +03:00
Victor Farazdagi c29dedf84a implements DiscardTransaction(), required for #32 2016-10-31 02:28:30 +03:00
Victor Farazdagi 6e18cbb5d4 tx send: allow to re-send + error signaling. Fixes #49, #51 2016-10-28 17:33:25 +03:00
Victor Farazdagi e731703a55 Rebase fixes + static nodes update 2016-10-21 12:03:18 +03:00
Victor Farazdagi 95fc7706a8 Add iOS-related code to signals.c #37 2016-10-17 16:24:05 +03:00
Roman Volosovskyi 7c08869ad8 Merge pull request #45 from farazdagi/feature/jail-context-passing
Jailed JSRE: context passing
2016-10-17 08:56:25 +03:00
Victor Farazdagi e8ef42eb06 Send transaction: fix jailed requests
- VM Cell access is isolated (each request runs w/i copy of the original VM)
- SendTransaction is intercepted and executed w/o RPC call
2016-10-15 16:20:13 +03:00
Victor Farazdagi 286a8fc344 Allow conditionally build for Testnet/Mainnet. Closes #40 2016-10-13 14:46:54 +03:00
Victor Farazdagi 6abbca9935 jail: more robust cell ticket acquire/release 2016-10-12 20:51:25 +03:00
Victor Farazdagi e31aa3c746 Jailed JSRE: context passing. Fixes #34 2016-10-12 01:59:42 +03:00
Victor Farazdagi a608901daa Adds references to cluster nodes 2016-10-11 14:33:37 +03:00
Victor Farazdagi 009fab27fd Rebased against the latest light-stable 2016-09-29 22:51:33 +03:00
Victor Farazdagi 67c0315dbc Travis CI tests pass now 2016-09-28 18:52:30 +03:00
Victor Farazdagi 7505281a63 eth.accounts rely on ext. keys now (account + sub accounts) 2016-09-28 10:38:44 +03:00
Victor Farazdagi b66188941d Non-blocking StartNode() 2016-09-15 06:13:40 +03:00
Victor Farazdagi edd8763c3c Major code refactoring
- geth package implemented
- jail package implemented (and tested)
- cgo and xgo (android, ios) builds w/o any issues
- better conditional compilation of signals code
2016-09-15 06:13:40 +03:00