Skip to content

Commit

Permalink
Update to go-ethereum 1.8.1 (#702)
Browse files Browse the repository at this point in the history
* Update `github.com/ethereum/go-ethereum` package to 1.8.1 branch. Part of #638
* Fix code due to some signature changes. Part of #638
* use upstream for whisper backend
* Add patch to downgrade usage of Whisper v6 to v5 in some geth 1.8.1 vendor files. Part of #638
* Take into account the DNS rebinding protection introduced in 1.8.0 by adding exception for localhost. Part of #638
* Add patches required for cross-compiled builds starting with geth 1.8.0. Only applied during build. Part of #638
* Update expected JSON result in `TestRegressionGetTransactionReceipt()` and `TestCallRawResultGetTransactionReceipt()`. Part of #665
* Fix some failing e2e tests. Part of #638
* Address comments in PR #702. Part of #638
  • Loading branch information
Pedro Pombeiro authored Feb 27, 2018
1 parent 0a15c9f commit e4cbce1
Show file tree
Hide file tree
Showing 487 changed files with 184,304 additions and 10,116 deletions.
53 changes: 48 additions & 5 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

[[constraint]]
name = "github.com/ethereum/go-ethereum"
branch = "release/1.7"
branch = "release/1.8"

[[constraint]]
name = "github.com/prometheus/client_golang"
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,22 @@ statusgo-cross: statusgo-android statusgo-ios
@ls -ld $(GOBIN)/statusgo-*

statusgo-android: xgo ##@cross-compile Build status-go for Android
./_assets/patches/patcher -b . -p geth-xgo
$(GOPATH)/bin/xgo --image $(XGOIMAGE) --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=android-16/aar -v -tags '$(BUILD_TAGS)' $(shell _assets/build/testnet-flags.sh) ./lib
./_assets/patches/patcher -b . -p geth-xgo -r
@echo "Android cross compilation done."

statusgo-ios: xgo ##@cross-compile Build status-go for iOS
./_assets/patches/patcher -b . -p geth-xgo
$(GOPATH)/bin/xgo --image $(XGOIMAGE) --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=ios-9.3/framework -v -tags '$(BUILD_TAGS)' $(shell _assets/build/testnet-flags.sh) ./lib
./_assets/patches/patcher -b . -p geth-xgo -r
@echo "iOS framework cross compilation done."

statusgo-ios-simulator: xgo ##@cross-compile Build status-go for iOS Simulator
@docker pull $(XGOIMAGEIOSSIM)
./_assets/patches/patcher -b . -p geth-xgo
$(GOPATH)/bin/xgo --image $(XGOIMAGEIOSSIM) --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=ios-9.3/framework -v -tags '$(BUILD_TAGS)' $(shell _assets/build/testnet-flags.sh) ./lib
./_assets/patches/patcher -b . -p geth-xgo -r
@echo "iOS framework cross compilation done."

statusgo-library: ##@cross-compile Build status-go as static library for current platform
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/vendor/gopkg.in/olebedev/go-duktape.v3/duk_minimal_printf.c b/vendor/gopkg.in/olebedev/go-duktape.v3/duk_minimal_printf.c
index e4b6e43a..baed990d 100755
--- a/vendor/gopkg.in/olebedev/go-duktape.v3/duk_minimal_printf.c
+++ b/vendor/gopkg.in/olebedev/go-duktape.v3/duk_minimal_printf.c
@@ -278,6 +278,7 @@ int duk_minimal_snprintf(char *str, size_t size, const char *format, ...) {
}

/* Minimal sprintf() entry point. */
+#if 0
int duk_minimal_sprintf(char *str, const char *format, ...) {
va_list ap;
int ret;
@@ -288,6 +289,7 @@ int duk_minimal_sprintf(char *str, const char *format, ...) {

return ret;
}
+#endif

/* Minimal sscanf() entry point. */
int duk_minimal_sscanf(const char *str, const char *format, ...) {
131 changes: 131 additions & 0 deletions _assets/patches/geth-xgo/0002-remove-dashboard-collectData.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
diff --git a/vendor/github.com/ethereum/go-ethereum/dashboard/dashboard.go b/vendor/github.com/ethereum/go-ethereum/dashboard/dashboard.go
index 09038638..070ecca3 100644
--- a/vendor/github.com/ethereum/go-ethereum/dashboard/dashboard.go
+++ b/vendor/github.com/ethereum/go-ethereum/dashboard/dashboard.go
@@ -29,17 +29,14 @@ import (
"net"
"net/http"
"path/filepath"
- "runtime"
"sync"
"sync/atomic"
"time"

- "github.com/elastic/gosigar"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc"
- "github.com/rcrowley/go-metrics"
"golang.org/x/net/websocket"
)

@@ -274,108 +271,6 @@ func (db *Dashboard) apiHandler(conn *websocket.Conn) {
// collectData collects the required data to plot on the dashboard.
func (db *Dashboard) collectData() {
defer db.wg.Done()
- systemCPUUsage := gosigar.Cpu{}
- systemCPUUsage.Get()
- var (
- prevNetworkIngress = metrics.DefaultRegistry.Get("p2p/InboundTraffic").(metrics.Meter).Count()
- prevNetworkEgress = metrics.DefaultRegistry.Get("p2p/OutboundTraffic").(metrics.Meter).Count()
- prevProcessCPUTime = getProcessCPUTime()
- prevSystemCPUUsage = systemCPUUsage
- prevDiskRead = metrics.DefaultRegistry.Get("eth/db/chaindata/compact/input").(metrics.Meter).Count()
- prevDiskWrite = metrics.DefaultRegistry.Get("eth/db/chaindata/compact/output").(metrics.Meter).Count()
-
- frequency = float64(db.config.Refresh / time.Second)
- numCPU = float64(runtime.NumCPU())
- )
-
- for {
- select {
- case errc := <-db.quit:
- errc <- nil
- return
- case <-time.After(db.config.Refresh):
- systemCPUUsage.Get()
- var (
- curNetworkIngress = metrics.DefaultRegistry.Get("p2p/InboundTraffic").(metrics.Meter).Count()
- curNetworkEgress = metrics.DefaultRegistry.Get("p2p/OutboundTraffic").(metrics.Meter).Count()
- curProcessCPUTime = getProcessCPUTime()
- curSystemCPUUsage = systemCPUUsage
- curDiskRead = metrics.DefaultRegistry.Get("eth/db/chaindata/compact/input").(metrics.Meter).Count()
- curDiskWrite = metrics.DefaultRegistry.Get("eth/db/chaindata/compact/output").(metrics.Meter).Count()
-
- deltaNetworkIngress = float64(curNetworkIngress - prevNetworkIngress)
- deltaNetworkEgress = float64(curNetworkEgress - prevNetworkEgress)
- deltaProcessCPUTime = curProcessCPUTime - prevProcessCPUTime
- deltaSystemCPUUsage = systemCPUUsage.Delta(prevSystemCPUUsage)
- deltaDiskRead = curDiskRead - prevDiskRead
- deltaDiskWrite = curDiskWrite - prevDiskWrite
- )
- prevNetworkIngress = curNetworkIngress
- prevNetworkEgress = curNetworkEgress
- prevProcessCPUTime = curProcessCPUTime
- prevSystemCPUUsage = curSystemCPUUsage
- prevDiskRead = curDiskRead
- prevDiskWrite = curDiskWrite
-
- now := time.Now()
-
- var mem runtime.MemStats
- runtime.ReadMemStats(&mem)
- activeMemory := &ChartEntry{
- Time: now,
- Value: float64(mem.Alloc) / frequency,
- }
- virtualMemory := &ChartEntry{
- Time: now,
- Value: float64(mem.Sys) / frequency,
- }
- networkIngress := &ChartEntry{
- Time: now,
- Value: deltaNetworkIngress / frequency,
- }
- networkEgress := &ChartEntry{
- Time: now,
- Value: deltaNetworkEgress / frequency,
- }
- processCPU := &ChartEntry{
- Time: now,
- Value: deltaProcessCPUTime / frequency / numCPU * 100,
- }
- systemCPU := &ChartEntry{
- Time: now,
- Value: float64(deltaSystemCPUUsage.Sys+deltaSystemCPUUsage.User) / frequency / numCPU,
- }
- diskRead := &ChartEntry{
- Time: now,
- Value: float64(deltaDiskRead) / frequency,
- }
- diskWrite := &ChartEntry{
- Time: now,
- Value: float64(deltaDiskWrite) / frequency,
- }
- db.charts.ActiveMemory = append(db.charts.ActiveMemory[1:], activeMemory)
- db.charts.VirtualMemory = append(db.charts.VirtualMemory[1:], virtualMemory)
- db.charts.NetworkIngress = append(db.charts.NetworkIngress[1:], networkIngress)
- db.charts.NetworkEgress = append(db.charts.NetworkEgress[1:], networkEgress)
- db.charts.ProcessCPU = append(db.charts.ProcessCPU[1:], processCPU)
- db.charts.SystemCPU = append(db.charts.SystemCPU[1:], systemCPU)
- db.charts.DiskRead = append(db.charts.DiskRead[1:], diskRead)
- db.charts.DiskWrite = append(db.charts.DiskRead[1:], diskWrite)
-
- db.sendToAll(&Message{
- Home: &HomeMessage{
- ActiveMemory: ChartEntries{activeMemory},
- VirtualMemory: ChartEntries{virtualMemory},
- NetworkIngress: ChartEntries{networkIngress},
- NetworkEgress: ChartEntries{networkEgress},
- ProcessCPU: ChartEntries{processCPU},
- SystemCPU: ChartEntries{systemCPU},
- DiskRead: ChartEntries{diskRead},
- DiskWrite: ChartEntries{diskWrite},
- },
- })
- }
- }
}

// collectLogs collects and sends the logs to the active dashboards.
20 changes: 20 additions & 0 deletions _assets/patches/geth-xgo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Status Patches for geth (go-ethereum) cross-compiled in Xgo
---

Status-go uses [go-ethereum](https://github.com/ethereum/go-ethereum) (**upstream**) as its dependency. When cross-compiling with Xgo, some headers or definitions are not available within the Xgo environment. In such a situation, we temporarily patch the sources before kicking the build in Xgo and revert them afterwards (this is taken care by the respective Makefile targets).

We try to minimize number and amount of changes in those patches as much as possible, and whereas possible, to contribute changes into the upstream.

# Creating patches

Instructions for creating a patch from the command line:

1. Enter the command line at the go-ethereum dependency root in vendor folder.
1. Create the patch:
1. If you already have a commit that represents the change, find its SHA1 (e.g. `$COMMIT_SHA1`) and do `git diff $COMMIT_SHA1 > file.patch`
1. If the files are staged, do `git diff --cached > file.patch`

# Patches

- [`0001-fix-duktapev3-missing-SIZE_MAX-def.patch`](./0001-fix-duktapev3-missing-SIZE_MAX-def.patch) — Adds patch to geth 1.8.0 dependency duktapev3, to address issue where SIZE_MAX is not defined in xgo for Android
- [`0002-remove-dashboard-collectData.patch`](./0002-remove-dashboard-collectData.patch) — Deletes the body of `collectData` in the `dashboard` package, since it will import the `gosigar` package which in turn includes a header (`libproc.h`) which is missing in the iOS environment in Xgo.
4 changes: 2 additions & 2 deletions _assets/patches/geth/0006-latest-cht.patch
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ index e7e513880..dc6562be8 100644
--- a/light/postprocess.go
+++ b/light/postprocess.go
@@ -66,12 +66,20 @@ var (
chtRoot: common.HexToHash("6f56dc61936752cc1f8c84b4addabdbe6a1c19693de3f21cb818362df2117f03"),
bloomTrieRoot: common.HexToHash("aca7d7c504d22737242effc3fdc604a762a0af9ced898036b5986c3a15220208"),
chtRoot: common.HexToHash("71d60207af74e5a22a3e1cfbfc89f9944f91b49aa980c86fba94d568369eaf44"),
bloomTrieRoot: common.HexToHash("70aca4b3b6d08dde8704c95cedb1420394453c1aec390947751e69ff8c436360"),
}
+
+ statusRopstenCheckpoint = trustedCheckpoint{
Expand Down
Loading

0 comments on commit e4cbce1

Please sign in to comment.