Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to go-ethereum 1.8.1 #702

Merged
merged 9 commits into from
Feb 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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