Skip to content

Commit f95dd93

Browse files
authored
Merge pull request #1615 from celo-org/gastonponti/merge-upstream-1.9.19
Merge from upstream, go-ethereum v 1.9.19 (https://github.com/ethereum/go-ethereum/releases/tag/v1.9.19) Geth v1.9.19 is our regular maintenance release Note, if you were using GraphQL previously, it was moved to the HTTP RPC endpoint. The old --graphql.host and --graphql.port flags will not work any more. You might need to adjust your TOML config files accordingly too. 1.9.19 Notes: Deprecated flags: GraphQLListenAddrFlag GraphQLPortFlag Added flags: CacheTrieJournalFlag CacheTrieRejournalFlag 28c5a8a fetcher.go/mainLoop check ancestor, otherwise the lightest sync could panic fetcher.go/newLightFetcher Add downloader.SyncMode as parameter c0c0161 (ethereum/go-ethereum#21105) node.go: startNetworking should server stop if proxyServer failed main.go startNode runnerFactory replaced 90dedea this commit tried to fusion the consensus/istanbul/core/event.go file with an erased tests (signed_data_internal_test.go) Restored that test, and add the changes from the signer/core/signed_data.go, to the shared/signer/signed_data.go c28fd9c make Berlin a copy of Istanbul instead of YoloV1 Backwards compatibility The commit c0c0161 (ethereum/go-ethereum#21105) "changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible" (following this proposal https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775)
2 parents 968e504 + 290c14d commit f95dd93

File tree

111 files changed

+4637
-4031
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+4637
-4031
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ target
1919

2020
# created when running tests
2121
/miner/validatorenodes/
22+
/graphql/roundstates/
23+
/graphql/validatorenodes/
24+
/graphql/versioncertificates/
2225

2326
#*
2427
.#*

build/ci.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,9 @@ func doInstall(cmdline []string) {
220220
var minor int
221221
fmt.Sscanf(strings.TrimPrefix(runtime.Version(), "go1."), "%d", &minor)
222222

223-
if minor < 11 {
223+
if minor < 13 {
224224
log.Println("You have Go version", runtime.Version())
225-
log.Println("go-ethereum requires at least Go version 1.11 and cannot")
225+
log.Println("go-ethereum requires at least Go version 1.13 and cannot")
226226
log.Println("be compiled with an earlier version. Please upgrade your Go installation.")
227227
os.Exit(1)
228228
}
@@ -238,6 +238,7 @@ func doInstall(cmdline []string) {
238238
if runtime.GOARCH == "arm64" {
239239
goinstall.Args = append(goinstall.Args, "-p", "1")
240240
}
241+
goinstall.Args = append(goinstall.Args, "-trimpath")
241242
goinstall.Args = append(goinstall.Args, "-v")
242243
goinstall.Args = append(goinstall.Args, packages...)
243244
build.MustRun(goinstall)
@@ -246,6 +247,7 @@ func doInstall(cmdline []string) {
246247

247248
// Seems we are cross compiling, work around forbidden GOBIN
248249
goinstall := goToolArch(*arch, *cc, "install", buildFlags(env)...)
250+
goinstall.Args = append(goinstall.Args, "-trimpath")
249251
goinstall.Args = append(goinstall.Args, "-v")
250252
goinstall.Args = append(goinstall.Args, []string{"-buildmode", "archive"}...)
251253
goinstall.Args = append(goinstall.Args, packages...)

cmd/clef/docs/setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ with minimal requirements.
9494
On the `client` qube, we need to create a listener which will receive the request from the Dapp, and proxy it.
9595

9696

97-
[qubes-client.py](qubes/client/qubes-client.py):
97+
[qubes-client.py](qubes/qubes-client.py):
9898

9999
```python
100100

cmd/devp2p/enrcmd.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"encoding/base64"
2222
"encoding/hex"
2323
"fmt"
24+
"io"
2425
"io/ioutil"
2526
"net"
2627
"os"
@@ -69,22 +70,30 @@ func enrdump(ctx *cli.Context) error {
6970
if err != nil {
7071
return fmt.Errorf("INVALID: %v", err)
7172
}
72-
fmt.Print(dumpRecord(r))
73+
dumpRecord(os.Stdout, r)
7374
return nil
7475
}
7576

7677
// dumpRecord creates a human-readable description of the given node record.
77-
func dumpRecord(r *enr.Record) string {
78-
out := new(bytes.Buffer)
79-
if n, err := enode.New(enode.ValidSchemes, r); err != nil {
78+
func dumpRecord(out io.Writer, r *enr.Record) {
79+
n, err := enode.New(enode.ValidSchemes, r)
80+
if err != nil {
8081
fmt.Fprintf(out, "INVALID: %v\n", err)
8182
} else {
8283
fmt.Fprintf(out, "Node ID: %v\n", n.ID())
84+
dumpNodeURL(out, n)
8385
}
8486
kv := r.AppendElements(nil)[1:]
8587
fmt.Fprintf(out, "Record has sequence number %d and %d key/value pairs.\n", r.Seq(), len(kv)/2)
8688
fmt.Fprint(out, dumpRecordKV(kv, 2))
87-
return out.String()
89+
}
90+
91+
func dumpNodeURL(out io.Writer, n *enode.Node) {
92+
var key enode.Secp256k1
93+
if n.Load(&key) != nil {
94+
return // no secp256k1 public key
95+
}
96+
fmt.Fprintf(out, "URLv4: %s\n", n.URLv4())
8897
}
8998

9099
func dumpRecordKV(kv []interface{}, indent int) string {

cmd/faucet/faucet.go

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -235,23 +235,20 @@ func newFaucet(genesis *core.Genesis, port int, enodes []*discv5.Node, network u
235235
if err != nil {
236236
return nil, err
237237
}
238+
238239
// Assemble the Ethereum light client protocol
239-
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
240-
cfg := eth.DefaultConfig
241-
cfg.SyncMode = downloader.LightSync
242-
cfg.NetworkId = network
243-
cfg.Genesis = genesis
244-
return les.New(ctx, &cfg)
245-
}); err != nil {
246-
return nil, err
240+
cfg := eth.DefaultConfig
241+
cfg.SyncMode = downloader.LightSync
242+
cfg.NetworkId = network
243+
cfg.Genesis = genesis
244+
lesBackend, err := les.New(stack, &cfg)
245+
if err != nil {
246+
return nil, fmt.Errorf("Failed to register the Ethereum service: %w", err)
247247
}
248+
248249
// Assemble the ethstats monitoring and reporting service'
249250
if stats != "" {
250-
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
251-
var serv *les.LightEthereum
252-
ctx.Service(&serv)
253-
return ethstats.New(stats, nil, serv)
254-
}); err != nil {
251+
if err := ethstats.New(stack, lesBackend.ApiBackend, lesBackend.Engine(), stats); err != nil {
255252
return nil, err
256253
}
257254
}
@@ -268,7 +265,7 @@ func newFaucet(genesis *core.Genesis, port int, enodes []*discv5.Node, network u
268265
// Attach to the client and retrieve and interesting metadatas
269266
api, err := stack.Attach()
270267
if err != nil {
271-
stack.Stop()
268+
stack.Close()
272269
return nil, err
273270
}
274271
client := ethclient.NewClient(api)

cmd/faucet/faucet.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ <h1 style="text-align: center;"><i class="fa fa-bath" aria-hidden="true"></i> {{
4949
<div class="row">
5050
<div class="col-lg-8 col-lg-offset-2">
5151
<div class="input-group">
52-
<input id="url" name="url" type="text" class="form-control" placeholder="Social network URL containing your Ethereum address...">
52+
<input id="url" name="url" type="text" class="form-control" placeholder="Social network URL containing your Ethereum address..."/>
5353
<span class="input-group-btn">
5454
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Give me Ether <i class="fa fa-caret-down" aria-hidden="true"></i></button>
5555
<ul class="dropdown-menu dropdown-menu-right">{{range $idx, $amount := .Amounts}}

cmd/geth/chaincmd.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ func initGenesis(ctx *cli.Context) error {
245245
if err := json.NewDecoder(file).Decode(genesis); err != nil {
246246
utils.Fatalf("invalid genesis file: %v", err)
247247
}
248-
// Open an initialise both full and light databases
249-
stack := makeFullNode(ctx)
248+
// Open and initialise both full and light databases
249+
stack, _ := makeConfigNode(ctx)
250250
defer stack.Close()
251251

252252
for _, name := range []string{"chaindata", "lightchaindata", "lightestchaindata"} {
@@ -283,7 +283,8 @@ func importChain(ctx *cli.Context) error {
283283
utils.SetupMetrics(ctx)
284284
// Start system runtime metrics collection
285285
go metrics.CollectProcessMetrics(3 * time.Second)
286-
stack := makeFullNode(ctx)
286+
287+
stack, _ := makeConfigNode(ctx)
287288
defer stack.Close()
288289

289290
chain, db := utils.MakeChain(ctx, stack, false)
@@ -369,7 +370,8 @@ func exportChain(ctx *cli.Context) error {
369370
if len(ctx.Args()) < 1 {
370371
utils.Fatalf("This command requires an argument.")
371372
}
372-
stack := makeFullNode(ctx)
373+
374+
stack, _ := makeConfigNode(ctx)
373375
defer stack.Close()
374376

375377
chain, _ := utils.MakeChain(ctx, stack, true)
@@ -404,7 +406,8 @@ func importPreimages(ctx *cli.Context) error {
404406
if len(ctx.Args()) < 1 {
405407
utils.Fatalf("This command requires an argument.")
406408
}
407-
stack := makeFullNode(ctx)
409+
410+
stack, _ := makeConfigNode(ctx)
408411
defer stack.Close()
409412

410413
db := utils.MakeChainDatabase(ctx, stack)
@@ -422,7 +425,8 @@ func exportPreimages(ctx *cli.Context) error {
422425
if len(ctx.Args()) < 1 {
423426
utils.Fatalf("This command requires an argument.")
424427
}
425-
stack := makeFullNode(ctx)
428+
429+
stack, _ := makeConfigNode(ctx)
426430
defer stack.Close()
427431

428432
db := utils.MakeChainDatabase(ctx, stack)
@@ -444,7 +448,7 @@ func copyDb(ctx *cli.Context) error {
444448
utils.Fatalf("Source ancient chain directory path argument missing")
445449
}
446450
// Initialize a new chain for the running node to sync into
447-
stack := makeFullNode(ctx)
451+
stack, _ := makeConfigNode(ctx)
448452
defer stack.Close()
449453

450454
chain, chainDb := utils.MakeChain(ctx, stack, false)
@@ -552,7 +556,7 @@ func confirmAndRemoveDB(database string, kind string) {
552556
}
553557

554558
func dump(ctx *cli.Context) error {
555-
stack := makeFullNode(ctx)
559+
stack, _ := makeConfigNode(ctx)
556560
defer stack.Close()
557561

558562
chain, chainDb := utils.MakeChain(ctx, stack, true)

cmd/geth/config.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727

2828
"github.com/celo-org/celo-blockchain/cmd/utils"
2929
"github.com/celo-org/celo-blockchain/eth"
30+
"github.com/celo-org/celo-blockchain/internal/ethapi"
3031
"github.com/celo-org/celo-blockchain/log"
3132
"github.com/celo-org/celo-blockchain/node"
3233
"github.com/celo-org/celo-blockchain/params"
@@ -105,6 +106,7 @@ func defaultNodeConfig() node.Config {
105106
return cfg
106107
}
107108

109+
// makeConfigNode loads geth configuration and creates a blank node instance.
108110
func makeConfigNode(ctx *cli.Context) (*node.Node, gethConfig) {
109111
// Load defaults.
110112
cfg := gethConfig{
@@ -149,15 +151,16 @@ func enableWhisper(ctx *cli.Context) bool {
149151
return false
150152
}
151153

152-
func makeFullNode(ctx *cli.Context) *node.Node {
154+
// makeFullNode loads geth configuration and creates the Ethereum backend.
155+
func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
153156
stack, cfg := makeConfigNode(ctx)
154157
if ctx.GlobalIsSet(utils.OverrideChurritoFlag.Name) {
155158
cfg.Eth.OverrideChurrito = new(big.Int).SetUint64(ctx.GlobalUint64(utils.OverrideChurritoFlag.Name))
156159
}
157160
if ctx.GlobalIsSet(utils.OverrideDonutFlag.Name) {
158161
cfg.Eth.OverrideDonut = new(big.Int).SetUint64(ctx.GlobalUint64(utils.OverrideDonutFlag.Name))
159162
}
160-
utils.RegisterEthService(stack, &cfg.Eth)
163+
backend := utils.RegisterEthService(stack, &cfg.Eth)
161164

162165
// Whisper must be explicitly enabled by specifying at least 1 whisper flag or in dev mode
163166
shhEnabled := enableWhisper(ctx)
@@ -176,13 +179,13 @@ func makeFullNode(ctx *cli.Context) *node.Node {
176179
}
177180
// Configure GraphQL if requested
178181
if ctx.GlobalIsSet(utils.GraphQLEnabledFlag.Name) {
179-
utils.RegisterGraphQLService(stack, cfg.Node.GraphQLEndpoint(), cfg.Node.GraphQLCors, cfg.Node.GraphQLVirtualHosts, cfg.Node.HTTPTimeouts)
182+
utils.RegisterGraphQLService(stack, backend, cfg.Node)
180183
}
181184
// Add the Ethereum Stats daemon if requested.
182185
if cfg.Ethstats.URL != "" {
183-
utils.RegisterEthStatsService(stack, cfg.Ethstats.URL)
186+
utils.RegisterEthStatsService(stack, backend, cfg.Ethstats.URL)
184187
}
185-
return stack
188+
return stack, backend
186189
}
187190

188191
// dumpConfig is the dumpconfig command.

cmd/geth/consolecmd.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ JavaScript API. See https://github.com/celo-org/celo-blockchain/wiki/JavaScript-
7878
func localConsole(ctx *cli.Context) error {
7979
// Create and start the node based on the CLI flags
8080
prepare(ctx)
81-
node := makeFullNode(ctx)
82-
startNode(ctx, node)
83-
defer node.Close()
81+
stack, backend := makeFullNode(ctx)
82+
startNode(ctx, stack, backend)
83+
defer stack.Close()
8484

8585
// Attach to the newly started node and start the JavaScript console
86-
client, err := node.Attach()
86+
client, err := stack.Attach()
8787
if err != nil {
8888
utils.Fatalf("Failed to attach to the inproc geth: %v", err)
8989
}
@@ -179,12 +179,12 @@ func dialRPC(endpoint string) (*rpc.Client, error) {
179179
// everything down.
180180
func ephemeralConsole(ctx *cli.Context) error {
181181
// Create and start the node based on the CLI flags
182-
node := makeFullNode(ctx)
183-
startNode(ctx, node)
184-
defer node.Close()
182+
stack, backend := makeFullNode(ctx)
183+
startNode(ctx, stack, backend)
184+
defer stack.Close()
185185

186186
// Attach to the newly started node and start the JavaScript console
187-
client, err := node.Attach()
187+
client, err := stack.Attach()
188188
if err != nil {
189189
utils.Fatalf("Failed to attach to the inproc geth: %v", err)
190190
}

cmd/geth/dao_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ func testDAOForkBlockNewChain(t *testing.T, test int, genesis string, expectBloc
112112
} else {
113113
// Force chain initialization
114114
args := []string{"--port", "0", "--maxpeers", "0", "--light.maxpeers", "0", "--nodiscover", "--nat", "none", "--ipcdisable", "--datadir", datadir}
115-
geth := runGeth(t, append(args, []string{"--exec", "2+2", "console"}...)...)
116-
geth.WaitExit()
115+
runGeth(t, append(args, []string{"--exec", "2+2", "console"}...)...).WaitExit()
117116
}
118117
// Retrieve the DAO config flag from the database
119118
path := filepath.Join(datadir, "geth", "chaindata")

0 commit comments

Comments
 (0)