Commit Graph

799 Commits

Author SHA1 Message Date
Steven Roose
952482d5e4 rpc: Support specifying HTTP client in RPC dialing (#15836)
* rpc: Support specifying HTTP client in RPC dialing

Adds a minimal interface that captures http.Client and adds a new method
rpc.DialHTTPClient that takes a client using that interface. The existing
rpc.DialHTTP method is then alternatively implemented by using the new
rpc.DialHTTPClient method provided with a standard *http.Client.

* rpc: fix minor doc typos
2018-01-24 10:59:15 +02:00
Sorin Neacsu
5369a5c54d rpc: allow OPTIONS requests without Content-Type (#15759)
Fixes #15740
2017-12-28 14:15:33 +01:00
Vitaly V
f258a21a63 rpc: use method constants instead of literal strings (#15652) 2017-12-12 19:12:32 +01:00
Zach
3da1bf8ca1 all: use gometalinter.v2, fix new gosimple issues (#15650) 2017-12-12 19:05:47 +01:00
Péter Szilágyi
3c6b9c5d72
rpc: minor cleanups to RPC PR 2017-11-17 14:25:02 +02:00
Armani Ferrante
c5b8569707 rpc: disallow PUT and DELETE on HTTP (#15501)
Fixes #15493
2017-11-17 13:07:11 +01:00
Péter Szilágyi
4013e23312
rpc: allow dumb empty requests for AWS health checks 2017-11-16 13:51:06 +02:00
Benoit Verkindt
3ee86a57f3 rpc: warn on WebSocket origin mismatch (#15451)
Fixes #15373
2017-11-10 10:22:06 +01:00
bas-vk
4fe30bf5ad rpc: check content-type for HTTP requests (#15220) 2017-11-09 10:54:58 +01:00
ferhat elmas
9619a61024 all: gofmt -w -s (#15419) 2017-11-08 11:45:52 +01:00
Lewis Marshall
9feec51e2d p2p: add network simulation framework (#14982)
This commit introduces a network simulation framework which
can be used to run simulated networks of devp2p nodes. The
intention is to use this for testing protocols, performing
benchmarks and visualising emergent network behaviour.
2017-09-25 10:08:07 +02:00
Egon Elbre
e063d538b8 rpc: fix megacheck warnings 2017-08-08 11:08:37 +02:00
Péter Szilágyi
feb2932706 Merge pull request #14540 from bas-vk/whisper-api
whisperv5: integrate whisper and implement API
2017-06-26 13:44:35 +03:00
bloonfield
413dc1d265 rpc: fix closure problem in batch processing (#14688)
Demo of the issue: https://play.golang.org/p/EeTLFfppqC
2017-06-26 12:26:22 +03:00
Bas van Kervel
b58a501673 whisperv5: integrate whisper and add whisper RPC simulator 2017-06-15 11:53:15 +02:00
Péter Szilágyi
a8eafcdc0e Merge pull request #13885 from bas-vk/rpc_generic_pubsub
rpc: support subscriptions under custom namespaces
2017-05-03 11:41:07 +03:00
Bas van Kervel
a6af56fa4d
rpc: disable CORS if user has not specified custom config 2017-05-02 11:14:40 +02:00
Bas van Kervel
37e3f561f1
rpc: support subscriptions under custom namespaces 2017-04-25 11:13:22 +02:00
Péter Szilágyi
e353f9c088 Merge pull request #13886 from bas-vk/rpc_blocknum_parse
rpc: improve BlockNumber unmarshal parsing
2017-04-18 14:55:53 +03:00
Bas van Kervel
7d0ac94809
rpc: improve BlockNumber unmarshal parsing 2017-04-13 13:20:19 +02:00
bas-vk
5e29f4be93 cmd/utils, node: remove unused solc references and improve RPC config (#14324)
Currently http cors and websocket origins are a comma separated string in the
config object. These are replaced with string arrays that are more expressive in
case of a config file.
2017-04-12 23:04:14 +02:00
Felix Lange
30d706c35e cmd/geth: add --config file flag (#13875)
* p2p/discover, p2p/discv5: add marshaling methods to Node

* p2p/netutil: make Netlist decodable from TOML

* common/math: encode nil HexOrDecimal256 as 0x0

* cmd/geth: add --config file flag

* cmd/geth: add missing license header

* eth: prettify Config again, fix tests

* eth: use gasprice.Config instead of duplicating its fields

* eth/gasprice: hide nil default from dumpconfig output

* cmd/geth: hide genesis block in dumpconfig output

* node: make tests compile

* console: fix tests

* cmd/geth: make TOML keys look exactly like Go struct fields

* p2p: use discovery by default

This makes the zero Config slightly more useful. It also fixes package
node tests because Node detects reuse of the datadir through the
NodeDatabase.

* cmd/geth: make ethstats URL settable through config file

* cmd/faucet: fix configuration

* cmd/geth: dedup attach tests

* eth: add comment for DefaultConfig

* eth: pass downloader.SyncMode in Config

This removes the FastSync, LightSync flags in favour of a more
general SyncMode flag.

* cmd/utils: remove jitvm flags

* cmd/utils: make mutually exclusive flag error prettier

It now reads:

   Fatal: flags --dev, --testnet can't be used at the same time

* p2p: fix typo

* node: add DefaultConfig, use it for geth

* mobile: add missing NoDiscovery option

* cmd/utils: drop MakeNode

This exposed a couple of places that needed to be updated to use
node.DefaultConfig.

* node: fix typo

* eth: make fast sync the default mode

* cmd/utils: remove IPCApiFlag (unused)

* node: remove default IPC path

Set it in the frontends instead.

* cmd/geth: add --syncmode

* cmd/utils: make --ipcdisable and --ipcpath mutually exclusive

* cmd/utils: don't enable WS, HTTP when setting addr

* cmd/utils: fix --identity
2017-04-12 17:27:23 +03:00
Péter Szilágyi
1018bf6a00 rpc: honour pending requests before tearing conn down (#3814) 2017-03-24 12:07:12 +01:00
Felix Lange
c213fd1fd8 all: import "context" instead of "golang.org/x/net/context"
There is no need to depend on the old context package now that the
minimum Go version is 1.7. The move to "context" eliminates our weird
vendoring setup. Some vendored code still uses golang.org/x/net/context
and it is now vendored in the normal way.

This change triggered new vet checks around context.WithTimeout which
didn't fire with golang.org/x/net/context.
2017-03-22 20:49:15 +01:00
Micah Zoltu
4e4e5fca54 rpc: add support for extended headers in CORS requests (#3783)
Fixes #3762.  Details about parameter:
a62a804a8a/cors.go (L50-L54)
2017-03-16 04:34:08 +01:00
Péter Szilágyi
d4fd06c3dc
all: blidly swap out glog to our log15, logs need rework 2017-02-23 12:16:44 +02:00
Felix Lange
a2b4abd89a rpc: send nil on subscription Err channel when Client is closed
This change makes client subscriptions compatible with the new
Subscription semantics introduced in the previous commit.
2017-01-25 18:44:21 +01:00
Felix Lange
b9b3efb09f all: fix ineffectual assignments and remove uses of crypto.Sha3
go get github.com/gordonklaus/ineffassign
ineffassign .
2017-01-09 16:24:42 +01:00
Péter Szilágyi
18c77744ff
all: fix spelling errors 2017-01-06 19:44:35 +02:00
Felix Lange
35a7dcb162 all: gofmt -w -s 2017-01-06 15:52:03 +01:00
Felix Lange
cf71f5cd60 rpc: remove HexNumber, replace all uses with hexutil types
This change couldn't be automated because HexNumber was used for numbers
of all sizes.
2016-12-20 14:41:58 +01:00
Felix Lange
adab2e16bd rpc: remove HexBytes, replace all uses with hexutil.Bytes 2016-12-20 14:35:26 +01:00
Felix Lange
a3e3235d97 rpc: improve error messages for invalid arguments
The message now includes the index of the invalid arg.
2016-12-20 14:35:26 +01:00
Kenji Siu
d85d3c74db internal/debug, internal/ethapi, rpc, swarm/storage: Ran "go fmt" 2016-11-01 18:40:36 +08:00
Jonathan Brown
ae341b31c8 rpc: set CORS Max-Age to reduce preflight OPTIONS requests 2016-10-03 20:24:58 +07:00
Bas van Kervel
43d716280e rpc: format filter ID according to spec for quantities 2016-09-01 11:50:13 +02:00
Felix Lange
b0d9f7372a internal/ethapi: add missing output fields
- returned headers didn't include mixHash
- returned transactions didn't include signature fields
- empty transaction input was returned as "", but should be "0x"
- returned receipts didn't include the bloom filter
- "root" in receipts was missing 0x prefix
2016-08-04 01:40:50 +02:00
Bas van Kervel
47ff813012 rpc: refactor subscriptions and filters 2016-08-17 12:59:58 +02:00
Felix Lange
e32925397b rpc: add context argument to EthSubscribe
It's inconsistent not to pass it and most callers will
work with contexts anyway.
2016-08-05 20:48:33 +02:00
Felix Lange
f5f042ffdc rpc: ensure client doesn't block for slow subscribers
I initially made the client block if the 100-element buffer was
exceeded. It turns out that this is inconvenient for simple uses of the
client which subscribe and perform calls on the same goroutine, e.g.

    client, _ := rpc.Dial(...)
    ch := make(chan int) // note: no buffer
    sub, _ := client.EthSubscribe(ch, "something")
    for event := range ch {
        client.Call(...)
    }

This innocent looking code will lock up if the server suddenly decides
to send 2000 notifications. In this case, the client's main loop won't
accept the call because it is trying to deliver a notification to ch.

The issue is kind of hard to explain in the docs and few people will
actually read them. Buffering is the simple option and works with close
to no overhead for subscribers that always listen.
2016-08-05 20:48:33 +02:00
Felix Lange
464660651d rpc: don't exceed context deadline while waiting for send lock 2016-08-05 13:27:02 +02:00
Felix Lange
91b7690428 rpc: add new client, use it everywhere
The new client implementation supports concurrent requests,
subscriptions and replaces the various ad hoc RPC clients
throughout go-ethereum.
2016-07-22 23:21:27 +02:00
Felix Lange
bb01bea4e2 rpc: fix bad method error for batch requests
If a batch request contained an invalid method, the server would reply
with a non-batch error response. Fix this by tracking an error for each
batch element.
2016-07-22 23:21:27 +02:00
Felix Lange
c145589f25 rpc: remove grace period when shutting down the server
The server delayed closing of connections for 3s when stopping. This was
supposed to allow for slow handlers, but it didn't really work. When
geth quits, it will just exit immediately after quitting the server.

Removing the timer makes testing easier because all connections will be
closed after Stop returns.
2016-07-22 23:21:27 +02:00
Felix Lange
74be4a62c5 Godeps, rpc: switch back to package npipe
The named pipe implementation from go-winio has some issues
that need to be addressed before we can use it again.
2016-07-14 23:03:40 +02:00
Fabio Berger
a3efdb13f2 README, core, rpc: fix various typos 2016-06-21 17:38:35 +01:00
Péter Szilágyi
ffaf58f0a9 cmd, console: split off the console into a reusable package 2016-05-30 17:25:23 +03:00
Péter Szilágyi
bc6fdad786 cmd/geth, internal/web3ext, rpc: surface rpc module, fix shh, fix miner 2016-05-11 11:49:44 +03:00
Bas van Kervel
5479097790 rpc: HTTP origin case insensitive 2016-05-10 18:01:58 +02:00
Péter Szilágyi
a6ca8fd268 Merge pull request #2463 from fjl/rpc-context-key
rpc: remove NotifierContextKey
2016-04-19 10:22:48 +03:00
Felix Lange
a40e61b4ac rpc: remove NotifierContextKey
Context keys must have a unique type in order to prevent
any unintented clashes. The code used int(1) as key.

Fix it by implementing the pattern recommended by package context.
2016-04-15 18:10:52 +02:00
Felix Lange
e728aaca72 rpc: move web3.js extensions to internal/web3ext 2016-04-15 17:36:01 +02:00
Felix Lange
6fdd0893c3 all: fix go vet warnings 2016-04-15 11:17:27 +02:00
Felix Lange
d04a2e7557 all: update license information 2016-04-15 09:48:05 +02:00
Péter Szilágyi
53016c1225 eth, rpc: make trace configs optional 2016-04-14 15:10:29 +03:00
Felix Lange
bea56d84e5 internal/debug: add memStats and gcStats to API 2016-04-13 12:08:07 +02:00
Felix Lange
bcd8aeefdd eth: add chaindbProperty to debug API 2016-04-13 12:08:07 +02:00
Jeffrey Wilcke
8627680e24 Merge pull request #2359 from bas-vk/rpc-optional-args
rpc: several fixes and support for optional arguments
2016-04-12 14:03:21 +02:00
Bas van Kervel
aa9fff3e68 rpc: various fixes/enhancements
rpc: be less restrictive on the request id
rpc: improved documentation
console: upgrade web3.js to version 0.16.0
rpc: cache http connections
rpc: rename wsDomains parameter to wsOrigins
2016-04-12 11:02:39 +02:00
Bas van Kervel
18490d833c console: use transaction output formatter for eth.pendingTransactions output 2016-04-06 11:27:05 +02:00
Jeffrey Wilcke
7e02105672 Merge pull request #2417 from fjl/rpc-go-winio
rpc: use go-winio instead of vendoring a named pipe implementation
2016-04-05 09:43:45 +02:00
Felix Lange
467bb7a719 rpc: use go-winio instead of vendoring a named pipe implementation 2016-04-04 13:56:17 +02:00
Bas van Kervel
f7328c5ecb rpc: add pub/sub support 2016-04-01 18:26:35 +02:00
Jeffrey Wilcke
75c86f8646 Merge pull request #2141 from obscuren/evm-init
core, core/vm, tests: changed the initialisation behaviour of the EVM
2016-03-23 23:20:51 +01:00
Jeffrey Wilcke
3601320ccd eth, rpc: implemented block debugging rpc calls
Implemented the following block debugging RPC calls

* Block(RLP)
* BlockByFile(fileName)
* BlockByNumber(number)
* BlockByHash(hash)
2016-03-23 23:02:44 +01:00
Bas van Kervel
a7bae3b2a6 rpc/http: improve request handling 2016-03-23 11:27:08 +01:00
Jeffrey Wilcke
41f35d7913 Merge pull request #2280 from bas-vk/js-cleanup
console: cleanup old autocompletations relics
2016-03-02 21:23:47 +01:00
Bas van Kervel
789b9a9f16 console: cleanup old autocompletations relics 2016-03-01 18:27:08 +01:00
Felix Lange
e8e6df5159 rpc: simplify inproc client
Fixes #2277
2016-03-01 12:47:36 +01:00
Péter Szilágyi
df75dbfd68 cmd, node, rpc: readd inproc RPC client, expose via node 2016-02-09 14:10:40 +02:00
Péter Szilágyi
900e124bee cmd, common, node, rpc: rework naming convention to canonical one 2016-02-09 13:24:42 +02:00
Péter Szilágyi
7486904b92 cmd, node, rpc: move websockets into node, break singleton 2016-02-05 16:53:47 +02:00
Péter Szilágyi
a13bc9d7a1 cmd, common, node, rpc: move HTTP RPC into node, drop singletone aspect 2016-02-05 13:45:36 +02:00
Péter Szilágyi
ba7c125153 Merge pull request #2168 from karalabe/move-rpc-into-node
cmd, common, node, rpc: move IPC into the node itself
2016-02-05 11:33:24 +02:00
Péter Szilágyi
6b939fbeaa rpc: add jsonrpc version to module request, use json types 2016-02-04 16:55:50 +02:00
Péter Szilágyi
188ab928c3 cmd, common, node, rpc: move IPC into the node itself 2016-02-04 11:23:15 +02:00
Jeffrey Wilcke
3274db19c7 Merge pull request #2169 from karalabe/fix-http-rpc-method
rpc: allow RPC requests on GET too
2016-02-03 23:34:36 +01:00
Péter Szilágyi
5da7ec7c18 cmd, eth, rpc: fix some RPC issues with pending blocks 2016-02-03 10:35:59 +02:00
Péter Szilágyi
a8fd0de0d3 Merge pull request #2156 from ppratscher/add_replay_tx
core/vm, rpc/api: added debug_replayTransaction RPC call
2016-02-03 10:34:52 +02:00
Péter Szilágyi
72c255caef rpc: allow RPC requests on GET too 2016-02-03 00:50:02 +02:00
Peter Pratscher
15780ead07 core/vm, rpc/api: renamed to debug.replayTransaction, migrated to new RPC, integrated feedback
Integrated code review suggestions

Integrated last review comments
2016-02-02 15:20:18 +01:00
Péter Szilágyi
d3642b0715 core, eth, rpc/api: rpc method to inspect the txpool queue 2016-02-01 14:58:14 +02:00
Felix Lange
3750d835a1 internal/debug: APIs for profiling and tracing
The debug package provides an RPC wrapper for glog settings and the
debugging facilities of the Go runtime. They can be triggered through
both command line flags and the IPC listener.
2016-01-28 13:36:11 +01:00
Felix Lange
5728dd381d rpc: fix success response encoding for null return value
The "result" field of JSON-RPC 2.0 responses was omitted
if the result was nil, causing exceptions in web3.js.
2016-01-27 00:06:37 +01:00
Bas van Kervel
19b2640e89 rpc: migrated the RPC insterface to a new reflection based RPC layer 2016-01-26 13:51:50 +01:00
Felix Lange
f2ab351e8d Merge pull request #2136 from fjl/glog-prefix
logger/glog: improve vmodule
2016-01-25 23:35:25 +01:00
Felix Lange
e4d794851b node, rpc/api: add debug_vmodule, move admin_verbosity to debug_verbosity 2016-01-21 13:37:38 +01:00
Bas van Kervel
cdd34fcb16 console: add admin.sleep and admin.sleepBlocks 2016-01-19 12:30:33 +01:00
Felix Lange
e640861704 Merge pull request #2061 from zsfelfoldi/rpc-context
rpc: optionally passing context argument to rpc v2 api methods
2015-12-16 11:12:06 +01:00
zsfelfoldi
f3aac71fad rpc/v2: optionally passing context argument to rpc v2 api methods 2015-12-16 03:48:08 +01:00
Péter Szilágyi
d8370a4e15 core, eth, node, rpc: port the admin and debug API 2015-12-14 19:36:51 +02:00
Bas van Kervel
eae81465c1 rpc: new RPC implementation with pub/sub support 2015-12-14 16:34:05 +01:00
Péter Szilágyi
3e1000fda3 cmd, eth, node, rpc, xeth: use single-instance services 2015-11-27 11:06:12 +02:00
Péter Szilágyi
1e806c4c77 cmd, common, core, eth, node, rpc, tests, whisper, xeth: use protocol stacks 2015-11-27 11:06:12 +02:00
Jeffrey Wilcke
6bb29aebee Merge pull request #1666 from obscuren/create-transaction
rpc/api, xeth: added signTransaction method
2015-11-20 21:36:56 +01:00
Jeffrey Wilcke
ae37a8013d Merge pull request #1917 from obscuren/validator-interface
core, eth, rpc: split out block validator and state processor
2015-11-19 10:57:00 +01:00
Jeffrey Wilcke
a1d9ef48c5 core, eth, rpc: split out block validator and state processor
This removes the burden on a single object to take care of all
validation and state processing. Now instead the validation is done by
the `core.BlockValidator` (`types.Validator`) that takes care of both
header and uncle validation through the `ValidateBlock` method and state
validation through the `ValidateState` method. The state processing is
done by a new object `core.StateProcessor` (`types.Processor`) and
accepts a new state as input and uses that to process the given block's
transactions (and uncles for rewords) to calculate the state root for
the next block (P_n + 1).
2015-11-18 14:24:42 +01:00
Péter Szilágyi
53f28e71dc rpc/api: fix #1986, newIdentity autocomplete 2015-11-18 13:03:20 +02:00
Jeffrey Wilcke
6ea05f5a54 rpc/api, xeth: added signTransaction method
SignTransaction creates a transaction but does submit it to the
network. SignTransaction returns a structure which includes the
transaction object details as well as the RLP encoded transaction that
could possibly be submitted by the SendRawTransaction method.
2015-11-17 17:51:05 +01:00
Péter Szilágyi
6e5349880e rpc/api: fix #1972 api regression (nil eth panic) in attach 2015-11-06 11:47:57 +02:00