erigon-pulse/node/node_test.go

688 lines
19 KiB
Go
Raw Normal View History

// Copyright 2015 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package node
import (
"context"
"errors"
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
"fmt"
"io"
"net"
geth 1.9.13 (#469) * core: initial version of state snapshots * core/state: lazy sorting, snapshot invalidation * core/state/snapshot: extract and split cap method, cover corners * snapshot: iteration and buffering optimizations * core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup * 123 * core/rawdb, core/state/snapshot: runtime snapshot generation * core/state/snapshot: fix difflayer origin-initalization after flatten * add "to merge" * core/state/snapshot: implement snapshot layer iteration * core/state/snapshot: node behavioural difference on bloom content * core: journal the snapshot inside leveldb, not a flat file * core/state/snapshot: bloom, metrics and prefetcher fixes * core/state/snapshot: move iterator out into its own files * core/state/snapshot: implement iterator priority for fast direct data lookup * core/state/snapshot: full featured account iteration * core/state/snapshot: faster account iteration, CLI integration * core: fix broken tests due to API changes + linter * core/state: fix an account resurrection issue * core/tests: test for destroy+recreate contract with storage * squashme * core/state/snapshot, tests: sync snap gen + snaps in consensus tests * core/state: extend snapshotter to handle account resurrections * core/state: fix account root hash update point * core/state: fix resurrection state clearing and access * core/state/snapshot: handle deleted accounts in fast iterator * core: more blockchain tests * core/state/snapshot: fix various iteration issues due to destruct set * core: fix two snapshot iterator flaws, decollide snap storage prefix * core/state/snapshot/iterator: fix two disk iterator flaws * core/rawdb: change SnapshotStoragePrefix to avoid prefix collision with preimagePrefix * params: begin v1.9.13 release cycle * cmd/checkpoint-admin: add some documentation (#20697) * go.mod: update duktape to fix sprintf warnings (#20777) This revision of go-duktype fixes the following warning ``` duk_logging.c: In function ‘duk__logger_prototype_log_shared’: duk_logging.c:184:64: warning: ‘Z’ directive writing 1 byte into a region of size between 0 and 9 [-Wformat-overflow=] 184 | sprintf((char *) date_buf, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", | ^ In file included from /usr/include/stdio.h:867, from duk_logging.c:5: /usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 25 and 85 bytes into a destination of size 32 36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` * core/rawdb: fix freezer table test error check Fixes: Condition is always 'false' because 'err' is always 'nil' * core/rawdb: improve table database (#20703) This PR fixes issues in TableDatabase. TableDatabase is a wrapper of underlying ethdb.Database with an additional prefix. The prefix is applied to all entries it maintains. However when we try to retrieve entries from it we don't handle the key properly. In theory the prefix should be truncated and only user key is returned. But we don't do it in some cases, e.g. the iterator and batch replayer created from it. So this PR is the fix to these issues. * eth: when triggering a sync, check the head header TD, not block * internal/web3ext: fix clique console apis to work on missing arguments * rpc: dont log an error if user configures --rpcapi=rpc... (#20776) This just prevents a false negative ERROR warning when, for some unknown reason, a user attempts to turn on the module rpc even though it's already going to be on. * node, cmd/clef: report actual port used for http rpc (#20789) * internal/ethapi: don't set sender-balance to maxuint, fixes #16999 (#20783) Prior to this change, eth_call changed the balance of the sender account in the EVM environment to 2^256 wei to cover the gas cost of the call execution. We've had this behavior for a long time even though it's super confusing. This commit sets the default call gasprice to zero instead of updating the balance, which is better because it makes eth_call semantics less surprising. Removing the built-in balance assignment also makes balance overrides work as expected. * metrics: disable CPU stats (gosigar) on iOS * cmd/devp2p: tweak DNS TTLs (#20801) * cmd/devp2p: tweak DNS TTLs * cmd/devp2p: bump treeNodeTTL to four weeks * cmd/devp2p: lower route53 change limit again (#20819) * cmd/devp2p: be very correct about route53 change splitting (#20820) Turns out the way RDATA limits work is documented after all, I just didn't search right. The trick to make it work is to count UPSERTs twice. This also adds an additional check to ensure TTL changes are applied on existing records. * graphql, node, rpc: fix typos in comments (#20824) * eth: improve shutdown synchronization (#20695) * eth: improve shutdown synchronization Most goroutines started by eth.Ethereum didn't have any shutdown sync at all, which lead to weird error messages when quitting the client. This change improves the clean shutdown path by stopping all internal components in dependency order and waiting for them to actually be stopped before shutdown is considered done. In particular, we now stop everything related to peers before stopping 'resident' parts such as core.BlockChain. * eth: rewrite sync controller * eth: remove sync start debug message * eth: notify chainSyncer about new peers after handshake * eth: move downloader.Cancel call into chainSyncer * eth: make post-sync block broadcast synchronous * eth: add comments * core: change blockchain stop message * eth: change closeBloomHandler channel type * eth/filters: fix typo on unindexedLogs function's comment (#20827) * core: bump txpool tx max size to 128KB * snapshotter/tests: verify snapdb post-state against trie (#20812) * core/state/snapshot: basic trie-to-hash implementation * tests: validate snapshot after test * core/state/snapshot: fix review concerns * cmd, consensus: add option to disable mmap for DAG caches/datasets (#20484) * cmd, consensus: add option to disable mmap for DAG caches/datasets * consensus: add benchmarks for mmap with/with lock * cmd/clef: add newaccount command (#20782) * cmd/clef: add newaccount command * cmd/clef: document clef_New, update API versioning * Update cmd/clef/intapi_changelog.md Co-Authored-By: ligi <ligi@ligi.de> * Update signer/core/uiapi.go Co-Authored-By: ligi <ligi@ligi.de> Co-authored-by: ligi <ligi@ligi.de> * eth: add debug_accountRange API (#19645) This new API allows reading accounts and their content by address range. Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: Felix Lange <fjl@twurst.com> * travis: allow cocoapods deploy to fail (#20833) * metrics: improve TestTimerFunc (#20818) The test failed due to what appears to be fluctuations in time.Sleep, which is not the actual method under test. This change modifies it so we compare the metered Max to the actual time instead of the desired time. * README: update private network genesis spec with istanbul (#20841) * add istanbul and muirGlacier to genesis states in README * remove muirGlacier, relocate istanbul * cmd/evm: Rework execution stats (#20792) - Dump stats also for --bench flag. - From memory stats only show number and size of allocations. This is what `test -bench` shows. I doubt others like number of GC runs are any useful, but can be added if requested. - Now the mem stats are for single execution in case of --bench. * cmd/devp2p, cmd/wnode, whisper: add missing calls to Timer.Stop (#20843) * p2p/server: add UDP port mapping goroutine to wait group (#20846) * accounts/abi faster unpacking of int256 (#20850) * p2p/discv5: add missing Timer.Stop calls (#20853) * miner/worker: add missing timer.Stop call (#20857) * cmd/geth: fix bad genesis test (#20860) * eth/filters: add missing Ticker.Stop call (#20862) * eth/fetcher: add missing timer.Stop calls (#20861) * event: add missing timer.Stop call in TestFeed (#20868) * metrics: add missing calls to Ticker.Stop in tests (#20866) * ethstats: add missing Ticker.Stop call (#20867) * p2p/discv5, p2p/testing: add missing Timer.Stop calls in tests (#20869) * core: add missing Timer.Stop call in TestLogReorgs (#20870) * rpc: add missing timer.Stop calls in websocket tests (#20863) * crypto/ecies: improve concatKDF (#20836) This removes a bunch of weird code around the counter overflow check in concatKDF and makes it actually work for different hash output sizes. The overflow check worked as follows: concatKDF applies the hash function N times, where N is roundup(kdLen, hashsize) / hashsize. N should not overflow 32 bits because that would lead to a repetition in the KDF output. A couple issues with the overflow check: - It used the hash.BlockSize, which is wrong because the block size is about the input of the hash function. Luckily, all standard hash functions have a block size that's greater than the output size, so concatKDF didn't crash, it just generated too much key material. - The check used big.Int to compare against 2^32-1. - The calculation could still overflow before reaching the check. The new code in concatKDF doesn't check for overflow. Instead, there is a new check on ECIESParams which ensures that params.KeyLen is < 512. This removes any possibility of overflow. There are a couple of miscellaneous improvements bundled in with this change: - The key buffer is pre-allocated instead of appending the hash output to an initially empty slice. - The code that uses concatKDF to derive keys is now shared between Encrypt and Decrypt. - There was a redundant invocation of IsOnCurve in Decrypt. This is now removed because elliptic.Unmarshal already checks whether the input is a valid curve point since Go 1.5. Co-authored-by: Felix Lange <fjl@twurst.com> * rpc: metrics for JSON-RPC method calls (#20847) This adds a couple of metrics for tracking the timing and frequency of method calls: - rpc/requests gauge counts all requests - rpc/success gauge counts requests which return err == nil - rpc/failure gauge counts requests which return err != nil - rpc/duration/all timer tracks timing of all requests - rpc/duration/<method>/<success/failure> tracks per-method timing * mobile: use bind.NewKeyedTransactor instead of duplicating (#20888) It's better to reuse the existing code to create a keyed transactor than to rewrite the logic again. * internal/ethapi: add CallArgs.ToMessage method (#20854) ToMessage is used to convert between ethapi.CallArgs and types.Message. It reduces the length of the DoCall method by about half by abstracting out the conversion between the CallArgs and the Message. This should improve the code's maintainability and reusability. * eth, les: fix flaky tests (#20897) * les: fix flaky test * eth: fix flaky test * cmd/geth: enable metrics for geth import command (#20738) * cmd/geth: enable metrics for geth import command * cmd/geth: enable metrics-flags for import command * core/vm: use a callcontext struct (#20761) * core/vm: use a callcontext struct * core/vm: fix tests * core/vm/runtime: benchmark * core/vm: make intpool push inlineable, unexpose callcontext * docs/audits: add discv5 protocol audits from LA and C53 (#20898) * .github: change gitter reference to discord link in issue template (#20896) * couple of fixes to docs in clef (#20900) * p2p/discover: add initial discovery v5 implementation (#20750)This adds an implementation of the current discovery v5 spec.There is full integration with cmd/devp2p and enode.Iterator in thisversion. In theory we could enable the new protocol as a replacement ofdiscovery v4 at any time. In practice, there will likely be a few morechanges to the spec and implementation before this can happen. * build: upgrade to golangci-lint 1.24.0 (#20901) * accounts/scwallet: remove unnecessary uses of fmt.Sprintf * cmd/puppeth: remove unnecessary uses of fmt.Sprintf * p2p/discv5: remove unnecessary use of fmt.Sprintf * whisper/mailserver: remove unnecessary uses of fmt.Sprintf * core: goimports -w tx_pool_test.go * eth/downloader: goimports -w downloader_test.go * build: upgrade to golangci-lint 1.24.0 * accounts/abi/bind: Refactored topics (#20851) * accounts/abi/bind: refactored topics * accounts/abi/bind: use store function to remove code duplication * accounts/abi/bind: removed unused type defs * accounts/abi/bind: error on tuples in topics * Cosmetic changes to restart travis build Co-authored-by: Guillaume Ballet <gballet@gmail.com> * node: allow websocket and HTTP on the same port (#20810) This change makes it possible to run geth with JSON-RPC over HTTP and WebSocket on the same TCP port. The default port for WebSocket is still 8546. geth --rpc --rpcport 8545 --ws --wsport 8545 This also removes a lot of deprecated API surface from package rpc. The rpc package is now purely about serving JSON-RPC and no longer provides a way to start an HTTP server. * crypto: improve error messages in LoadECDSA (#20718) This improves error messages when the file is too short or too long. Also rewrite the test for SaveECDSA because LoadECDSA has its own test now. Co-authored-by: Felix Lange <fjl@twurst.com> * changed date of rpcstack.go since new file (#20904) * accounts/abi/bind: fixed erroneous filtering of negative ints (#20865) * accounts/abi/bind: fixed erroneous packing of negative ints * accounts/abi/bind: added test cases for negative ints in topics * accounts/abi/bind: fixed genIntType for go 1.12 * accounts/abi: minor nitpick * cmd: deprecate --testnet, use named networks instead (#20852) * cmd/utils: make goerli the default testnet * cmd/geth: explicitly rename testnet to ropsten * core: explicitly rename testnet to ropsten * params: explicitly rename testnet to ropsten * cmd: explicitly rename testnet to ropsten * miner: explicitly rename testnet to ropsten * mobile: allow for returning the goerli spec * tests: explicitly rename testnet to ropsten * docs: update readme to reflect changes to the default testnet * mobile: allow for configuring goerli and rinkeby nodes * cmd/geth: revert --testnet back to ropsten and mark as legacy * cmd/util: mark --testnet flag as deprecated * docs: update readme to properly reflect the 3 testnets * cmd/utils: add an explicit deprecation warning on startup * cmd/utils: swap goerli and ropsten in usage * cmd/geth: swap goerli and ropsten in usage * cmd/geth: if running a known preset, log it for convenience * docs: improve readme on usage of ropsten's testnet datadir * cmd/utils: check if legacy `testnet` datadir exists for ropsten * cmd/geth: check for legacy testnet path in console command * cmd/geth: use switch statement for complex conditions in main * cmd/geth: move known preset log statement to the very top * cmd/utils: create new ropsten configurations in the ropsten datadir * cmd/utils: makedatadir should check for existing testnet dir * cmd/geth: add legacy testnet flag to the copy db command * cmd/geth: add legacy testnet flag to the inspect command * les, les/lespay/client: add service value statistics and API (#20837) This PR adds service value measurement statistics to the light client. It also adds a private API that makes these statistics accessible. A follow-up PR will add the new server pool which uses these statistics to select servers with good performance. This document describes the function of the new components: https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4 Co-authored-by: rjl493456442 <garyrong0905@gmail.com> Co-authored-by: rjl493456442 <garyrong0905@gmail.com> * README: update min go version to 1.13 (#20911) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 (#20913) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 * travis, appveyor: force GO111MODULE=on for every build * core/rawdb: fix data race between Retrieve and Close (#20919) * core/rawdb: fixed data race between retrieve and close closes https://github.com/ethereum/go-ethereum/issues/20420 * core/rawdb: use non-atomic load while holding mutex * all: simplify and fix database iteration with prefix/start (#20808) * core/state/snapshot: start fixing disk iterator seek * ethdb, rawdb, leveldb, memorydb: implement iterators with prefix and start * les, core/state/snapshot: iterator fixes * all: remove two iterator methods * all: rename Iteratee.NewIteratorWith -> NewIterator * ethdb: fix review concerns * params: update CHTs for the 1.9.13 release * params: release Geth v1.9.13 * added some missing files * post-rebase fixups Co-authored-by: Péter Szilágyi <peterke@gmail.com> Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: gary rong <garyrong0905@gmail.com> Co-authored-by: Alex Willmer <alex@moreati.org.uk> Co-authored-by: meowsbits <45600330+meowsbits@users.noreply.github.com> Co-authored-by: Felix Lange <fjl@twurst.com> Co-authored-by: rene <41963722+renaynay@users.noreply.github.com> Co-authored-by: Ha ĐANG <dvietha@gmail.com> Co-authored-by: Hanjiang Yu <42531996+de1acr0ix@users.noreply.github.com> Co-authored-by: ligi <ligi@ligi.de> Co-authored-by: Wenbiao Zheng <delweng@gmail.com> Co-authored-by: Adam Schmideg <adamschmideg@users.noreply.github.com> Co-authored-by: Jeff Wentworth <jeff@curvegrid.com> Co-authored-by: Paweł Bylica <chfast@gmail.com> Co-authored-by: ucwong <ucwong@126.com> Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de> Co-authored-by: Luke Champine <luke.champine@gmail.com> Co-authored-by: Boqin Qin <Bobbqqin@gmail.com> Co-authored-by: William Morriss <wjmelements@gmail.com> Co-authored-by: Guillaume Ballet <gballet@gmail.com> Co-authored-by: Raw Pong Ghmoa <58883403+q9f@users.noreply.github.com> Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
2020-04-19 17:31:47 +00:00
"net/http"
"reflect"
2021-06-18 03:35:11 +00:00
"runtime"
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
"strings"
"testing"
2021-07-29 11:53:13 +00:00
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon/crypto"
2022-05-26 05:27:44 +00:00
"github.com/ledgerwatch/erigon/node/nodecfg"
"github.com/ledgerwatch/erigon/p2p"
"github.com/ledgerwatch/erigon/rpc"
2021-07-29 10:23:23 +00:00
"github.com/ledgerwatch/log/v3"
"github.com/stretchr/testify/require"
geth 1.9.13 (#469) * core: initial version of state snapshots * core/state: lazy sorting, snapshot invalidation * core/state/snapshot: extract and split cap method, cover corners * snapshot: iteration and buffering optimizations * core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup * 123 * core/rawdb, core/state/snapshot: runtime snapshot generation * core/state/snapshot: fix difflayer origin-initalization after flatten * add "to merge" * core/state/snapshot: implement snapshot layer iteration * core/state/snapshot: node behavioural difference on bloom content * core: journal the snapshot inside leveldb, not a flat file * core/state/snapshot: bloom, metrics and prefetcher fixes * core/state/snapshot: move iterator out into its own files * core/state/snapshot: implement iterator priority for fast direct data lookup * core/state/snapshot: full featured account iteration * core/state/snapshot: faster account iteration, CLI integration * core: fix broken tests due to API changes + linter * core/state: fix an account resurrection issue * core/tests: test for destroy+recreate contract with storage * squashme * core/state/snapshot, tests: sync snap gen + snaps in consensus tests * core/state: extend snapshotter to handle account resurrections * core/state: fix account root hash update point * core/state: fix resurrection state clearing and access * core/state/snapshot: handle deleted accounts in fast iterator * core: more blockchain tests * core/state/snapshot: fix various iteration issues due to destruct set * core: fix two snapshot iterator flaws, decollide snap storage prefix * core/state/snapshot/iterator: fix two disk iterator flaws * core/rawdb: change SnapshotStoragePrefix to avoid prefix collision with preimagePrefix * params: begin v1.9.13 release cycle * cmd/checkpoint-admin: add some documentation (#20697) * go.mod: update duktape to fix sprintf warnings (#20777) This revision of go-duktype fixes the following warning ``` duk_logging.c: In function ‘duk__logger_prototype_log_shared’: duk_logging.c:184:64: warning: ‘Z’ directive writing 1 byte into a region of size between 0 and 9 [-Wformat-overflow=] 184 | sprintf((char *) date_buf, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", | ^ In file included from /usr/include/stdio.h:867, from duk_logging.c:5: /usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 25 and 85 bytes into a destination of size 32 36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` * core/rawdb: fix freezer table test error check Fixes: Condition is always 'false' because 'err' is always 'nil' * core/rawdb: improve table database (#20703) This PR fixes issues in TableDatabase. TableDatabase is a wrapper of underlying ethdb.Database with an additional prefix. The prefix is applied to all entries it maintains. However when we try to retrieve entries from it we don't handle the key properly. In theory the prefix should be truncated and only user key is returned. But we don't do it in some cases, e.g. the iterator and batch replayer created from it. So this PR is the fix to these issues. * eth: when triggering a sync, check the head header TD, not block * internal/web3ext: fix clique console apis to work on missing arguments * rpc: dont log an error if user configures --rpcapi=rpc... (#20776) This just prevents a false negative ERROR warning when, for some unknown reason, a user attempts to turn on the module rpc even though it's already going to be on. * node, cmd/clef: report actual port used for http rpc (#20789) * internal/ethapi: don't set sender-balance to maxuint, fixes #16999 (#20783) Prior to this change, eth_call changed the balance of the sender account in the EVM environment to 2^256 wei to cover the gas cost of the call execution. We've had this behavior for a long time even though it's super confusing. This commit sets the default call gasprice to zero instead of updating the balance, which is better because it makes eth_call semantics less surprising. Removing the built-in balance assignment also makes balance overrides work as expected. * metrics: disable CPU stats (gosigar) on iOS * cmd/devp2p: tweak DNS TTLs (#20801) * cmd/devp2p: tweak DNS TTLs * cmd/devp2p: bump treeNodeTTL to four weeks * cmd/devp2p: lower route53 change limit again (#20819) * cmd/devp2p: be very correct about route53 change splitting (#20820) Turns out the way RDATA limits work is documented after all, I just didn't search right. The trick to make it work is to count UPSERTs twice. This also adds an additional check to ensure TTL changes are applied on existing records. * graphql, node, rpc: fix typos in comments (#20824) * eth: improve shutdown synchronization (#20695) * eth: improve shutdown synchronization Most goroutines started by eth.Ethereum didn't have any shutdown sync at all, which lead to weird error messages when quitting the client. This change improves the clean shutdown path by stopping all internal components in dependency order and waiting for them to actually be stopped before shutdown is considered done. In particular, we now stop everything related to peers before stopping 'resident' parts such as core.BlockChain. * eth: rewrite sync controller * eth: remove sync start debug message * eth: notify chainSyncer about new peers after handshake * eth: move downloader.Cancel call into chainSyncer * eth: make post-sync block broadcast synchronous * eth: add comments * core: change blockchain stop message * eth: change closeBloomHandler channel type * eth/filters: fix typo on unindexedLogs function's comment (#20827) * core: bump txpool tx max size to 128KB * snapshotter/tests: verify snapdb post-state against trie (#20812) * core/state/snapshot: basic trie-to-hash implementation * tests: validate snapshot after test * core/state/snapshot: fix review concerns * cmd, consensus: add option to disable mmap for DAG caches/datasets (#20484) * cmd, consensus: add option to disable mmap for DAG caches/datasets * consensus: add benchmarks for mmap with/with lock * cmd/clef: add newaccount command (#20782) * cmd/clef: add newaccount command * cmd/clef: document clef_New, update API versioning * Update cmd/clef/intapi_changelog.md Co-Authored-By: ligi <ligi@ligi.de> * Update signer/core/uiapi.go Co-Authored-By: ligi <ligi@ligi.de> Co-authored-by: ligi <ligi@ligi.de> * eth: add debug_accountRange API (#19645) This new API allows reading accounts and their content by address range. Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: Felix Lange <fjl@twurst.com> * travis: allow cocoapods deploy to fail (#20833) * metrics: improve TestTimerFunc (#20818) The test failed due to what appears to be fluctuations in time.Sleep, which is not the actual method under test. This change modifies it so we compare the metered Max to the actual time instead of the desired time. * README: update private network genesis spec with istanbul (#20841) * add istanbul and muirGlacier to genesis states in README * remove muirGlacier, relocate istanbul * cmd/evm: Rework execution stats (#20792) - Dump stats also for --bench flag. - From memory stats only show number and size of allocations. This is what `test -bench` shows. I doubt others like number of GC runs are any useful, but can be added if requested. - Now the mem stats are for single execution in case of --bench. * cmd/devp2p, cmd/wnode, whisper: add missing calls to Timer.Stop (#20843) * p2p/server: add UDP port mapping goroutine to wait group (#20846) * accounts/abi faster unpacking of int256 (#20850) * p2p/discv5: add missing Timer.Stop calls (#20853) * miner/worker: add missing timer.Stop call (#20857) * cmd/geth: fix bad genesis test (#20860) * eth/filters: add missing Ticker.Stop call (#20862) * eth/fetcher: add missing timer.Stop calls (#20861) * event: add missing timer.Stop call in TestFeed (#20868) * metrics: add missing calls to Ticker.Stop in tests (#20866) * ethstats: add missing Ticker.Stop call (#20867) * p2p/discv5, p2p/testing: add missing Timer.Stop calls in tests (#20869) * core: add missing Timer.Stop call in TestLogReorgs (#20870) * rpc: add missing timer.Stop calls in websocket tests (#20863) * crypto/ecies: improve concatKDF (#20836) This removes a bunch of weird code around the counter overflow check in concatKDF and makes it actually work for different hash output sizes. The overflow check worked as follows: concatKDF applies the hash function N times, where N is roundup(kdLen, hashsize) / hashsize. N should not overflow 32 bits because that would lead to a repetition in the KDF output. A couple issues with the overflow check: - It used the hash.BlockSize, which is wrong because the block size is about the input of the hash function. Luckily, all standard hash functions have a block size that's greater than the output size, so concatKDF didn't crash, it just generated too much key material. - The check used big.Int to compare against 2^32-1. - The calculation could still overflow before reaching the check. The new code in concatKDF doesn't check for overflow. Instead, there is a new check on ECIESParams which ensures that params.KeyLen is < 512. This removes any possibility of overflow. There are a couple of miscellaneous improvements bundled in with this change: - The key buffer is pre-allocated instead of appending the hash output to an initially empty slice. - The code that uses concatKDF to derive keys is now shared between Encrypt and Decrypt. - There was a redundant invocation of IsOnCurve in Decrypt. This is now removed because elliptic.Unmarshal already checks whether the input is a valid curve point since Go 1.5. Co-authored-by: Felix Lange <fjl@twurst.com> * rpc: metrics for JSON-RPC method calls (#20847) This adds a couple of metrics for tracking the timing and frequency of method calls: - rpc/requests gauge counts all requests - rpc/success gauge counts requests which return err == nil - rpc/failure gauge counts requests which return err != nil - rpc/duration/all timer tracks timing of all requests - rpc/duration/<method>/<success/failure> tracks per-method timing * mobile: use bind.NewKeyedTransactor instead of duplicating (#20888) It's better to reuse the existing code to create a keyed transactor than to rewrite the logic again. * internal/ethapi: add CallArgs.ToMessage method (#20854) ToMessage is used to convert between ethapi.CallArgs and types.Message. It reduces the length of the DoCall method by about half by abstracting out the conversion between the CallArgs and the Message. This should improve the code's maintainability and reusability. * eth, les: fix flaky tests (#20897) * les: fix flaky test * eth: fix flaky test * cmd/geth: enable metrics for geth import command (#20738) * cmd/geth: enable metrics for geth import command * cmd/geth: enable metrics-flags for import command * core/vm: use a callcontext struct (#20761) * core/vm: use a callcontext struct * core/vm: fix tests * core/vm/runtime: benchmark * core/vm: make intpool push inlineable, unexpose callcontext * docs/audits: add discv5 protocol audits from LA and C53 (#20898) * .github: change gitter reference to discord link in issue template (#20896) * couple of fixes to docs in clef (#20900) * p2p/discover: add initial discovery v5 implementation (#20750)This adds an implementation of the current discovery v5 spec.There is full integration with cmd/devp2p and enode.Iterator in thisversion. In theory we could enable the new protocol as a replacement ofdiscovery v4 at any time. In practice, there will likely be a few morechanges to the spec and implementation before this can happen. * build: upgrade to golangci-lint 1.24.0 (#20901) * accounts/scwallet: remove unnecessary uses of fmt.Sprintf * cmd/puppeth: remove unnecessary uses of fmt.Sprintf * p2p/discv5: remove unnecessary use of fmt.Sprintf * whisper/mailserver: remove unnecessary uses of fmt.Sprintf * core: goimports -w tx_pool_test.go * eth/downloader: goimports -w downloader_test.go * build: upgrade to golangci-lint 1.24.0 * accounts/abi/bind: Refactored topics (#20851) * accounts/abi/bind: refactored topics * accounts/abi/bind: use store function to remove code duplication * accounts/abi/bind: removed unused type defs * accounts/abi/bind: error on tuples in topics * Cosmetic changes to restart travis build Co-authored-by: Guillaume Ballet <gballet@gmail.com> * node: allow websocket and HTTP on the same port (#20810) This change makes it possible to run geth with JSON-RPC over HTTP and WebSocket on the same TCP port. The default port for WebSocket is still 8546. geth --rpc --rpcport 8545 --ws --wsport 8545 This also removes a lot of deprecated API surface from package rpc. The rpc package is now purely about serving JSON-RPC and no longer provides a way to start an HTTP server. * crypto: improve error messages in LoadECDSA (#20718) This improves error messages when the file is too short or too long. Also rewrite the test for SaveECDSA because LoadECDSA has its own test now. Co-authored-by: Felix Lange <fjl@twurst.com> * changed date of rpcstack.go since new file (#20904) * accounts/abi/bind: fixed erroneous filtering of negative ints (#20865) * accounts/abi/bind: fixed erroneous packing of negative ints * accounts/abi/bind: added test cases for negative ints in topics * accounts/abi/bind: fixed genIntType for go 1.12 * accounts/abi: minor nitpick * cmd: deprecate --testnet, use named networks instead (#20852) * cmd/utils: make goerli the default testnet * cmd/geth: explicitly rename testnet to ropsten * core: explicitly rename testnet to ropsten * params: explicitly rename testnet to ropsten * cmd: explicitly rename testnet to ropsten * miner: explicitly rename testnet to ropsten * mobile: allow for returning the goerli spec * tests: explicitly rename testnet to ropsten * docs: update readme to reflect changes to the default testnet * mobile: allow for configuring goerli and rinkeby nodes * cmd/geth: revert --testnet back to ropsten and mark as legacy * cmd/util: mark --testnet flag as deprecated * docs: update readme to properly reflect the 3 testnets * cmd/utils: add an explicit deprecation warning on startup * cmd/utils: swap goerli and ropsten in usage * cmd/geth: swap goerli and ropsten in usage * cmd/geth: if running a known preset, log it for convenience * docs: improve readme on usage of ropsten's testnet datadir * cmd/utils: check if legacy `testnet` datadir exists for ropsten * cmd/geth: check for legacy testnet path in console command * cmd/geth: use switch statement for complex conditions in main * cmd/geth: move known preset log statement to the very top * cmd/utils: create new ropsten configurations in the ropsten datadir * cmd/utils: makedatadir should check for existing testnet dir * cmd/geth: add legacy testnet flag to the copy db command * cmd/geth: add legacy testnet flag to the inspect command * les, les/lespay/client: add service value statistics and API (#20837) This PR adds service value measurement statistics to the light client. It also adds a private API that makes these statistics accessible. A follow-up PR will add the new server pool which uses these statistics to select servers with good performance. This document describes the function of the new components: https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4 Co-authored-by: rjl493456442 <garyrong0905@gmail.com> Co-authored-by: rjl493456442 <garyrong0905@gmail.com> * README: update min go version to 1.13 (#20911) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 (#20913) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 * travis, appveyor: force GO111MODULE=on for every build * core/rawdb: fix data race between Retrieve and Close (#20919) * core/rawdb: fixed data race between retrieve and close closes https://github.com/ethereum/go-ethereum/issues/20420 * core/rawdb: use non-atomic load while holding mutex * all: simplify and fix database iteration with prefix/start (#20808) * core/state/snapshot: start fixing disk iterator seek * ethdb, rawdb, leveldb, memorydb: implement iterators with prefix and start * les, core/state/snapshot: iterator fixes * all: remove two iterator methods * all: rename Iteratee.NewIteratorWith -> NewIterator * ethdb: fix review concerns * params: update CHTs for the 1.9.13 release * params: release Geth v1.9.13 * added some missing files * post-rebase fixups Co-authored-by: Péter Szilágyi <peterke@gmail.com> Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: gary rong <garyrong0905@gmail.com> Co-authored-by: Alex Willmer <alex@moreati.org.uk> Co-authored-by: meowsbits <45600330+meowsbits@users.noreply.github.com> Co-authored-by: Felix Lange <fjl@twurst.com> Co-authored-by: rene <41963722+renaynay@users.noreply.github.com> Co-authored-by: Ha ĐANG <dvietha@gmail.com> Co-authored-by: Hanjiang Yu <42531996+de1acr0ix@users.noreply.github.com> Co-authored-by: ligi <ligi@ligi.de> Co-authored-by: Wenbiao Zheng <delweng@gmail.com> Co-authored-by: Adam Schmideg <adamschmideg@users.noreply.github.com> Co-authored-by: Jeff Wentworth <jeff@curvegrid.com> Co-authored-by: Paweł Bylica <chfast@gmail.com> Co-authored-by: ucwong <ucwong@126.com> Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de> Co-authored-by: Luke Champine <luke.champine@gmail.com> Co-authored-by: Boqin Qin <Bobbqqin@gmail.com> Co-authored-by: William Morriss <wjmelements@gmail.com> Co-authored-by: Guillaume Ballet <gballet@gmail.com> Co-authored-by: Raw Pong Ghmoa <58883403+q9f@users.noreply.github.com> Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
2020-04-19 17:31:47 +00:00
"github.com/stretchr/testify/assert"
)
var (
testNodeKey, _ = crypto.GenerateKey()
)
2022-05-26 05:27:44 +00:00
func testNodeConfig(t *testing.T) *nodecfg.Config {
return &nodecfg.Config{
Name: "test node",
P2P: p2p.Config{PrivateKey: testNodeKey},
DataDir: t.TempDir(),
}
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
// Tests that an empty protocol stack can be closed more than once.
func TestNodeCloseMultipleTimes(t *testing.T) {
2021-06-18 03:35:11 +00:00
if runtime.GOOS == "windows" {
t.Skip("fix me on win please")
}
stack, err := New(testNodeConfig(t))
if err != nil {
t.Fatalf("failed to create protocol stack: %v", err)
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
stack.Close()
// Ensure that a stopped node can be stopped again
for i := 0; i < 3; i++ {
2020-08-15 20:22:05 +00:00
if err := stack.Close(); !errors.Is(err, ErrNodeStopped) {
t.Fatalf("iter %d: stop failure mismatch: have %v, want %v", i, err, ErrNodeStopped)
}
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
}
func TestNodeStartMultipleTimes(t *testing.T) {
2021-06-18 03:35:11 +00:00
if runtime.GOOS == "windows" {
t.Skip("fix me on win please")
}
stack, err := New(testNodeConfig(t))
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
if err != nil {
t.Fatalf("failed to create protocol stack: %v", err)
}
// Ensure that a node can be successfully started, but only once
if err := stack.Start(); err != nil {
t.Fatalf("failed to start node: %v", err)
}
2020-08-15 20:22:05 +00:00
if err := stack.Start(); !errors.Is(err, ErrNodeRunning) {
t.Fatalf("start failure mismatch: have %v, want %v ", err, ErrNodeRunning)
}
// Ensure that a node can be stopped, but only once
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
if err := stack.Close(); err != nil {
t.Fatalf("failed to stop node: %v", err)
}
2020-08-15 20:22:05 +00:00
if err := stack.Close(); !errors.Is(err, ErrNodeStopped) {
t.Fatalf("stop failure mismatch: have %v, want %v ", err, ErrNodeStopped)
}
}
// Tests that if the data dir is already in use, an appropriate error is returned.
func TestNodeUsedDataDir(t *testing.T) {
2021-06-18 03:35:11 +00:00
if runtime.GOOS == "windows" {
t.Skip("fix me on win please")
}
// Create a temporary folder to use as the data directory
2021-05-18 12:13:16 +00:00
dir := t.TempDir()
// Create a new node based on the data directory
2022-05-26 05:27:44 +00:00
original, originalErr := New(&nodecfg.Config{DataDir: dir})
if originalErr != nil {
t.Fatalf("failed to create original protocol stack: %v", originalErr)
}
defer original.Close()
if err := original.Start(); err != nil {
t.Fatalf("failed to start original protocol stack: %v", err)
}
// Create a second node based on the same data directory and ensure failure
2022-05-26 05:27:44 +00:00
if _, err := New(&nodecfg.Config{DataDir: dir}); !errors.Is(err, ErrDataDirUsed) {
t.Fatalf("duplicate datadir failure mismatch: have %v, want %v", err, ErrDataDirUsed)
}
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
// Tests whether a Lifecycle can be registered.
func TestLifecycleRegistry_Successful(t *testing.T) {
stack, err := New(testNodeConfig(t))
if err != nil {
t.Fatalf("failed to create protocol stack: %v", err)
}
defer stack.Close()
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
noop := NewNoop()
stack.RegisterLifecycle(noop)
if !containsLifecycle(stack.lifecycles, noop) {
t.Fatalf("lifecycle was not properly registered on the node, %v", err)
}
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
// Tests whether a service's protocols can be registered properly on the node's p2p server.
func TestRegisterProtocols(t *testing.T) {
t.Skip("adjust to p2p sentry")
stack, err := New(testNodeConfig(t))
if err != nil {
t.Fatalf("failed to create protocol stack: %v", err)
}
defer stack.Close()
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
fs, err := NewFullService(stack)
if err != nil {
t.Fatalf("could not create full service: %v", err)
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
for _, protocol := range fs.Protocols() {
if !containsProtocol(stack.server.Protocols, protocol) {
t.Fatalf("protocol %v was not successfully registered", protocol)
}
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
for _, api := range fs.APIs() {
if !containsAPI(stack.rpcAPIs, api) {
t.Fatalf("api %v was not successfully registered", api)
}
}
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
// This test checks that open databases are closed with node.
func TestNodeCloseClosesDB(t *testing.T) {
2021-06-18 03:35:11 +00:00
if runtime.GOOS == "windows" {
t.Skip("fix me on win please")
}
stack, _ := New(testNodeConfig(t))
defer stack.Close()
db, err := OpenDatabase(stack.Config(), log.New(), kv.SentryDB)
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
if err != nil {
t.Fatal("can't open DB:", err)
}
if err = db.Update(context.Background(), func(tx kv.RwTx) error {
return tx.Put(kv.HashedAccounts, []byte("testK"), []byte{})
}); err != nil {
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
t.Fatal("can't Put on open DB:", err)
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
stack.Close()
//if err = db.Update(context.Background(), func(tx kv.RwTx) error {
// return tx.Put(kv.HashedAccounts, []byte("testK"), []byte{})
//}); err == nil {
// t.Fatal("Put succeeded after node is closed")
//}
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
// This test checks that OpenDatabase can be used from within a Lifecycle Start method.
func TestNodeOpenDatabaseFromLifecycleStart(t *testing.T) {
2021-06-18 03:35:11 +00:00
if runtime.GOOS == "windows" {
t.Skip("fix me on win please")
}
stack, err := New(testNodeConfig(t))
require.NoError(t, err)
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
defer stack.Close()
var db kv.RwDB
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
stack.RegisterLifecycle(&InstrumentedService{
startHook: func() {
db, err = OpenDatabase(stack.Config(), log.New(), kv.SentryDB)
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
if err != nil {
t.Fatal("can't open DB:", err)
}
},
stopHook: func() {
db.Close()
},
})
2020-08-15 20:17:38 +00:00
stack.Start() //nolint:errcheck
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
stack.Close()
}
// This test checks that OpenDatabase can be used from within a Lifecycle Stop method.
func TestNodeOpenDatabaseFromLifecycleStop(t *testing.T) {
2021-06-18 03:35:11 +00:00
if runtime.GOOS == "windows" {
t.Skip("fix me on win please")
}
stack, _ := New(testNodeConfig(t))
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
defer stack.Close()
stack.RegisterLifecycle(&InstrumentedService{
stopHook: func() {
db, err := OpenDatabase(stack.Config(), log.New(), kv.ChainDB)
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
if err != nil {
t.Fatal("can't open DB:", err)
}
db.Close()
},
})
2020-08-15 20:17:38 +00:00
stack.Start() //nolint:errcheck
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
stack.Close()
}
// Tests that registered Lifecycles get started and stopped correctly.
func TestLifecycleLifeCycle(t *testing.T) {
stack, _ := New(testNodeConfig(t))
defer stack.Close()
started := make(map[string]bool)
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
stopped := make(map[string]bool)
// Create a batch of instrumented services
lifecycles := map[string]Lifecycle{
"A": &InstrumentedService{
startHook: func() { started["A"] = true },
stopHook: func() { stopped["A"] = true },
},
"B": &InstrumentedService{
startHook: func() { started["B"] = true },
stopHook: func() { stopped["B"] = true },
},
"C": &InstrumentedService{
startHook: func() { started["C"] = true },
stopHook: func() { stopped["C"] = true },
},
}
// register lifecycles on node
for _, lifecycle := range lifecycles {
stack.RegisterLifecycle(lifecycle)
}
// Start the node and check that all services are running
if err := stack.Start(); err != nil {
t.Fatalf("failed to start protocol stack: %v", err)
}
for id := range lifecycles {
if !started[id] {
t.Fatalf("service %s: freshly started service not running", id)
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
if stopped[id] {
t.Fatalf("service %s: freshly started service already stopped", id)
}
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
// Stop the node and check that all services have been stopped
if err := stack.Close(); err != nil {
t.Fatalf("failed to stop protocol stack: %v", err)
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
for id := range lifecycles {
if !stopped[id] {
t.Fatalf("service %s: freshly terminated service still running", id)
}
}
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
// Tests that if a Lifecycle fails to start, all others started before it will be
// shut down.
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
func TestLifecycleStartupError(t *testing.T) {
2021-06-18 03:35:11 +00:00
if runtime.GOOS == "windows" {
t.Skip("fix me on win please")
}
stack, err := New(testNodeConfig(t))
if err != nil {
t.Fatalf("failed to create protocol stack: %v", err)
}
defer stack.Close()
started := make(map[string]bool)
stopped := make(map[string]bool)
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
// Create a batch of instrumented services
lifecycles := map[string]Lifecycle{
"A": &InstrumentedService{
startHook: func() { started["A"] = true },
stopHook: func() { stopped["A"] = true },
},
"B": &InstrumentedService{
startHook: func() { started["B"] = true },
stopHook: func() { stopped["B"] = true },
},
"C": &InstrumentedService{
startHook: func() { started["C"] = true },
stopHook: func() { stopped["C"] = true },
},
}
// register lifecycles on node
for _, lifecycle := range lifecycles {
stack.RegisterLifecycle(lifecycle)
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
// Register a service that fails to construct itself
failure := errors.New("fail")
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
failer := &InstrumentedService{start: failure}
stack.RegisterLifecycle(failer)
// Start the protocol stack and ensure all started services stop
2020-08-15 20:22:05 +00:00
if err := stack.Start(); !errors.Is(err, failure) {
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
t.Fatalf("stack startup failure mismatch: have %v, want %v", err, failure)
}
for id := range lifecycles {
if started[id] && !stopped[id] {
t.Fatalf("service %s: started but not stopped", id)
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
delete(started, id)
delete(stopped, id)
}
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
// Tests that even if a registered Lifecycle fails to shut down cleanly, it does
// not influence the rest of the shutdown invocations.
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
func TestLifecycleTerminationGuarantee(t *testing.T) {
stack, err := New(testNodeConfig(t))
if err != nil {
t.Fatalf("failed to create protocol stack: %v", err)
}
defer stack.Close()
started := make(map[string]bool)
stopped := make(map[string]bool)
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
// Create a batch of instrumented services
lifecycles := map[string]Lifecycle{
"A": &InstrumentedService{
startHook: func() { started["A"] = true },
stopHook: func() { stopped["A"] = true },
},
"B": &InstrumentedService{
startHook: func() { started["B"] = true },
stopHook: func() { stopped["B"] = true },
},
"C": &InstrumentedService{
startHook: func() { started["C"] = true },
stopHook: func() { stopped["C"] = true },
},
}
// register lifecycles on node
for _, lifecycle := range lifecycles {
stack.RegisterLifecycle(lifecycle)
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
// Register a service that fails to shot down cleanly
failure := errors.New("fail")
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
failer := &InstrumentedService{stop: failure}
stack.RegisterLifecycle(failer)
// Start the protocol stack, and ensure that a failing shut down terminates all
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
// Start the stack and make sure all is online
2020-08-15 20:22:05 +00:00
if err1 := stack.Start(); err != nil {
t.Fatalf("failed to start protocol stack: %v", err1)
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
}
for id := range lifecycles {
if !started[id] {
t.Fatalf("service %s: service not running", id)
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
if stopped[id] {
t.Fatalf("service %s: service already stopped", id)
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
}
// Stop the stack, verify failure and check all terminations
err = stack.Close()
if err, ok := err.(*StopError); !ok {
t.Fatalf("termination failure mismatch: have %v, want StopError", err)
} else {
failer := reflect.TypeOf(&InstrumentedService{})
2020-08-15 20:22:05 +00:00
if !errors.Is(err.Services[failer], failure) {
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
t.Fatalf("failer termination failure mismatch: have %v, want %v", err.Services[failer], failure)
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
if len(err.Services) != 1 {
t.Fatalf("failure count mismatch: have %d, want %d", len(err.Services), 1)
}
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
for id := range lifecycles {
if !stopped[id] {
t.Fatalf("service %s: service not terminated", id)
}
delete(started, id)
delete(stopped, id)
}
stack.server = &p2p.Server{}
stack.server.PrivateKey = testNodeKey
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
// Tests whether a handler can be successfully mounted on the canonical HTTP server
// on the given prefix
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
func TestRegisterHandler_Successful(t *testing.T) {
2021-06-18 03:35:11 +00:00
if runtime.GOOS == "windows" {
t.Skip("fix me on win please")
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
node := createNode(t, 7878, 7979)
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
// create and mount handler
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
2020-08-15 20:17:38 +00:00
w.Write([]byte("success")) //nolint:errcheck
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
})
node.RegisterHandler("test", "/test", handler)
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
// start node
if err := node.Start(); err != nil {
t.Fatalf("could not start node: %v", err)
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
// create HTTP request
httpReq, err := http.NewRequest(http.MethodGet, "http://127.0.0.1:7878/test", nil)
if err != nil {
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
t.Error("could not issue new http request ", err)
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
// check response
resp := doHTTPRequest(t, httpReq)
2021-08-02 07:52:54 +00:00
defer resp.Body.Close()
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
buf := make([]byte, 7)
_, err = io.ReadFull(resp.Body, buf)
if err != nil {
t.Fatalf("could not read response: %v", err)
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
assert.Equal(t, "success", string(buf))
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
// Tests that the given handler will not be successfully mounted since no HTTP server
// is enabled for RPC
func TestRegisterHandler_Unsuccessful(t *testing.T) {
2021-06-18 03:35:11 +00:00
if runtime.GOOS == "windows" {
t.Skip("fix me on win please")
}
2022-05-26 05:27:44 +00:00
node, err := New(&nodecfg.DefaultConfig)
if err != nil {
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
t.Fatalf("could not create new node: %v", err)
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
// create and mount handler
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
2020-08-15 20:17:38 +00:00
w.Write([]byte("success")) //nolint:errcheck
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
})
node.RegisterHandler("test", "/test", handler)
}
// Tests whether websocket requests can be handled on the same port as a regular http server.
func TestWebsocketHTTPOnSamePort_WebsocketRequest(t *testing.T) {
node := startHTTP(t, 0, 0)
defer node.Close()
ws := strings.Replace(node.HTTPEndpoint(), "http://", "ws://", 1)
if node.WSEndpoint() != ws {
t.Fatalf("endpoints should be the same")
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
if !checkRPC(ws) {
t.Fatalf("ws request failed")
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
if !checkRPC(node.HTTPEndpoint()) {
t.Fatalf("http request failed")
}
}
geth 1.9.13 (#469) * core: initial version of state snapshots * core/state: lazy sorting, snapshot invalidation * core/state/snapshot: extract and split cap method, cover corners * snapshot: iteration and buffering optimizations * core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup * 123 * core/rawdb, core/state/snapshot: runtime snapshot generation * core/state/snapshot: fix difflayer origin-initalization after flatten * add "to merge" * core/state/snapshot: implement snapshot layer iteration * core/state/snapshot: node behavioural difference on bloom content * core: journal the snapshot inside leveldb, not a flat file * core/state/snapshot: bloom, metrics and prefetcher fixes * core/state/snapshot: move iterator out into its own files * core/state/snapshot: implement iterator priority for fast direct data lookup * core/state/snapshot: full featured account iteration * core/state/snapshot: faster account iteration, CLI integration * core: fix broken tests due to API changes + linter * core/state: fix an account resurrection issue * core/tests: test for destroy+recreate contract with storage * squashme * core/state/snapshot, tests: sync snap gen + snaps in consensus tests * core/state: extend snapshotter to handle account resurrections * core/state: fix account root hash update point * core/state: fix resurrection state clearing and access * core/state/snapshot: handle deleted accounts in fast iterator * core: more blockchain tests * core/state/snapshot: fix various iteration issues due to destruct set * core: fix two snapshot iterator flaws, decollide snap storage prefix * core/state/snapshot/iterator: fix two disk iterator flaws * core/rawdb: change SnapshotStoragePrefix to avoid prefix collision with preimagePrefix * params: begin v1.9.13 release cycle * cmd/checkpoint-admin: add some documentation (#20697) * go.mod: update duktape to fix sprintf warnings (#20777) This revision of go-duktype fixes the following warning ``` duk_logging.c: In function ‘duk__logger_prototype_log_shared’: duk_logging.c:184:64: warning: ‘Z’ directive writing 1 byte into a region of size between 0 and 9 [-Wformat-overflow=] 184 | sprintf((char *) date_buf, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", | ^ In file included from /usr/include/stdio.h:867, from duk_logging.c:5: /usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 25 and 85 bytes into a destination of size 32 36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` * core/rawdb: fix freezer table test error check Fixes: Condition is always 'false' because 'err' is always 'nil' * core/rawdb: improve table database (#20703) This PR fixes issues in TableDatabase. TableDatabase is a wrapper of underlying ethdb.Database with an additional prefix. The prefix is applied to all entries it maintains. However when we try to retrieve entries from it we don't handle the key properly. In theory the prefix should be truncated and only user key is returned. But we don't do it in some cases, e.g. the iterator and batch replayer created from it. So this PR is the fix to these issues. * eth: when triggering a sync, check the head header TD, not block * internal/web3ext: fix clique console apis to work on missing arguments * rpc: dont log an error if user configures --rpcapi=rpc... (#20776) This just prevents a false negative ERROR warning when, for some unknown reason, a user attempts to turn on the module rpc even though it's already going to be on. * node, cmd/clef: report actual port used for http rpc (#20789) * internal/ethapi: don't set sender-balance to maxuint, fixes #16999 (#20783) Prior to this change, eth_call changed the balance of the sender account in the EVM environment to 2^256 wei to cover the gas cost of the call execution. We've had this behavior for a long time even though it's super confusing. This commit sets the default call gasprice to zero instead of updating the balance, which is better because it makes eth_call semantics less surprising. Removing the built-in balance assignment also makes balance overrides work as expected. * metrics: disable CPU stats (gosigar) on iOS * cmd/devp2p: tweak DNS TTLs (#20801) * cmd/devp2p: tweak DNS TTLs * cmd/devp2p: bump treeNodeTTL to four weeks * cmd/devp2p: lower route53 change limit again (#20819) * cmd/devp2p: be very correct about route53 change splitting (#20820) Turns out the way RDATA limits work is documented after all, I just didn't search right. The trick to make it work is to count UPSERTs twice. This also adds an additional check to ensure TTL changes are applied on existing records. * graphql, node, rpc: fix typos in comments (#20824) * eth: improve shutdown synchronization (#20695) * eth: improve shutdown synchronization Most goroutines started by eth.Ethereum didn't have any shutdown sync at all, which lead to weird error messages when quitting the client. This change improves the clean shutdown path by stopping all internal components in dependency order and waiting for them to actually be stopped before shutdown is considered done. In particular, we now stop everything related to peers before stopping 'resident' parts such as core.BlockChain. * eth: rewrite sync controller * eth: remove sync start debug message * eth: notify chainSyncer about new peers after handshake * eth: move downloader.Cancel call into chainSyncer * eth: make post-sync block broadcast synchronous * eth: add comments * core: change blockchain stop message * eth: change closeBloomHandler channel type * eth/filters: fix typo on unindexedLogs function's comment (#20827) * core: bump txpool tx max size to 128KB * snapshotter/tests: verify snapdb post-state against trie (#20812) * core/state/snapshot: basic trie-to-hash implementation * tests: validate snapshot after test * core/state/snapshot: fix review concerns * cmd, consensus: add option to disable mmap for DAG caches/datasets (#20484) * cmd, consensus: add option to disable mmap for DAG caches/datasets * consensus: add benchmarks for mmap with/with lock * cmd/clef: add newaccount command (#20782) * cmd/clef: add newaccount command * cmd/clef: document clef_New, update API versioning * Update cmd/clef/intapi_changelog.md Co-Authored-By: ligi <ligi@ligi.de> * Update signer/core/uiapi.go Co-Authored-By: ligi <ligi@ligi.de> Co-authored-by: ligi <ligi@ligi.de> * eth: add debug_accountRange API (#19645) This new API allows reading accounts and their content by address range. Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: Felix Lange <fjl@twurst.com> * travis: allow cocoapods deploy to fail (#20833) * metrics: improve TestTimerFunc (#20818) The test failed due to what appears to be fluctuations in time.Sleep, which is not the actual method under test. This change modifies it so we compare the metered Max to the actual time instead of the desired time. * README: update private network genesis spec with istanbul (#20841) * add istanbul and muirGlacier to genesis states in README * remove muirGlacier, relocate istanbul * cmd/evm: Rework execution stats (#20792) - Dump stats also for --bench flag. - From memory stats only show number and size of allocations. This is what `test -bench` shows. I doubt others like number of GC runs are any useful, but can be added if requested. - Now the mem stats are for single execution in case of --bench. * cmd/devp2p, cmd/wnode, whisper: add missing calls to Timer.Stop (#20843) * p2p/server: add UDP port mapping goroutine to wait group (#20846) * accounts/abi faster unpacking of int256 (#20850) * p2p/discv5: add missing Timer.Stop calls (#20853) * miner/worker: add missing timer.Stop call (#20857) * cmd/geth: fix bad genesis test (#20860) * eth/filters: add missing Ticker.Stop call (#20862) * eth/fetcher: add missing timer.Stop calls (#20861) * event: add missing timer.Stop call in TestFeed (#20868) * metrics: add missing calls to Ticker.Stop in tests (#20866) * ethstats: add missing Ticker.Stop call (#20867) * p2p/discv5, p2p/testing: add missing Timer.Stop calls in tests (#20869) * core: add missing Timer.Stop call in TestLogReorgs (#20870) * rpc: add missing timer.Stop calls in websocket tests (#20863) * crypto/ecies: improve concatKDF (#20836) This removes a bunch of weird code around the counter overflow check in concatKDF and makes it actually work for different hash output sizes. The overflow check worked as follows: concatKDF applies the hash function N times, where N is roundup(kdLen, hashsize) / hashsize. N should not overflow 32 bits because that would lead to a repetition in the KDF output. A couple issues with the overflow check: - It used the hash.BlockSize, which is wrong because the block size is about the input of the hash function. Luckily, all standard hash functions have a block size that's greater than the output size, so concatKDF didn't crash, it just generated too much key material. - The check used big.Int to compare against 2^32-1. - The calculation could still overflow before reaching the check. The new code in concatKDF doesn't check for overflow. Instead, there is a new check on ECIESParams which ensures that params.KeyLen is < 512. This removes any possibility of overflow. There are a couple of miscellaneous improvements bundled in with this change: - The key buffer is pre-allocated instead of appending the hash output to an initially empty slice. - The code that uses concatKDF to derive keys is now shared between Encrypt and Decrypt. - There was a redundant invocation of IsOnCurve in Decrypt. This is now removed because elliptic.Unmarshal already checks whether the input is a valid curve point since Go 1.5. Co-authored-by: Felix Lange <fjl@twurst.com> * rpc: metrics for JSON-RPC method calls (#20847) This adds a couple of metrics for tracking the timing and frequency of method calls: - rpc/requests gauge counts all requests - rpc/success gauge counts requests which return err == nil - rpc/failure gauge counts requests which return err != nil - rpc/duration/all timer tracks timing of all requests - rpc/duration/<method>/<success/failure> tracks per-method timing * mobile: use bind.NewKeyedTransactor instead of duplicating (#20888) It's better to reuse the existing code to create a keyed transactor than to rewrite the logic again. * internal/ethapi: add CallArgs.ToMessage method (#20854) ToMessage is used to convert between ethapi.CallArgs and types.Message. It reduces the length of the DoCall method by about half by abstracting out the conversion between the CallArgs and the Message. This should improve the code's maintainability and reusability. * eth, les: fix flaky tests (#20897) * les: fix flaky test * eth: fix flaky test * cmd/geth: enable metrics for geth import command (#20738) * cmd/geth: enable metrics for geth import command * cmd/geth: enable metrics-flags for import command * core/vm: use a callcontext struct (#20761) * core/vm: use a callcontext struct * core/vm: fix tests * core/vm/runtime: benchmark * core/vm: make intpool push inlineable, unexpose callcontext * docs/audits: add discv5 protocol audits from LA and C53 (#20898) * .github: change gitter reference to discord link in issue template (#20896) * couple of fixes to docs in clef (#20900) * p2p/discover: add initial discovery v5 implementation (#20750)This adds an implementation of the current discovery v5 spec.There is full integration with cmd/devp2p and enode.Iterator in thisversion. In theory we could enable the new protocol as a replacement ofdiscovery v4 at any time. In practice, there will likely be a few morechanges to the spec and implementation before this can happen. * build: upgrade to golangci-lint 1.24.0 (#20901) * accounts/scwallet: remove unnecessary uses of fmt.Sprintf * cmd/puppeth: remove unnecessary uses of fmt.Sprintf * p2p/discv5: remove unnecessary use of fmt.Sprintf * whisper/mailserver: remove unnecessary uses of fmt.Sprintf * core: goimports -w tx_pool_test.go * eth/downloader: goimports -w downloader_test.go * build: upgrade to golangci-lint 1.24.0 * accounts/abi/bind: Refactored topics (#20851) * accounts/abi/bind: refactored topics * accounts/abi/bind: use store function to remove code duplication * accounts/abi/bind: removed unused type defs * accounts/abi/bind: error on tuples in topics * Cosmetic changes to restart travis build Co-authored-by: Guillaume Ballet <gballet@gmail.com> * node: allow websocket and HTTP on the same port (#20810) This change makes it possible to run geth with JSON-RPC over HTTP and WebSocket on the same TCP port. The default port for WebSocket is still 8546. geth --rpc --rpcport 8545 --ws --wsport 8545 This also removes a lot of deprecated API surface from package rpc. The rpc package is now purely about serving JSON-RPC and no longer provides a way to start an HTTP server. * crypto: improve error messages in LoadECDSA (#20718) This improves error messages when the file is too short or too long. Also rewrite the test for SaveECDSA because LoadECDSA has its own test now. Co-authored-by: Felix Lange <fjl@twurst.com> * changed date of rpcstack.go since new file (#20904) * accounts/abi/bind: fixed erroneous filtering of negative ints (#20865) * accounts/abi/bind: fixed erroneous packing of negative ints * accounts/abi/bind: added test cases for negative ints in topics * accounts/abi/bind: fixed genIntType for go 1.12 * accounts/abi: minor nitpick * cmd: deprecate --testnet, use named networks instead (#20852) * cmd/utils: make goerli the default testnet * cmd/geth: explicitly rename testnet to ropsten * core: explicitly rename testnet to ropsten * params: explicitly rename testnet to ropsten * cmd: explicitly rename testnet to ropsten * miner: explicitly rename testnet to ropsten * mobile: allow for returning the goerli spec * tests: explicitly rename testnet to ropsten * docs: update readme to reflect changes to the default testnet * mobile: allow for configuring goerli and rinkeby nodes * cmd/geth: revert --testnet back to ropsten and mark as legacy * cmd/util: mark --testnet flag as deprecated * docs: update readme to properly reflect the 3 testnets * cmd/utils: add an explicit deprecation warning on startup * cmd/utils: swap goerli and ropsten in usage * cmd/geth: swap goerli and ropsten in usage * cmd/geth: if running a known preset, log it for convenience * docs: improve readme on usage of ropsten's testnet datadir * cmd/utils: check if legacy `testnet` datadir exists for ropsten * cmd/geth: check for legacy testnet path in console command * cmd/geth: use switch statement for complex conditions in main * cmd/geth: move known preset log statement to the very top * cmd/utils: create new ropsten configurations in the ropsten datadir * cmd/utils: makedatadir should check for existing testnet dir * cmd/geth: add legacy testnet flag to the copy db command * cmd/geth: add legacy testnet flag to the inspect command * les, les/lespay/client: add service value statistics and API (#20837) This PR adds service value measurement statistics to the light client. It also adds a private API that makes these statistics accessible. A follow-up PR will add the new server pool which uses these statistics to select servers with good performance. This document describes the function of the new components: https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4 Co-authored-by: rjl493456442 <garyrong0905@gmail.com> Co-authored-by: rjl493456442 <garyrong0905@gmail.com> * README: update min go version to 1.13 (#20911) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 (#20913) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 * travis, appveyor: force GO111MODULE=on for every build * core/rawdb: fix data race between Retrieve and Close (#20919) * core/rawdb: fixed data race between retrieve and close closes https://github.com/ethereum/go-ethereum/issues/20420 * core/rawdb: use non-atomic load while holding mutex * all: simplify and fix database iteration with prefix/start (#20808) * core/state/snapshot: start fixing disk iterator seek * ethdb, rawdb, leveldb, memorydb: implement iterators with prefix and start * les, core/state/snapshot: iterator fixes * all: remove two iterator methods * all: rename Iteratee.NewIteratorWith -> NewIterator * ethdb: fix review concerns * params: update CHTs for the 1.9.13 release * params: release Geth v1.9.13 * added some missing files * post-rebase fixups Co-authored-by: Péter Szilágyi <peterke@gmail.com> Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: gary rong <garyrong0905@gmail.com> Co-authored-by: Alex Willmer <alex@moreati.org.uk> Co-authored-by: meowsbits <45600330+meowsbits@users.noreply.github.com> Co-authored-by: Felix Lange <fjl@twurst.com> Co-authored-by: rene <41963722+renaynay@users.noreply.github.com> Co-authored-by: Ha ĐANG <dvietha@gmail.com> Co-authored-by: Hanjiang Yu <42531996+de1acr0ix@users.noreply.github.com> Co-authored-by: ligi <ligi@ligi.de> Co-authored-by: Wenbiao Zheng <delweng@gmail.com> Co-authored-by: Adam Schmideg <adamschmideg@users.noreply.github.com> Co-authored-by: Jeff Wentworth <jeff@curvegrid.com> Co-authored-by: Paweł Bylica <chfast@gmail.com> Co-authored-by: ucwong <ucwong@126.com> Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de> Co-authored-by: Luke Champine <luke.champine@gmail.com> Co-authored-by: Boqin Qin <Bobbqqin@gmail.com> Co-authored-by: William Morriss <wjmelements@gmail.com> Co-authored-by: Guillaume Ballet <gballet@gmail.com> Co-authored-by: Raw Pong Ghmoa <58883403+q9f@users.noreply.github.com> Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
2020-04-19 17:31:47 +00:00
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
func TestWebsocketHTTPOnSeparatePort_WSRequest(t *testing.T) {
// try and get a free port
listener, err := net.Listen("tcp", "127.0.0.1:0")
geth 1.9.13 (#469) * core: initial version of state snapshots * core/state: lazy sorting, snapshot invalidation * core/state/snapshot: extract and split cap method, cover corners * snapshot: iteration and buffering optimizations * core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup * 123 * core/rawdb, core/state/snapshot: runtime snapshot generation * core/state/snapshot: fix difflayer origin-initalization after flatten * add "to merge" * core/state/snapshot: implement snapshot layer iteration * core/state/snapshot: node behavioural difference on bloom content * core: journal the snapshot inside leveldb, not a flat file * core/state/snapshot: bloom, metrics and prefetcher fixes * core/state/snapshot: move iterator out into its own files * core/state/snapshot: implement iterator priority for fast direct data lookup * core/state/snapshot: full featured account iteration * core/state/snapshot: faster account iteration, CLI integration * core: fix broken tests due to API changes + linter * core/state: fix an account resurrection issue * core/tests: test for destroy+recreate contract with storage * squashme * core/state/snapshot, tests: sync snap gen + snaps in consensus tests * core/state: extend snapshotter to handle account resurrections * core/state: fix account root hash update point * core/state: fix resurrection state clearing and access * core/state/snapshot: handle deleted accounts in fast iterator * core: more blockchain tests * core/state/snapshot: fix various iteration issues due to destruct set * core: fix two snapshot iterator flaws, decollide snap storage prefix * core/state/snapshot/iterator: fix two disk iterator flaws * core/rawdb: change SnapshotStoragePrefix to avoid prefix collision with preimagePrefix * params: begin v1.9.13 release cycle * cmd/checkpoint-admin: add some documentation (#20697) * go.mod: update duktape to fix sprintf warnings (#20777) This revision of go-duktype fixes the following warning ``` duk_logging.c: In function ‘duk__logger_prototype_log_shared’: duk_logging.c:184:64: warning: ‘Z’ directive writing 1 byte into a region of size between 0 and 9 [-Wformat-overflow=] 184 | sprintf((char *) date_buf, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", | ^ In file included from /usr/include/stdio.h:867, from duk_logging.c:5: /usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 25 and 85 bytes into a destination of size 32 36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` * core/rawdb: fix freezer table test error check Fixes: Condition is always 'false' because 'err' is always 'nil' * core/rawdb: improve table database (#20703) This PR fixes issues in TableDatabase. TableDatabase is a wrapper of underlying ethdb.Database with an additional prefix. The prefix is applied to all entries it maintains. However when we try to retrieve entries from it we don't handle the key properly. In theory the prefix should be truncated and only user key is returned. But we don't do it in some cases, e.g. the iterator and batch replayer created from it. So this PR is the fix to these issues. * eth: when triggering a sync, check the head header TD, not block * internal/web3ext: fix clique console apis to work on missing arguments * rpc: dont log an error if user configures --rpcapi=rpc... (#20776) This just prevents a false negative ERROR warning when, for some unknown reason, a user attempts to turn on the module rpc even though it's already going to be on. * node, cmd/clef: report actual port used for http rpc (#20789) * internal/ethapi: don't set sender-balance to maxuint, fixes #16999 (#20783) Prior to this change, eth_call changed the balance of the sender account in the EVM environment to 2^256 wei to cover the gas cost of the call execution. We've had this behavior for a long time even though it's super confusing. This commit sets the default call gasprice to zero instead of updating the balance, which is better because it makes eth_call semantics less surprising. Removing the built-in balance assignment also makes balance overrides work as expected. * metrics: disable CPU stats (gosigar) on iOS * cmd/devp2p: tweak DNS TTLs (#20801) * cmd/devp2p: tweak DNS TTLs * cmd/devp2p: bump treeNodeTTL to four weeks * cmd/devp2p: lower route53 change limit again (#20819) * cmd/devp2p: be very correct about route53 change splitting (#20820) Turns out the way RDATA limits work is documented after all, I just didn't search right. The trick to make it work is to count UPSERTs twice. This also adds an additional check to ensure TTL changes are applied on existing records. * graphql, node, rpc: fix typos in comments (#20824) * eth: improve shutdown synchronization (#20695) * eth: improve shutdown synchronization Most goroutines started by eth.Ethereum didn't have any shutdown sync at all, which lead to weird error messages when quitting the client. This change improves the clean shutdown path by stopping all internal components in dependency order and waiting for them to actually be stopped before shutdown is considered done. In particular, we now stop everything related to peers before stopping 'resident' parts such as core.BlockChain. * eth: rewrite sync controller * eth: remove sync start debug message * eth: notify chainSyncer about new peers after handshake * eth: move downloader.Cancel call into chainSyncer * eth: make post-sync block broadcast synchronous * eth: add comments * core: change blockchain stop message * eth: change closeBloomHandler channel type * eth/filters: fix typo on unindexedLogs function's comment (#20827) * core: bump txpool tx max size to 128KB * snapshotter/tests: verify snapdb post-state against trie (#20812) * core/state/snapshot: basic trie-to-hash implementation * tests: validate snapshot after test * core/state/snapshot: fix review concerns * cmd, consensus: add option to disable mmap for DAG caches/datasets (#20484) * cmd, consensus: add option to disable mmap for DAG caches/datasets * consensus: add benchmarks for mmap with/with lock * cmd/clef: add newaccount command (#20782) * cmd/clef: add newaccount command * cmd/clef: document clef_New, update API versioning * Update cmd/clef/intapi_changelog.md Co-Authored-By: ligi <ligi@ligi.de> * Update signer/core/uiapi.go Co-Authored-By: ligi <ligi@ligi.de> Co-authored-by: ligi <ligi@ligi.de> * eth: add debug_accountRange API (#19645) This new API allows reading accounts and their content by address range. Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: Felix Lange <fjl@twurst.com> * travis: allow cocoapods deploy to fail (#20833) * metrics: improve TestTimerFunc (#20818) The test failed due to what appears to be fluctuations in time.Sleep, which is not the actual method under test. This change modifies it so we compare the metered Max to the actual time instead of the desired time. * README: update private network genesis spec with istanbul (#20841) * add istanbul and muirGlacier to genesis states in README * remove muirGlacier, relocate istanbul * cmd/evm: Rework execution stats (#20792) - Dump stats also for --bench flag. - From memory stats only show number and size of allocations. This is what `test -bench` shows. I doubt others like number of GC runs are any useful, but can be added if requested. - Now the mem stats are for single execution in case of --bench. * cmd/devp2p, cmd/wnode, whisper: add missing calls to Timer.Stop (#20843) * p2p/server: add UDP port mapping goroutine to wait group (#20846) * accounts/abi faster unpacking of int256 (#20850) * p2p/discv5: add missing Timer.Stop calls (#20853) * miner/worker: add missing timer.Stop call (#20857) * cmd/geth: fix bad genesis test (#20860) * eth/filters: add missing Ticker.Stop call (#20862) * eth/fetcher: add missing timer.Stop calls (#20861) * event: add missing timer.Stop call in TestFeed (#20868) * metrics: add missing calls to Ticker.Stop in tests (#20866) * ethstats: add missing Ticker.Stop call (#20867) * p2p/discv5, p2p/testing: add missing Timer.Stop calls in tests (#20869) * core: add missing Timer.Stop call in TestLogReorgs (#20870) * rpc: add missing timer.Stop calls in websocket tests (#20863) * crypto/ecies: improve concatKDF (#20836) This removes a bunch of weird code around the counter overflow check in concatKDF and makes it actually work for different hash output sizes. The overflow check worked as follows: concatKDF applies the hash function N times, where N is roundup(kdLen, hashsize) / hashsize. N should not overflow 32 bits because that would lead to a repetition in the KDF output. A couple issues with the overflow check: - It used the hash.BlockSize, which is wrong because the block size is about the input of the hash function. Luckily, all standard hash functions have a block size that's greater than the output size, so concatKDF didn't crash, it just generated too much key material. - The check used big.Int to compare against 2^32-1. - The calculation could still overflow before reaching the check. The new code in concatKDF doesn't check for overflow. Instead, there is a new check on ECIESParams which ensures that params.KeyLen is < 512. This removes any possibility of overflow. There are a couple of miscellaneous improvements bundled in with this change: - The key buffer is pre-allocated instead of appending the hash output to an initially empty slice. - The code that uses concatKDF to derive keys is now shared between Encrypt and Decrypt. - There was a redundant invocation of IsOnCurve in Decrypt. This is now removed because elliptic.Unmarshal already checks whether the input is a valid curve point since Go 1.5. Co-authored-by: Felix Lange <fjl@twurst.com> * rpc: metrics for JSON-RPC method calls (#20847) This adds a couple of metrics for tracking the timing and frequency of method calls: - rpc/requests gauge counts all requests - rpc/success gauge counts requests which return err == nil - rpc/failure gauge counts requests which return err != nil - rpc/duration/all timer tracks timing of all requests - rpc/duration/<method>/<success/failure> tracks per-method timing * mobile: use bind.NewKeyedTransactor instead of duplicating (#20888) It's better to reuse the existing code to create a keyed transactor than to rewrite the logic again. * internal/ethapi: add CallArgs.ToMessage method (#20854) ToMessage is used to convert between ethapi.CallArgs and types.Message. It reduces the length of the DoCall method by about half by abstracting out the conversion between the CallArgs and the Message. This should improve the code's maintainability and reusability. * eth, les: fix flaky tests (#20897) * les: fix flaky test * eth: fix flaky test * cmd/geth: enable metrics for geth import command (#20738) * cmd/geth: enable metrics for geth import command * cmd/geth: enable metrics-flags for import command * core/vm: use a callcontext struct (#20761) * core/vm: use a callcontext struct * core/vm: fix tests * core/vm/runtime: benchmark * core/vm: make intpool push inlineable, unexpose callcontext * docs/audits: add discv5 protocol audits from LA and C53 (#20898) * .github: change gitter reference to discord link in issue template (#20896) * couple of fixes to docs in clef (#20900) * p2p/discover: add initial discovery v5 implementation (#20750)This adds an implementation of the current discovery v5 spec.There is full integration with cmd/devp2p and enode.Iterator in thisversion. In theory we could enable the new protocol as a replacement ofdiscovery v4 at any time. In practice, there will likely be a few morechanges to the spec and implementation before this can happen. * build: upgrade to golangci-lint 1.24.0 (#20901) * accounts/scwallet: remove unnecessary uses of fmt.Sprintf * cmd/puppeth: remove unnecessary uses of fmt.Sprintf * p2p/discv5: remove unnecessary use of fmt.Sprintf * whisper/mailserver: remove unnecessary uses of fmt.Sprintf * core: goimports -w tx_pool_test.go * eth/downloader: goimports -w downloader_test.go * build: upgrade to golangci-lint 1.24.0 * accounts/abi/bind: Refactored topics (#20851) * accounts/abi/bind: refactored topics * accounts/abi/bind: use store function to remove code duplication * accounts/abi/bind: removed unused type defs * accounts/abi/bind: error on tuples in topics * Cosmetic changes to restart travis build Co-authored-by: Guillaume Ballet <gballet@gmail.com> * node: allow websocket and HTTP on the same port (#20810) This change makes it possible to run geth with JSON-RPC over HTTP and WebSocket on the same TCP port. The default port for WebSocket is still 8546. geth --rpc --rpcport 8545 --ws --wsport 8545 This also removes a lot of deprecated API surface from package rpc. The rpc package is now purely about serving JSON-RPC and no longer provides a way to start an HTTP server. * crypto: improve error messages in LoadECDSA (#20718) This improves error messages when the file is too short or too long. Also rewrite the test for SaveECDSA because LoadECDSA has its own test now. Co-authored-by: Felix Lange <fjl@twurst.com> * changed date of rpcstack.go since new file (#20904) * accounts/abi/bind: fixed erroneous filtering of negative ints (#20865) * accounts/abi/bind: fixed erroneous packing of negative ints * accounts/abi/bind: added test cases for negative ints in topics * accounts/abi/bind: fixed genIntType for go 1.12 * accounts/abi: minor nitpick * cmd: deprecate --testnet, use named networks instead (#20852) * cmd/utils: make goerli the default testnet * cmd/geth: explicitly rename testnet to ropsten * core: explicitly rename testnet to ropsten * params: explicitly rename testnet to ropsten * cmd: explicitly rename testnet to ropsten * miner: explicitly rename testnet to ropsten * mobile: allow for returning the goerli spec * tests: explicitly rename testnet to ropsten * docs: update readme to reflect changes to the default testnet * mobile: allow for configuring goerli and rinkeby nodes * cmd/geth: revert --testnet back to ropsten and mark as legacy * cmd/util: mark --testnet flag as deprecated * docs: update readme to properly reflect the 3 testnets * cmd/utils: add an explicit deprecation warning on startup * cmd/utils: swap goerli and ropsten in usage * cmd/geth: swap goerli and ropsten in usage * cmd/geth: if running a known preset, log it for convenience * docs: improve readme on usage of ropsten's testnet datadir * cmd/utils: check if legacy `testnet` datadir exists for ropsten * cmd/geth: check for legacy testnet path in console command * cmd/geth: use switch statement for complex conditions in main * cmd/geth: move known preset log statement to the very top * cmd/utils: create new ropsten configurations in the ropsten datadir * cmd/utils: makedatadir should check for existing testnet dir * cmd/geth: add legacy testnet flag to the copy db command * cmd/geth: add legacy testnet flag to the inspect command * les, les/lespay/client: add service value statistics and API (#20837) This PR adds service value measurement statistics to the light client. It also adds a private API that makes these statistics accessible. A follow-up PR will add the new server pool which uses these statistics to select servers with good performance. This document describes the function of the new components: https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4 Co-authored-by: rjl493456442 <garyrong0905@gmail.com> Co-authored-by: rjl493456442 <garyrong0905@gmail.com> * README: update min go version to 1.13 (#20911) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 (#20913) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 * travis, appveyor: force GO111MODULE=on for every build * core/rawdb: fix data race between Retrieve and Close (#20919) * core/rawdb: fixed data race between retrieve and close closes https://github.com/ethereum/go-ethereum/issues/20420 * core/rawdb: use non-atomic load while holding mutex * all: simplify and fix database iteration with prefix/start (#20808) * core/state/snapshot: start fixing disk iterator seek * ethdb, rawdb, leveldb, memorydb: implement iterators with prefix and start * les, core/state/snapshot: iterator fixes * all: remove two iterator methods * all: rename Iteratee.NewIteratorWith -> NewIterator * ethdb: fix review concerns * params: update CHTs for the 1.9.13 release * params: release Geth v1.9.13 * added some missing files * post-rebase fixups Co-authored-by: Péter Szilágyi <peterke@gmail.com> Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: gary rong <garyrong0905@gmail.com> Co-authored-by: Alex Willmer <alex@moreati.org.uk> Co-authored-by: meowsbits <45600330+meowsbits@users.noreply.github.com> Co-authored-by: Felix Lange <fjl@twurst.com> Co-authored-by: rene <41963722+renaynay@users.noreply.github.com> Co-authored-by: Ha ĐANG <dvietha@gmail.com> Co-authored-by: Hanjiang Yu <42531996+de1acr0ix@users.noreply.github.com> Co-authored-by: ligi <ligi@ligi.de> Co-authored-by: Wenbiao Zheng <delweng@gmail.com> Co-authored-by: Adam Schmideg <adamschmideg@users.noreply.github.com> Co-authored-by: Jeff Wentworth <jeff@curvegrid.com> Co-authored-by: Paweł Bylica <chfast@gmail.com> Co-authored-by: ucwong <ucwong@126.com> Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de> Co-authored-by: Luke Champine <luke.champine@gmail.com> Co-authored-by: Boqin Qin <Bobbqqin@gmail.com> Co-authored-by: William Morriss <wjmelements@gmail.com> Co-authored-by: Guillaume Ballet <gballet@gmail.com> Co-authored-by: Raw Pong Ghmoa <58883403+q9f@users.noreply.github.com> Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
2020-04-19 17:31:47 +00:00
if err != nil {
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
t.Fatal("can't listen:", err)
geth 1.9.13 (#469) * core: initial version of state snapshots * core/state: lazy sorting, snapshot invalidation * core/state/snapshot: extract and split cap method, cover corners * snapshot: iteration and buffering optimizations * core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup * 123 * core/rawdb, core/state/snapshot: runtime snapshot generation * core/state/snapshot: fix difflayer origin-initalization after flatten * add "to merge" * core/state/snapshot: implement snapshot layer iteration * core/state/snapshot: node behavioural difference on bloom content * core: journal the snapshot inside leveldb, not a flat file * core/state/snapshot: bloom, metrics and prefetcher fixes * core/state/snapshot: move iterator out into its own files * core/state/snapshot: implement iterator priority for fast direct data lookup * core/state/snapshot: full featured account iteration * core/state/snapshot: faster account iteration, CLI integration * core: fix broken tests due to API changes + linter * core/state: fix an account resurrection issue * core/tests: test for destroy+recreate contract with storage * squashme * core/state/snapshot, tests: sync snap gen + snaps in consensus tests * core/state: extend snapshotter to handle account resurrections * core/state: fix account root hash update point * core/state: fix resurrection state clearing and access * core/state/snapshot: handle deleted accounts in fast iterator * core: more blockchain tests * core/state/snapshot: fix various iteration issues due to destruct set * core: fix two snapshot iterator flaws, decollide snap storage prefix * core/state/snapshot/iterator: fix two disk iterator flaws * core/rawdb: change SnapshotStoragePrefix to avoid prefix collision with preimagePrefix * params: begin v1.9.13 release cycle * cmd/checkpoint-admin: add some documentation (#20697) * go.mod: update duktape to fix sprintf warnings (#20777) This revision of go-duktype fixes the following warning ``` duk_logging.c: In function ‘duk__logger_prototype_log_shared’: duk_logging.c:184:64: warning: ‘Z’ directive writing 1 byte into a region of size between 0 and 9 [-Wformat-overflow=] 184 | sprintf((char *) date_buf, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", | ^ In file included from /usr/include/stdio.h:867, from duk_logging.c:5: /usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 25 and 85 bytes into a destination of size 32 36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` * core/rawdb: fix freezer table test error check Fixes: Condition is always 'false' because 'err' is always 'nil' * core/rawdb: improve table database (#20703) This PR fixes issues in TableDatabase. TableDatabase is a wrapper of underlying ethdb.Database with an additional prefix. The prefix is applied to all entries it maintains. However when we try to retrieve entries from it we don't handle the key properly. In theory the prefix should be truncated and only user key is returned. But we don't do it in some cases, e.g. the iterator and batch replayer created from it. So this PR is the fix to these issues. * eth: when triggering a sync, check the head header TD, not block * internal/web3ext: fix clique console apis to work on missing arguments * rpc: dont log an error if user configures --rpcapi=rpc... (#20776) This just prevents a false negative ERROR warning when, for some unknown reason, a user attempts to turn on the module rpc even though it's already going to be on. * node, cmd/clef: report actual port used for http rpc (#20789) * internal/ethapi: don't set sender-balance to maxuint, fixes #16999 (#20783) Prior to this change, eth_call changed the balance of the sender account in the EVM environment to 2^256 wei to cover the gas cost of the call execution. We've had this behavior for a long time even though it's super confusing. This commit sets the default call gasprice to zero instead of updating the balance, which is better because it makes eth_call semantics less surprising. Removing the built-in balance assignment also makes balance overrides work as expected. * metrics: disable CPU stats (gosigar) on iOS * cmd/devp2p: tweak DNS TTLs (#20801) * cmd/devp2p: tweak DNS TTLs * cmd/devp2p: bump treeNodeTTL to four weeks * cmd/devp2p: lower route53 change limit again (#20819) * cmd/devp2p: be very correct about route53 change splitting (#20820) Turns out the way RDATA limits work is documented after all, I just didn't search right. The trick to make it work is to count UPSERTs twice. This also adds an additional check to ensure TTL changes are applied on existing records. * graphql, node, rpc: fix typos in comments (#20824) * eth: improve shutdown synchronization (#20695) * eth: improve shutdown synchronization Most goroutines started by eth.Ethereum didn't have any shutdown sync at all, which lead to weird error messages when quitting the client. This change improves the clean shutdown path by stopping all internal components in dependency order and waiting for them to actually be stopped before shutdown is considered done. In particular, we now stop everything related to peers before stopping 'resident' parts such as core.BlockChain. * eth: rewrite sync controller * eth: remove sync start debug message * eth: notify chainSyncer about new peers after handshake * eth: move downloader.Cancel call into chainSyncer * eth: make post-sync block broadcast synchronous * eth: add comments * core: change blockchain stop message * eth: change closeBloomHandler channel type * eth/filters: fix typo on unindexedLogs function's comment (#20827) * core: bump txpool tx max size to 128KB * snapshotter/tests: verify snapdb post-state against trie (#20812) * core/state/snapshot: basic trie-to-hash implementation * tests: validate snapshot after test * core/state/snapshot: fix review concerns * cmd, consensus: add option to disable mmap for DAG caches/datasets (#20484) * cmd, consensus: add option to disable mmap for DAG caches/datasets * consensus: add benchmarks for mmap with/with lock * cmd/clef: add newaccount command (#20782) * cmd/clef: add newaccount command * cmd/clef: document clef_New, update API versioning * Update cmd/clef/intapi_changelog.md Co-Authored-By: ligi <ligi@ligi.de> * Update signer/core/uiapi.go Co-Authored-By: ligi <ligi@ligi.de> Co-authored-by: ligi <ligi@ligi.de> * eth: add debug_accountRange API (#19645) This new API allows reading accounts and their content by address range. Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: Felix Lange <fjl@twurst.com> * travis: allow cocoapods deploy to fail (#20833) * metrics: improve TestTimerFunc (#20818) The test failed due to what appears to be fluctuations in time.Sleep, which is not the actual method under test. This change modifies it so we compare the metered Max to the actual time instead of the desired time. * README: update private network genesis spec with istanbul (#20841) * add istanbul and muirGlacier to genesis states in README * remove muirGlacier, relocate istanbul * cmd/evm: Rework execution stats (#20792) - Dump stats also for --bench flag. - From memory stats only show number and size of allocations. This is what `test -bench` shows. I doubt others like number of GC runs are any useful, but can be added if requested. - Now the mem stats are for single execution in case of --bench. * cmd/devp2p, cmd/wnode, whisper: add missing calls to Timer.Stop (#20843) * p2p/server: add UDP port mapping goroutine to wait group (#20846) * accounts/abi faster unpacking of int256 (#20850) * p2p/discv5: add missing Timer.Stop calls (#20853) * miner/worker: add missing timer.Stop call (#20857) * cmd/geth: fix bad genesis test (#20860) * eth/filters: add missing Ticker.Stop call (#20862) * eth/fetcher: add missing timer.Stop calls (#20861) * event: add missing timer.Stop call in TestFeed (#20868) * metrics: add missing calls to Ticker.Stop in tests (#20866) * ethstats: add missing Ticker.Stop call (#20867) * p2p/discv5, p2p/testing: add missing Timer.Stop calls in tests (#20869) * core: add missing Timer.Stop call in TestLogReorgs (#20870) * rpc: add missing timer.Stop calls in websocket tests (#20863) * crypto/ecies: improve concatKDF (#20836) This removes a bunch of weird code around the counter overflow check in concatKDF and makes it actually work for different hash output sizes. The overflow check worked as follows: concatKDF applies the hash function N times, where N is roundup(kdLen, hashsize) / hashsize. N should not overflow 32 bits because that would lead to a repetition in the KDF output. A couple issues with the overflow check: - It used the hash.BlockSize, which is wrong because the block size is about the input of the hash function. Luckily, all standard hash functions have a block size that's greater than the output size, so concatKDF didn't crash, it just generated too much key material. - The check used big.Int to compare against 2^32-1. - The calculation could still overflow before reaching the check. The new code in concatKDF doesn't check for overflow. Instead, there is a new check on ECIESParams which ensures that params.KeyLen is < 512. This removes any possibility of overflow. There are a couple of miscellaneous improvements bundled in with this change: - The key buffer is pre-allocated instead of appending the hash output to an initially empty slice. - The code that uses concatKDF to derive keys is now shared between Encrypt and Decrypt. - There was a redundant invocation of IsOnCurve in Decrypt. This is now removed because elliptic.Unmarshal already checks whether the input is a valid curve point since Go 1.5. Co-authored-by: Felix Lange <fjl@twurst.com> * rpc: metrics for JSON-RPC method calls (#20847) This adds a couple of metrics for tracking the timing and frequency of method calls: - rpc/requests gauge counts all requests - rpc/success gauge counts requests which return err == nil - rpc/failure gauge counts requests which return err != nil - rpc/duration/all timer tracks timing of all requests - rpc/duration/<method>/<success/failure> tracks per-method timing * mobile: use bind.NewKeyedTransactor instead of duplicating (#20888) It's better to reuse the existing code to create a keyed transactor than to rewrite the logic again. * internal/ethapi: add CallArgs.ToMessage method (#20854) ToMessage is used to convert between ethapi.CallArgs and types.Message. It reduces the length of the DoCall method by about half by abstracting out the conversion between the CallArgs and the Message. This should improve the code's maintainability and reusability. * eth, les: fix flaky tests (#20897) * les: fix flaky test * eth: fix flaky test * cmd/geth: enable metrics for geth import command (#20738) * cmd/geth: enable metrics for geth import command * cmd/geth: enable metrics-flags for import command * core/vm: use a callcontext struct (#20761) * core/vm: use a callcontext struct * core/vm: fix tests * core/vm/runtime: benchmark * core/vm: make intpool push inlineable, unexpose callcontext * docs/audits: add discv5 protocol audits from LA and C53 (#20898) * .github: change gitter reference to discord link in issue template (#20896) * couple of fixes to docs in clef (#20900) * p2p/discover: add initial discovery v5 implementation (#20750)This adds an implementation of the current discovery v5 spec.There is full integration with cmd/devp2p and enode.Iterator in thisversion. In theory we could enable the new protocol as a replacement ofdiscovery v4 at any time. In practice, there will likely be a few morechanges to the spec and implementation before this can happen. * build: upgrade to golangci-lint 1.24.0 (#20901) * accounts/scwallet: remove unnecessary uses of fmt.Sprintf * cmd/puppeth: remove unnecessary uses of fmt.Sprintf * p2p/discv5: remove unnecessary use of fmt.Sprintf * whisper/mailserver: remove unnecessary uses of fmt.Sprintf * core: goimports -w tx_pool_test.go * eth/downloader: goimports -w downloader_test.go * build: upgrade to golangci-lint 1.24.0 * accounts/abi/bind: Refactored topics (#20851) * accounts/abi/bind: refactored topics * accounts/abi/bind: use store function to remove code duplication * accounts/abi/bind: removed unused type defs * accounts/abi/bind: error on tuples in topics * Cosmetic changes to restart travis build Co-authored-by: Guillaume Ballet <gballet@gmail.com> * node: allow websocket and HTTP on the same port (#20810) This change makes it possible to run geth with JSON-RPC over HTTP and WebSocket on the same TCP port. The default port for WebSocket is still 8546. geth --rpc --rpcport 8545 --ws --wsport 8545 This also removes a lot of deprecated API surface from package rpc. The rpc package is now purely about serving JSON-RPC and no longer provides a way to start an HTTP server. * crypto: improve error messages in LoadECDSA (#20718) This improves error messages when the file is too short or too long. Also rewrite the test for SaveECDSA because LoadECDSA has its own test now. Co-authored-by: Felix Lange <fjl@twurst.com> * changed date of rpcstack.go since new file (#20904) * accounts/abi/bind: fixed erroneous filtering of negative ints (#20865) * accounts/abi/bind: fixed erroneous packing of negative ints * accounts/abi/bind: added test cases for negative ints in topics * accounts/abi/bind: fixed genIntType for go 1.12 * accounts/abi: minor nitpick * cmd: deprecate --testnet, use named networks instead (#20852) * cmd/utils: make goerli the default testnet * cmd/geth: explicitly rename testnet to ropsten * core: explicitly rename testnet to ropsten * params: explicitly rename testnet to ropsten * cmd: explicitly rename testnet to ropsten * miner: explicitly rename testnet to ropsten * mobile: allow for returning the goerli spec * tests: explicitly rename testnet to ropsten * docs: update readme to reflect changes to the default testnet * mobile: allow for configuring goerli and rinkeby nodes * cmd/geth: revert --testnet back to ropsten and mark as legacy * cmd/util: mark --testnet flag as deprecated * docs: update readme to properly reflect the 3 testnets * cmd/utils: add an explicit deprecation warning on startup * cmd/utils: swap goerli and ropsten in usage * cmd/geth: swap goerli and ropsten in usage * cmd/geth: if running a known preset, log it for convenience * docs: improve readme on usage of ropsten's testnet datadir * cmd/utils: check if legacy `testnet` datadir exists for ropsten * cmd/geth: check for legacy testnet path in console command * cmd/geth: use switch statement for complex conditions in main * cmd/geth: move known preset log statement to the very top * cmd/utils: create new ropsten configurations in the ropsten datadir * cmd/utils: makedatadir should check for existing testnet dir * cmd/geth: add legacy testnet flag to the copy db command * cmd/geth: add legacy testnet flag to the inspect command * les, les/lespay/client: add service value statistics and API (#20837) This PR adds service value measurement statistics to the light client. It also adds a private API that makes these statistics accessible. A follow-up PR will add the new server pool which uses these statistics to select servers with good performance. This document describes the function of the new components: https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4 Co-authored-by: rjl493456442 <garyrong0905@gmail.com> Co-authored-by: rjl493456442 <garyrong0905@gmail.com> * README: update min go version to 1.13 (#20911) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 (#20913) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 * travis, appveyor: force GO111MODULE=on for every build * core/rawdb: fix data race between Retrieve and Close (#20919) * core/rawdb: fixed data race between retrieve and close closes https://github.com/ethereum/go-ethereum/issues/20420 * core/rawdb: use non-atomic load while holding mutex * all: simplify and fix database iteration with prefix/start (#20808) * core/state/snapshot: start fixing disk iterator seek * ethdb, rawdb, leveldb, memorydb: implement iterators with prefix and start * les, core/state/snapshot: iterator fixes * all: remove two iterator methods * all: rename Iteratee.NewIteratorWith -> NewIterator * ethdb: fix review concerns * params: update CHTs for the 1.9.13 release * params: release Geth v1.9.13 * added some missing files * post-rebase fixups Co-authored-by: Péter Szilágyi <peterke@gmail.com> Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: gary rong <garyrong0905@gmail.com> Co-authored-by: Alex Willmer <alex@moreati.org.uk> Co-authored-by: meowsbits <45600330+meowsbits@users.noreply.github.com> Co-authored-by: Felix Lange <fjl@twurst.com> Co-authored-by: rene <41963722+renaynay@users.noreply.github.com> Co-authored-by: Ha ĐANG <dvietha@gmail.com> Co-authored-by: Hanjiang Yu <42531996+de1acr0ix@users.noreply.github.com> Co-authored-by: ligi <ligi@ligi.de> Co-authored-by: Wenbiao Zheng <delweng@gmail.com> Co-authored-by: Adam Schmideg <adamschmideg@users.noreply.github.com> Co-authored-by: Jeff Wentworth <jeff@curvegrid.com> Co-authored-by: Paweł Bylica <chfast@gmail.com> Co-authored-by: ucwong <ucwong@126.com> Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de> Co-authored-by: Luke Champine <luke.champine@gmail.com> Co-authored-by: Boqin Qin <Bobbqqin@gmail.com> Co-authored-by: William Morriss <wjmelements@gmail.com> Co-authored-by: Guillaume Ballet <gballet@gmail.com> Co-authored-by: Raw Pong Ghmoa <58883403+q9f@users.noreply.github.com> Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
2020-04-19 17:31:47 +00:00
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
port := listener.Addr().(*net.TCPAddr).Port
listener.Close()
geth 1.9.13 (#469) * core: initial version of state snapshots * core/state: lazy sorting, snapshot invalidation * core/state/snapshot: extract and split cap method, cover corners * snapshot: iteration and buffering optimizations * core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup * 123 * core/rawdb, core/state/snapshot: runtime snapshot generation * core/state/snapshot: fix difflayer origin-initalization after flatten * add "to merge" * core/state/snapshot: implement snapshot layer iteration * core/state/snapshot: node behavioural difference on bloom content * core: journal the snapshot inside leveldb, not a flat file * core/state/snapshot: bloom, metrics and prefetcher fixes * core/state/snapshot: move iterator out into its own files * core/state/snapshot: implement iterator priority for fast direct data lookup * core/state/snapshot: full featured account iteration * core/state/snapshot: faster account iteration, CLI integration * core: fix broken tests due to API changes + linter * core/state: fix an account resurrection issue * core/tests: test for destroy+recreate contract with storage * squashme * core/state/snapshot, tests: sync snap gen + snaps in consensus tests * core/state: extend snapshotter to handle account resurrections * core/state: fix account root hash update point * core/state: fix resurrection state clearing and access * core/state/snapshot: handle deleted accounts in fast iterator * core: more blockchain tests * core/state/snapshot: fix various iteration issues due to destruct set * core: fix two snapshot iterator flaws, decollide snap storage prefix * core/state/snapshot/iterator: fix two disk iterator flaws * core/rawdb: change SnapshotStoragePrefix to avoid prefix collision with preimagePrefix * params: begin v1.9.13 release cycle * cmd/checkpoint-admin: add some documentation (#20697) * go.mod: update duktape to fix sprintf warnings (#20777) This revision of go-duktype fixes the following warning ``` duk_logging.c: In function ‘duk__logger_prototype_log_shared’: duk_logging.c:184:64: warning: ‘Z’ directive writing 1 byte into a region of size between 0 and 9 [-Wformat-overflow=] 184 | sprintf((char *) date_buf, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", | ^ In file included from /usr/include/stdio.h:867, from duk_logging.c:5: /usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 25 and 85 bytes into a destination of size 32 36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` * core/rawdb: fix freezer table test error check Fixes: Condition is always 'false' because 'err' is always 'nil' * core/rawdb: improve table database (#20703) This PR fixes issues in TableDatabase. TableDatabase is a wrapper of underlying ethdb.Database with an additional prefix. The prefix is applied to all entries it maintains. However when we try to retrieve entries from it we don't handle the key properly. In theory the prefix should be truncated and only user key is returned. But we don't do it in some cases, e.g. the iterator and batch replayer created from it. So this PR is the fix to these issues. * eth: when triggering a sync, check the head header TD, not block * internal/web3ext: fix clique console apis to work on missing arguments * rpc: dont log an error if user configures --rpcapi=rpc... (#20776) This just prevents a false negative ERROR warning when, for some unknown reason, a user attempts to turn on the module rpc even though it's already going to be on. * node, cmd/clef: report actual port used for http rpc (#20789) * internal/ethapi: don't set sender-balance to maxuint, fixes #16999 (#20783) Prior to this change, eth_call changed the balance of the sender account in the EVM environment to 2^256 wei to cover the gas cost of the call execution. We've had this behavior for a long time even though it's super confusing. This commit sets the default call gasprice to zero instead of updating the balance, which is better because it makes eth_call semantics less surprising. Removing the built-in balance assignment also makes balance overrides work as expected. * metrics: disable CPU stats (gosigar) on iOS * cmd/devp2p: tweak DNS TTLs (#20801) * cmd/devp2p: tweak DNS TTLs * cmd/devp2p: bump treeNodeTTL to four weeks * cmd/devp2p: lower route53 change limit again (#20819) * cmd/devp2p: be very correct about route53 change splitting (#20820) Turns out the way RDATA limits work is documented after all, I just didn't search right. The trick to make it work is to count UPSERTs twice. This also adds an additional check to ensure TTL changes are applied on existing records. * graphql, node, rpc: fix typos in comments (#20824) * eth: improve shutdown synchronization (#20695) * eth: improve shutdown synchronization Most goroutines started by eth.Ethereum didn't have any shutdown sync at all, which lead to weird error messages when quitting the client. This change improves the clean shutdown path by stopping all internal components in dependency order and waiting for them to actually be stopped before shutdown is considered done. In particular, we now stop everything related to peers before stopping 'resident' parts such as core.BlockChain. * eth: rewrite sync controller * eth: remove sync start debug message * eth: notify chainSyncer about new peers after handshake * eth: move downloader.Cancel call into chainSyncer * eth: make post-sync block broadcast synchronous * eth: add comments * core: change blockchain stop message * eth: change closeBloomHandler channel type * eth/filters: fix typo on unindexedLogs function's comment (#20827) * core: bump txpool tx max size to 128KB * snapshotter/tests: verify snapdb post-state against trie (#20812) * core/state/snapshot: basic trie-to-hash implementation * tests: validate snapshot after test * core/state/snapshot: fix review concerns * cmd, consensus: add option to disable mmap for DAG caches/datasets (#20484) * cmd, consensus: add option to disable mmap for DAG caches/datasets * consensus: add benchmarks for mmap with/with lock * cmd/clef: add newaccount command (#20782) * cmd/clef: add newaccount command * cmd/clef: document clef_New, update API versioning * Update cmd/clef/intapi_changelog.md Co-Authored-By: ligi <ligi@ligi.de> * Update signer/core/uiapi.go Co-Authored-By: ligi <ligi@ligi.de> Co-authored-by: ligi <ligi@ligi.de> * eth: add debug_accountRange API (#19645) This new API allows reading accounts and their content by address range. Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: Felix Lange <fjl@twurst.com> * travis: allow cocoapods deploy to fail (#20833) * metrics: improve TestTimerFunc (#20818) The test failed due to what appears to be fluctuations in time.Sleep, which is not the actual method under test. This change modifies it so we compare the metered Max to the actual time instead of the desired time. * README: update private network genesis spec with istanbul (#20841) * add istanbul and muirGlacier to genesis states in README * remove muirGlacier, relocate istanbul * cmd/evm: Rework execution stats (#20792) - Dump stats also for --bench flag. - From memory stats only show number and size of allocations. This is what `test -bench` shows. I doubt others like number of GC runs are any useful, but can be added if requested. - Now the mem stats are for single execution in case of --bench. * cmd/devp2p, cmd/wnode, whisper: add missing calls to Timer.Stop (#20843) * p2p/server: add UDP port mapping goroutine to wait group (#20846) * accounts/abi faster unpacking of int256 (#20850) * p2p/discv5: add missing Timer.Stop calls (#20853) * miner/worker: add missing timer.Stop call (#20857) * cmd/geth: fix bad genesis test (#20860) * eth/filters: add missing Ticker.Stop call (#20862) * eth/fetcher: add missing timer.Stop calls (#20861) * event: add missing timer.Stop call in TestFeed (#20868) * metrics: add missing calls to Ticker.Stop in tests (#20866) * ethstats: add missing Ticker.Stop call (#20867) * p2p/discv5, p2p/testing: add missing Timer.Stop calls in tests (#20869) * core: add missing Timer.Stop call in TestLogReorgs (#20870) * rpc: add missing timer.Stop calls in websocket tests (#20863) * crypto/ecies: improve concatKDF (#20836) This removes a bunch of weird code around the counter overflow check in concatKDF and makes it actually work for different hash output sizes. The overflow check worked as follows: concatKDF applies the hash function N times, where N is roundup(kdLen, hashsize) / hashsize. N should not overflow 32 bits because that would lead to a repetition in the KDF output. A couple issues with the overflow check: - It used the hash.BlockSize, which is wrong because the block size is about the input of the hash function. Luckily, all standard hash functions have a block size that's greater than the output size, so concatKDF didn't crash, it just generated too much key material. - The check used big.Int to compare against 2^32-1. - The calculation could still overflow before reaching the check. The new code in concatKDF doesn't check for overflow. Instead, there is a new check on ECIESParams which ensures that params.KeyLen is < 512. This removes any possibility of overflow. There are a couple of miscellaneous improvements bundled in with this change: - The key buffer is pre-allocated instead of appending the hash output to an initially empty slice. - The code that uses concatKDF to derive keys is now shared between Encrypt and Decrypt. - There was a redundant invocation of IsOnCurve in Decrypt. This is now removed because elliptic.Unmarshal already checks whether the input is a valid curve point since Go 1.5. Co-authored-by: Felix Lange <fjl@twurst.com> * rpc: metrics for JSON-RPC method calls (#20847) This adds a couple of metrics for tracking the timing and frequency of method calls: - rpc/requests gauge counts all requests - rpc/success gauge counts requests which return err == nil - rpc/failure gauge counts requests which return err != nil - rpc/duration/all timer tracks timing of all requests - rpc/duration/<method>/<success/failure> tracks per-method timing * mobile: use bind.NewKeyedTransactor instead of duplicating (#20888) It's better to reuse the existing code to create a keyed transactor than to rewrite the logic again. * internal/ethapi: add CallArgs.ToMessage method (#20854) ToMessage is used to convert between ethapi.CallArgs and types.Message. It reduces the length of the DoCall method by about half by abstracting out the conversion between the CallArgs and the Message. This should improve the code's maintainability and reusability. * eth, les: fix flaky tests (#20897) * les: fix flaky test * eth: fix flaky test * cmd/geth: enable metrics for geth import command (#20738) * cmd/geth: enable metrics for geth import command * cmd/geth: enable metrics-flags for import command * core/vm: use a callcontext struct (#20761) * core/vm: use a callcontext struct * core/vm: fix tests * core/vm/runtime: benchmark * core/vm: make intpool push inlineable, unexpose callcontext * docs/audits: add discv5 protocol audits from LA and C53 (#20898) * .github: change gitter reference to discord link in issue template (#20896) * couple of fixes to docs in clef (#20900) * p2p/discover: add initial discovery v5 implementation (#20750)This adds an implementation of the current discovery v5 spec.There is full integration with cmd/devp2p and enode.Iterator in thisversion. In theory we could enable the new protocol as a replacement ofdiscovery v4 at any time. In practice, there will likely be a few morechanges to the spec and implementation before this can happen. * build: upgrade to golangci-lint 1.24.0 (#20901) * accounts/scwallet: remove unnecessary uses of fmt.Sprintf * cmd/puppeth: remove unnecessary uses of fmt.Sprintf * p2p/discv5: remove unnecessary use of fmt.Sprintf * whisper/mailserver: remove unnecessary uses of fmt.Sprintf * core: goimports -w tx_pool_test.go * eth/downloader: goimports -w downloader_test.go * build: upgrade to golangci-lint 1.24.0 * accounts/abi/bind: Refactored topics (#20851) * accounts/abi/bind: refactored topics * accounts/abi/bind: use store function to remove code duplication * accounts/abi/bind: removed unused type defs * accounts/abi/bind: error on tuples in topics * Cosmetic changes to restart travis build Co-authored-by: Guillaume Ballet <gballet@gmail.com> * node: allow websocket and HTTP on the same port (#20810) This change makes it possible to run geth with JSON-RPC over HTTP and WebSocket on the same TCP port. The default port for WebSocket is still 8546. geth --rpc --rpcport 8545 --ws --wsport 8545 This also removes a lot of deprecated API surface from package rpc. The rpc package is now purely about serving JSON-RPC and no longer provides a way to start an HTTP server. * crypto: improve error messages in LoadECDSA (#20718) This improves error messages when the file is too short or too long. Also rewrite the test for SaveECDSA because LoadECDSA has its own test now. Co-authored-by: Felix Lange <fjl@twurst.com> * changed date of rpcstack.go since new file (#20904) * accounts/abi/bind: fixed erroneous filtering of negative ints (#20865) * accounts/abi/bind: fixed erroneous packing of negative ints * accounts/abi/bind: added test cases for negative ints in topics * accounts/abi/bind: fixed genIntType for go 1.12 * accounts/abi: minor nitpick * cmd: deprecate --testnet, use named networks instead (#20852) * cmd/utils: make goerli the default testnet * cmd/geth: explicitly rename testnet to ropsten * core: explicitly rename testnet to ropsten * params: explicitly rename testnet to ropsten * cmd: explicitly rename testnet to ropsten * miner: explicitly rename testnet to ropsten * mobile: allow for returning the goerli spec * tests: explicitly rename testnet to ropsten * docs: update readme to reflect changes to the default testnet * mobile: allow for configuring goerli and rinkeby nodes * cmd/geth: revert --testnet back to ropsten and mark as legacy * cmd/util: mark --testnet flag as deprecated * docs: update readme to properly reflect the 3 testnets * cmd/utils: add an explicit deprecation warning on startup * cmd/utils: swap goerli and ropsten in usage * cmd/geth: swap goerli and ropsten in usage * cmd/geth: if running a known preset, log it for convenience * docs: improve readme on usage of ropsten's testnet datadir * cmd/utils: check if legacy `testnet` datadir exists for ropsten * cmd/geth: check for legacy testnet path in console command * cmd/geth: use switch statement for complex conditions in main * cmd/geth: move known preset log statement to the very top * cmd/utils: create new ropsten configurations in the ropsten datadir * cmd/utils: makedatadir should check for existing testnet dir * cmd/geth: add legacy testnet flag to the copy db command * cmd/geth: add legacy testnet flag to the inspect command * les, les/lespay/client: add service value statistics and API (#20837) This PR adds service value measurement statistics to the light client. It also adds a private API that makes these statistics accessible. A follow-up PR will add the new server pool which uses these statistics to select servers with good performance. This document describes the function of the new components: https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4 Co-authored-by: rjl493456442 <garyrong0905@gmail.com> Co-authored-by: rjl493456442 <garyrong0905@gmail.com> * README: update min go version to 1.13 (#20911) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 (#20913) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 * travis, appveyor: force GO111MODULE=on for every build * core/rawdb: fix data race between Retrieve and Close (#20919) * core/rawdb: fixed data race between retrieve and close closes https://github.com/ethereum/go-ethereum/issues/20420 * core/rawdb: use non-atomic load while holding mutex * all: simplify and fix database iteration with prefix/start (#20808) * core/state/snapshot: start fixing disk iterator seek * ethdb, rawdb, leveldb, memorydb: implement iterators with prefix and start * les, core/state/snapshot: iterator fixes * all: remove two iterator methods * all: rename Iteratee.NewIteratorWith -> NewIterator * ethdb: fix review concerns * params: update CHTs for the 1.9.13 release * params: release Geth v1.9.13 * added some missing files * post-rebase fixups Co-authored-by: Péter Szilágyi <peterke@gmail.com> Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: gary rong <garyrong0905@gmail.com> Co-authored-by: Alex Willmer <alex@moreati.org.uk> Co-authored-by: meowsbits <45600330+meowsbits@users.noreply.github.com> Co-authored-by: Felix Lange <fjl@twurst.com> Co-authored-by: rene <41963722+renaynay@users.noreply.github.com> Co-authored-by: Ha ĐANG <dvietha@gmail.com> Co-authored-by: Hanjiang Yu <42531996+de1acr0ix@users.noreply.github.com> Co-authored-by: ligi <ligi@ligi.de> Co-authored-by: Wenbiao Zheng <delweng@gmail.com> Co-authored-by: Adam Schmideg <adamschmideg@users.noreply.github.com> Co-authored-by: Jeff Wentworth <jeff@curvegrid.com> Co-authored-by: Paweł Bylica <chfast@gmail.com> Co-authored-by: ucwong <ucwong@126.com> Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de> Co-authored-by: Luke Champine <luke.champine@gmail.com> Co-authored-by: Boqin Qin <Bobbqqin@gmail.com> Co-authored-by: William Morriss <wjmelements@gmail.com> Co-authored-by: Guillaume Ballet <gballet@gmail.com> Co-authored-by: Raw Pong Ghmoa <58883403+q9f@users.noreply.github.com> Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
2020-04-19 17:31:47 +00:00
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
node := startHTTP(t, 0, port)
defer node.Close()
geth 1.9.13 (#469) * core: initial version of state snapshots * core/state: lazy sorting, snapshot invalidation * core/state/snapshot: extract and split cap method, cover corners * snapshot: iteration and buffering optimizations * core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup * 123 * core/rawdb, core/state/snapshot: runtime snapshot generation * core/state/snapshot: fix difflayer origin-initalization after flatten * add "to merge" * core/state/snapshot: implement snapshot layer iteration * core/state/snapshot: node behavioural difference on bloom content * core: journal the snapshot inside leveldb, not a flat file * core/state/snapshot: bloom, metrics and prefetcher fixes * core/state/snapshot: move iterator out into its own files * core/state/snapshot: implement iterator priority for fast direct data lookup * core/state/snapshot: full featured account iteration * core/state/snapshot: faster account iteration, CLI integration * core: fix broken tests due to API changes + linter * core/state: fix an account resurrection issue * core/tests: test for destroy+recreate contract with storage * squashme * core/state/snapshot, tests: sync snap gen + snaps in consensus tests * core/state: extend snapshotter to handle account resurrections * core/state: fix account root hash update point * core/state: fix resurrection state clearing and access * core/state/snapshot: handle deleted accounts in fast iterator * core: more blockchain tests * core/state/snapshot: fix various iteration issues due to destruct set * core: fix two snapshot iterator flaws, decollide snap storage prefix * core/state/snapshot/iterator: fix two disk iterator flaws * core/rawdb: change SnapshotStoragePrefix to avoid prefix collision with preimagePrefix * params: begin v1.9.13 release cycle * cmd/checkpoint-admin: add some documentation (#20697) * go.mod: update duktape to fix sprintf warnings (#20777) This revision of go-duktype fixes the following warning ``` duk_logging.c: In function ‘duk__logger_prototype_log_shared’: duk_logging.c:184:64: warning: ‘Z’ directive writing 1 byte into a region of size between 0 and 9 [-Wformat-overflow=] 184 | sprintf((char *) date_buf, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", | ^ In file included from /usr/include/stdio.h:867, from duk_logging.c:5: /usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 25 and 85 bytes into a destination of size 32 36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` * core/rawdb: fix freezer table test error check Fixes: Condition is always 'false' because 'err' is always 'nil' * core/rawdb: improve table database (#20703) This PR fixes issues in TableDatabase. TableDatabase is a wrapper of underlying ethdb.Database with an additional prefix. The prefix is applied to all entries it maintains. However when we try to retrieve entries from it we don't handle the key properly. In theory the prefix should be truncated and only user key is returned. But we don't do it in some cases, e.g. the iterator and batch replayer created from it. So this PR is the fix to these issues. * eth: when triggering a sync, check the head header TD, not block * internal/web3ext: fix clique console apis to work on missing arguments * rpc: dont log an error if user configures --rpcapi=rpc... (#20776) This just prevents a false negative ERROR warning when, for some unknown reason, a user attempts to turn on the module rpc even though it's already going to be on. * node, cmd/clef: report actual port used for http rpc (#20789) * internal/ethapi: don't set sender-balance to maxuint, fixes #16999 (#20783) Prior to this change, eth_call changed the balance of the sender account in the EVM environment to 2^256 wei to cover the gas cost of the call execution. We've had this behavior for a long time even though it's super confusing. This commit sets the default call gasprice to zero instead of updating the balance, which is better because it makes eth_call semantics less surprising. Removing the built-in balance assignment also makes balance overrides work as expected. * metrics: disable CPU stats (gosigar) on iOS * cmd/devp2p: tweak DNS TTLs (#20801) * cmd/devp2p: tweak DNS TTLs * cmd/devp2p: bump treeNodeTTL to four weeks * cmd/devp2p: lower route53 change limit again (#20819) * cmd/devp2p: be very correct about route53 change splitting (#20820) Turns out the way RDATA limits work is documented after all, I just didn't search right. The trick to make it work is to count UPSERTs twice. This also adds an additional check to ensure TTL changes are applied on existing records. * graphql, node, rpc: fix typos in comments (#20824) * eth: improve shutdown synchronization (#20695) * eth: improve shutdown synchronization Most goroutines started by eth.Ethereum didn't have any shutdown sync at all, which lead to weird error messages when quitting the client. This change improves the clean shutdown path by stopping all internal components in dependency order and waiting for them to actually be stopped before shutdown is considered done. In particular, we now stop everything related to peers before stopping 'resident' parts such as core.BlockChain. * eth: rewrite sync controller * eth: remove sync start debug message * eth: notify chainSyncer about new peers after handshake * eth: move downloader.Cancel call into chainSyncer * eth: make post-sync block broadcast synchronous * eth: add comments * core: change blockchain stop message * eth: change closeBloomHandler channel type * eth/filters: fix typo on unindexedLogs function's comment (#20827) * core: bump txpool tx max size to 128KB * snapshotter/tests: verify snapdb post-state against trie (#20812) * core/state/snapshot: basic trie-to-hash implementation * tests: validate snapshot after test * core/state/snapshot: fix review concerns * cmd, consensus: add option to disable mmap for DAG caches/datasets (#20484) * cmd, consensus: add option to disable mmap for DAG caches/datasets * consensus: add benchmarks for mmap with/with lock * cmd/clef: add newaccount command (#20782) * cmd/clef: add newaccount command * cmd/clef: document clef_New, update API versioning * Update cmd/clef/intapi_changelog.md Co-Authored-By: ligi <ligi@ligi.de> * Update signer/core/uiapi.go Co-Authored-By: ligi <ligi@ligi.de> Co-authored-by: ligi <ligi@ligi.de> * eth: add debug_accountRange API (#19645) This new API allows reading accounts and their content by address range. Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: Felix Lange <fjl@twurst.com> * travis: allow cocoapods deploy to fail (#20833) * metrics: improve TestTimerFunc (#20818) The test failed due to what appears to be fluctuations in time.Sleep, which is not the actual method under test. This change modifies it so we compare the metered Max to the actual time instead of the desired time. * README: update private network genesis spec with istanbul (#20841) * add istanbul and muirGlacier to genesis states in README * remove muirGlacier, relocate istanbul * cmd/evm: Rework execution stats (#20792) - Dump stats also for --bench flag. - From memory stats only show number and size of allocations. This is what `test -bench` shows. I doubt others like number of GC runs are any useful, but can be added if requested. - Now the mem stats are for single execution in case of --bench. * cmd/devp2p, cmd/wnode, whisper: add missing calls to Timer.Stop (#20843) * p2p/server: add UDP port mapping goroutine to wait group (#20846) * accounts/abi faster unpacking of int256 (#20850) * p2p/discv5: add missing Timer.Stop calls (#20853) * miner/worker: add missing timer.Stop call (#20857) * cmd/geth: fix bad genesis test (#20860) * eth/filters: add missing Ticker.Stop call (#20862) * eth/fetcher: add missing timer.Stop calls (#20861) * event: add missing timer.Stop call in TestFeed (#20868) * metrics: add missing calls to Ticker.Stop in tests (#20866) * ethstats: add missing Ticker.Stop call (#20867) * p2p/discv5, p2p/testing: add missing Timer.Stop calls in tests (#20869) * core: add missing Timer.Stop call in TestLogReorgs (#20870) * rpc: add missing timer.Stop calls in websocket tests (#20863) * crypto/ecies: improve concatKDF (#20836) This removes a bunch of weird code around the counter overflow check in concatKDF and makes it actually work for different hash output sizes. The overflow check worked as follows: concatKDF applies the hash function N times, where N is roundup(kdLen, hashsize) / hashsize. N should not overflow 32 bits because that would lead to a repetition in the KDF output. A couple issues with the overflow check: - It used the hash.BlockSize, which is wrong because the block size is about the input of the hash function. Luckily, all standard hash functions have a block size that's greater than the output size, so concatKDF didn't crash, it just generated too much key material. - The check used big.Int to compare against 2^32-1. - The calculation could still overflow before reaching the check. The new code in concatKDF doesn't check for overflow. Instead, there is a new check on ECIESParams which ensures that params.KeyLen is < 512. This removes any possibility of overflow. There are a couple of miscellaneous improvements bundled in with this change: - The key buffer is pre-allocated instead of appending the hash output to an initially empty slice. - The code that uses concatKDF to derive keys is now shared between Encrypt and Decrypt. - There was a redundant invocation of IsOnCurve in Decrypt. This is now removed because elliptic.Unmarshal already checks whether the input is a valid curve point since Go 1.5. Co-authored-by: Felix Lange <fjl@twurst.com> * rpc: metrics for JSON-RPC method calls (#20847) This adds a couple of metrics for tracking the timing and frequency of method calls: - rpc/requests gauge counts all requests - rpc/success gauge counts requests which return err == nil - rpc/failure gauge counts requests which return err != nil - rpc/duration/all timer tracks timing of all requests - rpc/duration/<method>/<success/failure> tracks per-method timing * mobile: use bind.NewKeyedTransactor instead of duplicating (#20888) It's better to reuse the existing code to create a keyed transactor than to rewrite the logic again. * internal/ethapi: add CallArgs.ToMessage method (#20854) ToMessage is used to convert between ethapi.CallArgs and types.Message. It reduces the length of the DoCall method by about half by abstracting out the conversion between the CallArgs and the Message. This should improve the code's maintainability and reusability. * eth, les: fix flaky tests (#20897) * les: fix flaky test * eth: fix flaky test * cmd/geth: enable metrics for geth import command (#20738) * cmd/geth: enable metrics for geth import command * cmd/geth: enable metrics-flags for import command * core/vm: use a callcontext struct (#20761) * core/vm: use a callcontext struct * core/vm: fix tests * core/vm/runtime: benchmark * core/vm: make intpool push inlineable, unexpose callcontext * docs/audits: add discv5 protocol audits from LA and C53 (#20898) * .github: change gitter reference to discord link in issue template (#20896) * couple of fixes to docs in clef (#20900) * p2p/discover: add initial discovery v5 implementation (#20750)This adds an implementation of the current discovery v5 spec.There is full integration with cmd/devp2p and enode.Iterator in thisversion. In theory we could enable the new protocol as a replacement ofdiscovery v4 at any time. In practice, there will likely be a few morechanges to the spec and implementation before this can happen. * build: upgrade to golangci-lint 1.24.0 (#20901) * accounts/scwallet: remove unnecessary uses of fmt.Sprintf * cmd/puppeth: remove unnecessary uses of fmt.Sprintf * p2p/discv5: remove unnecessary use of fmt.Sprintf * whisper/mailserver: remove unnecessary uses of fmt.Sprintf * core: goimports -w tx_pool_test.go * eth/downloader: goimports -w downloader_test.go * build: upgrade to golangci-lint 1.24.0 * accounts/abi/bind: Refactored topics (#20851) * accounts/abi/bind: refactored topics * accounts/abi/bind: use store function to remove code duplication * accounts/abi/bind: removed unused type defs * accounts/abi/bind: error on tuples in topics * Cosmetic changes to restart travis build Co-authored-by: Guillaume Ballet <gballet@gmail.com> * node: allow websocket and HTTP on the same port (#20810) This change makes it possible to run geth with JSON-RPC over HTTP and WebSocket on the same TCP port. The default port for WebSocket is still 8546. geth --rpc --rpcport 8545 --ws --wsport 8545 This also removes a lot of deprecated API surface from package rpc. The rpc package is now purely about serving JSON-RPC and no longer provides a way to start an HTTP server. * crypto: improve error messages in LoadECDSA (#20718) This improves error messages when the file is too short or too long. Also rewrite the test for SaveECDSA because LoadECDSA has its own test now. Co-authored-by: Felix Lange <fjl@twurst.com> * changed date of rpcstack.go since new file (#20904) * accounts/abi/bind: fixed erroneous filtering of negative ints (#20865) * accounts/abi/bind: fixed erroneous packing of negative ints * accounts/abi/bind: added test cases for negative ints in topics * accounts/abi/bind: fixed genIntType for go 1.12 * accounts/abi: minor nitpick * cmd: deprecate --testnet, use named networks instead (#20852) * cmd/utils: make goerli the default testnet * cmd/geth: explicitly rename testnet to ropsten * core: explicitly rename testnet to ropsten * params: explicitly rename testnet to ropsten * cmd: explicitly rename testnet to ropsten * miner: explicitly rename testnet to ropsten * mobile: allow for returning the goerli spec * tests: explicitly rename testnet to ropsten * docs: update readme to reflect changes to the default testnet * mobile: allow for configuring goerli and rinkeby nodes * cmd/geth: revert --testnet back to ropsten and mark as legacy * cmd/util: mark --testnet flag as deprecated * docs: update readme to properly reflect the 3 testnets * cmd/utils: add an explicit deprecation warning on startup * cmd/utils: swap goerli and ropsten in usage * cmd/geth: swap goerli and ropsten in usage * cmd/geth: if running a known preset, log it for convenience * docs: improve readme on usage of ropsten's testnet datadir * cmd/utils: check if legacy `testnet` datadir exists for ropsten * cmd/geth: check for legacy testnet path in console command * cmd/geth: use switch statement for complex conditions in main * cmd/geth: move known preset log statement to the very top * cmd/utils: create new ropsten configurations in the ropsten datadir * cmd/utils: makedatadir should check for existing testnet dir * cmd/geth: add legacy testnet flag to the copy db command * cmd/geth: add legacy testnet flag to the inspect command * les, les/lespay/client: add service value statistics and API (#20837) This PR adds service value measurement statistics to the light client. It also adds a private API that makes these statistics accessible. A follow-up PR will add the new server pool which uses these statistics to select servers with good performance. This document describes the function of the new components: https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4 Co-authored-by: rjl493456442 <garyrong0905@gmail.com> Co-authored-by: rjl493456442 <garyrong0905@gmail.com> * README: update min go version to 1.13 (#20911) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 (#20913) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 * travis, appveyor: force GO111MODULE=on for every build * core/rawdb: fix data race between Retrieve and Close (#20919) * core/rawdb: fixed data race between retrieve and close closes https://github.com/ethereum/go-ethereum/issues/20420 * core/rawdb: use non-atomic load while holding mutex * all: simplify and fix database iteration with prefix/start (#20808) * core/state/snapshot: start fixing disk iterator seek * ethdb, rawdb, leveldb, memorydb: implement iterators with prefix and start * les, core/state/snapshot: iterator fixes * all: remove two iterator methods * all: rename Iteratee.NewIteratorWith -> NewIterator * ethdb: fix review concerns * params: update CHTs for the 1.9.13 release * params: release Geth v1.9.13 * added some missing files * post-rebase fixups Co-authored-by: Péter Szilágyi <peterke@gmail.com> Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: gary rong <garyrong0905@gmail.com> Co-authored-by: Alex Willmer <alex@moreati.org.uk> Co-authored-by: meowsbits <45600330+meowsbits@users.noreply.github.com> Co-authored-by: Felix Lange <fjl@twurst.com> Co-authored-by: rene <41963722+renaynay@users.noreply.github.com> Co-authored-by: Ha ĐANG <dvietha@gmail.com> Co-authored-by: Hanjiang Yu <42531996+de1acr0ix@users.noreply.github.com> Co-authored-by: ligi <ligi@ligi.de> Co-authored-by: Wenbiao Zheng <delweng@gmail.com> Co-authored-by: Adam Schmideg <adamschmideg@users.noreply.github.com> Co-authored-by: Jeff Wentworth <jeff@curvegrid.com> Co-authored-by: Paweł Bylica <chfast@gmail.com> Co-authored-by: ucwong <ucwong@126.com> Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de> Co-authored-by: Luke Champine <luke.champine@gmail.com> Co-authored-by: Boqin Qin <Bobbqqin@gmail.com> Co-authored-by: William Morriss <wjmelements@gmail.com> Co-authored-by: Guillaume Ballet <gballet@gmail.com> Co-authored-by: Raw Pong Ghmoa <58883403+q9f@users.noreply.github.com> Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
2020-04-19 17:31:47 +00:00
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
wsOnHTTP := strings.Replace(node.HTTPEndpoint(), "http://", "ws://", 1)
ws := fmt.Sprintf("ws://127.0.0.1:%d", port)
geth 1.9.13 (#469) * core: initial version of state snapshots * core/state: lazy sorting, snapshot invalidation * core/state/snapshot: extract and split cap method, cover corners * snapshot: iteration and buffering optimizations * core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup * 123 * core/rawdb, core/state/snapshot: runtime snapshot generation * core/state/snapshot: fix difflayer origin-initalization after flatten * add "to merge" * core/state/snapshot: implement snapshot layer iteration * core/state/snapshot: node behavioural difference on bloom content * core: journal the snapshot inside leveldb, not a flat file * core/state/snapshot: bloom, metrics and prefetcher fixes * core/state/snapshot: move iterator out into its own files * core/state/snapshot: implement iterator priority for fast direct data lookup * core/state/snapshot: full featured account iteration * core/state/snapshot: faster account iteration, CLI integration * core: fix broken tests due to API changes + linter * core/state: fix an account resurrection issue * core/tests: test for destroy+recreate contract with storage * squashme * core/state/snapshot, tests: sync snap gen + snaps in consensus tests * core/state: extend snapshotter to handle account resurrections * core/state: fix account root hash update point * core/state: fix resurrection state clearing and access * core/state/snapshot: handle deleted accounts in fast iterator * core: more blockchain tests * core/state/snapshot: fix various iteration issues due to destruct set * core: fix two snapshot iterator flaws, decollide snap storage prefix * core/state/snapshot/iterator: fix two disk iterator flaws * core/rawdb: change SnapshotStoragePrefix to avoid prefix collision with preimagePrefix * params: begin v1.9.13 release cycle * cmd/checkpoint-admin: add some documentation (#20697) * go.mod: update duktape to fix sprintf warnings (#20777) This revision of go-duktype fixes the following warning ``` duk_logging.c: In function ‘duk__logger_prototype_log_shared’: duk_logging.c:184:64: warning: ‘Z’ directive writing 1 byte into a region of size between 0 and 9 [-Wformat-overflow=] 184 | sprintf((char *) date_buf, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", | ^ In file included from /usr/include/stdio.h:867, from duk_logging.c:5: /usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 25 and 85 bytes into a destination of size 32 36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` * core/rawdb: fix freezer table test error check Fixes: Condition is always 'false' because 'err' is always 'nil' * core/rawdb: improve table database (#20703) This PR fixes issues in TableDatabase. TableDatabase is a wrapper of underlying ethdb.Database with an additional prefix. The prefix is applied to all entries it maintains. However when we try to retrieve entries from it we don't handle the key properly. In theory the prefix should be truncated and only user key is returned. But we don't do it in some cases, e.g. the iterator and batch replayer created from it. So this PR is the fix to these issues. * eth: when triggering a sync, check the head header TD, not block * internal/web3ext: fix clique console apis to work on missing arguments * rpc: dont log an error if user configures --rpcapi=rpc... (#20776) This just prevents a false negative ERROR warning when, for some unknown reason, a user attempts to turn on the module rpc even though it's already going to be on. * node, cmd/clef: report actual port used for http rpc (#20789) * internal/ethapi: don't set sender-balance to maxuint, fixes #16999 (#20783) Prior to this change, eth_call changed the balance of the sender account in the EVM environment to 2^256 wei to cover the gas cost of the call execution. We've had this behavior for a long time even though it's super confusing. This commit sets the default call gasprice to zero instead of updating the balance, which is better because it makes eth_call semantics less surprising. Removing the built-in balance assignment also makes balance overrides work as expected. * metrics: disable CPU stats (gosigar) on iOS * cmd/devp2p: tweak DNS TTLs (#20801) * cmd/devp2p: tweak DNS TTLs * cmd/devp2p: bump treeNodeTTL to four weeks * cmd/devp2p: lower route53 change limit again (#20819) * cmd/devp2p: be very correct about route53 change splitting (#20820) Turns out the way RDATA limits work is documented after all, I just didn't search right. The trick to make it work is to count UPSERTs twice. This also adds an additional check to ensure TTL changes are applied on existing records. * graphql, node, rpc: fix typos in comments (#20824) * eth: improve shutdown synchronization (#20695) * eth: improve shutdown synchronization Most goroutines started by eth.Ethereum didn't have any shutdown sync at all, which lead to weird error messages when quitting the client. This change improves the clean shutdown path by stopping all internal components in dependency order and waiting for them to actually be stopped before shutdown is considered done. In particular, we now stop everything related to peers before stopping 'resident' parts such as core.BlockChain. * eth: rewrite sync controller * eth: remove sync start debug message * eth: notify chainSyncer about new peers after handshake * eth: move downloader.Cancel call into chainSyncer * eth: make post-sync block broadcast synchronous * eth: add comments * core: change blockchain stop message * eth: change closeBloomHandler channel type * eth/filters: fix typo on unindexedLogs function's comment (#20827) * core: bump txpool tx max size to 128KB * snapshotter/tests: verify snapdb post-state against trie (#20812) * core/state/snapshot: basic trie-to-hash implementation * tests: validate snapshot after test * core/state/snapshot: fix review concerns * cmd, consensus: add option to disable mmap for DAG caches/datasets (#20484) * cmd, consensus: add option to disable mmap for DAG caches/datasets * consensus: add benchmarks for mmap with/with lock * cmd/clef: add newaccount command (#20782) * cmd/clef: add newaccount command * cmd/clef: document clef_New, update API versioning * Update cmd/clef/intapi_changelog.md Co-Authored-By: ligi <ligi@ligi.de> * Update signer/core/uiapi.go Co-Authored-By: ligi <ligi@ligi.de> Co-authored-by: ligi <ligi@ligi.de> * eth: add debug_accountRange API (#19645) This new API allows reading accounts and their content by address range. Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: Felix Lange <fjl@twurst.com> * travis: allow cocoapods deploy to fail (#20833) * metrics: improve TestTimerFunc (#20818) The test failed due to what appears to be fluctuations in time.Sleep, which is not the actual method under test. This change modifies it so we compare the metered Max to the actual time instead of the desired time. * README: update private network genesis spec with istanbul (#20841) * add istanbul and muirGlacier to genesis states in README * remove muirGlacier, relocate istanbul * cmd/evm: Rework execution stats (#20792) - Dump stats also for --bench flag. - From memory stats only show number and size of allocations. This is what `test -bench` shows. I doubt others like number of GC runs are any useful, but can be added if requested. - Now the mem stats are for single execution in case of --bench. * cmd/devp2p, cmd/wnode, whisper: add missing calls to Timer.Stop (#20843) * p2p/server: add UDP port mapping goroutine to wait group (#20846) * accounts/abi faster unpacking of int256 (#20850) * p2p/discv5: add missing Timer.Stop calls (#20853) * miner/worker: add missing timer.Stop call (#20857) * cmd/geth: fix bad genesis test (#20860) * eth/filters: add missing Ticker.Stop call (#20862) * eth/fetcher: add missing timer.Stop calls (#20861) * event: add missing timer.Stop call in TestFeed (#20868) * metrics: add missing calls to Ticker.Stop in tests (#20866) * ethstats: add missing Ticker.Stop call (#20867) * p2p/discv5, p2p/testing: add missing Timer.Stop calls in tests (#20869) * core: add missing Timer.Stop call in TestLogReorgs (#20870) * rpc: add missing timer.Stop calls in websocket tests (#20863) * crypto/ecies: improve concatKDF (#20836) This removes a bunch of weird code around the counter overflow check in concatKDF and makes it actually work for different hash output sizes. The overflow check worked as follows: concatKDF applies the hash function N times, where N is roundup(kdLen, hashsize) / hashsize. N should not overflow 32 bits because that would lead to a repetition in the KDF output. A couple issues with the overflow check: - It used the hash.BlockSize, which is wrong because the block size is about the input of the hash function. Luckily, all standard hash functions have a block size that's greater than the output size, so concatKDF didn't crash, it just generated too much key material. - The check used big.Int to compare against 2^32-1. - The calculation could still overflow before reaching the check. The new code in concatKDF doesn't check for overflow. Instead, there is a new check on ECIESParams which ensures that params.KeyLen is < 512. This removes any possibility of overflow. There are a couple of miscellaneous improvements bundled in with this change: - The key buffer is pre-allocated instead of appending the hash output to an initially empty slice. - The code that uses concatKDF to derive keys is now shared between Encrypt and Decrypt. - There was a redundant invocation of IsOnCurve in Decrypt. This is now removed because elliptic.Unmarshal already checks whether the input is a valid curve point since Go 1.5. Co-authored-by: Felix Lange <fjl@twurst.com> * rpc: metrics for JSON-RPC method calls (#20847) This adds a couple of metrics for tracking the timing and frequency of method calls: - rpc/requests gauge counts all requests - rpc/success gauge counts requests which return err == nil - rpc/failure gauge counts requests which return err != nil - rpc/duration/all timer tracks timing of all requests - rpc/duration/<method>/<success/failure> tracks per-method timing * mobile: use bind.NewKeyedTransactor instead of duplicating (#20888) It's better to reuse the existing code to create a keyed transactor than to rewrite the logic again. * internal/ethapi: add CallArgs.ToMessage method (#20854) ToMessage is used to convert between ethapi.CallArgs and types.Message. It reduces the length of the DoCall method by about half by abstracting out the conversion between the CallArgs and the Message. This should improve the code's maintainability and reusability. * eth, les: fix flaky tests (#20897) * les: fix flaky test * eth: fix flaky test * cmd/geth: enable metrics for geth import command (#20738) * cmd/geth: enable metrics for geth import command * cmd/geth: enable metrics-flags for import command * core/vm: use a callcontext struct (#20761) * core/vm: use a callcontext struct * core/vm: fix tests * core/vm/runtime: benchmark * core/vm: make intpool push inlineable, unexpose callcontext * docs/audits: add discv5 protocol audits from LA and C53 (#20898) * .github: change gitter reference to discord link in issue template (#20896) * couple of fixes to docs in clef (#20900) * p2p/discover: add initial discovery v5 implementation (#20750)This adds an implementation of the current discovery v5 spec.There is full integration with cmd/devp2p and enode.Iterator in thisversion. In theory we could enable the new protocol as a replacement ofdiscovery v4 at any time. In practice, there will likely be a few morechanges to the spec and implementation before this can happen. * build: upgrade to golangci-lint 1.24.0 (#20901) * accounts/scwallet: remove unnecessary uses of fmt.Sprintf * cmd/puppeth: remove unnecessary uses of fmt.Sprintf * p2p/discv5: remove unnecessary use of fmt.Sprintf * whisper/mailserver: remove unnecessary uses of fmt.Sprintf * core: goimports -w tx_pool_test.go * eth/downloader: goimports -w downloader_test.go * build: upgrade to golangci-lint 1.24.0 * accounts/abi/bind: Refactored topics (#20851) * accounts/abi/bind: refactored topics * accounts/abi/bind: use store function to remove code duplication * accounts/abi/bind: removed unused type defs * accounts/abi/bind: error on tuples in topics * Cosmetic changes to restart travis build Co-authored-by: Guillaume Ballet <gballet@gmail.com> * node: allow websocket and HTTP on the same port (#20810) This change makes it possible to run geth with JSON-RPC over HTTP and WebSocket on the same TCP port. The default port for WebSocket is still 8546. geth --rpc --rpcport 8545 --ws --wsport 8545 This also removes a lot of deprecated API surface from package rpc. The rpc package is now purely about serving JSON-RPC and no longer provides a way to start an HTTP server. * crypto: improve error messages in LoadECDSA (#20718) This improves error messages when the file is too short or too long. Also rewrite the test for SaveECDSA because LoadECDSA has its own test now. Co-authored-by: Felix Lange <fjl@twurst.com> * changed date of rpcstack.go since new file (#20904) * accounts/abi/bind: fixed erroneous filtering of negative ints (#20865) * accounts/abi/bind: fixed erroneous packing of negative ints * accounts/abi/bind: added test cases for negative ints in topics * accounts/abi/bind: fixed genIntType for go 1.12 * accounts/abi: minor nitpick * cmd: deprecate --testnet, use named networks instead (#20852) * cmd/utils: make goerli the default testnet * cmd/geth: explicitly rename testnet to ropsten * core: explicitly rename testnet to ropsten * params: explicitly rename testnet to ropsten * cmd: explicitly rename testnet to ropsten * miner: explicitly rename testnet to ropsten * mobile: allow for returning the goerli spec * tests: explicitly rename testnet to ropsten * docs: update readme to reflect changes to the default testnet * mobile: allow for configuring goerli and rinkeby nodes * cmd/geth: revert --testnet back to ropsten and mark as legacy * cmd/util: mark --testnet flag as deprecated * docs: update readme to properly reflect the 3 testnets * cmd/utils: add an explicit deprecation warning on startup * cmd/utils: swap goerli and ropsten in usage * cmd/geth: swap goerli and ropsten in usage * cmd/geth: if running a known preset, log it for convenience * docs: improve readme on usage of ropsten's testnet datadir * cmd/utils: check if legacy `testnet` datadir exists for ropsten * cmd/geth: check for legacy testnet path in console command * cmd/geth: use switch statement for complex conditions in main * cmd/geth: move known preset log statement to the very top * cmd/utils: create new ropsten configurations in the ropsten datadir * cmd/utils: makedatadir should check for existing testnet dir * cmd/geth: add legacy testnet flag to the copy db command * cmd/geth: add legacy testnet flag to the inspect command * les, les/lespay/client: add service value statistics and API (#20837) This PR adds service value measurement statistics to the light client. It also adds a private API that makes these statistics accessible. A follow-up PR will add the new server pool which uses these statistics to select servers with good performance. This document describes the function of the new components: https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4 Co-authored-by: rjl493456442 <garyrong0905@gmail.com> Co-authored-by: rjl493456442 <garyrong0905@gmail.com> * README: update min go version to 1.13 (#20911) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 (#20913) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 * travis, appveyor: force GO111MODULE=on for every build * core/rawdb: fix data race between Retrieve and Close (#20919) * core/rawdb: fixed data race between retrieve and close closes https://github.com/ethereum/go-ethereum/issues/20420 * core/rawdb: use non-atomic load while holding mutex * all: simplify and fix database iteration with prefix/start (#20808) * core/state/snapshot: start fixing disk iterator seek * ethdb, rawdb, leveldb, memorydb: implement iterators with prefix and start * les, core/state/snapshot: iterator fixes * all: remove two iterator methods * all: rename Iteratee.NewIteratorWith -> NewIterator * ethdb: fix review concerns * params: update CHTs for the 1.9.13 release * params: release Geth v1.9.13 * added some missing files * post-rebase fixups Co-authored-by: Péter Szilágyi <peterke@gmail.com> Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: gary rong <garyrong0905@gmail.com> Co-authored-by: Alex Willmer <alex@moreati.org.uk> Co-authored-by: meowsbits <45600330+meowsbits@users.noreply.github.com> Co-authored-by: Felix Lange <fjl@twurst.com> Co-authored-by: rene <41963722+renaynay@users.noreply.github.com> Co-authored-by: Ha ĐANG <dvietha@gmail.com> Co-authored-by: Hanjiang Yu <42531996+de1acr0ix@users.noreply.github.com> Co-authored-by: ligi <ligi@ligi.de> Co-authored-by: Wenbiao Zheng <delweng@gmail.com> Co-authored-by: Adam Schmideg <adamschmideg@users.noreply.github.com> Co-authored-by: Jeff Wentworth <jeff@curvegrid.com> Co-authored-by: Paweł Bylica <chfast@gmail.com> Co-authored-by: ucwong <ucwong@126.com> Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de> Co-authored-by: Luke Champine <luke.champine@gmail.com> Co-authored-by: Boqin Qin <Bobbqqin@gmail.com> Co-authored-by: William Morriss <wjmelements@gmail.com> Co-authored-by: Guillaume Ballet <gballet@gmail.com> Co-authored-by: Raw Pong Ghmoa <58883403+q9f@users.noreply.github.com> Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
2020-04-19 17:31:47 +00:00
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
if node.WSEndpoint() == wsOnHTTP {
t.Fatalf("endpoints should not be the same")
}
// ensure ws endpoint matches the expected endpoint
if node.WSEndpoint() != ws {
t.Fatalf("ws endpoint is incorrect: expected %s, got %s", ws, node.WSEndpoint())
}
if !checkRPC(ws) {
t.Fatalf("ws request failed")
}
if !checkRPC(node.HTTPEndpoint()) {
t.Fatalf("http request failed")
geth 1.9.13 (#469) * core: initial version of state snapshots * core/state: lazy sorting, snapshot invalidation * core/state/snapshot: extract and split cap method, cover corners * snapshot: iteration and buffering optimizations * core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup * 123 * core/rawdb, core/state/snapshot: runtime snapshot generation * core/state/snapshot: fix difflayer origin-initalization after flatten * add "to merge" * core/state/snapshot: implement snapshot layer iteration * core/state/snapshot: node behavioural difference on bloom content * core: journal the snapshot inside leveldb, not a flat file * core/state/snapshot: bloom, metrics and prefetcher fixes * core/state/snapshot: move iterator out into its own files * core/state/snapshot: implement iterator priority for fast direct data lookup * core/state/snapshot: full featured account iteration * core/state/snapshot: faster account iteration, CLI integration * core: fix broken tests due to API changes + linter * core/state: fix an account resurrection issue * core/tests: test for destroy+recreate contract with storage * squashme * core/state/snapshot, tests: sync snap gen + snaps in consensus tests * core/state: extend snapshotter to handle account resurrections * core/state: fix account root hash update point * core/state: fix resurrection state clearing and access * core/state/snapshot: handle deleted accounts in fast iterator * core: more blockchain tests * core/state/snapshot: fix various iteration issues due to destruct set * core: fix two snapshot iterator flaws, decollide snap storage prefix * core/state/snapshot/iterator: fix two disk iterator flaws * core/rawdb: change SnapshotStoragePrefix to avoid prefix collision with preimagePrefix * params: begin v1.9.13 release cycle * cmd/checkpoint-admin: add some documentation (#20697) * go.mod: update duktape to fix sprintf warnings (#20777) This revision of go-duktype fixes the following warning ``` duk_logging.c: In function ‘duk__logger_prototype_log_shared’: duk_logging.c:184:64: warning: ‘Z’ directive writing 1 byte into a region of size between 0 and 9 [-Wformat-overflow=] 184 | sprintf((char *) date_buf, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", | ^ In file included from /usr/include/stdio.h:867, from duk_logging.c:5: /usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 25 and 85 bytes into a destination of size 32 36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` * core/rawdb: fix freezer table test error check Fixes: Condition is always 'false' because 'err' is always 'nil' * core/rawdb: improve table database (#20703) This PR fixes issues in TableDatabase. TableDatabase is a wrapper of underlying ethdb.Database with an additional prefix. The prefix is applied to all entries it maintains. However when we try to retrieve entries from it we don't handle the key properly. In theory the prefix should be truncated and only user key is returned. But we don't do it in some cases, e.g. the iterator and batch replayer created from it. So this PR is the fix to these issues. * eth: when triggering a sync, check the head header TD, not block * internal/web3ext: fix clique console apis to work on missing arguments * rpc: dont log an error if user configures --rpcapi=rpc... (#20776) This just prevents a false negative ERROR warning when, for some unknown reason, a user attempts to turn on the module rpc even though it's already going to be on. * node, cmd/clef: report actual port used for http rpc (#20789) * internal/ethapi: don't set sender-balance to maxuint, fixes #16999 (#20783) Prior to this change, eth_call changed the balance of the sender account in the EVM environment to 2^256 wei to cover the gas cost of the call execution. We've had this behavior for a long time even though it's super confusing. This commit sets the default call gasprice to zero instead of updating the balance, which is better because it makes eth_call semantics less surprising. Removing the built-in balance assignment also makes balance overrides work as expected. * metrics: disable CPU stats (gosigar) on iOS * cmd/devp2p: tweak DNS TTLs (#20801) * cmd/devp2p: tweak DNS TTLs * cmd/devp2p: bump treeNodeTTL to four weeks * cmd/devp2p: lower route53 change limit again (#20819) * cmd/devp2p: be very correct about route53 change splitting (#20820) Turns out the way RDATA limits work is documented after all, I just didn't search right. The trick to make it work is to count UPSERTs twice. This also adds an additional check to ensure TTL changes are applied on existing records. * graphql, node, rpc: fix typos in comments (#20824) * eth: improve shutdown synchronization (#20695) * eth: improve shutdown synchronization Most goroutines started by eth.Ethereum didn't have any shutdown sync at all, which lead to weird error messages when quitting the client. This change improves the clean shutdown path by stopping all internal components in dependency order and waiting for them to actually be stopped before shutdown is considered done. In particular, we now stop everything related to peers before stopping 'resident' parts such as core.BlockChain. * eth: rewrite sync controller * eth: remove sync start debug message * eth: notify chainSyncer about new peers after handshake * eth: move downloader.Cancel call into chainSyncer * eth: make post-sync block broadcast synchronous * eth: add comments * core: change blockchain stop message * eth: change closeBloomHandler channel type * eth/filters: fix typo on unindexedLogs function's comment (#20827) * core: bump txpool tx max size to 128KB * snapshotter/tests: verify snapdb post-state against trie (#20812) * core/state/snapshot: basic trie-to-hash implementation * tests: validate snapshot after test * core/state/snapshot: fix review concerns * cmd, consensus: add option to disable mmap for DAG caches/datasets (#20484) * cmd, consensus: add option to disable mmap for DAG caches/datasets * consensus: add benchmarks for mmap with/with lock * cmd/clef: add newaccount command (#20782) * cmd/clef: add newaccount command * cmd/clef: document clef_New, update API versioning * Update cmd/clef/intapi_changelog.md Co-Authored-By: ligi <ligi@ligi.de> * Update signer/core/uiapi.go Co-Authored-By: ligi <ligi@ligi.de> Co-authored-by: ligi <ligi@ligi.de> * eth: add debug_accountRange API (#19645) This new API allows reading accounts and their content by address range. Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: Felix Lange <fjl@twurst.com> * travis: allow cocoapods deploy to fail (#20833) * metrics: improve TestTimerFunc (#20818) The test failed due to what appears to be fluctuations in time.Sleep, which is not the actual method under test. This change modifies it so we compare the metered Max to the actual time instead of the desired time. * README: update private network genesis spec with istanbul (#20841) * add istanbul and muirGlacier to genesis states in README * remove muirGlacier, relocate istanbul * cmd/evm: Rework execution stats (#20792) - Dump stats also for --bench flag. - From memory stats only show number and size of allocations. This is what `test -bench` shows. I doubt others like number of GC runs are any useful, but can be added if requested. - Now the mem stats are for single execution in case of --bench. * cmd/devp2p, cmd/wnode, whisper: add missing calls to Timer.Stop (#20843) * p2p/server: add UDP port mapping goroutine to wait group (#20846) * accounts/abi faster unpacking of int256 (#20850) * p2p/discv5: add missing Timer.Stop calls (#20853) * miner/worker: add missing timer.Stop call (#20857) * cmd/geth: fix bad genesis test (#20860) * eth/filters: add missing Ticker.Stop call (#20862) * eth/fetcher: add missing timer.Stop calls (#20861) * event: add missing timer.Stop call in TestFeed (#20868) * metrics: add missing calls to Ticker.Stop in tests (#20866) * ethstats: add missing Ticker.Stop call (#20867) * p2p/discv5, p2p/testing: add missing Timer.Stop calls in tests (#20869) * core: add missing Timer.Stop call in TestLogReorgs (#20870) * rpc: add missing timer.Stop calls in websocket tests (#20863) * crypto/ecies: improve concatKDF (#20836) This removes a bunch of weird code around the counter overflow check in concatKDF and makes it actually work for different hash output sizes. The overflow check worked as follows: concatKDF applies the hash function N times, where N is roundup(kdLen, hashsize) / hashsize. N should not overflow 32 bits because that would lead to a repetition in the KDF output. A couple issues with the overflow check: - It used the hash.BlockSize, which is wrong because the block size is about the input of the hash function. Luckily, all standard hash functions have a block size that's greater than the output size, so concatKDF didn't crash, it just generated too much key material. - The check used big.Int to compare against 2^32-1. - The calculation could still overflow before reaching the check. The new code in concatKDF doesn't check for overflow. Instead, there is a new check on ECIESParams which ensures that params.KeyLen is < 512. This removes any possibility of overflow. There are a couple of miscellaneous improvements bundled in with this change: - The key buffer is pre-allocated instead of appending the hash output to an initially empty slice. - The code that uses concatKDF to derive keys is now shared between Encrypt and Decrypt. - There was a redundant invocation of IsOnCurve in Decrypt. This is now removed because elliptic.Unmarshal already checks whether the input is a valid curve point since Go 1.5. Co-authored-by: Felix Lange <fjl@twurst.com> * rpc: metrics for JSON-RPC method calls (#20847) This adds a couple of metrics for tracking the timing and frequency of method calls: - rpc/requests gauge counts all requests - rpc/success gauge counts requests which return err == nil - rpc/failure gauge counts requests which return err != nil - rpc/duration/all timer tracks timing of all requests - rpc/duration/<method>/<success/failure> tracks per-method timing * mobile: use bind.NewKeyedTransactor instead of duplicating (#20888) It's better to reuse the existing code to create a keyed transactor than to rewrite the logic again. * internal/ethapi: add CallArgs.ToMessage method (#20854) ToMessage is used to convert between ethapi.CallArgs and types.Message. It reduces the length of the DoCall method by about half by abstracting out the conversion between the CallArgs and the Message. This should improve the code's maintainability and reusability. * eth, les: fix flaky tests (#20897) * les: fix flaky test * eth: fix flaky test * cmd/geth: enable metrics for geth import command (#20738) * cmd/geth: enable metrics for geth import command * cmd/geth: enable metrics-flags for import command * core/vm: use a callcontext struct (#20761) * core/vm: use a callcontext struct * core/vm: fix tests * core/vm/runtime: benchmark * core/vm: make intpool push inlineable, unexpose callcontext * docs/audits: add discv5 protocol audits from LA and C53 (#20898) * .github: change gitter reference to discord link in issue template (#20896) * couple of fixes to docs in clef (#20900) * p2p/discover: add initial discovery v5 implementation (#20750)This adds an implementation of the current discovery v5 spec.There is full integration with cmd/devp2p and enode.Iterator in thisversion. In theory we could enable the new protocol as a replacement ofdiscovery v4 at any time. In practice, there will likely be a few morechanges to the spec and implementation before this can happen. * build: upgrade to golangci-lint 1.24.0 (#20901) * accounts/scwallet: remove unnecessary uses of fmt.Sprintf * cmd/puppeth: remove unnecessary uses of fmt.Sprintf * p2p/discv5: remove unnecessary use of fmt.Sprintf * whisper/mailserver: remove unnecessary uses of fmt.Sprintf * core: goimports -w tx_pool_test.go * eth/downloader: goimports -w downloader_test.go * build: upgrade to golangci-lint 1.24.0 * accounts/abi/bind: Refactored topics (#20851) * accounts/abi/bind: refactored topics * accounts/abi/bind: use store function to remove code duplication * accounts/abi/bind: removed unused type defs * accounts/abi/bind: error on tuples in topics * Cosmetic changes to restart travis build Co-authored-by: Guillaume Ballet <gballet@gmail.com> * node: allow websocket and HTTP on the same port (#20810) This change makes it possible to run geth with JSON-RPC over HTTP and WebSocket on the same TCP port. The default port for WebSocket is still 8546. geth --rpc --rpcport 8545 --ws --wsport 8545 This also removes a lot of deprecated API surface from package rpc. The rpc package is now purely about serving JSON-RPC and no longer provides a way to start an HTTP server. * crypto: improve error messages in LoadECDSA (#20718) This improves error messages when the file is too short or too long. Also rewrite the test for SaveECDSA because LoadECDSA has its own test now. Co-authored-by: Felix Lange <fjl@twurst.com> * changed date of rpcstack.go since new file (#20904) * accounts/abi/bind: fixed erroneous filtering of negative ints (#20865) * accounts/abi/bind: fixed erroneous packing of negative ints * accounts/abi/bind: added test cases for negative ints in topics * accounts/abi/bind: fixed genIntType for go 1.12 * accounts/abi: minor nitpick * cmd: deprecate --testnet, use named networks instead (#20852) * cmd/utils: make goerli the default testnet * cmd/geth: explicitly rename testnet to ropsten * core: explicitly rename testnet to ropsten * params: explicitly rename testnet to ropsten * cmd: explicitly rename testnet to ropsten * miner: explicitly rename testnet to ropsten * mobile: allow for returning the goerli spec * tests: explicitly rename testnet to ropsten * docs: update readme to reflect changes to the default testnet * mobile: allow for configuring goerli and rinkeby nodes * cmd/geth: revert --testnet back to ropsten and mark as legacy * cmd/util: mark --testnet flag as deprecated * docs: update readme to properly reflect the 3 testnets * cmd/utils: add an explicit deprecation warning on startup * cmd/utils: swap goerli and ropsten in usage * cmd/geth: swap goerli and ropsten in usage * cmd/geth: if running a known preset, log it for convenience * docs: improve readme on usage of ropsten's testnet datadir * cmd/utils: check if legacy `testnet` datadir exists for ropsten * cmd/geth: check for legacy testnet path in console command * cmd/geth: use switch statement for complex conditions in main * cmd/geth: move known preset log statement to the very top * cmd/utils: create new ropsten configurations in the ropsten datadir * cmd/utils: makedatadir should check for existing testnet dir * cmd/geth: add legacy testnet flag to the copy db command * cmd/geth: add legacy testnet flag to the inspect command * les, les/lespay/client: add service value statistics and API (#20837) This PR adds service value measurement statistics to the light client. It also adds a private API that makes these statistics accessible. A follow-up PR will add the new server pool which uses these statistics to select servers with good performance. This document describes the function of the new components: https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4 Co-authored-by: rjl493456442 <garyrong0905@gmail.com> Co-authored-by: rjl493456442 <garyrong0905@gmail.com> * README: update min go version to 1.13 (#20911) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 (#20913) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 * travis, appveyor: force GO111MODULE=on for every build * core/rawdb: fix data race between Retrieve and Close (#20919) * core/rawdb: fixed data race between retrieve and close closes https://github.com/ethereum/go-ethereum/issues/20420 * core/rawdb: use non-atomic load while holding mutex * all: simplify and fix database iteration with prefix/start (#20808) * core/state/snapshot: start fixing disk iterator seek * ethdb, rawdb, leveldb, memorydb: implement iterators with prefix and start * les, core/state/snapshot: iterator fixes * all: remove two iterator methods * all: rename Iteratee.NewIteratorWith -> NewIterator * ethdb: fix review concerns * params: update CHTs for the 1.9.13 release * params: release Geth v1.9.13 * added some missing files * post-rebase fixups Co-authored-by: Péter Szilágyi <peterke@gmail.com> Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: gary rong <garyrong0905@gmail.com> Co-authored-by: Alex Willmer <alex@moreati.org.uk> Co-authored-by: meowsbits <45600330+meowsbits@users.noreply.github.com> Co-authored-by: Felix Lange <fjl@twurst.com> Co-authored-by: rene <41963722+renaynay@users.noreply.github.com> Co-authored-by: Ha ĐANG <dvietha@gmail.com> Co-authored-by: Hanjiang Yu <42531996+de1acr0ix@users.noreply.github.com> Co-authored-by: ligi <ligi@ligi.de> Co-authored-by: Wenbiao Zheng <delweng@gmail.com> Co-authored-by: Adam Schmideg <adamschmideg@users.noreply.github.com> Co-authored-by: Jeff Wentworth <jeff@curvegrid.com> Co-authored-by: Paweł Bylica <chfast@gmail.com> Co-authored-by: ucwong <ucwong@126.com> Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de> Co-authored-by: Luke Champine <luke.champine@gmail.com> Co-authored-by: Boqin Qin <Bobbqqin@gmail.com> Co-authored-by: William Morriss <wjmelements@gmail.com> Co-authored-by: Guillaume Ballet <gballet@gmail.com> Co-authored-by: Raw Pong Ghmoa <58883403+q9f@users.noreply.github.com> Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
2020-04-19 17:31:47 +00:00
}
}
type rpcPrefixTest struct {
httpPrefix, wsPrefix string
// These lists paths on which JSON-RPC should be served / not served.
wantHTTP []string
wantNoHTTP []string
wantWS []string
wantNoWS []string
}
func TestNodeRPCPrefix(t *testing.T) {
t.Parallel()
tests := []rpcPrefixTest{
// both off
{
httpPrefix: "", wsPrefix: "",
wantHTTP: []string{"/", "/?p=1"},
wantNoHTTP: []string{"/test", "/test?p=1"},
wantWS: []string{"/", "/?p=1"},
wantNoWS: []string{"/test", "/test?p=1"},
},
// only http prefix
{
httpPrefix: "/testprefix", wsPrefix: "",
wantHTTP: []string{"/testprefix", "/testprefix?p=1", "/testprefix/x", "/testprefix/x?p=1"},
wantNoHTTP: []string{"/", "/?p=1", "/test", "/test?p=1"},
wantWS: []string{"/", "/?p=1"},
wantNoWS: []string{"/testprefix", "/testprefix?p=1", "/test", "/test?p=1"},
},
// only ws prefix
{
httpPrefix: "", wsPrefix: "/testprefix",
wantHTTP: []string{"/", "/?p=1"},
wantNoHTTP: []string{"/testprefix", "/testprefix?p=1", "/test", "/test?p=1"},
wantWS: []string{"/testprefix", "/testprefix?p=1", "/testprefix/x", "/testprefix/x?p=1"},
wantNoWS: []string{"/", "/?p=1", "/test", "/test?p=1"},
},
// both set
{
httpPrefix: "/testprefix", wsPrefix: "/testprefix",
wantHTTP: []string{"/testprefix", "/testprefix?p=1", "/testprefix/x", "/testprefix/x?p=1"},
wantNoHTTP: []string{"/", "/?p=1", "/test", "/test?p=1"},
wantWS: []string{"/testprefix", "/testprefix?p=1", "/testprefix/x", "/testprefix/x?p=1"},
wantNoWS: []string{"/", "/?p=1", "/test", "/test?p=1"},
},
}
for _, test := range tests {
test := test
name := fmt.Sprintf("http=%s ws=%s", test.httpPrefix, test.wsPrefix)
t.Run(name, func(t *testing.T) {
2022-05-26 05:27:44 +00:00
cfg := &nodecfg.Config{
HTTPHost: "127.0.0.1",
HTTPPathPrefix: test.httpPrefix,
WSHost: "127.0.0.1",
WSPathPrefix: test.wsPrefix,
}
node, err := New(cfg)
if err != nil {
t.Fatal("can't create node:", err)
}
defer node.Close()
if err := node.Start(); err != nil {
t.Fatal("can't start node:", err)
}
test.check(t, node)
})
}
}
func (test rpcPrefixTest) check(t *testing.T, node *Node) {
t.Helper()
httpBase := "http://" + node.http.listenAddr()
wsBase := "ws://" + node.http.listenAddr()
if node.WSEndpoint() != wsBase+test.wsPrefix {
t.Errorf("Error: node has wrong WSEndpoint %q", node.WSEndpoint())
}
for _, path := range test.wantHTTP {
resp := rpcRequest(t, httpBase+path)
if resp.StatusCode != 200 {
t.Errorf("Error: %s: bad status code %d, want 200", path, resp.StatusCode)
}
2021-08-02 07:52:54 +00:00
resp.Body.Close()
}
for _, path := range test.wantNoHTTP {
resp := rpcRequest(t, httpBase+path)
if resp.StatusCode != 404 {
t.Errorf("Error: %s: bad status code %d, want 404", path, resp.StatusCode)
}
2021-08-02 07:52:54 +00:00
resp.Body.Close()
}
for _, path := range test.wantWS {
err := wsRequest(t, wsBase+path, "")
if err != nil {
t.Errorf("Error: %s: WebSocket connection failed: %v", path, err)
}
}
for _, path := range test.wantNoWS {
err := wsRequest(t, wsBase+path, "")
if err == nil {
t.Errorf("Error: %s: WebSocket connection succeeded for path in wantNoWS", path)
}
}
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
func createNode(t *testing.T, httpPort, wsPort int) *Node {
2022-05-26 05:27:44 +00:00
conf := &nodecfg.Config{
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
HTTPHost: "127.0.0.1",
HTTPPort: httpPort,
WSHost: "127.0.0.1",
WSPort: wsPort,
}
geth 1.9.13 (#469) * core: initial version of state snapshots * core/state: lazy sorting, snapshot invalidation * core/state/snapshot: extract and split cap method, cover corners * snapshot: iteration and buffering optimizations * core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup * 123 * core/rawdb, core/state/snapshot: runtime snapshot generation * core/state/snapshot: fix difflayer origin-initalization after flatten * add "to merge" * core/state/snapshot: implement snapshot layer iteration * core/state/snapshot: node behavioural difference on bloom content * core: journal the snapshot inside leveldb, not a flat file * core/state/snapshot: bloom, metrics and prefetcher fixes * core/state/snapshot: move iterator out into its own files * core/state/snapshot: implement iterator priority for fast direct data lookup * core/state/snapshot: full featured account iteration * core/state/snapshot: faster account iteration, CLI integration * core: fix broken tests due to API changes + linter * core/state: fix an account resurrection issue * core/tests: test for destroy+recreate contract with storage * squashme * core/state/snapshot, tests: sync snap gen + snaps in consensus tests * core/state: extend snapshotter to handle account resurrections * core/state: fix account root hash update point * core/state: fix resurrection state clearing and access * core/state/snapshot: handle deleted accounts in fast iterator * core: more blockchain tests * core/state/snapshot: fix various iteration issues due to destruct set * core: fix two snapshot iterator flaws, decollide snap storage prefix * core/state/snapshot/iterator: fix two disk iterator flaws * core/rawdb: change SnapshotStoragePrefix to avoid prefix collision with preimagePrefix * params: begin v1.9.13 release cycle * cmd/checkpoint-admin: add some documentation (#20697) * go.mod: update duktape to fix sprintf warnings (#20777) This revision of go-duktype fixes the following warning ``` duk_logging.c: In function ‘duk__logger_prototype_log_shared’: duk_logging.c:184:64: warning: ‘Z’ directive writing 1 byte into a region of size between 0 and 9 [-Wformat-overflow=] 184 | sprintf((char *) date_buf, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", | ^ In file included from /usr/include/stdio.h:867, from duk_logging.c:5: /usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 25 and 85 bytes into a destination of size 32 36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` * core/rawdb: fix freezer table test error check Fixes: Condition is always 'false' because 'err' is always 'nil' * core/rawdb: improve table database (#20703) This PR fixes issues in TableDatabase. TableDatabase is a wrapper of underlying ethdb.Database with an additional prefix. The prefix is applied to all entries it maintains. However when we try to retrieve entries from it we don't handle the key properly. In theory the prefix should be truncated and only user key is returned. But we don't do it in some cases, e.g. the iterator and batch replayer created from it. So this PR is the fix to these issues. * eth: when triggering a sync, check the head header TD, not block * internal/web3ext: fix clique console apis to work on missing arguments * rpc: dont log an error if user configures --rpcapi=rpc... (#20776) This just prevents a false negative ERROR warning when, for some unknown reason, a user attempts to turn on the module rpc even though it's already going to be on. * node, cmd/clef: report actual port used for http rpc (#20789) * internal/ethapi: don't set sender-balance to maxuint, fixes #16999 (#20783) Prior to this change, eth_call changed the balance of the sender account in the EVM environment to 2^256 wei to cover the gas cost of the call execution. We've had this behavior for a long time even though it's super confusing. This commit sets the default call gasprice to zero instead of updating the balance, which is better because it makes eth_call semantics less surprising. Removing the built-in balance assignment also makes balance overrides work as expected. * metrics: disable CPU stats (gosigar) on iOS * cmd/devp2p: tweak DNS TTLs (#20801) * cmd/devp2p: tweak DNS TTLs * cmd/devp2p: bump treeNodeTTL to four weeks * cmd/devp2p: lower route53 change limit again (#20819) * cmd/devp2p: be very correct about route53 change splitting (#20820) Turns out the way RDATA limits work is documented after all, I just didn't search right. The trick to make it work is to count UPSERTs twice. This also adds an additional check to ensure TTL changes are applied on existing records. * graphql, node, rpc: fix typos in comments (#20824) * eth: improve shutdown synchronization (#20695) * eth: improve shutdown synchronization Most goroutines started by eth.Ethereum didn't have any shutdown sync at all, which lead to weird error messages when quitting the client. This change improves the clean shutdown path by stopping all internal components in dependency order and waiting for them to actually be stopped before shutdown is considered done. In particular, we now stop everything related to peers before stopping 'resident' parts such as core.BlockChain. * eth: rewrite sync controller * eth: remove sync start debug message * eth: notify chainSyncer about new peers after handshake * eth: move downloader.Cancel call into chainSyncer * eth: make post-sync block broadcast synchronous * eth: add comments * core: change blockchain stop message * eth: change closeBloomHandler channel type * eth/filters: fix typo on unindexedLogs function's comment (#20827) * core: bump txpool tx max size to 128KB * snapshotter/tests: verify snapdb post-state against trie (#20812) * core/state/snapshot: basic trie-to-hash implementation * tests: validate snapshot after test * core/state/snapshot: fix review concerns * cmd, consensus: add option to disable mmap for DAG caches/datasets (#20484) * cmd, consensus: add option to disable mmap for DAG caches/datasets * consensus: add benchmarks for mmap with/with lock * cmd/clef: add newaccount command (#20782) * cmd/clef: add newaccount command * cmd/clef: document clef_New, update API versioning * Update cmd/clef/intapi_changelog.md Co-Authored-By: ligi <ligi@ligi.de> * Update signer/core/uiapi.go Co-Authored-By: ligi <ligi@ligi.de> Co-authored-by: ligi <ligi@ligi.de> * eth: add debug_accountRange API (#19645) This new API allows reading accounts and their content by address range. Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: Felix Lange <fjl@twurst.com> * travis: allow cocoapods deploy to fail (#20833) * metrics: improve TestTimerFunc (#20818) The test failed due to what appears to be fluctuations in time.Sleep, which is not the actual method under test. This change modifies it so we compare the metered Max to the actual time instead of the desired time. * README: update private network genesis spec with istanbul (#20841) * add istanbul and muirGlacier to genesis states in README * remove muirGlacier, relocate istanbul * cmd/evm: Rework execution stats (#20792) - Dump stats also for --bench flag. - From memory stats only show number and size of allocations. This is what `test -bench` shows. I doubt others like number of GC runs are any useful, but can be added if requested. - Now the mem stats are for single execution in case of --bench. * cmd/devp2p, cmd/wnode, whisper: add missing calls to Timer.Stop (#20843) * p2p/server: add UDP port mapping goroutine to wait group (#20846) * accounts/abi faster unpacking of int256 (#20850) * p2p/discv5: add missing Timer.Stop calls (#20853) * miner/worker: add missing timer.Stop call (#20857) * cmd/geth: fix bad genesis test (#20860) * eth/filters: add missing Ticker.Stop call (#20862) * eth/fetcher: add missing timer.Stop calls (#20861) * event: add missing timer.Stop call in TestFeed (#20868) * metrics: add missing calls to Ticker.Stop in tests (#20866) * ethstats: add missing Ticker.Stop call (#20867) * p2p/discv5, p2p/testing: add missing Timer.Stop calls in tests (#20869) * core: add missing Timer.Stop call in TestLogReorgs (#20870) * rpc: add missing timer.Stop calls in websocket tests (#20863) * crypto/ecies: improve concatKDF (#20836) This removes a bunch of weird code around the counter overflow check in concatKDF and makes it actually work for different hash output sizes. The overflow check worked as follows: concatKDF applies the hash function N times, where N is roundup(kdLen, hashsize) / hashsize. N should not overflow 32 bits because that would lead to a repetition in the KDF output. A couple issues with the overflow check: - It used the hash.BlockSize, which is wrong because the block size is about the input of the hash function. Luckily, all standard hash functions have a block size that's greater than the output size, so concatKDF didn't crash, it just generated too much key material. - The check used big.Int to compare against 2^32-1. - The calculation could still overflow before reaching the check. The new code in concatKDF doesn't check for overflow. Instead, there is a new check on ECIESParams which ensures that params.KeyLen is < 512. This removes any possibility of overflow. There are a couple of miscellaneous improvements bundled in with this change: - The key buffer is pre-allocated instead of appending the hash output to an initially empty slice. - The code that uses concatKDF to derive keys is now shared between Encrypt and Decrypt. - There was a redundant invocation of IsOnCurve in Decrypt. This is now removed because elliptic.Unmarshal already checks whether the input is a valid curve point since Go 1.5. Co-authored-by: Felix Lange <fjl@twurst.com> * rpc: metrics for JSON-RPC method calls (#20847) This adds a couple of metrics for tracking the timing and frequency of method calls: - rpc/requests gauge counts all requests - rpc/success gauge counts requests which return err == nil - rpc/failure gauge counts requests which return err != nil - rpc/duration/all timer tracks timing of all requests - rpc/duration/<method>/<success/failure> tracks per-method timing * mobile: use bind.NewKeyedTransactor instead of duplicating (#20888) It's better to reuse the existing code to create a keyed transactor than to rewrite the logic again. * internal/ethapi: add CallArgs.ToMessage method (#20854) ToMessage is used to convert between ethapi.CallArgs and types.Message. It reduces the length of the DoCall method by about half by abstracting out the conversion between the CallArgs and the Message. This should improve the code's maintainability and reusability. * eth, les: fix flaky tests (#20897) * les: fix flaky test * eth: fix flaky test * cmd/geth: enable metrics for geth import command (#20738) * cmd/geth: enable metrics for geth import command * cmd/geth: enable metrics-flags for import command * core/vm: use a callcontext struct (#20761) * core/vm: use a callcontext struct * core/vm: fix tests * core/vm/runtime: benchmark * core/vm: make intpool push inlineable, unexpose callcontext * docs/audits: add discv5 protocol audits from LA and C53 (#20898) * .github: change gitter reference to discord link in issue template (#20896) * couple of fixes to docs in clef (#20900) * p2p/discover: add initial discovery v5 implementation (#20750)This adds an implementation of the current discovery v5 spec.There is full integration with cmd/devp2p and enode.Iterator in thisversion. In theory we could enable the new protocol as a replacement ofdiscovery v4 at any time. In practice, there will likely be a few morechanges to the spec and implementation before this can happen. * build: upgrade to golangci-lint 1.24.0 (#20901) * accounts/scwallet: remove unnecessary uses of fmt.Sprintf * cmd/puppeth: remove unnecessary uses of fmt.Sprintf * p2p/discv5: remove unnecessary use of fmt.Sprintf * whisper/mailserver: remove unnecessary uses of fmt.Sprintf * core: goimports -w tx_pool_test.go * eth/downloader: goimports -w downloader_test.go * build: upgrade to golangci-lint 1.24.0 * accounts/abi/bind: Refactored topics (#20851) * accounts/abi/bind: refactored topics * accounts/abi/bind: use store function to remove code duplication * accounts/abi/bind: removed unused type defs * accounts/abi/bind: error on tuples in topics * Cosmetic changes to restart travis build Co-authored-by: Guillaume Ballet <gballet@gmail.com> * node: allow websocket and HTTP on the same port (#20810) This change makes it possible to run geth with JSON-RPC over HTTP and WebSocket on the same TCP port. The default port for WebSocket is still 8546. geth --rpc --rpcport 8545 --ws --wsport 8545 This also removes a lot of deprecated API surface from package rpc. The rpc package is now purely about serving JSON-RPC and no longer provides a way to start an HTTP server. * crypto: improve error messages in LoadECDSA (#20718) This improves error messages when the file is too short or too long. Also rewrite the test for SaveECDSA because LoadECDSA has its own test now. Co-authored-by: Felix Lange <fjl@twurst.com> * changed date of rpcstack.go since new file (#20904) * accounts/abi/bind: fixed erroneous filtering of negative ints (#20865) * accounts/abi/bind: fixed erroneous packing of negative ints * accounts/abi/bind: added test cases for negative ints in topics * accounts/abi/bind: fixed genIntType for go 1.12 * accounts/abi: minor nitpick * cmd: deprecate --testnet, use named networks instead (#20852) * cmd/utils: make goerli the default testnet * cmd/geth: explicitly rename testnet to ropsten * core: explicitly rename testnet to ropsten * params: explicitly rename testnet to ropsten * cmd: explicitly rename testnet to ropsten * miner: explicitly rename testnet to ropsten * mobile: allow for returning the goerli spec * tests: explicitly rename testnet to ropsten * docs: update readme to reflect changes to the default testnet * mobile: allow for configuring goerli and rinkeby nodes * cmd/geth: revert --testnet back to ropsten and mark as legacy * cmd/util: mark --testnet flag as deprecated * docs: update readme to properly reflect the 3 testnets * cmd/utils: add an explicit deprecation warning on startup * cmd/utils: swap goerli and ropsten in usage * cmd/geth: swap goerli and ropsten in usage * cmd/geth: if running a known preset, log it for convenience * docs: improve readme on usage of ropsten's testnet datadir * cmd/utils: check if legacy `testnet` datadir exists for ropsten * cmd/geth: check for legacy testnet path in console command * cmd/geth: use switch statement for complex conditions in main * cmd/geth: move known preset log statement to the very top * cmd/utils: create new ropsten configurations in the ropsten datadir * cmd/utils: makedatadir should check for existing testnet dir * cmd/geth: add legacy testnet flag to the copy db command * cmd/geth: add legacy testnet flag to the inspect command * les, les/lespay/client: add service value statistics and API (#20837) This PR adds service value measurement statistics to the light client. It also adds a private API that makes these statistics accessible. A follow-up PR will add the new server pool which uses these statistics to select servers with good performance. This document describes the function of the new components: https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4 Co-authored-by: rjl493456442 <garyrong0905@gmail.com> Co-authored-by: rjl493456442 <garyrong0905@gmail.com> * README: update min go version to 1.13 (#20911) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 (#20913) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 * travis, appveyor: force GO111MODULE=on for every build * core/rawdb: fix data race between Retrieve and Close (#20919) * core/rawdb: fixed data race between retrieve and close closes https://github.com/ethereum/go-ethereum/issues/20420 * core/rawdb: use non-atomic load while holding mutex * all: simplify and fix database iteration with prefix/start (#20808) * core/state/snapshot: start fixing disk iterator seek * ethdb, rawdb, leveldb, memorydb: implement iterators with prefix and start * les, core/state/snapshot: iterator fixes * all: remove two iterator methods * all: rename Iteratee.NewIteratorWith -> NewIterator * ethdb: fix review concerns * params: update CHTs for the 1.9.13 release * params: release Geth v1.9.13 * added some missing files * post-rebase fixups Co-authored-by: Péter Szilágyi <peterke@gmail.com> Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: gary rong <garyrong0905@gmail.com> Co-authored-by: Alex Willmer <alex@moreati.org.uk> Co-authored-by: meowsbits <45600330+meowsbits@users.noreply.github.com> Co-authored-by: Felix Lange <fjl@twurst.com> Co-authored-by: rene <41963722+renaynay@users.noreply.github.com> Co-authored-by: Ha ĐANG <dvietha@gmail.com> Co-authored-by: Hanjiang Yu <42531996+de1acr0ix@users.noreply.github.com> Co-authored-by: ligi <ligi@ligi.de> Co-authored-by: Wenbiao Zheng <delweng@gmail.com> Co-authored-by: Adam Schmideg <adamschmideg@users.noreply.github.com> Co-authored-by: Jeff Wentworth <jeff@curvegrid.com> Co-authored-by: Paweł Bylica <chfast@gmail.com> Co-authored-by: ucwong <ucwong@126.com> Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de> Co-authored-by: Luke Champine <luke.champine@gmail.com> Co-authored-by: Boqin Qin <Bobbqqin@gmail.com> Co-authored-by: William Morriss <wjmelements@gmail.com> Co-authored-by: Guillaume Ballet <gballet@gmail.com> Co-authored-by: Raw Pong Ghmoa <58883403+q9f@users.noreply.github.com> Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
2020-04-19 17:31:47 +00:00
node, err := New(conf)
if err != nil {
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
t.Fatalf("could not create a new node: %v", err)
geth 1.9.13 (#469) * core: initial version of state snapshots * core/state: lazy sorting, snapshot invalidation * core/state/snapshot: extract and split cap method, cover corners * snapshot: iteration and buffering optimizations * core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup * 123 * core/rawdb, core/state/snapshot: runtime snapshot generation * core/state/snapshot: fix difflayer origin-initalization after flatten * add "to merge" * core/state/snapshot: implement snapshot layer iteration * core/state/snapshot: node behavioural difference on bloom content * core: journal the snapshot inside leveldb, not a flat file * core/state/snapshot: bloom, metrics and prefetcher fixes * core/state/snapshot: move iterator out into its own files * core/state/snapshot: implement iterator priority for fast direct data lookup * core/state/snapshot: full featured account iteration * core/state/snapshot: faster account iteration, CLI integration * core: fix broken tests due to API changes + linter * core/state: fix an account resurrection issue * core/tests: test for destroy+recreate contract with storage * squashme * core/state/snapshot, tests: sync snap gen + snaps in consensus tests * core/state: extend snapshotter to handle account resurrections * core/state: fix account root hash update point * core/state: fix resurrection state clearing and access * core/state/snapshot: handle deleted accounts in fast iterator * core: more blockchain tests * core/state/snapshot: fix various iteration issues due to destruct set * core: fix two snapshot iterator flaws, decollide snap storage prefix * core/state/snapshot/iterator: fix two disk iterator flaws * core/rawdb: change SnapshotStoragePrefix to avoid prefix collision with preimagePrefix * params: begin v1.9.13 release cycle * cmd/checkpoint-admin: add some documentation (#20697) * go.mod: update duktape to fix sprintf warnings (#20777) This revision of go-duktype fixes the following warning ``` duk_logging.c: In function ‘duk__logger_prototype_log_shared’: duk_logging.c:184:64: warning: ‘Z’ directive writing 1 byte into a region of size between 0 and 9 [-Wformat-overflow=] 184 | sprintf((char *) date_buf, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", | ^ In file included from /usr/include/stdio.h:867, from duk_logging.c:5: /usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 25 and 85 bytes into a destination of size 32 36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` * core/rawdb: fix freezer table test error check Fixes: Condition is always 'false' because 'err' is always 'nil' * core/rawdb: improve table database (#20703) This PR fixes issues in TableDatabase. TableDatabase is a wrapper of underlying ethdb.Database with an additional prefix. The prefix is applied to all entries it maintains. However when we try to retrieve entries from it we don't handle the key properly. In theory the prefix should be truncated and only user key is returned. But we don't do it in some cases, e.g. the iterator and batch replayer created from it. So this PR is the fix to these issues. * eth: when triggering a sync, check the head header TD, not block * internal/web3ext: fix clique console apis to work on missing arguments * rpc: dont log an error if user configures --rpcapi=rpc... (#20776) This just prevents a false negative ERROR warning when, for some unknown reason, a user attempts to turn on the module rpc even though it's already going to be on. * node, cmd/clef: report actual port used for http rpc (#20789) * internal/ethapi: don't set sender-balance to maxuint, fixes #16999 (#20783) Prior to this change, eth_call changed the balance of the sender account in the EVM environment to 2^256 wei to cover the gas cost of the call execution. We've had this behavior for a long time even though it's super confusing. This commit sets the default call gasprice to zero instead of updating the balance, which is better because it makes eth_call semantics less surprising. Removing the built-in balance assignment also makes balance overrides work as expected. * metrics: disable CPU stats (gosigar) on iOS * cmd/devp2p: tweak DNS TTLs (#20801) * cmd/devp2p: tweak DNS TTLs * cmd/devp2p: bump treeNodeTTL to four weeks * cmd/devp2p: lower route53 change limit again (#20819) * cmd/devp2p: be very correct about route53 change splitting (#20820) Turns out the way RDATA limits work is documented after all, I just didn't search right. The trick to make it work is to count UPSERTs twice. This also adds an additional check to ensure TTL changes are applied on existing records. * graphql, node, rpc: fix typos in comments (#20824) * eth: improve shutdown synchronization (#20695) * eth: improve shutdown synchronization Most goroutines started by eth.Ethereum didn't have any shutdown sync at all, which lead to weird error messages when quitting the client. This change improves the clean shutdown path by stopping all internal components in dependency order and waiting for them to actually be stopped before shutdown is considered done. In particular, we now stop everything related to peers before stopping 'resident' parts such as core.BlockChain. * eth: rewrite sync controller * eth: remove sync start debug message * eth: notify chainSyncer about new peers after handshake * eth: move downloader.Cancel call into chainSyncer * eth: make post-sync block broadcast synchronous * eth: add comments * core: change blockchain stop message * eth: change closeBloomHandler channel type * eth/filters: fix typo on unindexedLogs function's comment (#20827) * core: bump txpool tx max size to 128KB * snapshotter/tests: verify snapdb post-state against trie (#20812) * core/state/snapshot: basic trie-to-hash implementation * tests: validate snapshot after test * core/state/snapshot: fix review concerns * cmd, consensus: add option to disable mmap for DAG caches/datasets (#20484) * cmd, consensus: add option to disable mmap for DAG caches/datasets * consensus: add benchmarks for mmap with/with lock * cmd/clef: add newaccount command (#20782) * cmd/clef: add newaccount command * cmd/clef: document clef_New, update API versioning * Update cmd/clef/intapi_changelog.md Co-Authored-By: ligi <ligi@ligi.de> * Update signer/core/uiapi.go Co-Authored-By: ligi <ligi@ligi.de> Co-authored-by: ligi <ligi@ligi.de> * eth: add debug_accountRange API (#19645) This new API allows reading accounts and their content by address range. Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: Felix Lange <fjl@twurst.com> * travis: allow cocoapods deploy to fail (#20833) * metrics: improve TestTimerFunc (#20818) The test failed due to what appears to be fluctuations in time.Sleep, which is not the actual method under test. This change modifies it so we compare the metered Max to the actual time instead of the desired time. * README: update private network genesis spec with istanbul (#20841) * add istanbul and muirGlacier to genesis states in README * remove muirGlacier, relocate istanbul * cmd/evm: Rework execution stats (#20792) - Dump stats also for --bench flag. - From memory stats only show number and size of allocations. This is what `test -bench` shows. I doubt others like number of GC runs are any useful, but can be added if requested. - Now the mem stats are for single execution in case of --bench. * cmd/devp2p, cmd/wnode, whisper: add missing calls to Timer.Stop (#20843) * p2p/server: add UDP port mapping goroutine to wait group (#20846) * accounts/abi faster unpacking of int256 (#20850) * p2p/discv5: add missing Timer.Stop calls (#20853) * miner/worker: add missing timer.Stop call (#20857) * cmd/geth: fix bad genesis test (#20860) * eth/filters: add missing Ticker.Stop call (#20862) * eth/fetcher: add missing timer.Stop calls (#20861) * event: add missing timer.Stop call in TestFeed (#20868) * metrics: add missing calls to Ticker.Stop in tests (#20866) * ethstats: add missing Ticker.Stop call (#20867) * p2p/discv5, p2p/testing: add missing Timer.Stop calls in tests (#20869) * core: add missing Timer.Stop call in TestLogReorgs (#20870) * rpc: add missing timer.Stop calls in websocket tests (#20863) * crypto/ecies: improve concatKDF (#20836) This removes a bunch of weird code around the counter overflow check in concatKDF and makes it actually work for different hash output sizes. The overflow check worked as follows: concatKDF applies the hash function N times, where N is roundup(kdLen, hashsize) / hashsize. N should not overflow 32 bits because that would lead to a repetition in the KDF output. A couple issues with the overflow check: - It used the hash.BlockSize, which is wrong because the block size is about the input of the hash function. Luckily, all standard hash functions have a block size that's greater than the output size, so concatKDF didn't crash, it just generated too much key material. - The check used big.Int to compare against 2^32-1. - The calculation could still overflow before reaching the check. The new code in concatKDF doesn't check for overflow. Instead, there is a new check on ECIESParams which ensures that params.KeyLen is < 512. This removes any possibility of overflow. There are a couple of miscellaneous improvements bundled in with this change: - The key buffer is pre-allocated instead of appending the hash output to an initially empty slice. - The code that uses concatKDF to derive keys is now shared between Encrypt and Decrypt. - There was a redundant invocation of IsOnCurve in Decrypt. This is now removed because elliptic.Unmarshal already checks whether the input is a valid curve point since Go 1.5. Co-authored-by: Felix Lange <fjl@twurst.com> * rpc: metrics for JSON-RPC method calls (#20847) This adds a couple of metrics for tracking the timing and frequency of method calls: - rpc/requests gauge counts all requests - rpc/success gauge counts requests which return err == nil - rpc/failure gauge counts requests which return err != nil - rpc/duration/all timer tracks timing of all requests - rpc/duration/<method>/<success/failure> tracks per-method timing * mobile: use bind.NewKeyedTransactor instead of duplicating (#20888) It's better to reuse the existing code to create a keyed transactor than to rewrite the logic again. * internal/ethapi: add CallArgs.ToMessage method (#20854) ToMessage is used to convert between ethapi.CallArgs and types.Message. It reduces the length of the DoCall method by about half by abstracting out the conversion between the CallArgs and the Message. This should improve the code's maintainability and reusability. * eth, les: fix flaky tests (#20897) * les: fix flaky test * eth: fix flaky test * cmd/geth: enable metrics for geth import command (#20738) * cmd/geth: enable metrics for geth import command * cmd/geth: enable metrics-flags for import command * core/vm: use a callcontext struct (#20761) * core/vm: use a callcontext struct * core/vm: fix tests * core/vm/runtime: benchmark * core/vm: make intpool push inlineable, unexpose callcontext * docs/audits: add discv5 protocol audits from LA and C53 (#20898) * .github: change gitter reference to discord link in issue template (#20896) * couple of fixes to docs in clef (#20900) * p2p/discover: add initial discovery v5 implementation (#20750)This adds an implementation of the current discovery v5 spec.There is full integration with cmd/devp2p and enode.Iterator in thisversion. In theory we could enable the new protocol as a replacement ofdiscovery v4 at any time. In practice, there will likely be a few morechanges to the spec and implementation before this can happen. * build: upgrade to golangci-lint 1.24.0 (#20901) * accounts/scwallet: remove unnecessary uses of fmt.Sprintf * cmd/puppeth: remove unnecessary uses of fmt.Sprintf * p2p/discv5: remove unnecessary use of fmt.Sprintf * whisper/mailserver: remove unnecessary uses of fmt.Sprintf * core: goimports -w tx_pool_test.go * eth/downloader: goimports -w downloader_test.go * build: upgrade to golangci-lint 1.24.0 * accounts/abi/bind: Refactored topics (#20851) * accounts/abi/bind: refactored topics * accounts/abi/bind: use store function to remove code duplication * accounts/abi/bind: removed unused type defs * accounts/abi/bind: error on tuples in topics * Cosmetic changes to restart travis build Co-authored-by: Guillaume Ballet <gballet@gmail.com> * node: allow websocket and HTTP on the same port (#20810) This change makes it possible to run geth with JSON-RPC over HTTP and WebSocket on the same TCP port. The default port for WebSocket is still 8546. geth --rpc --rpcport 8545 --ws --wsport 8545 This also removes a lot of deprecated API surface from package rpc. The rpc package is now purely about serving JSON-RPC and no longer provides a way to start an HTTP server. * crypto: improve error messages in LoadECDSA (#20718) This improves error messages when the file is too short or too long. Also rewrite the test for SaveECDSA because LoadECDSA has its own test now. Co-authored-by: Felix Lange <fjl@twurst.com> * changed date of rpcstack.go since new file (#20904) * accounts/abi/bind: fixed erroneous filtering of negative ints (#20865) * accounts/abi/bind: fixed erroneous packing of negative ints * accounts/abi/bind: added test cases for negative ints in topics * accounts/abi/bind: fixed genIntType for go 1.12 * accounts/abi: minor nitpick * cmd: deprecate --testnet, use named networks instead (#20852) * cmd/utils: make goerli the default testnet * cmd/geth: explicitly rename testnet to ropsten * core: explicitly rename testnet to ropsten * params: explicitly rename testnet to ropsten * cmd: explicitly rename testnet to ropsten * miner: explicitly rename testnet to ropsten * mobile: allow for returning the goerli spec * tests: explicitly rename testnet to ropsten * docs: update readme to reflect changes to the default testnet * mobile: allow for configuring goerli and rinkeby nodes * cmd/geth: revert --testnet back to ropsten and mark as legacy * cmd/util: mark --testnet flag as deprecated * docs: update readme to properly reflect the 3 testnets * cmd/utils: add an explicit deprecation warning on startup * cmd/utils: swap goerli and ropsten in usage * cmd/geth: swap goerli and ropsten in usage * cmd/geth: if running a known preset, log it for convenience * docs: improve readme on usage of ropsten's testnet datadir * cmd/utils: check if legacy `testnet` datadir exists for ropsten * cmd/geth: check for legacy testnet path in console command * cmd/geth: use switch statement for complex conditions in main * cmd/geth: move known preset log statement to the very top * cmd/utils: create new ropsten configurations in the ropsten datadir * cmd/utils: makedatadir should check for existing testnet dir * cmd/geth: add legacy testnet flag to the copy db command * cmd/geth: add legacy testnet flag to the inspect command * les, les/lespay/client: add service value statistics and API (#20837) This PR adds service value measurement statistics to the light client. It also adds a private API that makes these statistics accessible. A follow-up PR will add the new server pool which uses these statistics to select servers with good performance. This document describes the function of the new components: https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4 Co-authored-by: rjl493456442 <garyrong0905@gmail.com> Co-authored-by: rjl493456442 <garyrong0905@gmail.com> * README: update min go version to 1.13 (#20911) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 (#20913) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 * travis, appveyor: force GO111MODULE=on for every build * core/rawdb: fix data race between Retrieve and Close (#20919) * core/rawdb: fixed data race between retrieve and close closes https://github.com/ethereum/go-ethereum/issues/20420 * core/rawdb: use non-atomic load while holding mutex * all: simplify and fix database iteration with prefix/start (#20808) * core/state/snapshot: start fixing disk iterator seek * ethdb, rawdb, leveldb, memorydb: implement iterators with prefix and start * les, core/state/snapshot: iterator fixes * all: remove two iterator methods * all: rename Iteratee.NewIteratorWith -> NewIterator * ethdb: fix review concerns * params: update CHTs for the 1.9.13 release * params: release Geth v1.9.13 * added some missing files * post-rebase fixups Co-authored-by: Péter Szilágyi <peterke@gmail.com> Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: gary rong <garyrong0905@gmail.com> Co-authored-by: Alex Willmer <alex@moreati.org.uk> Co-authored-by: meowsbits <45600330+meowsbits@users.noreply.github.com> Co-authored-by: Felix Lange <fjl@twurst.com> Co-authored-by: rene <41963722+renaynay@users.noreply.github.com> Co-authored-by: Ha ĐANG <dvietha@gmail.com> Co-authored-by: Hanjiang Yu <42531996+de1acr0ix@users.noreply.github.com> Co-authored-by: ligi <ligi@ligi.de> Co-authored-by: Wenbiao Zheng <delweng@gmail.com> Co-authored-by: Adam Schmideg <adamschmideg@users.noreply.github.com> Co-authored-by: Jeff Wentworth <jeff@curvegrid.com> Co-authored-by: Paweł Bylica <chfast@gmail.com> Co-authored-by: ucwong <ucwong@126.com> Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de> Co-authored-by: Luke Champine <luke.champine@gmail.com> Co-authored-by: Boqin Qin <Bobbqqin@gmail.com> Co-authored-by: William Morriss <wjmelements@gmail.com> Co-authored-by: Guillaume Ballet <gballet@gmail.com> Co-authored-by: Raw Pong Ghmoa <58883403+q9f@users.noreply.github.com> Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
2020-04-19 17:31:47 +00:00
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
return node
}
geth 1.9.13 (#469) * core: initial version of state snapshots * core/state: lazy sorting, snapshot invalidation * core/state/snapshot: extract and split cap method, cover corners * snapshot: iteration and buffering optimizations * core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup * 123 * core/rawdb, core/state/snapshot: runtime snapshot generation * core/state/snapshot: fix difflayer origin-initalization after flatten * add "to merge" * core/state/snapshot: implement snapshot layer iteration * core/state/snapshot: node behavioural difference on bloom content * core: journal the snapshot inside leveldb, not a flat file * core/state/snapshot: bloom, metrics and prefetcher fixes * core/state/snapshot: move iterator out into its own files * core/state/snapshot: implement iterator priority for fast direct data lookup * core/state/snapshot: full featured account iteration * core/state/snapshot: faster account iteration, CLI integration * core: fix broken tests due to API changes + linter * core/state: fix an account resurrection issue * core/tests: test for destroy+recreate contract with storage * squashme * core/state/snapshot, tests: sync snap gen + snaps in consensus tests * core/state: extend snapshotter to handle account resurrections * core/state: fix account root hash update point * core/state: fix resurrection state clearing and access * core/state/snapshot: handle deleted accounts in fast iterator * core: more blockchain tests * core/state/snapshot: fix various iteration issues due to destruct set * core: fix two snapshot iterator flaws, decollide snap storage prefix * core/state/snapshot/iterator: fix two disk iterator flaws * core/rawdb: change SnapshotStoragePrefix to avoid prefix collision with preimagePrefix * params: begin v1.9.13 release cycle * cmd/checkpoint-admin: add some documentation (#20697) * go.mod: update duktape to fix sprintf warnings (#20777) This revision of go-duktype fixes the following warning ``` duk_logging.c: In function ‘duk__logger_prototype_log_shared’: duk_logging.c:184:64: warning: ‘Z’ directive writing 1 byte into a region of size between 0 and 9 [-Wformat-overflow=] 184 | sprintf((char *) date_buf, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", | ^ In file included from /usr/include/stdio.h:867, from duk_logging.c:5: /usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 25 and 85 bytes into a destination of size 32 36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` * core/rawdb: fix freezer table test error check Fixes: Condition is always 'false' because 'err' is always 'nil' * core/rawdb: improve table database (#20703) This PR fixes issues in TableDatabase. TableDatabase is a wrapper of underlying ethdb.Database with an additional prefix. The prefix is applied to all entries it maintains. However when we try to retrieve entries from it we don't handle the key properly. In theory the prefix should be truncated and only user key is returned. But we don't do it in some cases, e.g. the iterator and batch replayer created from it. So this PR is the fix to these issues. * eth: when triggering a sync, check the head header TD, not block * internal/web3ext: fix clique console apis to work on missing arguments * rpc: dont log an error if user configures --rpcapi=rpc... (#20776) This just prevents a false negative ERROR warning when, for some unknown reason, a user attempts to turn on the module rpc even though it's already going to be on. * node, cmd/clef: report actual port used for http rpc (#20789) * internal/ethapi: don't set sender-balance to maxuint, fixes #16999 (#20783) Prior to this change, eth_call changed the balance of the sender account in the EVM environment to 2^256 wei to cover the gas cost of the call execution. We've had this behavior for a long time even though it's super confusing. This commit sets the default call gasprice to zero instead of updating the balance, which is better because it makes eth_call semantics less surprising. Removing the built-in balance assignment also makes balance overrides work as expected. * metrics: disable CPU stats (gosigar) on iOS * cmd/devp2p: tweak DNS TTLs (#20801) * cmd/devp2p: tweak DNS TTLs * cmd/devp2p: bump treeNodeTTL to four weeks * cmd/devp2p: lower route53 change limit again (#20819) * cmd/devp2p: be very correct about route53 change splitting (#20820) Turns out the way RDATA limits work is documented after all, I just didn't search right. The trick to make it work is to count UPSERTs twice. This also adds an additional check to ensure TTL changes are applied on existing records. * graphql, node, rpc: fix typos in comments (#20824) * eth: improve shutdown synchronization (#20695) * eth: improve shutdown synchronization Most goroutines started by eth.Ethereum didn't have any shutdown sync at all, which lead to weird error messages when quitting the client. This change improves the clean shutdown path by stopping all internal components in dependency order and waiting for them to actually be stopped before shutdown is considered done. In particular, we now stop everything related to peers before stopping 'resident' parts such as core.BlockChain. * eth: rewrite sync controller * eth: remove sync start debug message * eth: notify chainSyncer about new peers after handshake * eth: move downloader.Cancel call into chainSyncer * eth: make post-sync block broadcast synchronous * eth: add comments * core: change blockchain stop message * eth: change closeBloomHandler channel type * eth/filters: fix typo on unindexedLogs function's comment (#20827) * core: bump txpool tx max size to 128KB * snapshotter/tests: verify snapdb post-state against trie (#20812) * core/state/snapshot: basic trie-to-hash implementation * tests: validate snapshot after test * core/state/snapshot: fix review concerns * cmd, consensus: add option to disable mmap for DAG caches/datasets (#20484) * cmd, consensus: add option to disable mmap for DAG caches/datasets * consensus: add benchmarks for mmap with/with lock * cmd/clef: add newaccount command (#20782) * cmd/clef: add newaccount command * cmd/clef: document clef_New, update API versioning * Update cmd/clef/intapi_changelog.md Co-Authored-By: ligi <ligi@ligi.de> * Update signer/core/uiapi.go Co-Authored-By: ligi <ligi@ligi.de> Co-authored-by: ligi <ligi@ligi.de> * eth: add debug_accountRange API (#19645) This new API allows reading accounts and their content by address range. Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: Felix Lange <fjl@twurst.com> * travis: allow cocoapods deploy to fail (#20833) * metrics: improve TestTimerFunc (#20818) The test failed due to what appears to be fluctuations in time.Sleep, which is not the actual method under test. This change modifies it so we compare the metered Max to the actual time instead of the desired time. * README: update private network genesis spec with istanbul (#20841) * add istanbul and muirGlacier to genesis states in README * remove muirGlacier, relocate istanbul * cmd/evm: Rework execution stats (#20792) - Dump stats also for --bench flag. - From memory stats only show number and size of allocations. This is what `test -bench` shows. I doubt others like number of GC runs are any useful, but can be added if requested. - Now the mem stats are for single execution in case of --bench. * cmd/devp2p, cmd/wnode, whisper: add missing calls to Timer.Stop (#20843) * p2p/server: add UDP port mapping goroutine to wait group (#20846) * accounts/abi faster unpacking of int256 (#20850) * p2p/discv5: add missing Timer.Stop calls (#20853) * miner/worker: add missing timer.Stop call (#20857) * cmd/geth: fix bad genesis test (#20860) * eth/filters: add missing Ticker.Stop call (#20862) * eth/fetcher: add missing timer.Stop calls (#20861) * event: add missing timer.Stop call in TestFeed (#20868) * metrics: add missing calls to Ticker.Stop in tests (#20866) * ethstats: add missing Ticker.Stop call (#20867) * p2p/discv5, p2p/testing: add missing Timer.Stop calls in tests (#20869) * core: add missing Timer.Stop call in TestLogReorgs (#20870) * rpc: add missing timer.Stop calls in websocket tests (#20863) * crypto/ecies: improve concatKDF (#20836) This removes a bunch of weird code around the counter overflow check in concatKDF and makes it actually work for different hash output sizes. The overflow check worked as follows: concatKDF applies the hash function N times, where N is roundup(kdLen, hashsize) / hashsize. N should not overflow 32 bits because that would lead to a repetition in the KDF output. A couple issues with the overflow check: - It used the hash.BlockSize, which is wrong because the block size is about the input of the hash function. Luckily, all standard hash functions have a block size that's greater than the output size, so concatKDF didn't crash, it just generated too much key material. - The check used big.Int to compare against 2^32-1. - The calculation could still overflow before reaching the check. The new code in concatKDF doesn't check for overflow. Instead, there is a new check on ECIESParams which ensures that params.KeyLen is < 512. This removes any possibility of overflow. There are a couple of miscellaneous improvements bundled in with this change: - The key buffer is pre-allocated instead of appending the hash output to an initially empty slice. - The code that uses concatKDF to derive keys is now shared between Encrypt and Decrypt. - There was a redundant invocation of IsOnCurve in Decrypt. This is now removed because elliptic.Unmarshal already checks whether the input is a valid curve point since Go 1.5. Co-authored-by: Felix Lange <fjl@twurst.com> * rpc: metrics for JSON-RPC method calls (#20847) This adds a couple of metrics for tracking the timing and frequency of method calls: - rpc/requests gauge counts all requests - rpc/success gauge counts requests which return err == nil - rpc/failure gauge counts requests which return err != nil - rpc/duration/all timer tracks timing of all requests - rpc/duration/<method>/<success/failure> tracks per-method timing * mobile: use bind.NewKeyedTransactor instead of duplicating (#20888) It's better to reuse the existing code to create a keyed transactor than to rewrite the logic again. * internal/ethapi: add CallArgs.ToMessage method (#20854) ToMessage is used to convert between ethapi.CallArgs and types.Message. It reduces the length of the DoCall method by about half by abstracting out the conversion between the CallArgs and the Message. This should improve the code's maintainability and reusability. * eth, les: fix flaky tests (#20897) * les: fix flaky test * eth: fix flaky test * cmd/geth: enable metrics for geth import command (#20738) * cmd/geth: enable metrics for geth import command * cmd/geth: enable metrics-flags for import command * core/vm: use a callcontext struct (#20761) * core/vm: use a callcontext struct * core/vm: fix tests * core/vm/runtime: benchmark * core/vm: make intpool push inlineable, unexpose callcontext * docs/audits: add discv5 protocol audits from LA and C53 (#20898) * .github: change gitter reference to discord link in issue template (#20896) * couple of fixes to docs in clef (#20900) * p2p/discover: add initial discovery v5 implementation (#20750)This adds an implementation of the current discovery v5 spec.There is full integration with cmd/devp2p and enode.Iterator in thisversion. In theory we could enable the new protocol as a replacement ofdiscovery v4 at any time. In practice, there will likely be a few morechanges to the spec and implementation before this can happen. * build: upgrade to golangci-lint 1.24.0 (#20901) * accounts/scwallet: remove unnecessary uses of fmt.Sprintf * cmd/puppeth: remove unnecessary uses of fmt.Sprintf * p2p/discv5: remove unnecessary use of fmt.Sprintf * whisper/mailserver: remove unnecessary uses of fmt.Sprintf * core: goimports -w tx_pool_test.go * eth/downloader: goimports -w downloader_test.go * build: upgrade to golangci-lint 1.24.0 * accounts/abi/bind: Refactored topics (#20851) * accounts/abi/bind: refactored topics * accounts/abi/bind: use store function to remove code duplication * accounts/abi/bind: removed unused type defs * accounts/abi/bind: error on tuples in topics * Cosmetic changes to restart travis build Co-authored-by: Guillaume Ballet <gballet@gmail.com> * node: allow websocket and HTTP on the same port (#20810) This change makes it possible to run geth with JSON-RPC over HTTP and WebSocket on the same TCP port. The default port for WebSocket is still 8546. geth --rpc --rpcport 8545 --ws --wsport 8545 This also removes a lot of deprecated API surface from package rpc. The rpc package is now purely about serving JSON-RPC and no longer provides a way to start an HTTP server. * crypto: improve error messages in LoadECDSA (#20718) This improves error messages when the file is too short or too long. Also rewrite the test for SaveECDSA because LoadECDSA has its own test now. Co-authored-by: Felix Lange <fjl@twurst.com> * changed date of rpcstack.go since new file (#20904) * accounts/abi/bind: fixed erroneous filtering of negative ints (#20865) * accounts/abi/bind: fixed erroneous packing of negative ints * accounts/abi/bind: added test cases for negative ints in topics * accounts/abi/bind: fixed genIntType for go 1.12 * accounts/abi: minor nitpick * cmd: deprecate --testnet, use named networks instead (#20852) * cmd/utils: make goerli the default testnet * cmd/geth: explicitly rename testnet to ropsten * core: explicitly rename testnet to ropsten * params: explicitly rename testnet to ropsten * cmd: explicitly rename testnet to ropsten * miner: explicitly rename testnet to ropsten * mobile: allow for returning the goerli spec * tests: explicitly rename testnet to ropsten * docs: update readme to reflect changes to the default testnet * mobile: allow for configuring goerli and rinkeby nodes * cmd/geth: revert --testnet back to ropsten and mark as legacy * cmd/util: mark --testnet flag as deprecated * docs: update readme to properly reflect the 3 testnets * cmd/utils: add an explicit deprecation warning on startup * cmd/utils: swap goerli and ropsten in usage * cmd/geth: swap goerli and ropsten in usage * cmd/geth: if running a known preset, log it for convenience * docs: improve readme on usage of ropsten's testnet datadir * cmd/utils: check if legacy `testnet` datadir exists for ropsten * cmd/geth: check for legacy testnet path in console command * cmd/geth: use switch statement for complex conditions in main * cmd/geth: move known preset log statement to the very top * cmd/utils: create new ropsten configurations in the ropsten datadir * cmd/utils: makedatadir should check for existing testnet dir * cmd/geth: add legacy testnet flag to the copy db command * cmd/geth: add legacy testnet flag to the inspect command * les, les/lespay/client: add service value statistics and API (#20837) This PR adds service value measurement statistics to the light client. It also adds a private API that makes these statistics accessible. A follow-up PR will add the new server pool which uses these statistics to select servers with good performance. This document describes the function of the new components: https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4 Co-authored-by: rjl493456442 <garyrong0905@gmail.com> Co-authored-by: rjl493456442 <garyrong0905@gmail.com> * README: update min go version to 1.13 (#20911) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 (#20913) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 * travis, appveyor: force GO111MODULE=on for every build * core/rawdb: fix data race between Retrieve and Close (#20919) * core/rawdb: fixed data race between retrieve and close closes https://github.com/ethereum/go-ethereum/issues/20420 * core/rawdb: use non-atomic load while holding mutex * all: simplify and fix database iteration with prefix/start (#20808) * core/state/snapshot: start fixing disk iterator seek * ethdb, rawdb, leveldb, memorydb: implement iterators with prefix and start * les, core/state/snapshot: iterator fixes * all: remove two iterator methods * all: rename Iteratee.NewIteratorWith -> NewIterator * ethdb: fix review concerns * params: update CHTs for the 1.9.13 release * params: release Geth v1.9.13 * added some missing files * post-rebase fixups Co-authored-by: Péter Szilágyi <peterke@gmail.com> Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: gary rong <garyrong0905@gmail.com> Co-authored-by: Alex Willmer <alex@moreati.org.uk> Co-authored-by: meowsbits <45600330+meowsbits@users.noreply.github.com> Co-authored-by: Felix Lange <fjl@twurst.com> Co-authored-by: rene <41963722+renaynay@users.noreply.github.com> Co-authored-by: Ha ĐANG <dvietha@gmail.com> Co-authored-by: Hanjiang Yu <42531996+de1acr0ix@users.noreply.github.com> Co-authored-by: ligi <ligi@ligi.de> Co-authored-by: Wenbiao Zheng <delweng@gmail.com> Co-authored-by: Adam Schmideg <adamschmideg@users.noreply.github.com> Co-authored-by: Jeff Wentworth <jeff@curvegrid.com> Co-authored-by: Paweł Bylica <chfast@gmail.com> Co-authored-by: ucwong <ucwong@126.com> Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de> Co-authored-by: Luke Champine <luke.champine@gmail.com> Co-authored-by: Boqin Qin <Bobbqqin@gmail.com> Co-authored-by: William Morriss <wjmelements@gmail.com> Co-authored-by: Guillaume Ballet <gballet@gmail.com> Co-authored-by: Raw Pong Ghmoa <58883403+q9f@users.noreply.github.com> Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
2020-04-19 17:31:47 +00:00
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
func startHTTP(t *testing.T, httpPort, wsPort int) *Node {
node := createNode(t, httpPort, wsPort)
err := node.Start()
geth 1.9.13 (#469) * core: initial version of state snapshots * core/state: lazy sorting, snapshot invalidation * core/state/snapshot: extract and split cap method, cover corners * snapshot: iteration and buffering optimizations * core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup * 123 * core/rawdb, core/state/snapshot: runtime snapshot generation * core/state/snapshot: fix difflayer origin-initalization after flatten * add "to merge" * core/state/snapshot: implement snapshot layer iteration * core/state/snapshot: node behavioural difference on bloom content * core: journal the snapshot inside leveldb, not a flat file * core/state/snapshot: bloom, metrics and prefetcher fixes * core/state/snapshot: move iterator out into its own files * core/state/snapshot: implement iterator priority for fast direct data lookup * core/state/snapshot: full featured account iteration * core/state/snapshot: faster account iteration, CLI integration * core: fix broken tests due to API changes + linter * core/state: fix an account resurrection issue * core/tests: test for destroy+recreate contract with storage * squashme * core/state/snapshot, tests: sync snap gen + snaps in consensus tests * core/state: extend snapshotter to handle account resurrections * core/state: fix account root hash update point * core/state: fix resurrection state clearing and access * core/state/snapshot: handle deleted accounts in fast iterator * core: more blockchain tests * core/state/snapshot: fix various iteration issues due to destruct set * core: fix two snapshot iterator flaws, decollide snap storage prefix * core/state/snapshot/iterator: fix two disk iterator flaws * core/rawdb: change SnapshotStoragePrefix to avoid prefix collision with preimagePrefix * params: begin v1.9.13 release cycle * cmd/checkpoint-admin: add some documentation (#20697) * go.mod: update duktape to fix sprintf warnings (#20777) This revision of go-duktype fixes the following warning ``` duk_logging.c: In function ‘duk__logger_prototype_log_shared’: duk_logging.c:184:64: warning: ‘Z’ directive writing 1 byte into a region of size between 0 and 9 [-Wformat-overflow=] 184 | sprintf((char *) date_buf, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", | ^ In file included from /usr/include/stdio.h:867, from duk_logging.c:5: /usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 25 and 85 bytes into a destination of size 32 36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` * core/rawdb: fix freezer table test error check Fixes: Condition is always 'false' because 'err' is always 'nil' * core/rawdb: improve table database (#20703) This PR fixes issues in TableDatabase. TableDatabase is a wrapper of underlying ethdb.Database with an additional prefix. The prefix is applied to all entries it maintains. However when we try to retrieve entries from it we don't handle the key properly. In theory the prefix should be truncated and only user key is returned. But we don't do it in some cases, e.g. the iterator and batch replayer created from it. So this PR is the fix to these issues. * eth: when triggering a sync, check the head header TD, not block * internal/web3ext: fix clique console apis to work on missing arguments * rpc: dont log an error if user configures --rpcapi=rpc... (#20776) This just prevents a false negative ERROR warning when, for some unknown reason, a user attempts to turn on the module rpc even though it's already going to be on. * node, cmd/clef: report actual port used for http rpc (#20789) * internal/ethapi: don't set sender-balance to maxuint, fixes #16999 (#20783) Prior to this change, eth_call changed the balance of the sender account in the EVM environment to 2^256 wei to cover the gas cost of the call execution. We've had this behavior for a long time even though it's super confusing. This commit sets the default call gasprice to zero instead of updating the balance, which is better because it makes eth_call semantics less surprising. Removing the built-in balance assignment also makes balance overrides work as expected. * metrics: disable CPU stats (gosigar) on iOS * cmd/devp2p: tweak DNS TTLs (#20801) * cmd/devp2p: tweak DNS TTLs * cmd/devp2p: bump treeNodeTTL to four weeks * cmd/devp2p: lower route53 change limit again (#20819) * cmd/devp2p: be very correct about route53 change splitting (#20820) Turns out the way RDATA limits work is documented after all, I just didn't search right. The trick to make it work is to count UPSERTs twice. This also adds an additional check to ensure TTL changes are applied on existing records. * graphql, node, rpc: fix typos in comments (#20824) * eth: improve shutdown synchronization (#20695) * eth: improve shutdown synchronization Most goroutines started by eth.Ethereum didn't have any shutdown sync at all, which lead to weird error messages when quitting the client. This change improves the clean shutdown path by stopping all internal components in dependency order and waiting for them to actually be stopped before shutdown is considered done. In particular, we now stop everything related to peers before stopping 'resident' parts such as core.BlockChain. * eth: rewrite sync controller * eth: remove sync start debug message * eth: notify chainSyncer about new peers after handshake * eth: move downloader.Cancel call into chainSyncer * eth: make post-sync block broadcast synchronous * eth: add comments * core: change blockchain stop message * eth: change closeBloomHandler channel type * eth/filters: fix typo on unindexedLogs function's comment (#20827) * core: bump txpool tx max size to 128KB * snapshotter/tests: verify snapdb post-state against trie (#20812) * core/state/snapshot: basic trie-to-hash implementation * tests: validate snapshot after test * core/state/snapshot: fix review concerns * cmd, consensus: add option to disable mmap for DAG caches/datasets (#20484) * cmd, consensus: add option to disable mmap for DAG caches/datasets * consensus: add benchmarks for mmap with/with lock * cmd/clef: add newaccount command (#20782) * cmd/clef: add newaccount command * cmd/clef: document clef_New, update API versioning * Update cmd/clef/intapi_changelog.md Co-Authored-By: ligi <ligi@ligi.de> * Update signer/core/uiapi.go Co-Authored-By: ligi <ligi@ligi.de> Co-authored-by: ligi <ligi@ligi.de> * eth: add debug_accountRange API (#19645) This new API allows reading accounts and their content by address range. Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: Felix Lange <fjl@twurst.com> * travis: allow cocoapods deploy to fail (#20833) * metrics: improve TestTimerFunc (#20818) The test failed due to what appears to be fluctuations in time.Sleep, which is not the actual method under test. This change modifies it so we compare the metered Max to the actual time instead of the desired time. * README: update private network genesis spec with istanbul (#20841) * add istanbul and muirGlacier to genesis states in README * remove muirGlacier, relocate istanbul * cmd/evm: Rework execution stats (#20792) - Dump stats also for --bench flag. - From memory stats only show number and size of allocations. This is what `test -bench` shows. I doubt others like number of GC runs are any useful, but can be added if requested. - Now the mem stats are for single execution in case of --bench. * cmd/devp2p, cmd/wnode, whisper: add missing calls to Timer.Stop (#20843) * p2p/server: add UDP port mapping goroutine to wait group (#20846) * accounts/abi faster unpacking of int256 (#20850) * p2p/discv5: add missing Timer.Stop calls (#20853) * miner/worker: add missing timer.Stop call (#20857) * cmd/geth: fix bad genesis test (#20860) * eth/filters: add missing Ticker.Stop call (#20862) * eth/fetcher: add missing timer.Stop calls (#20861) * event: add missing timer.Stop call in TestFeed (#20868) * metrics: add missing calls to Ticker.Stop in tests (#20866) * ethstats: add missing Ticker.Stop call (#20867) * p2p/discv5, p2p/testing: add missing Timer.Stop calls in tests (#20869) * core: add missing Timer.Stop call in TestLogReorgs (#20870) * rpc: add missing timer.Stop calls in websocket tests (#20863) * crypto/ecies: improve concatKDF (#20836) This removes a bunch of weird code around the counter overflow check in concatKDF and makes it actually work for different hash output sizes. The overflow check worked as follows: concatKDF applies the hash function N times, where N is roundup(kdLen, hashsize) / hashsize. N should not overflow 32 bits because that would lead to a repetition in the KDF output. A couple issues with the overflow check: - It used the hash.BlockSize, which is wrong because the block size is about the input of the hash function. Luckily, all standard hash functions have a block size that's greater than the output size, so concatKDF didn't crash, it just generated too much key material. - The check used big.Int to compare against 2^32-1. - The calculation could still overflow before reaching the check. The new code in concatKDF doesn't check for overflow. Instead, there is a new check on ECIESParams which ensures that params.KeyLen is < 512. This removes any possibility of overflow. There are a couple of miscellaneous improvements bundled in with this change: - The key buffer is pre-allocated instead of appending the hash output to an initially empty slice. - The code that uses concatKDF to derive keys is now shared between Encrypt and Decrypt. - There was a redundant invocation of IsOnCurve in Decrypt. This is now removed because elliptic.Unmarshal already checks whether the input is a valid curve point since Go 1.5. Co-authored-by: Felix Lange <fjl@twurst.com> * rpc: metrics for JSON-RPC method calls (#20847) This adds a couple of metrics for tracking the timing and frequency of method calls: - rpc/requests gauge counts all requests - rpc/success gauge counts requests which return err == nil - rpc/failure gauge counts requests which return err != nil - rpc/duration/all timer tracks timing of all requests - rpc/duration/<method>/<success/failure> tracks per-method timing * mobile: use bind.NewKeyedTransactor instead of duplicating (#20888) It's better to reuse the existing code to create a keyed transactor than to rewrite the logic again. * internal/ethapi: add CallArgs.ToMessage method (#20854) ToMessage is used to convert between ethapi.CallArgs and types.Message. It reduces the length of the DoCall method by about half by abstracting out the conversion between the CallArgs and the Message. This should improve the code's maintainability and reusability. * eth, les: fix flaky tests (#20897) * les: fix flaky test * eth: fix flaky test * cmd/geth: enable metrics for geth import command (#20738) * cmd/geth: enable metrics for geth import command * cmd/geth: enable metrics-flags for import command * core/vm: use a callcontext struct (#20761) * core/vm: use a callcontext struct * core/vm: fix tests * core/vm/runtime: benchmark * core/vm: make intpool push inlineable, unexpose callcontext * docs/audits: add discv5 protocol audits from LA and C53 (#20898) * .github: change gitter reference to discord link in issue template (#20896) * couple of fixes to docs in clef (#20900) * p2p/discover: add initial discovery v5 implementation (#20750)This adds an implementation of the current discovery v5 spec.There is full integration with cmd/devp2p and enode.Iterator in thisversion. In theory we could enable the new protocol as a replacement ofdiscovery v4 at any time. In practice, there will likely be a few morechanges to the spec and implementation before this can happen. * build: upgrade to golangci-lint 1.24.0 (#20901) * accounts/scwallet: remove unnecessary uses of fmt.Sprintf * cmd/puppeth: remove unnecessary uses of fmt.Sprintf * p2p/discv5: remove unnecessary use of fmt.Sprintf * whisper/mailserver: remove unnecessary uses of fmt.Sprintf * core: goimports -w tx_pool_test.go * eth/downloader: goimports -w downloader_test.go * build: upgrade to golangci-lint 1.24.0 * accounts/abi/bind: Refactored topics (#20851) * accounts/abi/bind: refactored topics * accounts/abi/bind: use store function to remove code duplication * accounts/abi/bind: removed unused type defs * accounts/abi/bind: error on tuples in topics * Cosmetic changes to restart travis build Co-authored-by: Guillaume Ballet <gballet@gmail.com> * node: allow websocket and HTTP on the same port (#20810) This change makes it possible to run geth with JSON-RPC over HTTP and WebSocket on the same TCP port. The default port for WebSocket is still 8546. geth --rpc --rpcport 8545 --ws --wsport 8545 This also removes a lot of deprecated API surface from package rpc. The rpc package is now purely about serving JSON-RPC and no longer provides a way to start an HTTP server. * crypto: improve error messages in LoadECDSA (#20718) This improves error messages when the file is too short or too long. Also rewrite the test for SaveECDSA because LoadECDSA has its own test now. Co-authored-by: Felix Lange <fjl@twurst.com> * changed date of rpcstack.go since new file (#20904) * accounts/abi/bind: fixed erroneous filtering of negative ints (#20865) * accounts/abi/bind: fixed erroneous packing of negative ints * accounts/abi/bind: added test cases for negative ints in topics * accounts/abi/bind: fixed genIntType for go 1.12 * accounts/abi: minor nitpick * cmd: deprecate --testnet, use named networks instead (#20852) * cmd/utils: make goerli the default testnet * cmd/geth: explicitly rename testnet to ropsten * core: explicitly rename testnet to ropsten * params: explicitly rename testnet to ropsten * cmd: explicitly rename testnet to ropsten * miner: explicitly rename testnet to ropsten * mobile: allow for returning the goerli spec * tests: explicitly rename testnet to ropsten * docs: update readme to reflect changes to the default testnet * mobile: allow for configuring goerli and rinkeby nodes * cmd/geth: revert --testnet back to ropsten and mark as legacy * cmd/util: mark --testnet flag as deprecated * docs: update readme to properly reflect the 3 testnets * cmd/utils: add an explicit deprecation warning on startup * cmd/utils: swap goerli and ropsten in usage * cmd/geth: swap goerli and ropsten in usage * cmd/geth: if running a known preset, log it for convenience * docs: improve readme on usage of ropsten's testnet datadir * cmd/utils: check if legacy `testnet` datadir exists for ropsten * cmd/geth: check for legacy testnet path in console command * cmd/geth: use switch statement for complex conditions in main * cmd/geth: move known preset log statement to the very top * cmd/utils: create new ropsten configurations in the ropsten datadir * cmd/utils: makedatadir should check for existing testnet dir * cmd/geth: add legacy testnet flag to the copy db command * cmd/geth: add legacy testnet flag to the inspect command * les, les/lespay/client: add service value statistics and API (#20837) This PR adds service value measurement statistics to the light client. It also adds a private API that makes these statistics accessible. A follow-up PR will add the new server pool which uses these statistics to select servers with good performance. This document describes the function of the new components: https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4 Co-authored-by: rjl493456442 <garyrong0905@gmail.com> Co-authored-by: rjl493456442 <garyrong0905@gmail.com> * README: update min go version to 1.13 (#20911) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 (#20913) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 * travis, appveyor: force GO111MODULE=on for every build * core/rawdb: fix data race between Retrieve and Close (#20919) * core/rawdb: fixed data race between retrieve and close closes https://github.com/ethereum/go-ethereum/issues/20420 * core/rawdb: use non-atomic load while holding mutex * all: simplify and fix database iteration with prefix/start (#20808) * core/state/snapshot: start fixing disk iterator seek * ethdb, rawdb, leveldb, memorydb: implement iterators with prefix and start * les, core/state/snapshot: iterator fixes * all: remove two iterator methods * all: rename Iteratee.NewIteratorWith -> NewIterator * ethdb: fix review concerns * params: update CHTs for the 1.9.13 release * params: release Geth v1.9.13 * added some missing files * post-rebase fixups Co-authored-by: Péter Szilágyi <peterke@gmail.com> Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: gary rong <garyrong0905@gmail.com> Co-authored-by: Alex Willmer <alex@moreati.org.uk> Co-authored-by: meowsbits <45600330+meowsbits@users.noreply.github.com> Co-authored-by: Felix Lange <fjl@twurst.com> Co-authored-by: rene <41963722+renaynay@users.noreply.github.com> Co-authored-by: Ha ĐANG <dvietha@gmail.com> Co-authored-by: Hanjiang Yu <42531996+de1acr0ix@users.noreply.github.com> Co-authored-by: ligi <ligi@ligi.de> Co-authored-by: Wenbiao Zheng <delweng@gmail.com> Co-authored-by: Adam Schmideg <adamschmideg@users.noreply.github.com> Co-authored-by: Jeff Wentworth <jeff@curvegrid.com> Co-authored-by: Paweł Bylica <chfast@gmail.com> Co-authored-by: ucwong <ucwong@126.com> Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de> Co-authored-by: Luke Champine <luke.champine@gmail.com> Co-authored-by: Boqin Qin <Bobbqqin@gmail.com> Co-authored-by: William Morriss <wjmelements@gmail.com> Co-authored-by: Guillaume Ballet <gballet@gmail.com> Co-authored-by: Raw Pong Ghmoa <58883403+q9f@users.noreply.github.com> Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
2020-04-19 17:31:47 +00:00
if err != nil {
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
t.Fatalf("could not start http service on node: %v", err)
geth 1.9.13 (#469) * core: initial version of state snapshots * core/state: lazy sorting, snapshot invalidation * core/state/snapshot: extract and split cap method, cover corners * snapshot: iteration and buffering optimizations * core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup * 123 * core/rawdb, core/state/snapshot: runtime snapshot generation * core/state/snapshot: fix difflayer origin-initalization after flatten * add "to merge" * core/state/snapshot: implement snapshot layer iteration * core/state/snapshot: node behavioural difference on bloom content * core: journal the snapshot inside leveldb, not a flat file * core/state/snapshot: bloom, metrics and prefetcher fixes * core/state/snapshot: move iterator out into its own files * core/state/snapshot: implement iterator priority for fast direct data lookup * core/state/snapshot: full featured account iteration * core/state/snapshot: faster account iteration, CLI integration * core: fix broken tests due to API changes + linter * core/state: fix an account resurrection issue * core/tests: test for destroy+recreate contract with storage * squashme * core/state/snapshot, tests: sync snap gen + snaps in consensus tests * core/state: extend snapshotter to handle account resurrections * core/state: fix account root hash update point * core/state: fix resurrection state clearing and access * core/state/snapshot: handle deleted accounts in fast iterator * core: more blockchain tests * core/state/snapshot: fix various iteration issues due to destruct set * core: fix two snapshot iterator flaws, decollide snap storage prefix * core/state/snapshot/iterator: fix two disk iterator flaws * core/rawdb: change SnapshotStoragePrefix to avoid prefix collision with preimagePrefix * params: begin v1.9.13 release cycle * cmd/checkpoint-admin: add some documentation (#20697) * go.mod: update duktape to fix sprintf warnings (#20777) This revision of go-duktype fixes the following warning ``` duk_logging.c: In function ‘duk__logger_prototype_log_shared’: duk_logging.c:184:64: warning: ‘Z’ directive writing 1 byte into a region of size between 0 and 9 [-Wformat-overflow=] 184 | sprintf((char *) date_buf, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", | ^ In file included from /usr/include/stdio.h:867, from duk_logging.c:5: /usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 25 and 85 bytes into a destination of size 32 36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` * core/rawdb: fix freezer table test error check Fixes: Condition is always 'false' because 'err' is always 'nil' * core/rawdb: improve table database (#20703) This PR fixes issues in TableDatabase. TableDatabase is a wrapper of underlying ethdb.Database with an additional prefix. The prefix is applied to all entries it maintains. However when we try to retrieve entries from it we don't handle the key properly. In theory the prefix should be truncated and only user key is returned. But we don't do it in some cases, e.g. the iterator and batch replayer created from it. So this PR is the fix to these issues. * eth: when triggering a sync, check the head header TD, not block * internal/web3ext: fix clique console apis to work on missing arguments * rpc: dont log an error if user configures --rpcapi=rpc... (#20776) This just prevents a false negative ERROR warning when, for some unknown reason, a user attempts to turn on the module rpc even though it's already going to be on. * node, cmd/clef: report actual port used for http rpc (#20789) * internal/ethapi: don't set sender-balance to maxuint, fixes #16999 (#20783) Prior to this change, eth_call changed the balance of the sender account in the EVM environment to 2^256 wei to cover the gas cost of the call execution. We've had this behavior for a long time even though it's super confusing. This commit sets the default call gasprice to zero instead of updating the balance, which is better because it makes eth_call semantics less surprising. Removing the built-in balance assignment also makes balance overrides work as expected. * metrics: disable CPU stats (gosigar) on iOS * cmd/devp2p: tweak DNS TTLs (#20801) * cmd/devp2p: tweak DNS TTLs * cmd/devp2p: bump treeNodeTTL to four weeks * cmd/devp2p: lower route53 change limit again (#20819) * cmd/devp2p: be very correct about route53 change splitting (#20820) Turns out the way RDATA limits work is documented after all, I just didn't search right. The trick to make it work is to count UPSERTs twice. This also adds an additional check to ensure TTL changes are applied on existing records. * graphql, node, rpc: fix typos in comments (#20824) * eth: improve shutdown synchronization (#20695) * eth: improve shutdown synchronization Most goroutines started by eth.Ethereum didn't have any shutdown sync at all, which lead to weird error messages when quitting the client. This change improves the clean shutdown path by stopping all internal components in dependency order and waiting for them to actually be stopped before shutdown is considered done. In particular, we now stop everything related to peers before stopping 'resident' parts such as core.BlockChain. * eth: rewrite sync controller * eth: remove sync start debug message * eth: notify chainSyncer about new peers after handshake * eth: move downloader.Cancel call into chainSyncer * eth: make post-sync block broadcast synchronous * eth: add comments * core: change blockchain stop message * eth: change closeBloomHandler channel type * eth/filters: fix typo on unindexedLogs function's comment (#20827) * core: bump txpool tx max size to 128KB * snapshotter/tests: verify snapdb post-state against trie (#20812) * core/state/snapshot: basic trie-to-hash implementation * tests: validate snapshot after test * core/state/snapshot: fix review concerns * cmd, consensus: add option to disable mmap for DAG caches/datasets (#20484) * cmd, consensus: add option to disable mmap for DAG caches/datasets * consensus: add benchmarks for mmap with/with lock * cmd/clef: add newaccount command (#20782) * cmd/clef: add newaccount command * cmd/clef: document clef_New, update API versioning * Update cmd/clef/intapi_changelog.md Co-Authored-By: ligi <ligi@ligi.de> * Update signer/core/uiapi.go Co-Authored-By: ligi <ligi@ligi.de> Co-authored-by: ligi <ligi@ligi.de> * eth: add debug_accountRange API (#19645) This new API allows reading accounts and their content by address range. Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: Felix Lange <fjl@twurst.com> * travis: allow cocoapods deploy to fail (#20833) * metrics: improve TestTimerFunc (#20818) The test failed due to what appears to be fluctuations in time.Sleep, which is not the actual method under test. This change modifies it so we compare the metered Max to the actual time instead of the desired time. * README: update private network genesis spec with istanbul (#20841) * add istanbul and muirGlacier to genesis states in README * remove muirGlacier, relocate istanbul * cmd/evm: Rework execution stats (#20792) - Dump stats also for --bench flag. - From memory stats only show number and size of allocations. This is what `test -bench` shows. I doubt others like number of GC runs are any useful, but can be added if requested. - Now the mem stats are for single execution in case of --bench. * cmd/devp2p, cmd/wnode, whisper: add missing calls to Timer.Stop (#20843) * p2p/server: add UDP port mapping goroutine to wait group (#20846) * accounts/abi faster unpacking of int256 (#20850) * p2p/discv5: add missing Timer.Stop calls (#20853) * miner/worker: add missing timer.Stop call (#20857) * cmd/geth: fix bad genesis test (#20860) * eth/filters: add missing Ticker.Stop call (#20862) * eth/fetcher: add missing timer.Stop calls (#20861) * event: add missing timer.Stop call in TestFeed (#20868) * metrics: add missing calls to Ticker.Stop in tests (#20866) * ethstats: add missing Ticker.Stop call (#20867) * p2p/discv5, p2p/testing: add missing Timer.Stop calls in tests (#20869) * core: add missing Timer.Stop call in TestLogReorgs (#20870) * rpc: add missing timer.Stop calls in websocket tests (#20863) * crypto/ecies: improve concatKDF (#20836) This removes a bunch of weird code around the counter overflow check in concatKDF and makes it actually work for different hash output sizes. The overflow check worked as follows: concatKDF applies the hash function N times, where N is roundup(kdLen, hashsize) / hashsize. N should not overflow 32 bits because that would lead to a repetition in the KDF output. A couple issues with the overflow check: - It used the hash.BlockSize, which is wrong because the block size is about the input of the hash function. Luckily, all standard hash functions have a block size that's greater than the output size, so concatKDF didn't crash, it just generated too much key material. - The check used big.Int to compare against 2^32-1. - The calculation could still overflow before reaching the check. The new code in concatKDF doesn't check for overflow. Instead, there is a new check on ECIESParams which ensures that params.KeyLen is < 512. This removes any possibility of overflow. There are a couple of miscellaneous improvements bundled in with this change: - The key buffer is pre-allocated instead of appending the hash output to an initially empty slice. - The code that uses concatKDF to derive keys is now shared between Encrypt and Decrypt. - There was a redundant invocation of IsOnCurve in Decrypt. This is now removed because elliptic.Unmarshal already checks whether the input is a valid curve point since Go 1.5. Co-authored-by: Felix Lange <fjl@twurst.com> * rpc: metrics for JSON-RPC method calls (#20847) This adds a couple of metrics for tracking the timing and frequency of method calls: - rpc/requests gauge counts all requests - rpc/success gauge counts requests which return err == nil - rpc/failure gauge counts requests which return err != nil - rpc/duration/all timer tracks timing of all requests - rpc/duration/<method>/<success/failure> tracks per-method timing * mobile: use bind.NewKeyedTransactor instead of duplicating (#20888) It's better to reuse the existing code to create a keyed transactor than to rewrite the logic again. * internal/ethapi: add CallArgs.ToMessage method (#20854) ToMessage is used to convert between ethapi.CallArgs and types.Message. It reduces the length of the DoCall method by about half by abstracting out the conversion between the CallArgs and the Message. This should improve the code's maintainability and reusability. * eth, les: fix flaky tests (#20897) * les: fix flaky test * eth: fix flaky test * cmd/geth: enable metrics for geth import command (#20738) * cmd/geth: enable metrics for geth import command * cmd/geth: enable metrics-flags for import command * core/vm: use a callcontext struct (#20761) * core/vm: use a callcontext struct * core/vm: fix tests * core/vm/runtime: benchmark * core/vm: make intpool push inlineable, unexpose callcontext * docs/audits: add discv5 protocol audits from LA and C53 (#20898) * .github: change gitter reference to discord link in issue template (#20896) * couple of fixes to docs in clef (#20900) * p2p/discover: add initial discovery v5 implementation (#20750)This adds an implementation of the current discovery v5 spec.There is full integration with cmd/devp2p and enode.Iterator in thisversion. In theory we could enable the new protocol as a replacement ofdiscovery v4 at any time. In practice, there will likely be a few morechanges to the spec and implementation before this can happen. * build: upgrade to golangci-lint 1.24.0 (#20901) * accounts/scwallet: remove unnecessary uses of fmt.Sprintf * cmd/puppeth: remove unnecessary uses of fmt.Sprintf * p2p/discv5: remove unnecessary use of fmt.Sprintf * whisper/mailserver: remove unnecessary uses of fmt.Sprintf * core: goimports -w tx_pool_test.go * eth/downloader: goimports -w downloader_test.go * build: upgrade to golangci-lint 1.24.0 * accounts/abi/bind: Refactored topics (#20851) * accounts/abi/bind: refactored topics * accounts/abi/bind: use store function to remove code duplication * accounts/abi/bind: removed unused type defs * accounts/abi/bind: error on tuples in topics * Cosmetic changes to restart travis build Co-authored-by: Guillaume Ballet <gballet@gmail.com> * node: allow websocket and HTTP on the same port (#20810) This change makes it possible to run geth with JSON-RPC over HTTP and WebSocket on the same TCP port. The default port for WebSocket is still 8546. geth --rpc --rpcport 8545 --ws --wsport 8545 This also removes a lot of deprecated API surface from package rpc. The rpc package is now purely about serving JSON-RPC and no longer provides a way to start an HTTP server. * crypto: improve error messages in LoadECDSA (#20718) This improves error messages when the file is too short or too long. Also rewrite the test for SaveECDSA because LoadECDSA has its own test now. Co-authored-by: Felix Lange <fjl@twurst.com> * changed date of rpcstack.go since new file (#20904) * accounts/abi/bind: fixed erroneous filtering of negative ints (#20865) * accounts/abi/bind: fixed erroneous packing of negative ints * accounts/abi/bind: added test cases for negative ints in topics * accounts/abi/bind: fixed genIntType for go 1.12 * accounts/abi: minor nitpick * cmd: deprecate --testnet, use named networks instead (#20852) * cmd/utils: make goerli the default testnet * cmd/geth: explicitly rename testnet to ropsten * core: explicitly rename testnet to ropsten * params: explicitly rename testnet to ropsten * cmd: explicitly rename testnet to ropsten * miner: explicitly rename testnet to ropsten * mobile: allow for returning the goerli spec * tests: explicitly rename testnet to ropsten * docs: update readme to reflect changes to the default testnet * mobile: allow for configuring goerli and rinkeby nodes * cmd/geth: revert --testnet back to ropsten and mark as legacy * cmd/util: mark --testnet flag as deprecated * docs: update readme to properly reflect the 3 testnets * cmd/utils: add an explicit deprecation warning on startup * cmd/utils: swap goerli and ropsten in usage * cmd/geth: swap goerli and ropsten in usage * cmd/geth: if running a known preset, log it for convenience * docs: improve readme on usage of ropsten's testnet datadir * cmd/utils: check if legacy `testnet` datadir exists for ropsten * cmd/geth: check for legacy testnet path in console command * cmd/geth: use switch statement for complex conditions in main * cmd/geth: move known preset log statement to the very top * cmd/utils: create new ropsten configurations in the ropsten datadir * cmd/utils: makedatadir should check for existing testnet dir * cmd/geth: add legacy testnet flag to the copy db command * cmd/geth: add legacy testnet flag to the inspect command * les, les/lespay/client: add service value statistics and API (#20837) This PR adds service value measurement statistics to the light client. It also adds a private API that makes these statistics accessible. A follow-up PR will add the new server pool which uses these statistics to select servers with good performance. This document describes the function of the new components: https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4 Co-authored-by: rjl493456442 <garyrong0905@gmail.com> Co-authored-by: rjl493456442 <garyrong0905@gmail.com> * README: update min go version to 1.13 (#20911) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 (#20913) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 * travis, appveyor: force GO111MODULE=on for every build * core/rawdb: fix data race between Retrieve and Close (#20919) * core/rawdb: fixed data race between retrieve and close closes https://github.com/ethereum/go-ethereum/issues/20420 * core/rawdb: use non-atomic load while holding mutex * all: simplify and fix database iteration with prefix/start (#20808) * core/state/snapshot: start fixing disk iterator seek * ethdb, rawdb, leveldb, memorydb: implement iterators with prefix and start * les, core/state/snapshot: iterator fixes * all: remove two iterator methods * all: rename Iteratee.NewIteratorWith -> NewIterator * ethdb: fix review concerns * params: update CHTs for the 1.9.13 release * params: release Geth v1.9.13 * added some missing files * post-rebase fixups Co-authored-by: Péter Szilágyi <peterke@gmail.com> Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: gary rong <garyrong0905@gmail.com> Co-authored-by: Alex Willmer <alex@moreati.org.uk> Co-authored-by: meowsbits <45600330+meowsbits@users.noreply.github.com> Co-authored-by: Felix Lange <fjl@twurst.com> Co-authored-by: rene <41963722+renaynay@users.noreply.github.com> Co-authored-by: Ha ĐANG <dvietha@gmail.com> Co-authored-by: Hanjiang Yu <42531996+de1acr0ix@users.noreply.github.com> Co-authored-by: ligi <ligi@ligi.de> Co-authored-by: Wenbiao Zheng <delweng@gmail.com> Co-authored-by: Adam Schmideg <adamschmideg@users.noreply.github.com> Co-authored-by: Jeff Wentworth <jeff@curvegrid.com> Co-authored-by: Paweł Bylica <chfast@gmail.com> Co-authored-by: ucwong <ucwong@126.com> Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de> Co-authored-by: Luke Champine <luke.champine@gmail.com> Co-authored-by: Boqin Qin <Bobbqqin@gmail.com> Co-authored-by: William Morriss <wjmelements@gmail.com> Co-authored-by: Guillaume Ballet <gballet@gmail.com> Co-authored-by: Raw Pong Ghmoa <58883403+q9f@users.noreply.github.com> Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
2020-04-19 17:31:47 +00:00
}
return node
}
func doHTTPRequest(t *testing.T, req *http.Request) *http.Response {
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
client := http.DefaultClient
geth 1.9.13 (#469) * core: initial version of state snapshots * core/state: lazy sorting, snapshot invalidation * core/state/snapshot: extract and split cap method, cover corners * snapshot: iteration and buffering optimizations * core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup * 123 * core/rawdb, core/state/snapshot: runtime snapshot generation * core/state/snapshot: fix difflayer origin-initalization after flatten * add "to merge" * core/state/snapshot: implement snapshot layer iteration * core/state/snapshot: node behavioural difference on bloom content * core: journal the snapshot inside leveldb, not a flat file * core/state/snapshot: bloom, metrics and prefetcher fixes * core/state/snapshot: move iterator out into its own files * core/state/snapshot: implement iterator priority for fast direct data lookup * core/state/snapshot: full featured account iteration * core/state/snapshot: faster account iteration, CLI integration * core: fix broken tests due to API changes + linter * core/state: fix an account resurrection issue * core/tests: test for destroy+recreate contract with storage * squashme * core/state/snapshot, tests: sync snap gen + snaps in consensus tests * core/state: extend snapshotter to handle account resurrections * core/state: fix account root hash update point * core/state: fix resurrection state clearing and access * core/state/snapshot: handle deleted accounts in fast iterator * core: more blockchain tests * core/state/snapshot: fix various iteration issues due to destruct set * core: fix two snapshot iterator flaws, decollide snap storage prefix * core/state/snapshot/iterator: fix two disk iterator flaws * core/rawdb: change SnapshotStoragePrefix to avoid prefix collision with preimagePrefix * params: begin v1.9.13 release cycle * cmd/checkpoint-admin: add some documentation (#20697) * go.mod: update duktape to fix sprintf warnings (#20777) This revision of go-duktype fixes the following warning ``` duk_logging.c: In function ‘duk__logger_prototype_log_shared’: duk_logging.c:184:64: warning: ‘Z’ directive writing 1 byte into a region of size between 0 and 9 [-Wformat-overflow=] 184 | sprintf((char *) date_buf, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", | ^ In file included from /usr/include/stdio.h:867, from duk_logging.c:5: /usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 25 and 85 bytes into a destination of size 32 36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` * core/rawdb: fix freezer table test error check Fixes: Condition is always 'false' because 'err' is always 'nil' * core/rawdb: improve table database (#20703) This PR fixes issues in TableDatabase. TableDatabase is a wrapper of underlying ethdb.Database with an additional prefix. The prefix is applied to all entries it maintains. However when we try to retrieve entries from it we don't handle the key properly. In theory the prefix should be truncated and only user key is returned. But we don't do it in some cases, e.g. the iterator and batch replayer created from it. So this PR is the fix to these issues. * eth: when triggering a sync, check the head header TD, not block * internal/web3ext: fix clique console apis to work on missing arguments * rpc: dont log an error if user configures --rpcapi=rpc... (#20776) This just prevents a false negative ERROR warning when, for some unknown reason, a user attempts to turn on the module rpc even though it's already going to be on. * node, cmd/clef: report actual port used for http rpc (#20789) * internal/ethapi: don't set sender-balance to maxuint, fixes #16999 (#20783) Prior to this change, eth_call changed the balance of the sender account in the EVM environment to 2^256 wei to cover the gas cost of the call execution. We've had this behavior for a long time even though it's super confusing. This commit sets the default call gasprice to zero instead of updating the balance, which is better because it makes eth_call semantics less surprising. Removing the built-in balance assignment also makes balance overrides work as expected. * metrics: disable CPU stats (gosigar) on iOS * cmd/devp2p: tweak DNS TTLs (#20801) * cmd/devp2p: tweak DNS TTLs * cmd/devp2p: bump treeNodeTTL to four weeks * cmd/devp2p: lower route53 change limit again (#20819) * cmd/devp2p: be very correct about route53 change splitting (#20820) Turns out the way RDATA limits work is documented after all, I just didn't search right. The trick to make it work is to count UPSERTs twice. This also adds an additional check to ensure TTL changes are applied on existing records. * graphql, node, rpc: fix typos in comments (#20824) * eth: improve shutdown synchronization (#20695) * eth: improve shutdown synchronization Most goroutines started by eth.Ethereum didn't have any shutdown sync at all, which lead to weird error messages when quitting the client. This change improves the clean shutdown path by stopping all internal components in dependency order and waiting for them to actually be stopped before shutdown is considered done. In particular, we now stop everything related to peers before stopping 'resident' parts such as core.BlockChain. * eth: rewrite sync controller * eth: remove sync start debug message * eth: notify chainSyncer about new peers after handshake * eth: move downloader.Cancel call into chainSyncer * eth: make post-sync block broadcast synchronous * eth: add comments * core: change blockchain stop message * eth: change closeBloomHandler channel type * eth/filters: fix typo on unindexedLogs function's comment (#20827) * core: bump txpool tx max size to 128KB * snapshotter/tests: verify snapdb post-state against trie (#20812) * core/state/snapshot: basic trie-to-hash implementation * tests: validate snapshot after test * core/state/snapshot: fix review concerns * cmd, consensus: add option to disable mmap for DAG caches/datasets (#20484) * cmd, consensus: add option to disable mmap for DAG caches/datasets * consensus: add benchmarks for mmap with/with lock * cmd/clef: add newaccount command (#20782) * cmd/clef: add newaccount command * cmd/clef: document clef_New, update API versioning * Update cmd/clef/intapi_changelog.md Co-Authored-By: ligi <ligi@ligi.de> * Update signer/core/uiapi.go Co-Authored-By: ligi <ligi@ligi.de> Co-authored-by: ligi <ligi@ligi.de> * eth: add debug_accountRange API (#19645) This new API allows reading accounts and their content by address range. Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: Felix Lange <fjl@twurst.com> * travis: allow cocoapods deploy to fail (#20833) * metrics: improve TestTimerFunc (#20818) The test failed due to what appears to be fluctuations in time.Sleep, which is not the actual method under test. This change modifies it so we compare the metered Max to the actual time instead of the desired time. * README: update private network genesis spec with istanbul (#20841) * add istanbul and muirGlacier to genesis states in README * remove muirGlacier, relocate istanbul * cmd/evm: Rework execution stats (#20792) - Dump stats also for --bench flag. - From memory stats only show number and size of allocations. This is what `test -bench` shows. I doubt others like number of GC runs are any useful, but can be added if requested. - Now the mem stats are for single execution in case of --bench. * cmd/devp2p, cmd/wnode, whisper: add missing calls to Timer.Stop (#20843) * p2p/server: add UDP port mapping goroutine to wait group (#20846) * accounts/abi faster unpacking of int256 (#20850) * p2p/discv5: add missing Timer.Stop calls (#20853) * miner/worker: add missing timer.Stop call (#20857) * cmd/geth: fix bad genesis test (#20860) * eth/filters: add missing Ticker.Stop call (#20862) * eth/fetcher: add missing timer.Stop calls (#20861) * event: add missing timer.Stop call in TestFeed (#20868) * metrics: add missing calls to Ticker.Stop in tests (#20866) * ethstats: add missing Ticker.Stop call (#20867) * p2p/discv5, p2p/testing: add missing Timer.Stop calls in tests (#20869) * core: add missing Timer.Stop call in TestLogReorgs (#20870) * rpc: add missing timer.Stop calls in websocket tests (#20863) * crypto/ecies: improve concatKDF (#20836) This removes a bunch of weird code around the counter overflow check in concatKDF and makes it actually work for different hash output sizes. The overflow check worked as follows: concatKDF applies the hash function N times, where N is roundup(kdLen, hashsize) / hashsize. N should not overflow 32 bits because that would lead to a repetition in the KDF output. A couple issues with the overflow check: - It used the hash.BlockSize, which is wrong because the block size is about the input of the hash function. Luckily, all standard hash functions have a block size that's greater than the output size, so concatKDF didn't crash, it just generated too much key material. - The check used big.Int to compare against 2^32-1. - The calculation could still overflow before reaching the check. The new code in concatKDF doesn't check for overflow. Instead, there is a new check on ECIESParams which ensures that params.KeyLen is < 512. This removes any possibility of overflow. There are a couple of miscellaneous improvements bundled in with this change: - The key buffer is pre-allocated instead of appending the hash output to an initially empty slice. - The code that uses concatKDF to derive keys is now shared between Encrypt and Decrypt. - There was a redundant invocation of IsOnCurve in Decrypt. This is now removed because elliptic.Unmarshal already checks whether the input is a valid curve point since Go 1.5. Co-authored-by: Felix Lange <fjl@twurst.com> * rpc: metrics for JSON-RPC method calls (#20847) This adds a couple of metrics for tracking the timing and frequency of method calls: - rpc/requests gauge counts all requests - rpc/success gauge counts requests which return err == nil - rpc/failure gauge counts requests which return err != nil - rpc/duration/all timer tracks timing of all requests - rpc/duration/<method>/<success/failure> tracks per-method timing * mobile: use bind.NewKeyedTransactor instead of duplicating (#20888) It's better to reuse the existing code to create a keyed transactor than to rewrite the logic again. * internal/ethapi: add CallArgs.ToMessage method (#20854) ToMessage is used to convert between ethapi.CallArgs and types.Message. It reduces the length of the DoCall method by about half by abstracting out the conversion between the CallArgs and the Message. This should improve the code's maintainability and reusability. * eth, les: fix flaky tests (#20897) * les: fix flaky test * eth: fix flaky test * cmd/geth: enable metrics for geth import command (#20738) * cmd/geth: enable metrics for geth import command * cmd/geth: enable metrics-flags for import command * core/vm: use a callcontext struct (#20761) * core/vm: use a callcontext struct * core/vm: fix tests * core/vm/runtime: benchmark * core/vm: make intpool push inlineable, unexpose callcontext * docs/audits: add discv5 protocol audits from LA and C53 (#20898) * .github: change gitter reference to discord link in issue template (#20896) * couple of fixes to docs in clef (#20900) * p2p/discover: add initial discovery v5 implementation (#20750)This adds an implementation of the current discovery v5 spec.There is full integration with cmd/devp2p and enode.Iterator in thisversion. In theory we could enable the new protocol as a replacement ofdiscovery v4 at any time. In practice, there will likely be a few morechanges to the spec and implementation before this can happen. * build: upgrade to golangci-lint 1.24.0 (#20901) * accounts/scwallet: remove unnecessary uses of fmt.Sprintf * cmd/puppeth: remove unnecessary uses of fmt.Sprintf * p2p/discv5: remove unnecessary use of fmt.Sprintf * whisper/mailserver: remove unnecessary uses of fmt.Sprintf * core: goimports -w tx_pool_test.go * eth/downloader: goimports -w downloader_test.go * build: upgrade to golangci-lint 1.24.0 * accounts/abi/bind: Refactored topics (#20851) * accounts/abi/bind: refactored topics * accounts/abi/bind: use store function to remove code duplication * accounts/abi/bind: removed unused type defs * accounts/abi/bind: error on tuples in topics * Cosmetic changes to restart travis build Co-authored-by: Guillaume Ballet <gballet@gmail.com> * node: allow websocket and HTTP on the same port (#20810) This change makes it possible to run geth with JSON-RPC over HTTP and WebSocket on the same TCP port. The default port for WebSocket is still 8546. geth --rpc --rpcport 8545 --ws --wsport 8545 This also removes a lot of deprecated API surface from package rpc. The rpc package is now purely about serving JSON-RPC and no longer provides a way to start an HTTP server. * crypto: improve error messages in LoadECDSA (#20718) This improves error messages when the file is too short or too long. Also rewrite the test for SaveECDSA because LoadECDSA has its own test now. Co-authored-by: Felix Lange <fjl@twurst.com> * changed date of rpcstack.go since new file (#20904) * accounts/abi/bind: fixed erroneous filtering of negative ints (#20865) * accounts/abi/bind: fixed erroneous packing of negative ints * accounts/abi/bind: added test cases for negative ints in topics * accounts/abi/bind: fixed genIntType for go 1.12 * accounts/abi: minor nitpick * cmd: deprecate --testnet, use named networks instead (#20852) * cmd/utils: make goerli the default testnet * cmd/geth: explicitly rename testnet to ropsten * core: explicitly rename testnet to ropsten * params: explicitly rename testnet to ropsten * cmd: explicitly rename testnet to ropsten * miner: explicitly rename testnet to ropsten * mobile: allow for returning the goerli spec * tests: explicitly rename testnet to ropsten * docs: update readme to reflect changes to the default testnet * mobile: allow for configuring goerli and rinkeby nodes * cmd/geth: revert --testnet back to ropsten and mark as legacy * cmd/util: mark --testnet flag as deprecated * docs: update readme to properly reflect the 3 testnets * cmd/utils: add an explicit deprecation warning on startup * cmd/utils: swap goerli and ropsten in usage * cmd/geth: swap goerli and ropsten in usage * cmd/geth: if running a known preset, log it for convenience * docs: improve readme on usage of ropsten's testnet datadir * cmd/utils: check if legacy `testnet` datadir exists for ropsten * cmd/geth: check for legacy testnet path in console command * cmd/geth: use switch statement for complex conditions in main * cmd/geth: move known preset log statement to the very top * cmd/utils: create new ropsten configurations in the ropsten datadir * cmd/utils: makedatadir should check for existing testnet dir * cmd/geth: add legacy testnet flag to the copy db command * cmd/geth: add legacy testnet flag to the inspect command * les, les/lespay/client: add service value statistics and API (#20837) This PR adds service value measurement statistics to the light client. It also adds a private API that makes these statistics accessible. A follow-up PR will add the new server pool which uses these statistics to select servers with good performance. This document describes the function of the new components: https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4 Co-authored-by: rjl493456442 <garyrong0905@gmail.com> Co-authored-by: rjl493456442 <garyrong0905@gmail.com> * README: update min go version to 1.13 (#20911) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 (#20913) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 * travis, appveyor: force GO111MODULE=on for every build * core/rawdb: fix data race between Retrieve and Close (#20919) * core/rawdb: fixed data race between retrieve and close closes https://github.com/ethereum/go-ethereum/issues/20420 * core/rawdb: use non-atomic load while holding mutex * all: simplify and fix database iteration with prefix/start (#20808) * core/state/snapshot: start fixing disk iterator seek * ethdb, rawdb, leveldb, memorydb: implement iterators with prefix and start * les, core/state/snapshot: iterator fixes * all: remove two iterator methods * all: rename Iteratee.NewIteratorWith -> NewIterator * ethdb: fix review concerns * params: update CHTs for the 1.9.13 release * params: release Geth v1.9.13 * added some missing files * post-rebase fixups Co-authored-by: Péter Szilágyi <peterke@gmail.com> Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: gary rong <garyrong0905@gmail.com> Co-authored-by: Alex Willmer <alex@moreati.org.uk> Co-authored-by: meowsbits <45600330+meowsbits@users.noreply.github.com> Co-authored-by: Felix Lange <fjl@twurst.com> Co-authored-by: rene <41963722+renaynay@users.noreply.github.com> Co-authored-by: Ha ĐANG <dvietha@gmail.com> Co-authored-by: Hanjiang Yu <42531996+de1acr0ix@users.noreply.github.com> Co-authored-by: ligi <ligi@ligi.de> Co-authored-by: Wenbiao Zheng <delweng@gmail.com> Co-authored-by: Adam Schmideg <adamschmideg@users.noreply.github.com> Co-authored-by: Jeff Wentworth <jeff@curvegrid.com> Co-authored-by: Paweł Bylica <chfast@gmail.com> Co-authored-by: ucwong <ucwong@126.com> Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de> Co-authored-by: Luke Champine <luke.champine@gmail.com> Co-authored-by: Boqin Qin <Bobbqqin@gmail.com> Co-authored-by: William Morriss <wjmelements@gmail.com> Co-authored-by: Guillaume Ballet <gballet@gmail.com> Co-authored-by: Raw Pong Ghmoa <58883403+q9f@users.noreply.github.com> Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
2020-04-19 17:31:47 +00:00
resp, err := client.Do(req)
if err != nil {
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
t.Fatalf("could not issue a GET request to the given endpoint: %v", err)
geth 1.9.13 (#469) * core: initial version of state snapshots * core/state: lazy sorting, snapshot invalidation * core/state/snapshot: extract and split cap method, cover corners * snapshot: iteration and buffering optimizations * core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup * 123 * core/rawdb, core/state/snapshot: runtime snapshot generation * core/state/snapshot: fix difflayer origin-initalization after flatten * add "to merge" * core/state/snapshot: implement snapshot layer iteration * core/state/snapshot: node behavioural difference on bloom content * core: journal the snapshot inside leveldb, not a flat file * core/state/snapshot: bloom, metrics and prefetcher fixes * core/state/snapshot: move iterator out into its own files * core/state/snapshot: implement iterator priority for fast direct data lookup * core/state/snapshot: full featured account iteration * core/state/snapshot: faster account iteration, CLI integration * core: fix broken tests due to API changes + linter * core/state: fix an account resurrection issue * core/tests: test for destroy+recreate contract with storage * squashme * core/state/snapshot, tests: sync snap gen + snaps in consensus tests * core/state: extend snapshotter to handle account resurrections * core/state: fix account root hash update point * core/state: fix resurrection state clearing and access * core/state/snapshot: handle deleted accounts in fast iterator * core: more blockchain tests * core/state/snapshot: fix various iteration issues due to destruct set * core: fix two snapshot iterator flaws, decollide snap storage prefix * core/state/snapshot/iterator: fix two disk iterator flaws * core/rawdb: change SnapshotStoragePrefix to avoid prefix collision with preimagePrefix * params: begin v1.9.13 release cycle * cmd/checkpoint-admin: add some documentation (#20697) * go.mod: update duktape to fix sprintf warnings (#20777) This revision of go-duktype fixes the following warning ``` duk_logging.c: In function ‘duk__logger_prototype_log_shared’: duk_logging.c:184:64: warning: ‘Z’ directive writing 1 byte into a region of size between 0 and 9 [-Wformat-overflow=] 184 | sprintf((char *) date_buf, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", | ^ In file included from /usr/include/stdio.h:867, from duk_logging.c:5: /usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 25 and 85 bytes into a destination of size 32 36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` * core/rawdb: fix freezer table test error check Fixes: Condition is always 'false' because 'err' is always 'nil' * core/rawdb: improve table database (#20703) This PR fixes issues in TableDatabase. TableDatabase is a wrapper of underlying ethdb.Database with an additional prefix. The prefix is applied to all entries it maintains. However when we try to retrieve entries from it we don't handle the key properly. In theory the prefix should be truncated and only user key is returned. But we don't do it in some cases, e.g. the iterator and batch replayer created from it. So this PR is the fix to these issues. * eth: when triggering a sync, check the head header TD, not block * internal/web3ext: fix clique console apis to work on missing arguments * rpc: dont log an error if user configures --rpcapi=rpc... (#20776) This just prevents a false negative ERROR warning when, for some unknown reason, a user attempts to turn on the module rpc even though it's already going to be on. * node, cmd/clef: report actual port used for http rpc (#20789) * internal/ethapi: don't set sender-balance to maxuint, fixes #16999 (#20783) Prior to this change, eth_call changed the balance of the sender account in the EVM environment to 2^256 wei to cover the gas cost of the call execution. We've had this behavior for a long time even though it's super confusing. This commit sets the default call gasprice to zero instead of updating the balance, which is better because it makes eth_call semantics less surprising. Removing the built-in balance assignment also makes balance overrides work as expected. * metrics: disable CPU stats (gosigar) on iOS * cmd/devp2p: tweak DNS TTLs (#20801) * cmd/devp2p: tweak DNS TTLs * cmd/devp2p: bump treeNodeTTL to four weeks * cmd/devp2p: lower route53 change limit again (#20819) * cmd/devp2p: be very correct about route53 change splitting (#20820) Turns out the way RDATA limits work is documented after all, I just didn't search right. The trick to make it work is to count UPSERTs twice. This also adds an additional check to ensure TTL changes are applied on existing records. * graphql, node, rpc: fix typos in comments (#20824) * eth: improve shutdown synchronization (#20695) * eth: improve shutdown synchronization Most goroutines started by eth.Ethereum didn't have any shutdown sync at all, which lead to weird error messages when quitting the client. This change improves the clean shutdown path by stopping all internal components in dependency order and waiting for them to actually be stopped before shutdown is considered done. In particular, we now stop everything related to peers before stopping 'resident' parts such as core.BlockChain. * eth: rewrite sync controller * eth: remove sync start debug message * eth: notify chainSyncer about new peers after handshake * eth: move downloader.Cancel call into chainSyncer * eth: make post-sync block broadcast synchronous * eth: add comments * core: change blockchain stop message * eth: change closeBloomHandler channel type * eth/filters: fix typo on unindexedLogs function's comment (#20827) * core: bump txpool tx max size to 128KB * snapshotter/tests: verify snapdb post-state against trie (#20812) * core/state/snapshot: basic trie-to-hash implementation * tests: validate snapshot after test * core/state/snapshot: fix review concerns * cmd, consensus: add option to disable mmap for DAG caches/datasets (#20484) * cmd, consensus: add option to disable mmap for DAG caches/datasets * consensus: add benchmarks for mmap with/with lock * cmd/clef: add newaccount command (#20782) * cmd/clef: add newaccount command * cmd/clef: document clef_New, update API versioning * Update cmd/clef/intapi_changelog.md Co-Authored-By: ligi <ligi@ligi.de> * Update signer/core/uiapi.go Co-Authored-By: ligi <ligi@ligi.de> Co-authored-by: ligi <ligi@ligi.de> * eth: add debug_accountRange API (#19645) This new API allows reading accounts and their content by address range. Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: Felix Lange <fjl@twurst.com> * travis: allow cocoapods deploy to fail (#20833) * metrics: improve TestTimerFunc (#20818) The test failed due to what appears to be fluctuations in time.Sleep, which is not the actual method under test. This change modifies it so we compare the metered Max to the actual time instead of the desired time. * README: update private network genesis spec with istanbul (#20841) * add istanbul and muirGlacier to genesis states in README * remove muirGlacier, relocate istanbul * cmd/evm: Rework execution stats (#20792) - Dump stats also for --bench flag. - From memory stats only show number and size of allocations. This is what `test -bench` shows. I doubt others like number of GC runs are any useful, but can be added if requested. - Now the mem stats are for single execution in case of --bench. * cmd/devp2p, cmd/wnode, whisper: add missing calls to Timer.Stop (#20843) * p2p/server: add UDP port mapping goroutine to wait group (#20846) * accounts/abi faster unpacking of int256 (#20850) * p2p/discv5: add missing Timer.Stop calls (#20853) * miner/worker: add missing timer.Stop call (#20857) * cmd/geth: fix bad genesis test (#20860) * eth/filters: add missing Ticker.Stop call (#20862) * eth/fetcher: add missing timer.Stop calls (#20861) * event: add missing timer.Stop call in TestFeed (#20868) * metrics: add missing calls to Ticker.Stop in tests (#20866) * ethstats: add missing Ticker.Stop call (#20867) * p2p/discv5, p2p/testing: add missing Timer.Stop calls in tests (#20869) * core: add missing Timer.Stop call in TestLogReorgs (#20870) * rpc: add missing timer.Stop calls in websocket tests (#20863) * crypto/ecies: improve concatKDF (#20836) This removes a bunch of weird code around the counter overflow check in concatKDF and makes it actually work for different hash output sizes. The overflow check worked as follows: concatKDF applies the hash function N times, where N is roundup(kdLen, hashsize) / hashsize. N should not overflow 32 bits because that would lead to a repetition in the KDF output. A couple issues with the overflow check: - It used the hash.BlockSize, which is wrong because the block size is about the input of the hash function. Luckily, all standard hash functions have a block size that's greater than the output size, so concatKDF didn't crash, it just generated too much key material. - The check used big.Int to compare against 2^32-1. - The calculation could still overflow before reaching the check. The new code in concatKDF doesn't check for overflow. Instead, there is a new check on ECIESParams which ensures that params.KeyLen is < 512. This removes any possibility of overflow. There are a couple of miscellaneous improvements bundled in with this change: - The key buffer is pre-allocated instead of appending the hash output to an initially empty slice. - The code that uses concatKDF to derive keys is now shared between Encrypt and Decrypt. - There was a redundant invocation of IsOnCurve in Decrypt. This is now removed because elliptic.Unmarshal already checks whether the input is a valid curve point since Go 1.5. Co-authored-by: Felix Lange <fjl@twurst.com> * rpc: metrics for JSON-RPC method calls (#20847) This adds a couple of metrics for tracking the timing and frequency of method calls: - rpc/requests gauge counts all requests - rpc/success gauge counts requests which return err == nil - rpc/failure gauge counts requests which return err != nil - rpc/duration/all timer tracks timing of all requests - rpc/duration/<method>/<success/failure> tracks per-method timing * mobile: use bind.NewKeyedTransactor instead of duplicating (#20888) It's better to reuse the existing code to create a keyed transactor than to rewrite the logic again. * internal/ethapi: add CallArgs.ToMessage method (#20854) ToMessage is used to convert between ethapi.CallArgs and types.Message. It reduces the length of the DoCall method by about half by abstracting out the conversion between the CallArgs and the Message. This should improve the code's maintainability and reusability. * eth, les: fix flaky tests (#20897) * les: fix flaky test * eth: fix flaky test * cmd/geth: enable metrics for geth import command (#20738) * cmd/geth: enable metrics for geth import command * cmd/geth: enable metrics-flags for import command * core/vm: use a callcontext struct (#20761) * core/vm: use a callcontext struct * core/vm: fix tests * core/vm/runtime: benchmark * core/vm: make intpool push inlineable, unexpose callcontext * docs/audits: add discv5 protocol audits from LA and C53 (#20898) * .github: change gitter reference to discord link in issue template (#20896) * couple of fixes to docs in clef (#20900) * p2p/discover: add initial discovery v5 implementation (#20750)This adds an implementation of the current discovery v5 spec.There is full integration with cmd/devp2p and enode.Iterator in thisversion. In theory we could enable the new protocol as a replacement ofdiscovery v4 at any time. In practice, there will likely be a few morechanges to the spec and implementation before this can happen. * build: upgrade to golangci-lint 1.24.0 (#20901) * accounts/scwallet: remove unnecessary uses of fmt.Sprintf * cmd/puppeth: remove unnecessary uses of fmt.Sprintf * p2p/discv5: remove unnecessary use of fmt.Sprintf * whisper/mailserver: remove unnecessary uses of fmt.Sprintf * core: goimports -w tx_pool_test.go * eth/downloader: goimports -w downloader_test.go * build: upgrade to golangci-lint 1.24.0 * accounts/abi/bind: Refactored topics (#20851) * accounts/abi/bind: refactored topics * accounts/abi/bind: use store function to remove code duplication * accounts/abi/bind: removed unused type defs * accounts/abi/bind: error on tuples in topics * Cosmetic changes to restart travis build Co-authored-by: Guillaume Ballet <gballet@gmail.com> * node: allow websocket and HTTP on the same port (#20810) This change makes it possible to run geth with JSON-RPC over HTTP and WebSocket on the same TCP port. The default port for WebSocket is still 8546. geth --rpc --rpcport 8545 --ws --wsport 8545 This also removes a lot of deprecated API surface from package rpc. The rpc package is now purely about serving JSON-RPC and no longer provides a way to start an HTTP server. * crypto: improve error messages in LoadECDSA (#20718) This improves error messages when the file is too short or too long. Also rewrite the test for SaveECDSA because LoadECDSA has its own test now. Co-authored-by: Felix Lange <fjl@twurst.com> * changed date of rpcstack.go since new file (#20904) * accounts/abi/bind: fixed erroneous filtering of negative ints (#20865) * accounts/abi/bind: fixed erroneous packing of negative ints * accounts/abi/bind: added test cases for negative ints in topics * accounts/abi/bind: fixed genIntType for go 1.12 * accounts/abi: minor nitpick * cmd: deprecate --testnet, use named networks instead (#20852) * cmd/utils: make goerli the default testnet * cmd/geth: explicitly rename testnet to ropsten * core: explicitly rename testnet to ropsten * params: explicitly rename testnet to ropsten * cmd: explicitly rename testnet to ropsten * miner: explicitly rename testnet to ropsten * mobile: allow for returning the goerli spec * tests: explicitly rename testnet to ropsten * docs: update readme to reflect changes to the default testnet * mobile: allow for configuring goerli and rinkeby nodes * cmd/geth: revert --testnet back to ropsten and mark as legacy * cmd/util: mark --testnet flag as deprecated * docs: update readme to properly reflect the 3 testnets * cmd/utils: add an explicit deprecation warning on startup * cmd/utils: swap goerli and ropsten in usage * cmd/geth: swap goerli and ropsten in usage * cmd/geth: if running a known preset, log it for convenience * docs: improve readme on usage of ropsten's testnet datadir * cmd/utils: check if legacy `testnet` datadir exists for ropsten * cmd/geth: check for legacy testnet path in console command * cmd/geth: use switch statement for complex conditions in main * cmd/geth: move known preset log statement to the very top * cmd/utils: create new ropsten configurations in the ropsten datadir * cmd/utils: makedatadir should check for existing testnet dir * cmd/geth: add legacy testnet flag to the copy db command * cmd/geth: add legacy testnet flag to the inspect command * les, les/lespay/client: add service value statistics and API (#20837) This PR adds service value measurement statistics to the light client. It also adds a private API that makes these statistics accessible. A follow-up PR will add the new server pool which uses these statistics to select servers with good performance. This document describes the function of the new components: https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4 Co-authored-by: rjl493456442 <garyrong0905@gmail.com> Co-authored-by: rjl493456442 <garyrong0905@gmail.com> * README: update min go version to 1.13 (#20911) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 (#20913) * travis, appveyor, build, Dockerfile: bump Go to 1.14.2 * travis, appveyor: force GO111MODULE=on for every build * core/rawdb: fix data race between Retrieve and Close (#20919) * core/rawdb: fixed data race between retrieve and close closes https://github.com/ethereum/go-ethereum/issues/20420 * core/rawdb: use non-atomic load while holding mutex * all: simplify and fix database iteration with prefix/start (#20808) * core/state/snapshot: start fixing disk iterator seek * ethdb, rawdb, leveldb, memorydb: implement iterators with prefix and start * les, core/state/snapshot: iterator fixes * all: remove two iterator methods * all: rename Iteratee.NewIteratorWith -> NewIterator * ethdb: fix review concerns * params: update CHTs for the 1.9.13 release * params: release Geth v1.9.13 * added some missing files * post-rebase fixups Co-authored-by: Péter Szilágyi <peterke@gmail.com> Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: gary rong <garyrong0905@gmail.com> Co-authored-by: Alex Willmer <alex@moreati.org.uk> Co-authored-by: meowsbits <45600330+meowsbits@users.noreply.github.com> Co-authored-by: Felix Lange <fjl@twurst.com> Co-authored-by: rene <41963722+renaynay@users.noreply.github.com> Co-authored-by: Ha ĐANG <dvietha@gmail.com> Co-authored-by: Hanjiang Yu <42531996+de1acr0ix@users.noreply.github.com> Co-authored-by: ligi <ligi@ligi.de> Co-authored-by: Wenbiao Zheng <delweng@gmail.com> Co-authored-by: Adam Schmideg <adamschmideg@users.noreply.github.com> Co-authored-by: Jeff Wentworth <jeff@curvegrid.com> Co-authored-by: Paweł Bylica <chfast@gmail.com> Co-authored-by: ucwong <ucwong@126.com> Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de> Co-authored-by: Luke Champine <luke.champine@gmail.com> Co-authored-by: Boqin Qin <Bobbqqin@gmail.com> Co-authored-by: William Morriss <wjmelements@gmail.com> Co-authored-by: Guillaume Ballet <gballet@gmail.com> Co-authored-by: Raw Pong Ghmoa <58883403+q9f@users.noreply.github.com> Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
2020-04-19 17:31:47 +00:00
}
return resp
}
node: refactor package node (#21105) This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available. # Conflicts: # cmd/faucet/faucet.go # cmd/geth/chaincmd.go # cmd/geth/config.go # cmd/geth/consolecmd.go # cmd/geth/main.go # cmd/utils/flags.go # cmd/wnode/main.go # core/rawdb/freezer.go # eth/api_backend.go # eth/backend.go # ethclient/ethclient_test.go # ethstats/ethstats.go # graphql/service.go # internal/ethapi/backend.go # les/api_backend.go # les/api_test.go # les/checkpointoracle/oracle.go # les/client.go # les/commons.go # les/server.go # miner/stresstest/stress_clique.go # miner/stresstest/stress_ethash.go # mobile/geth.go # node/api.go # node/node.go # node/node_example_test.go # node/node_test.go # node/rpcstack.go # node/rpcstack_test.go # node/service.go # node/service_test.go # node/utils_test.go # p2p/simulations/examples/ping-pong.go # p2p/testing/peerpool.go # p2p/testing/protocolsession.go # p2p/testing/protocoltester.go # whisper/mailserver/server_test.go # whisper/whisperv6/api_test.go # whisper/whisperv6/filter_test.go # whisper/whisperv6/whisper.go # whisper/whisperv6/whisper_test.go
2020-08-03 17:40:46 +00:00
func containsProtocol(stackProtocols []p2p.Protocol, protocol p2p.Protocol) bool {
for _, a := range stackProtocols {
if reflect.DeepEqual(a, protocol) {
return true
}
}
return false
}
func containsAPI(stackAPIs []rpc.API, api rpc.API) bool {
for _, a := range stackAPIs {
if reflect.DeepEqual(a, api) {
return true
}
}
return false
}