Skip to content

Commit

Permalink
Merge pull request #1146 from ConsenSys/upgrade/go-ethereum/v1.9.19-2…
Browse files Browse the repository at this point in the history
…021301114425

[Upgrade] Go-Ethereum release v1.9.19
  • Loading branch information
ricardolyn authored Mar 10, 2021
2 parents e2397c2 + 1b3a6b5 commit b8117c6
Show file tree
Hide file tree
Showing 138 changed files with 5,062 additions and 4,490 deletions.
6 changes: 4 additions & 2 deletions build/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ func doInstall(cmdline []string) {
var minor int
fmt.Sscanf(strings.TrimPrefix(runtime.Version(), "go1."), "%d", &minor)

if minor < 11 {
if minor < 13 {
log.Println("You have Go version", runtime.Version())
log.Println("go-ethereum requires at least Go version 1.11 and cannot")
log.Println("go-ethereum requires at least Go version 1.13 and cannot")
log.Println("be compiled with an earlier version. Please upgrade your Go installation.")
os.Exit(1)
}
Expand All @@ -233,6 +233,7 @@ func doInstall(cmdline []string) {
if runtime.GOARCH == "arm64" {
goinstall.Args = append(goinstall.Args, "-p", "1")
}
goinstall.Args = append(goinstall.Args, "-trimpath")
goinstall.Args = append(goinstall.Args, "-v")
goinstall.Args = append(goinstall.Args, packages...)
build.MustRun(goinstall)
Expand All @@ -241,6 +242,7 @@ func doInstall(cmdline []string) {

// Seems we are cross compiling, work around forbidden GOBIN
goinstall := goToolArch(*arch, *cc, "install", buildFlags(env)...)
goinstall.Args = append(goinstall.Args, "-trimpath")
goinstall.Args = append(goinstall.Args, "-v")
goinstall.Args = append(goinstall.Args, []string{"-buildmode", "archive"}...)
goinstall.Args = append(goinstall.Args, packages...)
Expand Down
2 changes: 1 addition & 1 deletion cmd/clef/docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ with minimal requirements.
On the `client` qube, we need to create a listener which will receive the request from the Dapp, and proxy it.


[qubes-client.py](qubes/client/qubes-client.py):
[qubes-client.py](qubes/qubes-client.py):

```python

Expand Down
2 changes: 1 addition & 1 deletion cmd/clef/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ func startPluginManager(c *cli.Context) (*plugin.PluginManager, *plugin.Settings
if err != nil {
return nil, nil, err
}
if err := pm.Start(nil); err != nil {
if err := pm.Start(); err != nil {
return nil, nil, err
}
return pm, pluginConf, nil
Expand Down
19 changes: 14 additions & 5 deletions cmd/devp2p/enrcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"encoding/base64"
"encoding/hex"
"fmt"
"io"
"io/ioutil"
"net"
"os"
Expand Down Expand Up @@ -69,22 +70,30 @@ func enrdump(ctx *cli.Context) error {
if err != nil {
return fmt.Errorf("INVALID: %v", err)
}
fmt.Print(dumpRecord(r))
dumpRecord(os.Stdout, r)
return nil
}

// dumpRecord creates a human-readable description of the given node record.
func dumpRecord(r *enr.Record) string {
out := new(bytes.Buffer)
if n, err := enode.New(enode.ValidSchemes, r); err != nil {
func dumpRecord(out io.Writer, r *enr.Record) {
n, err := enode.New(enode.ValidSchemes, r)
if err != nil {
fmt.Fprintf(out, "INVALID: %v\n", err)
} else {
fmt.Fprintf(out, "Node ID: %v\n", n.ID())
dumpNodeURL(out, n)
}
kv := r.AppendElements(nil)[1:]
fmt.Fprintf(out, "Record has sequence number %d and %d key/value pairs.\n", r.Seq(), len(kv)/2)
fmt.Fprint(out, dumpRecordKV(kv, 2))
return out.String()
}

func dumpNodeURL(out io.Writer, n *enode.Node) {
var key enode.Secp256k1
if n.Load(&key) != nil {
return // no secp256k1 public key
}
fmt.Fprintf(out, "URLv4: %s\n", n.URLv4())
}

func dumpRecordKV(kv []interface{}, indent int) string {
Expand Down
25 changes: 11 additions & 14 deletions cmd/faucet/faucet.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,23 +237,20 @@ func newFaucet(genesis *core.Genesis, port int, enodes []*discv5.Node, network u
if err != nil {
return nil, err
}

// Assemble the Ethereum light client protocol
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
cfg := eth.DefaultConfig
cfg.SyncMode = downloader.LightSync
cfg.NetworkId = network
cfg.Genesis = genesis
return les.New(ctx, &cfg)
}); err != nil {
return nil, err
cfg := eth.DefaultConfig
cfg.SyncMode = downloader.LightSync
cfg.NetworkId = network
cfg.Genesis = genesis
lesBackend, err := les.New(stack, &cfg)
if err != nil {
return nil, fmt.Errorf("Failed to register the Ethereum service: %w", err)
}

// Assemble the ethstats monitoring and reporting service'
if stats != "" {
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
var serv *les.LightEthereum
ctx.Service(&serv)
return ethstats.New(stats, nil, serv)
}); err != nil {
if err := ethstats.New(stack, lesBackend.ApiBackend, lesBackend.Engine(), stats); err != nil {
return nil, err
}
}
Expand All @@ -270,7 +267,7 @@ func newFaucet(genesis *core.Genesis, port int, enodes []*discv5.Node, network u
// Attach to the client and retrieve and interesting metadatas
api, err := stack.Attach()
if err != nil {
stack.Stop()
stack.Close()
return nil, err
}
client := ethclient.NewClient(api)
Expand Down
2 changes: 1 addition & 1 deletion cmd/faucet/faucet.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ <h1 style="text-align: center;"><i class="fa fa-bath" aria-hidden="true"></i> {{
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<div class="input-group">
<input id="url" name="url" type="text" class="form-control" placeholder="Social network URL containing your Ethereum address...">
<input id="url" name="url" type="text" class="form-control" placeholder="Social network URL containing your Ethereum address..."/>
<span class="input-group-btn">
<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>
<ul class="dropdown-menu dropdown-menu-right">{{range $idx, $amount := .Amounts}}
Expand Down
2 changes: 1 addition & 1 deletion cmd/geth/accountcmd_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func setupAccountPluginForCLI(ctx *cli.Context) (*accountPlugin, error) {
if err != nil {
return nil, fmt.Errorf("unable to create plugin manager: %v", err)
}
if err := pm.Start(nil); err != nil {
if err := pm.Start(); err != nil {
return nil, fmt.Errorf("unable to start plugin manager: %v", err)
}

Expand Down
22 changes: 14 additions & 8 deletions cmd/geth/chaincmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ func initGenesis(ctx *cli.Context) error {
utils.Fatalf("invalid genesis file: %v", err)
}

// Quorum
file.Seek(0, 0)
genesis.Config.IsQuorum = getIsQuorum(file)

Expand All @@ -268,9 +269,10 @@ func initGenesis(ctx *cli.Context) error {
if err != nil {
utils.Fatalf("maxCodeSize data invalid: %v", err)
}
// End Quorum

// Open an initialise both full and light databases
stack := makeFullNode(ctx)
// Open and initialise both full and light databases
stack, _ := makeConfigNode(ctx)
defer stack.Close()

for _, name := range []string{"chaindata", "lightchaindata"} {
Expand Down Expand Up @@ -307,7 +309,8 @@ func importChain(ctx *cli.Context) error {
utils.SetupMetrics(ctx)
// Start system runtime metrics collection
go metrics.CollectProcessMetrics(3 * time.Second)
stack := makeFullNode(ctx)

stack, _ := makeConfigNode(ctx)
defer stack.Close()

chain, db := utils.MakeChain(ctx, stack, false, true)
Expand Down Expand Up @@ -401,7 +404,8 @@ func exportChain(ctx *cli.Context) error {
if len(ctx.Args()) < 1 {
utils.Fatalf("This command requires an argument.")
}
stack := makeFullNode(ctx)

stack, _ := makeConfigNode(ctx)
defer stack.Close()

chain, _ := utils.MakeChain(ctx, stack, true, true)
Expand Down Expand Up @@ -436,7 +440,8 @@ func importPreimages(ctx *cli.Context) error {
if len(ctx.Args()) < 1 {
utils.Fatalf("This command requires an argument.")
}
stack := makeFullNode(ctx)

stack, _ := makeConfigNode(ctx)
defer stack.Close()

db := utils.MakeChainDatabase(ctx, stack)
Expand All @@ -454,7 +459,8 @@ func exportPreimages(ctx *cli.Context) error {
if len(ctx.Args()) < 1 {
utils.Fatalf("This command requires an argument.")
}
stack := makeFullNode(ctx)

stack, _ := makeConfigNode(ctx)
defer stack.Close()

db := utils.MakeChainDatabase(ctx, stack)
Expand All @@ -476,7 +482,7 @@ func copyDb(ctx *cli.Context) error {
utils.Fatalf("Source ancient chain directory path argument missing")
}
// Initialize a new chain for the running node to sync into
stack := makeFullNode(ctx)
stack, _ := makeConfigNode(ctx)
defer stack.Close()

chain, chainDb := utils.MakeChain(ctx, stack, false, false)
Expand Down Expand Up @@ -584,7 +590,7 @@ func confirmAndRemoveDB(database string, kind string) {
}

func dump(ctx *cli.Context) error {
stack := makeFullNode(ctx)
stack, _ := makeConfigNode(ctx)
defer stack.Close()

chain, chainDb := utils.MakeChain(ctx, stack, true, false)
Expand Down
23 changes: 15 additions & 8 deletions cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common/http"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/internal/ethapi"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/params"
Expand Down Expand Up @@ -107,6 +108,7 @@ func defaultNodeConfig() node.Config {
return cfg
}

// makeConfigNode loads geth configuration and creates a blank node instance.
func makeConfigNode(ctx *cli.Context) (*node.Node, gethConfig) {
// Load defaults.
cfg := gethConfig{
Expand Down Expand Up @@ -147,10 +149,14 @@ func enableWhisper(ctx *cli.Context) bool {
return false
}

func makeFullNode(ctx *cli.Context) *node.Node {
// makeFullNode loads geth configuration and creates the Ethereum backend.
func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
stack, cfg := makeConfigNode(ctx)
ethChan := utils.RegisterEthService(stack, &cfg.Eth)

// Quorum - returning `ethService` too for the Raft and extension service
backend, ethService := utils.RegisterEthService(stack, &cfg.Eth)

// Quorum
// plugin service must be after eth service so that eth service will be stopped gradually if any of the plugin
// fails to start
if cfg.Node.Plugins != nil {
Expand All @@ -162,12 +168,13 @@ func makeFullNode(ctx *cli.Context) *node.Node {
}

if ctx.GlobalBool(utils.RaftModeFlag.Name) {
utils.RegisterRaftService(stack, ctx, &cfg.Node, ethChan)
utils.RegisterRaftService(stack, ctx, &cfg.Node, ethService)
}

if private.IsQuorumPrivacyEnabled() {
utils.RegisterExtensionService(stack, ethChan)
utils.RegisterExtensionService(stack, ethService)
}
// End Quorum

// Whisper must be explicitly enabled by specifying at least 1 whisper flag or in dev mode
shhEnabled := enableWhisper(ctx)
Expand All @@ -186,13 +193,13 @@ func makeFullNode(ctx *cli.Context) *node.Node {
}
// Configure GraphQL if requested
if ctx.GlobalIsSet(utils.GraphQLEnabledFlag.Name) {
utils.RegisterGraphQLService(stack, cfg.Node.GraphQLEndpoint(), cfg.Node.GraphQLCors, cfg.Node.GraphQLVirtualHosts, cfg.Node.HTTPTimeouts)
utils.RegisterGraphQLService(stack, backend, cfg.Node)
}
// Add the Ethereum Stats daemon if requested.
if cfg.Ethstats.URL != "" {
utils.RegisterEthStatsService(stack, cfg.Ethstats.URL)
utils.RegisterEthStatsService(stack, backend, cfg.Ethstats.URL)
}
return stack
return stack, backend
}

// dumpConfig is the dumpconfig command.
Expand Down Expand Up @@ -228,7 +235,7 @@ func dumpConfig(ctx *cli.Context) error {
func quorumValidateEthService(stack *node.Node, isRaft bool) {
var ethereum *eth.Ethereum

err := stack.Service(&ethereum)
err := stack.Lifecycle(&ethereum)
if err != nil {
utils.Fatalf("Error retrieving Ethereum service: %v", err)
}
Expand Down
16 changes: 8 additions & 8 deletions cmd/geth/consolecmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ func readTLSClientConfig(endpoint string, ctx *cli.Context) (*tls.Config, bool,
func localConsole(ctx *cli.Context) error {
// Create and start the node based on the CLI flags
prepare(ctx)
node := makeFullNode(ctx)
startNode(ctx, node)
defer node.Close()
stack, backend := makeFullNode(ctx)
startNode(ctx, stack, backend)
defer stack.Close()

// Attach to the newly started node and start the JavaScript console
client, err := node.Attach()
client, err := stack.Attach()
if err != nil {
utils.Fatalf("Failed to attach to the inproc geth: %v", err)
}
Expand Down Expand Up @@ -311,12 +311,12 @@ func dialRPC(endpoint string, ctx *cli.Context) (*rpc.Client, error) {
// everything down.
func ephemeralConsole(ctx *cli.Context) error {
// Create and start the node based on the CLI flags
node := makeFullNode(ctx)
startNode(ctx, node)
defer node.Close()
stack, backend := makeFullNode(ctx)
startNode(ctx, stack, backend)
defer stack.Close()

// Attach to the newly started node and start the JavaScript console
client, err := node.Attach()
client, err := stack.Attach()
if err != nil {
utils.Fatalf("Failed to attach to the inproc geth: %v", err)
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/geth/dao_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ func testDAOForkBlockNewChain(t *testing.T, test int, genesis string, expectBloc
} else {
// Force chain initialization
args := []string{"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none", "--ipcdisable", "--datadir", datadir}
geth := runGeth(t, append(args, []string{"--exec", "2+2", "console"}...)...)
geth.WaitExit()
runGeth(t, append(args, []string{"--exec", "2+2", "console"}...)...).WaitExit()
}
// Retrieve the DAO config flag from the database
path := filepath.Join(datadir, "geth", "chaindata")
Expand Down
Loading

0 comments on commit b8117c6

Please sign in to comment.