Skip to content

Commit 586eddf

Browse files
committed
release, all: integrate the release service into geth
1 parent d46da27 commit 586eddf

14 files changed

Lines changed: 822 additions & 583 deletions

File tree

‎accounts/abi/bind/backend.go‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ type ContractCaller interface {
4747
// used when the user does not provide some needed values, but rather leaves it up
4848
// to the transactor to decide.
4949
type ContractTransactor interface {
50-
// Nonce retrieves the current pending nonce associated with an account.
50+
// PendingAccountNonce retrieves the current pending nonce associated with an
51+
// account.
5152
PendingAccountNonce(account common.Address) (uint64, error)
5253

5354
// SuggestGasPrice retrieves the currently suggested gas price to allow a timely
@@ -62,7 +63,7 @@ type ContractTransactor interface {
6263
EstimateGasLimit(sender common.Address, contract *common.Address, value *big.Int, data []byte) (*big.Int, error)
6364

6465
// SendTransaction injects the transaction into the pending pool for execution.
65-
SendTransaction(*types.Transaction) error
66+
SendTransaction(tx *types.Transaction) error
6667
}
6768

6869
// ContractBackend defines the methods needed to allow operating with contract

‎cmd/geth/main.go‎

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package main
1919

2020
import (
21+
"encoding/hex"
2122
"fmt"
2223
"io/ioutil"
2324
"os"
@@ -41,31 +42,48 @@ import (
4142
"github.com/ethereum/go-ethereum/metrics"
4243
"github.com/ethereum/go-ethereum/node"
4344
"github.com/ethereum/go-ethereum/params"
45+
"github.com/ethereum/go-ethereum/release"
4446
"github.com/ethereum/go-ethereum/rlp"
4547
)
4648

4749
const (
48-
ClientIdentifier = "Geth"
49-
Version = "1.5.0-unstable"
50-
VersionMajor = 1
51-
VersionMinor = 5
52-
VersionPatch = 0
50+
clientIdentifier = "Geth" // Client identifier to advertise over the network
51+
versionMajor = 1 // Major version component of the current release
52+
versionMinor = 5 // Minor version component of the current release
53+
versionPatch = 0 // Patch version component of the current release
54+
versionMeta = "unstable" // Version metadata to append to the version string
55+
56+
versionOracle = "0x48a117313039b73ab02fb9f73e04a66defe123ec" // Ethereum address of the Geth release oracle
5357
)
5458

5559
var (
56-
gitCommit string // set via linker flagg
57-
nodeNameVersion string
58-
app *cli.App
60+
gitCommit string // Git SHA1 commit hash of the release (set via linker flags)
61+
verString string // Combined textual representation of all the version components
62+
relConfig release.Config // Structured version information and release oracle config
63+
app *cli.App
5964
)
6065

6166
func init() {
62-
if gitCommit == "" {
63-
nodeNameVersion = Version
64-
} else {
65-
nodeNameVersion = Version + "-" + gitCommit[:8]
67+
// Construct the textual version string from the individual components
68+
verString = fmt.Sprintf("%d.%d.%d", versionMajor, versionMinor, versionPatch)
69+
if versionMeta != "" {
70+
verString += "-" + versionMeta
71+
}
72+
if gitCommit != "" {
73+
verString += "-" + gitCommit[:8]
6674
}
75+
// Construct the version release oracle configuration
76+
relConfig.Oracle = common.HexToAddress(versionOracle)
6777

68-
app = utils.NewApp(Version, "the go-ethereum command line interface")
78+
relConfig.Major = uint32(versionMajor)
79+
relConfig.Minor = uint32(versionMinor)
80+
relConfig.Patch = uint32(versionPatch)
81+
82+
commit, _ := hex.DecodeString(gitCommit)
83+
copy(relConfig.Commit[:], commit)
84+
85+
// Initialize the CLI app and start Geth
86+
app = utils.NewApp(verString, "the go-ethereum command line interface")
6987
app.Action = geth
7088
app.HideVersion = true // we have a command to print the version
7189
app.Commands = []cli.Command{
@@ -257,7 +275,7 @@ func makeDefaultExtra() []byte {
257275
Name string
258276
GoVersion string
259277
Os string
260-
}{uint(VersionMajor<<16 | VersionMinor<<8 | VersionPatch), ClientIdentifier, runtime.Version(), runtime.GOOS}
278+
}{uint(versionMajor<<16 | versionMinor<<8 | versionPatch), clientIdentifier, runtime.Version(), runtime.GOOS}
261279
extra, err := rlp.EncodeToBytes(clientInfo)
262280
if err != nil {
263281
glog.V(logger.Warn).Infoln("error setting canonical miner information:", err)
@@ -275,7 +293,7 @@ func makeDefaultExtra() []byte {
275293
// It creates a default node based on the command line arguments and runs it in
276294
// blocking mode, waiting for it to be shut down.
277295
func geth(ctx *cli.Context) {
278-
node := utils.MakeSystemNode(ClientIdentifier, nodeNameVersion, makeDefaultExtra(), ctx)
296+
node := utils.MakeSystemNode(clientIdentifier, verString, relConfig, makeDefaultExtra(), ctx)
279297
startNode(ctx, node)
280298
node.Wait()
281299
}
@@ -339,7 +357,7 @@ func initGenesis(ctx *cli.Context) {
339357
// same time.
340358
func console(ctx *cli.Context) {
341359
// Create and start the node based on the CLI flags
342-
node := utils.MakeSystemNode(ClientIdentifier, nodeNameVersion, makeDefaultExtra(), ctx)
360+
node := utils.MakeSystemNode(clientIdentifier, verString, relConfig, makeDefaultExtra(), ctx)
343361
startNode(ctx, node)
344362

345363
// Attach to the newly started node, and either execute script or become interactive
@@ -372,7 +390,7 @@ func console(ctx *cli.Context) {
372390
// of the JavaScript files specified as command arguments.
373391
func execScripts(ctx *cli.Context) {
374392
// Create and start the node based on the CLI flags
375-
node := utils.MakeSystemNode(ClientIdentifier, nodeNameVersion, makeDefaultExtra(), ctx)
393+
node := utils.MakeSystemNode(clientIdentifier, verString, relConfig, makeDefaultExtra(), ctx)
376394
startNode(ctx, node)
377395
defer node.Stop()
378396

@@ -488,11 +506,8 @@ func gpubench(ctx *cli.Context) {
488506
}
489507

490508
func version(c *cli.Context) {
491-
fmt.Println(ClientIdentifier)
492-
fmt.Println("Version:", Version)
493-
if gitCommit != "" {
494-
fmt.Println("Git Commit:", gitCommit)
495-
}
509+
fmt.Println(clientIdentifier)
510+
fmt.Println("Version:", version)
496511
fmt.Println("Protocol Versions:", eth.ProtocolVersions)
497512
fmt.Println("Network Id:", c.GlobalInt(utils.NetworkIdFlag.Name))
498513
fmt.Println("Go Version:", runtime.Version())

‎cmd/utils/flags.go‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import (
3434
"github.com/ethereum/ethash"
3535
"github.com/ethereum/go-ethereum/accounts"
3636
"github.com/ethereum/go-ethereum/common"
37-
"github.com/ethereum/go-ethereum/common/versions"
3837
"github.com/ethereum/go-ethereum/core"
3938
"github.com/ethereum/go-ethereum/core/state"
4039
"github.com/ethereum/go-ethereum/crypto"
@@ -49,6 +48,7 @@ import (
4948
"github.com/ethereum/go-ethereum/p2p/nat"
5049
"github.com/ethereum/go-ethereum/params"
5150
"github.com/ethereum/go-ethereum/pow"
51+
"github.com/ethereum/go-ethereum/release"
5252
"github.com/ethereum/go-ethereum/rpc"
5353
"github.com/ethereum/go-ethereum/whisper"
5454
)
@@ -642,7 +642,7 @@ func MakePasswordList(ctx *cli.Context) []string {
642642

643643
// MakeSystemNode sets up a local node, configures the services to launch and
644644
// assembles the P2P protocol stack.
645-
func MakeSystemNode(name, version string, extra []byte, ctx *cli.Context) *node.Node {
645+
func MakeSystemNode(name, version string, relconf release.Config, extra []byte, ctx *cli.Context) *node.Node {
646646
// Avoid conflicting network flags
647647
networks, netFlags := 0, []cli.BoolFlag{DevModeFlag, TestNetFlag, OlympicFlag}
648648
for _, flag := range netFlags {
@@ -773,12 +773,10 @@ func MakeSystemNode(name, version string, extra []byte, ctx *cli.Context) *node.
773773
Fatalf("Failed to register the Whisper service: %v", err)
774774
}
775775
}
776-
777-
err = stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
778-
return versions.NewVersionCheck(ctx)
779-
})
780-
if err != nil {
781-
Fatalf("Failed to register the Version Check service: %v", err)
776+
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
777+
return release.NewReleaseService(ctx, relconf)
778+
}); err != nil {
779+
Fatalf("Failed to register the Geth release oracle service: %v", err)
782780
}
783781
return stack
784782
}

0 commit comments

Comments
 (0)