merge upstream

This commit is contained in:
Nguyen Sy Thanh Son 2018-05-03 04:05:41 +00:00
commit bcfce2af3d
35 changed files with 295 additions and 430 deletions

2
.gitignore vendored
View file

@ -25,7 +25,7 @@ build/_vendor/pkg
# used by the Makefile # used by the Makefile
/build/_workspace/ /build/_workspace/
/build/bin/ /build/bin/
/geth*.zip /tomo*.zip
# travis # travis
profile.tmp profile.tmp

View file

@ -3,207 +3,48 @@ go_import_path: github.com/ethereum/go-ethereum
sudo: false sudo: false
matrix: matrix:
include: include:
- os: linux - os: linux
dist: trusty dist: trusty
sudo: required sudo: required
go: 1.9.x go: 1.9.x
script: script:
- sudo modprobe fuse - sudo modprobe fuse
- sudo chmod 666 /dev/fuse - sudo chmod 666 /dev/fuse
- sudo chown root:$USER /etc/fuse.conf - sudo chown root:$USER /etc/fuse.conf
- go run build/ci.go install - go run build/ci.go install
- go run build/ci.go test -coverage - go run build/ci.go test -coverage
- os: linux
# These are the latest Go versions. dist: trusty
- os: linux sudo: required
dist: trusty go: '1.10'
sudo: required script:
go: "1.10" - sudo modprobe fuse
script: - sudo chmod 666 /dev/fuse
- sudo modprobe fuse - sudo chown root:$USER /etc/fuse.conf
- sudo chmod 666 /dev/fuse - go run build/ci.go install
- sudo chown root:$USER /etc/fuse.conf - go run build/ci.go test -coverage
- go run build/ci.go install - os: osx
- go run build/ci.go test -coverage go: '1.10'
script:
- os: osx - unset -f cd
go: "1.10" - brew update
script: - brew install caskroom/cask/brew-cask
- unset -f cd # workaround for https://github.com/travis-ci/travis-ci/issues/8703 - brew cask install osxfuse
- brew update - go run build/ci.go install
- brew install caskroom/cask/brew-cask - go run build/ci.go test -coverage
- brew cask install osxfuse - os: linux
- go run build/ci.go install dist: trusty
- go run build/ci.go test -coverage go: '1.10'
env:
# This builder only tests code linters on latest version of Go - lint
- os: linux git:
dist: trusty submodules: false
go: "1.10" script:
env: - go run build/ci.go lint
- lint
git:
submodules: false # avoid cloning ethereum/tests
script:
- go run build/ci.go lint
# This builder does the Ubuntu PPA upload
- os: linux
dist: trusty
go: "1.10"
env:
- ubuntu-ppa
git:
submodules: false # avoid cloning ethereum/tests
addons:
apt:
packages:
- devscripts
- debhelper
- dput
- fakeroot
script:
- go run build/ci.go debsrc -signer "Go Ethereum Linux Builder <geth-ci@ethereum.org>" -upload ppa:ethereum/ethereum
# This builder does the Linux Azure uploads
- os: linux
dist: trusty
sudo: required
go: "1.10"
env:
- azure-linux
git:
submodules: false # avoid cloning ethereum/tests
addons:
apt:
packages:
- gcc-multilib
script:
# Build for the primary platforms that Trusty can manage
- go run build/ci.go install
- go run build/ci.go archive -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
- go run build/ci.go install -arch 386
- go run build/ci.go archive -arch 386 -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
# Switch over GCC to cross compilation (breaks 386, hence why do it here only)
- sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install gcc-arm-linux-gnueabi libc6-dev-armel-cross gcc-arm-linux-gnueabihf libc6-dev-armhf-cross gcc-aarch64-linux-gnu libc6-dev-arm64-cross
- sudo ln -s /usr/include/asm-generic /usr/include/asm
- GOARM=5 go run build/ci.go install -arch arm -cc arm-linux-gnueabi-gcc
- GOARM=5 go run build/ci.go archive -arch arm -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
- GOARM=6 go run build/ci.go install -arch arm -cc arm-linux-gnueabi-gcc
- GOARM=6 go run build/ci.go archive -arch arm -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
- GOARM=7 go run build/ci.go install -arch arm -cc arm-linux-gnueabihf-gcc
- GOARM=7 go run build/ci.go archive -arch arm -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
- go run build/ci.go install -arch arm64 -cc aarch64-linux-gnu-gcc
- go run build/ci.go archive -arch arm64 -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
# This builder does the Linux Azure MIPS xgo uploads
- os: linux
dist: trusty
services:
- docker
go: "1.10"
env:
- azure-linux-mips
git:
submodules: false # avoid cloning ethereum/tests
script:
- go run build/ci.go xgo --alltools -- --targets=linux/mips --ldflags '-extldflags "-static"' -v
- for bin in build/bin/*-linux-mips; do mv -f "${bin}" "${bin/-linux-mips/}"; done
- go run build/ci.go archive -arch mips -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
- go run build/ci.go xgo --alltools -- --targets=linux/mipsle --ldflags '-extldflags "-static"' -v
- for bin in build/bin/*-linux-mipsle; do mv -f "${bin}" "${bin/-linux-mipsle/}"; done
- go run build/ci.go archive -arch mipsle -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
- go run build/ci.go xgo --alltools -- --targets=linux/mips64 --ldflags '-extldflags "-static"' -v
- for bin in build/bin/*-linux-mips64; do mv -f "${bin}" "${bin/-linux-mips64/}"; done
- go run build/ci.go archive -arch mips64 -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
- go run build/ci.go xgo --alltools -- --targets=linux/mips64le --ldflags '-extldflags "-static"' -v
- for bin in build/bin/*-linux-mips64le; do mv -f "${bin}" "${bin/-linux-mips64le/}"; done
- go run build/ci.go archive -arch mips64le -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
# This builder does the Android Maven and Azure uploads
- os: linux
dist: precise # Needed for the android tools
addons:
apt:
packages:
- oracle-java8-installer
- oracle-java8-set-default
language: android
android:
components:
- platform-tools
- tools
- android-15
- android-19
- android-24
env:
- azure-android
- maven-android
git:
submodules: false # avoid cloning ethereum/tests
before_install:
- curl https://storage.googleapis.com/golang/go1.10.linux-amd64.tar.gz | tar -xz
- export PATH=`pwd`/go/bin:$PATH
- export GOROOT=`pwd`/go
- export GOPATH=$HOME/go
script:
# Build the Android archive and upload it to Maven Central and Azure
- curl https://dl.google.com/android/repository/android-ndk-r15c-linux-x86_64.zip -o android-ndk-r15c.zip
- unzip -q android-ndk-r15c.zip && rm android-ndk-r15c.zip
- mv android-ndk-r15c $HOME
- export ANDROID_NDK=$HOME/android-ndk-r15c
- mkdir -p $GOPATH/src/github.com/ethereum
- ln -s `pwd` $GOPATH/src/github.com/ethereum
- go run build/ci.go aar -signer ANDROID_SIGNING_KEY -deploy https://oss.sonatype.org -upload gethstore/builds
# This builder does the OSX Azure, iOS CocoaPods and iOS Azure uploads
- os: osx
go: "1.10"
env:
- azure-osx
- azure-ios
- cocoapods-ios
git:
submodules: false # avoid cloning ethereum/tests
script:
- go run build/ci.go install
- go run build/ci.go archive -type tar -signer OSX_SIGNING_KEY -upload gethstore/builds
# Build the iOS framework and upload it to CocoaPods and Azure
- gem uninstall cocoapods -a -x
- gem install cocoapods
- mv ~/.cocoapods/repos/master ~/.cocoapods/repos/master.bak
- sed -i '.bak' 's/repo.join/!repo.join/g' $(dirname `gem which cocoapods`)/cocoapods/sources_manager.rb
- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then git clone --depth=1 https://github.com/CocoaPods/Specs.git ~/.cocoapods/repos/master && pod setup --verbose; fi
- xctool -version
- xcrun simctl list
# Workaround for https://github.com/golang/go/issues/23749
- export CGO_CFLAGS_ALLOW='-fmodules|-fblocks|-fobjc-arc'
- go run build/ci.go xcode -signer IOS_SIGNING_KEY -deploy trunk -upload gethstore/builds
# This builder does the Azure archive purges to avoid accumulating junk
- os: linux
dist: trusty
go: "1.10"
env:
- azure-purge
git:
submodules: false # avoid cloning ethereum/tests
script:
- go run build/ci.go purge -store gethstore/builds -days 14
notifications: notifications:
webhooks: slack:
urls: rooms:
- https://webhooks.gitter.im/e/e09ccdce1048c5e03445 secure: DoWVSWEKZre0rsYvHPqOBpYa5hL7DagVCP7eGR+2dluzsyUOTW58uiaezaZMAPPG6k7i1TC9CufONkFRwH6kqLrFtAFd+t3sKb3X4D9/PSa9k88uBuNfsX+JhUzEMT53pfLO9NTBbZs3M6bOuZDP7GddWWnMZpO6Mu7RzZtVxyqbZIcNu3nxsmLkoaQ8726npaHrxhO1Ab+3rgR4dkNFLgl9/CnPwvuv/j24dsKzly6tF+4Ms9Fz5O0Te8zK5d/UWZN50e+uDnbzcIvbY2VHOYXchXZRbfKO8/M2TIXLPKbLc3alCw1ZvpFZqiMYK3SnGNby4FLp8RlC6H4sv52YeNq3fHH8SgOJ3xTL8m6ejIlqoKnUNsJ1lwtfiEVu5D1b8FRKTPqoh+cjadJxsF9dO0xZsf1d5Pmq6Ncr0j6di1ZMjCc6TPFERxkdA48+PzQY4TqfBpM4E5RnJuX9O9MJFbA1fZo2xhHcy0LlkslZMpSwiv/YO4bCJZPmxvHtruqELJXxjYyC67UbzSzrBVE1g1bXy0V5xyxPIEA38jzlNczhq6fg2gyEc+6JCbzN2gFoAS5uFWQHpUhXHc7zNB5Jyi7GPQv6cfHYcedjn9In9/bNDqqGexGX4Ih/cb6W1GOHC7c2A/AsfTa9KWmsyj7YwBRXFIXfme7bBh6VGuRqU3Y=
on_success: change on_success: change
on_failure: always on_failure: always

131
Makefile
View file

@ -2,19 +2,24 @@
# with Go source code. If you know what GOPATH is then you probably # with Go source code. If you know what GOPATH is then you probably
# don't need to bother with make. # don't need to bother with make.
.PHONY: geth android ios geth-cross swarm evm all test clean .PHONY: tomo android ios tomo-cross swarm evm all test clean
.PHONY: geth-linux geth-linux-386 geth-linux-amd64 geth-linux-mips64 geth-linux-mips64le .PHONY: tomo-linux tomo-linux-386 tomo-linux-amd64 tomo-linux-mips64 tomo-linux-mips64le
.PHONY: geth-linux-arm geth-linux-arm-5 geth-linux-arm-6 geth-linux-arm-7 geth-linux-arm64 .PHONY: tomo-linux-arm tomo-linux-arm-5 tomo-linux-arm-6 tomo-linux-arm-7 tomo-linux-arm64
.PHONY: geth-darwin geth-darwin-386 geth-darwin-amd64 .PHONY: tomo-darwin tomo-darwin-386 tomo-darwin-amd64
.PHONY: geth-windows geth-windows-386 geth-windows-amd64 .PHONY: tomo-windows tomo-windows-386 tomo-windows-amd64
GOBIN = $(shell pwd)/build/bin GOBIN = $(shell pwd)/build/bin
GOFMT = gofmt
GO ?= latest GO ?= latest
GO_PACKAGES = .
GO_FILES := $(shell find $(shell go list -f '{{.Dir}}' $(GO_PACKAGES)) -name \*.go)
geth: GIT = git
build/env.sh go run build/ci.go install ./cmd/geth
tomo:
build/env.sh go run build/ci.go install ./cmd/tomo
@echo "Done building." @echo "Done building."
@echo "Run \"$(GOBIN)/geth\" to launch geth." @echo "Run \"$(GOBIN)/tomo\" to launch tomo."
swarm: swarm:
build/env.sh go run build/ci.go install ./cmd/swarm build/env.sh go run build/ci.go install ./cmd/swarm
@ -27,12 +32,12 @@ all:
android: android:
build/env.sh go run build/ci.go aar --local build/env.sh go run build/ci.go aar --local
@echo "Done building." @echo "Done building."
@echo "Import \"$(GOBIN)/geth.aar\" to use the library." @echo "Import \"$(GOBIN)/tomo.aar\" to use the library."
ios: ios:
build/env.sh go run build/ci.go xcode --local build/env.sh go run build/ci.go xcode --local
@echo "Done building." @echo "Done building."
@echo "Import \"$(GOBIN)/Geth.framework\" to use the library." @echo "Import \"$(GOBIN)/tomo.framework\" to use the library."
test: all test: all
build/env.sh go run build/ci.go test build/env.sh go run build/ci.go test
@ -55,92 +60,96 @@ devtools:
# Cross Compilation Targets (xgo) # Cross Compilation Targets (xgo)
geth-cross: geth-linux geth-darwin geth-windows geth-android geth-ios tomo-cross: tomo-linux tomo-darwin tomo-windows tomo-android tomo-ios
@echo "Full cross compilation done:" @echo "Full cross compilation done:"
@ls -ld $(GOBIN)/geth-* @ls -ld $(GOBIN)/tomo-*
geth-linux: geth-linux-386 geth-linux-amd64 geth-linux-arm geth-linux-mips64 geth-linux-mips64le tomo-linux: tomo-linux-386 tomo-linux-amd64 tomo-linux-arm tomo-linux-mips64 tomo-linux-mips64le
@echo "Linux cross compilation done:" @echo "Linux cross compilation done:"
@ls -ld $(GOBIN)/geth-linux-* @ls -ld $(GOBIN)/tomo-linux-*
geth-linux-386: tomo-linux-386:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/386 -v ./cmd/geth build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/386 -v ./cmd/tomo
@echo "Linux 386 cross compilation done:" @echo "Linux 386 cross compilation done:"
@ls -ld $(GOBIN)/geth-linux-* | grep 386 @ls -ld $(GOBIN)/tomo-linux-* | grep 386
geth-linux-amd64: tomo-linux-amd64:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/amd64 -v ./cmd/geth build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/amd64 -v ./cmd/tomo
@echo "Linux amd64 cross compilation done:" @echo "Linux amd64 cross compilation done:"
@ls -ld $(GOBIN)/geth-linux-* | grep amd64 @ls -ld $(GOBIN)/tomo-linux-* | grep amd64
geth-linux-arm: geth-linux-arm-5 geth-linux-arm-6 geth-linux-arm-7 geth-linux-arm64 tomo-linux-arm: tomo-linux-arm-5 tomo-linux-arm-6 tomo-linux-arm-7 tomo-linux-arm64
@echo "Linux ARM cross compilation done:" @echo "Linux ARM cross compilation done:"
@ls -ld $(GOBIN)/geth-linux-* | grep arm @ls -ld $(GOBIN)/tomo-linux-* | grep arm
geth-linux-arm-5: tomo-linux-arm-5:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm-5 -v ./cmd/geth build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm-5 -v ./cmd/tomo
@echo "Linux ARMv5 cross compilation done:" @echo "Linux ARMv5 cross compilation done:"
@ls -ld $(GOBIN)/geth-linux-* | grep arm-5 @ls -ld $(GOBIN)/tomo-linux-* | grep arm-5
geth-linux-arm-6: tomo-linux-arm-6:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm-6 -v ./cmd/geth build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm-6 -v ./cmd/tomo
@echo "Linux ARMv6 cross compilation done:" @echo "Linux ARMv6 cross compilation done:"
@ls -ld $(GOBIN)/geth-linux-* | grep arm-6 @ls -ld $(GOBIN)/tomo-linux-* | grep arm-6
geth-linux-arm-7: tomo-linux-arm-7:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm-7 -v ./cmd/geth build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm-7 -v ./cmd/tomo
@echo "Linux ARMv7 cross compilation done:" @echo "Linux ARMv7 cross compilation done:"
@ls -ld $(GOBIN)/geth-linux-* | grep arm-7 @ls -ld $(GOBIN)/tomo-linux-* | grep arm-7
geth-linux-arm64: tomo-linux-arm64:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm64 -v ./cmd/geth build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm64 -v ./cmd/tomo
@echo "Linux ARM64 cross compilation done:" @echo "Linux ARM64 cross compilation done:"
@ls -ld $(GOBIN)/geth-linux-* | grep arm64 @ls -ld $(GOBIN)/tomo-linux-* | grep arm64
geth-linux-mips: tomo-linux-mips:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/mips --ldflags '-extldflags "-static"' -v ./cmd/geth build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/mips --ldflags '-extldflags "-static"' -v ./cmd/tomo
@echo "Linux MIPS cross compilation done:" @echo "Linux MIPS cross compilation done:"
@ls -ld $(GOBIN)/geth-linux-* | grep mips @ls -ld $(GOBIN)/tomo-linux-* | grep mips
geth-linux-mipsle: tomo-linux-mipsle:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/mipsle --ldflags '-extldflags "-static"' -v ./cmd/geth build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/mipsle --ldflags '-extldflags "-static"' -v ./cmd/tomo
@echo "Linux MIPSle cross compilation done:" @echo "Linux MIPSle cross compilation done:"
@ls -ld $(GOBIN)/geth-linux-* | grep mipsle @ls -ld $(GOBIN)/tomo-linux-* | grep mipsle
geth-linux-mips64: tomo-linux-mips64:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/mips64 --ldflags '-extldflags "-static"' -v ./cmd/geth build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/mips64 --ldflags '-extldflags "-static"' -v ./cmd/tomo
@echo "Linux MIPS64 cross compilation done:" @echo "Linux MIPS64 cross compilation done:"
@ls -ld $(GOBIN)/geth-linux-* | grep mips64 @ls -ld $(GOBIN)/tomo-linux-* | grep mips64
geth-linux-mips64le: tomo-linux-mips64le:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/mips64le --ldflags '-extldflags "-static"' -v ./cmd/geth build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/mips64le --ldflags '-extldflags "-static"' -v ./cmd/tomo
@echo "Linux MIPS64le cross compilation done:" @echo "Linux MIPS64le cross compilation done:"
@ls -ld $(GOBIN)/geth-linux-* | grep mips64le @ls -ld $(GOBIN)/tomo-linux-* | grep mips64le
geth-darwin: geth-darwin-386 geth-darwin-amd64 tomo-darwin: tomo-darwin-386 tomo-darwin-amd64
@echo "Darwin cross compilation done:" @echo "Darwin cross compilation done:"
@ls -ld $(GOBIN)/geth-darwin-* @ls -ld $(GOBIN)/tomo-darwin-*
geth-darwin-386: tomo-darwin-386:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=darwin/386 -v ./cmd/geth build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=darwin/386 -v ./cmd/tomo
@echo "Darwin 386 cross compilation done:" @echo "Darwin 386 cross compilation done:"
@ls -ld $(GOBIN)/geth-darwin-* | grep 386 @ls -ld $(GOBIN)/tomo-darwin-* | grep 386
geth-darwin-amd64: tomo-darwin-amd64:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=darwin/amd64 -v ./cmd/geth build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=darwin/amd64 -v ./cmd/tomo
@echo "Darwin amd64 cross compilation done:" @echo "Darwin amd64 cross compilation done:"
@ls -ld $(GOBIN)/geth-darwin-* | grep amd64 @ls -ld $(GOBIN)/tomo-darwin-* | grep amd64
geth-windows: geth-windows-386 geth-windows-amd64 tomo-windows: tomo-windows-386 tomo-windows-amd64
@echo "Windows cross compilation done:" @echo "Windows cross compilation done:"
@ls -ld $(GOBIN)/geth-windows-* @ls -ld $(GOBIN)/tomo-windows-*
geth-windows-386: tomo-windows-386:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=windows/386 -v ./cmd/geth build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=windows/386 -v ./cmd/tomo
@echo "Windows 386 cross compilation done:" @echo "Windows 386 cross compilation done:"
@ls -ld $(GOBIN)/geth-windows-* | grep 386 @ls -ld $(GOBIN)/tomo-windows-* | grep 386
geth-windows-amd64: tomo-windows-amd64:
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=windows/amd64 -v ./cmd/geth build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=windows/amd64 -v ./cmd/tomo
@echo "Windows amd64 cross compilation done:" @echo "Windows amd64 cross compilation done:"
@ls -ld $(GOBIN)/geth-windows-* | grep amd64 @ls -ld $(GOBIN)/geth-windows-* | grep amd64
gofmt:
$(GOFMT) -s -w $(GO_FILES)
$(GIT) checkout vendor

View file

@ -1,5 +1,7 @@
## Tomochain ## Tomochain
[![Build Status](https://travis-ci.org/tomochain/tomochain.svg?branch=master)](https://travis-ci.org/tomochain/tomochain)
Blockchain for decentralized applications, token issuance and integration Blockchain for decentralized applications, token issuance and integration
https://tomochain.com https://tomochain.com

View file

@ -188,7 +188,7 @@ func doInstall(cmdline []string) {
if minor < 9 { if minor < 9 {
log.Println("You have Go version", runtime.Version()) log.Println("You have Go version", runtime.Version())
log.Println("go-ethereum requires at least Go version 1.9 and cannot") log.Println("tomo requires at least Go version 1.9 and cannot")
log.Println("be compiled with an earlier version. Please upgrade your Go installation.") log.Println("be compiled with an earlier version. Please upgrade your Go installation.")
os.Exit(1) os.Exit(1)
} }

View file

@ -215,7 +215,7 @@ type faucet struct {
func newFaucet(genesis *core.Genesis, port int, enodes []*discv5.Node, network uint64, stats string, ks *keystore.KeyStore, index []byte) (*faucet, error) { func newFaucet(genesis *core.Genesis, port int, enodes []*discv5.Node, network uint64, stats string, ks *keystore.KeyStore, index []byte) (*faucet, error) {
// Assemble the raw devp2p protocol stack // Assemble the raw devp2p protocol stack
stack, err := node.New(&node.Config{ stack, err := node.New(&node.Config{
Name: "geth", Name: "tomo",
Version: params.Version, Version: params.Version,
DataDir: filepath.Join(os.Getenv("HOME"), ".faucet"), DataDir: filepath.Join(os.Getenv("HOME"), ".faucet"),
P2P: p2p.Config{ P2P: p2p.Config{

View file

@ -40,11 +40,11 @@ ADD genesis.json /genesis.json
ADD signer.pass /signer.pass ADD signer.pass /signer.pass
{{end}} {{end}}
RUN \ RUN \
echo 'geth --cache 512 init /genesis.json' > geth.sh && \{{if .Unlock}} echo 'tomo --cache 512 init /genesis.json' > tomo.sh && \{{if .Unlock}}
echo 'mkdir -p /root/.ethereum/keystore/ && cp /signer.json /root/.ethereum/keystore/' >> geth.sh && \{{end}} echo 'mkdir -p /root/.ethereum/keystore/ && cp /signer.json /root/.ethereum/keystore/' >> tomo.sh && \{{end}}
echo $'geth --networkid {{.NetworkID}} --cache 512 --port {{.Port}} --maxpeers {{.Peers}} {{.LightFlag}} --ethstats \'{{.Ethstats}}\' {{if .Bootnodes}}--bootnodes {{.Bootnodes}}{{end}} {{if .Etherbase}}--etherbase {{.Etherbase}} --mine --minerthreads 1{{end}} {{if .Unlock}}--unlock 0 --password /signer.pass --mine{{end}} --targetgaslimit {{.GasTarget}} --gasprice {{.GasPrice}}' >> geth.sh echo $'tomo --networkid {{.NetworkID}} --cache 512 --port {{.Port}} --maxpeers {{.Peers}} {{.LightFlag}} --ethstats \'{{.Ethstats}}\' {{if .Bootnodes}}--bootnodes {{.Bootnodes}}{{end}} {{if .Etherbase}}--etherbase {{.Etherbase}} --mine --minerthreads 1{{end}} {{if .Unlock}}--unlock 0 --password /signer.pass --mine{{end}} --targetgaslimit {{.GasTarget}} --gasprice {{.GasPrice}}' >> tomo.sh
ENTRYPOINT ["/bin/sh", "geth.sh"] ENTRYPOINT ["/bin/sh", "tomo.sh"]
` `
// nodeComposefile is the docker-compose.yml file required to deploy and maintain // nodeComposefile is the docker-compose.yml file required to deploy and maintain
@ -221,7 +221,7 @@ func checkNode(client *sshClient, network string, boot bool) (*nodeInfos, error)
// Container available, retrieve its node ID and its genesis json // Container available, retrieve its node ID and its genesis json
var out []byte var out []byte
if out, err = client.Run(fmt.Sprintf("docker exec %s_%s_1 geth --exec admin.nodeInfo.id attach", network, kind)); err != nil { if out, err = client.Run(fmt.Sprintf("docker exec %s_%s_1 tomo --exec admin.nodeInfo.id attach", network, kind)); err != nil {
return nil, ErrServiceUnreachable return nil, ErrServiceUnreachable
} }
id := bytes.Trim(bytes.TrimSpace(out), "\"") id := bytes.Trim(bytes.TrimSpace(out), "\"")

View file

@ -36,8 +36,8 @@ ADD genesis.json /genesis.json
RUN \ RUN \
echo 'node server.js &' > wallet.sh && \ echo 'node server.js &' > wallet.sh && \
echo 'geth --cache 512 init /genesis.json' >> wallet.sh && \ echo 'tomo --cache 512 init /genesis.json' >> wallet.sh && \
echo $'geth --networkid {{.NetworkID}} --port {{.NodePort}} --bootnodes {{.Bootnodes}} --ethstats \'{{.Ethstats}}\' --cache=512 --rpc --rpcaddr=0.0.0.0 --rpccorsdomain "*" --rpcvhosts "*"' >> wallet.sh echo $'tomo --networkid {{.NetworkID}} --port {{.NodePort}} --bootnodes {{.Bootnodes}} --ethstats \'{{.Ethstats}}\' --cache=512 --rpc --rpcaddr=0.0.0.0 --rpccorsdomain "*" --rpcvhosts "*"' >> wallet.sh
RUN \ RUN \
sed -i 's/PuppethNetworkID/{{.NetworkID}}/g' dist/js/etherwallet-master.js && \ sed -i 's/PuppethNetworkID/{{.NetworkID}}/g' dist/js/etherwallet-master.js && \

View file

@ -66,11 +66,16 @@ func (w *wizard) makeGenesis() {
genesis.Config.Clique = &params.CliqueConfig{ genesis.Config.Clique = &params.CliqueConfig{
Period: 15, Period: 15,
Epoch: 30000, Epoch: 30000,
Reward: 0,
} }
fmt.Println() fmt.Println()
fmt.Println("How many seconds should blocks take? (default = 15)") fmt.Println("How many seconds should blocks take? (default = 15)")
genesis.Config.Clique.Period = uint64(w.readDefaultInt(15)) genesis.Config.Clique.Period = uint64(w.readDefaultInt(15))
fmt.Println()
fmt.Println("How many Ethers should be rewarded to signer? (default = 0)")
genesis.Config.Clique.Reward = uint64(w.readDefaultInt(0))
// We also need the initial list of signers // We also need the initial list of signers
fmt.Println() fmt.Println()
fmt.Println("Which accounts are allowed to seal? (mandatory at least one)") fmt.Println("Which accounts are allowed to seal? (mandatory at least one)")

View file

@ -70,7 +70,7 @@ const (
SWARM_ENV_ENS_ADDR = "SWARM_ENS_ADDR" SWARM_ENV_ENS_ADDR = "SWARM_ENS_ADDR"
SWARM_ENV_CORS = "SWARM_CORS" SWARM_ENV_CORS = "SWARM_CORS"
SWARM_ENV_BOOTNODES = "SWARM_BOOTNODES" SWARM_ENV_BOOTNODES = "SWARM_BOOTNODES"
GETH_ENV_DATADIR = "GETH_DATADIR" TOMO_ENV_DATADIR = "TOMO_DATADIR"
) )
// These settings ensure that TOML keys use the same names as Go struct fields. // These settings ensure that TOML keys use the same names as Go struct fields.
@ -116,7 +116,7 @@ func initSwarmNode(config *bzzapi.Config, stack *node.Node, ctx *cli.Context) {
//at this point, all vars should be set in the Config //at this point, all vars should be set in the Config
//get the account for the provided swarm account //get the account for the provided swarm account
prvkey := getAccount(config.BzzAccount, ctx, stack) prvkey := getAccount(config.BzzAccount, ctx, stack)
//set the resolved config path (geth --datadir) //set the resolved config path (tomo --datadir)
config.Path = stack.InstanceDir() config.Path = stack.InstanceDir()
//finally, initialize the configuration //finally, initialize the configuration
config.Init(prvkey) config.Init(prvkey)
@ -243,7 +243,7 @@ func envVarsOverride(currentConfig *bzzapi.Config) (config *bzzapi.Config) {
} }
} }
if datadir := os.Getenv(GETH_ENV_DATADIR); datadir != "" { if datadir := os.Getenv(TOMO_ENV_DATADIR); datadir != "" {
currentConfig.Path = datadir currentConfig.Path = datadir
} }

View file

@ -405,9 +405,9 @@ func bzzd(ctx *cli.Context) error {
} }
cfg := defaultNodeConfig cfg := defaultNodeConfig
//geth only supports --datadir via command line //tomo only supports --datadir via command line
//in order to be consistent within swarm, if we pass --datadir via environment variable //in order to be consistent within swarm, if we pass --datadir via environment variable
//or via config file, we get the same directory for geth and swarm //or via config file, we get the same directory for tomo and swarm
if _, err := os.Stat(bzzconfig.Path); err == nil { if _, err := os.Stat(bzzconfig.Path); err == nil {
cfg.DataDir = bzzconfig.Path cfg.DataDir = bzzconfig.Path
} }

View file

@ -36,7 +36,7 @@ var (
ArgsUsage: "", ArgsUsage: "",
Category: "ACCOUNT COMMANDS", Category: "ACCOUNT COMMANDS",
Description: ` Description: `
geth wallet import /path/to/my/presale.wallet tomo wallet import /path/to/my/presale.wallet
will prompt for your password and imports your ether presale account. will prompt for your password and imports your ether presale account.
It can be used non-interactively with the --password option taking a It can be used non-interactively with the --password option taking a
@ -56,7 +56,7 @@ passwordfile as argument containing the wallet password in plaintext.`,
utils.LightKDFFlag, utils.LightKDFFlag,
}, },
Description: ` Description: `
geth wallet [options] /path/to/my/presale.wallet tomo wallet [options] /path/to/my/presale.wallet
will prompt for your password and imports your ether presale account. will prompt for your password and imports your ether presale account.
It can be used non-interactively with the --password option taking a It can be used non-interactively with the --password option taking a
@ -112,7 +112,7 @@ Print a short summary of all accounts`,
utils.LightKDFFlag, utils.LightKDFFlag,
}, },
Description: ` Description: `
geth account new tomo account new
Creates a new account and prints the address. Creates a new account and prints the address.
@ -137,7 +137,7 @@ password to file or expose in any other way.
utils.LightKDFFlag, utils.LightKDFFlag,
}, },
Description: ` Description: `
geth account update <address> tomo account update <address>
Update an existing account. Update an existing account.
@ -149,7 +149,7 @@ format to the newest format or change the password for an account.
For non-interactive use the passphrase can be specified with the --password flag: For non-interactive use the passphrase can be specified with the --password flag:
geth account update [options] <address> tomo account update [options] <address>
Since only one password can be given, only format update can be performed, Since only one password can be given, only format update can be performed,
changing your password is only possible interactively. changing your password is only possible interactively.
@ -167,7 +167,7 @@ changing your password is only possible interactively.
}, },
ArgsUsage: "<keyFile>", ArgsUsage: "<keyFile>",
Description: ` Description: `
geth account import <keyfile> tomo account import <keyfile>
Imports an unencrypted private key from <keyfile> and creates a new account. Imports an unencrypted private key from <keyfile> and creates a new account.
Prints the address. Prints the address.
@ -180,7 +180,7 @@ You must remember this passphrase to unlock your account in the future.
For non-interactive use the passphrase can be specified with the -password flag: For non-interactive use the passphrase can be specified with the -password flag:
geth account import [options] <keyfile> tomo account import [options] <keyfile>
Note: Note:
As you can directly copy your encrypted accounts to another ethereum instance, As you can directly copy your encrypted accounts to another ethereum instance,
@ -291,7 +291,7 @@ func ambiguousAddrRecovery(ks *keystore.KeyStore, err *keystore.AmbiguousAddrErr
// accountCreate creates a new account into the keystore defined by the CLI flags. // accountCreate creates a new account into the keystore defined by the CLI flags.
func accountCreate(ctx *cli.Context) error { func accountCreate(ctx *cli.Context) error {
cfg := gethConfig{Node: defaultNodeConfig()} cfg := tomoConfig{Node: defaultNodeConfig()}
// Load config file. // Load config file.
if file := ctx.GlobalString(configFileFlag.Name); file != "" { if file := ctx.GlobalString(configFileFlag.Name); file != "" {
if err := loadConfig(file, &cfg); err != nil { if err := loadConfig(file, &cfg); err != nil {

View file

@ -43,22 +43,22 @@ func tmpDatadirWithKeystore(t *testing.T) string {
} }
func TestAccountListEmpty(t *testing.T) { func TestAccountListEmpty(t *testing.T) {
geth := runGeth(t, "account", "list") tomo := runTomo(t, "account", "list")
geth.ExpectExit() tomo.ExpectExit()
} }
func TestAccountList(t *testing.T) { func TestAccountList(t *testing.T) {
datadir := tmpDatadirWithKeystore(t) datadir := tmpDatadirWithKeystore(t)
geth := runGeth(t, "account", "list", "--datadir", datadir) tomo := runTomo(t, "account", "list", "--datadir", datadir)
defer geth.ExpectExit() defer tomo.ExpectExit()
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
geth.Expect(` tomo.Expect(`
Account #0: {7ef5a6135f1fd6a02593eedc869c6d41d934aef8} keystore://{{.Datadir}}\keystore\UTC--2016-03-22T12-57-55.920751759Z--7ef5a6135f1fd6a02593eedc869c6d41d934aef8 Account #0: {7ef5a6135f1fd6a02593eedc869c6d41d934aef8} keystore://{{.Datadir}}\keystore\UTC--2016-03-22T12-57-55.920751759Z--7ef5a6135f1fd6a02593eedc869c6d41d934aef8
Account #1: {f466859ead1932d743d622cb74fc058882e8648a} keystore://{{.Datadir}}\keystore\aaa Account #1: {f466859ead1932d743d622cb74fc058882e8648a} keystore://{{.Datadir}}\keystore\aaa
Account #2: {289d485d9771714cce91d3393d764e1311907acc} keystore://{{.Datadir}}\keystore\zzz Account #2: {289d485d9771714cce91d3393d764e1311907acc} keystore://{{.Datadir}}\keystore\zzz
`) `)
} else { } else {
geth.Expect(` tomo.Expect(`
Account #0: {7ef5a6135f1fd6a02593eedc869c6d41d934aef8} keystore://{{.Datadir}}/keystore/UTC--2016-03-22T12-57-55.920751759Z--7ef5a6135f1fd6a02593eedc869c6d41d934aef8 Account #0: {7ef5a6135f1fd6a02593eedc869c6d41d934aef8} keystore://{{.Datadir}}/keystore/UTC--2016-03-22T12-57-55.920751759Z--7ef5a6135f1fd6a02593eedc869c6d41d934aef8
Account #1: {f466859ead1932d743d622cb74fc058882e8648a} keystore://{{.Datadir}}/keystore/aaa Account #1: {f466859ead1932d743d622cb74fc058882e8648a} keystore://{{.Datadir}}/keystore/aaa
Account #2: {289d485d9771714cce91d3393d764e1311907acc} keystore://{{.Datadir}}/keystore/zzz Account #2: {289d485d9771714cce91d3393d764e1311907acc} keystore://{{.Datadir}}/keystore/zzz
@ -67,21 +67,21 @@ Account #2: {289d485d9771714cce91d3393d764e1311907acc} keystore://{{.Datadir}}/k
} }
func TestAccountNew(t *testing.T) { func TestAccountNew(t *testing.T) {
geth := runGeth(t, "account", "new", "--lightkdf") tomo := runTomo(t, "account", "new", "--lightkdf")
defer geth.ExpectExit() defer tomo.ExpectExit()
geth.Expect(` tomo.Expect(`
Your new account is locked with a password. Please give a password. Do not forget this password. Your new account is locked with a password. Please give a password. Do not forget this password.
!! Unsupported terminal, password will be echoed. !! Unsupported terminal, password will be echoed.
Passphrase: {{.InputLine "foobar"}} Passphrase: {{.InputLine "foobar"}}
Repeat passphrase: {{.InputLine "foobar"}} Repeat passphrase: {{.InputLine "foobar"}}
`) `)
geth.ExpectRegexp(`Address: \{[0-9a-f]{40}\}\n`) tomo.ExpectRegexp(`Address: \{[0-9a-f]{40}\}\n`)
} }
func TestAccountNewBadRepeat(t *testing.T) { func TestAccountNewBadRepeat(t *testing.T) {
geth := runGeth(t, "account", "new", "--lightkdf") tomo := runTomo(t, "account", "new", "--lightkdf")
defer geth.ExpectExit() defer tomo.ExpectExit()
geth.Expect(` tomo.Expect(`
Your new account is locked with a password. Please give a password. Do not forget this password. Your new account is locked with a password. Please give a password. Do not forget this password.
!! Unsupported terminal, password will be echoed. !! Unsupported terminal, password will be echoed.
Passphrase: {{.InputLine "something"}} Passphrase: {{.InputLine "something"}}
@ -92,11 +92,11 @@ Fatal: Passphrases do not match
func TestAccountUpdate(t *testing.T) { func TestAccountUpdate(t *testing.T) {
datadir := tmpDatadirWithKeystore(t) datadir := tmpDatadirWithKeystore(t)
geth := runGeth(t, "account", "update", tomo := runTomo(t, "account", "update",
"--datadir", datadir, "--lightkdf", "--datadir", datadir, "--lightkdf",
"f466859ead1932d743d622cb74fc058882e8648a") "f466859ead1932d743d622cb74fc058882e8648a")
defer geth.ExpectExit() defer tomo.ExpectExit()
geth.Expect(` tomo.Expect(`
Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3 Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3
!! Unsupported terminal, password will be echoed. !! Unsupported terminal, password will be echoed.
Passphrase: {{.InputLine "foobar"}} Passphrase: {{.InputLine "foobar"}}
@ -107,24 +107,24 @@ Repeat passphrase: {{.InputLine "foobar2"}}
} }
func TestWalletImport(t *testing.T) { func TestWalletImport(t *testing.T) {
geth := runGeth(t, "wallet", "import", "--lightkdf", "testdata/guswallet.json") tomo := runTomo(t, "wallet", "import", "--lightkdf", "testdata/guswallet.json")
defer geth.ExpectExit() defer tomo.ExpectExit()
geth.Expect(` tomo.Expect(`
!! Unsupported terminal, password will be echoed. !! Unsupported terminal, password will be echoed.
Passphrase: {{.InputLine "foo"}} Passphrase: {{.InputLine "foo"}}
Address: {d4584b5f6229b7be90727b0fc8c6b91bb427821f} Address: {d4584b5f6229b7be90727b0fc8c6b91bb427821f}
`) `)
files, err := ioutil.ReadDir(filepath.Join(geth.Datadir, "keystore")) files, err := ioutil.ReadDir(filepath.Join(tomo.Datadir, "keystore"))
if len(files) != 1 { if len(files) != 1 {
t.Errorf("expected one key file in keystore directory, found %d files (error: %v)", len(files), err) t.Errorf("expected one key file in keystore directory, found %d files (error: %v)", len(files), err)
} }
} }
func TestWalletImportBadPassword(t *testing.T) { func TestWalletImportBadPassword(t *testing.T) {
geth := runGeth(t, "wallet", "import", "--lightkdf", "testdata/guswallet.json") tomo := runTomo(t, "wallet", "import", "--lightkdf", "testdata/guswallet.json")
defer geth.ExpectExit() defer tomo.ExpectExit()
geth.Expect(` tomo.Expect(`
!! Unsupported terminal, password will be echoed. !! Unsupported terminal, password will be echoed.
Passphrase: {{.InputLine "wrong"}} Passphrase: {{.InputLine "wrong"}}
Fatal: could not decrypt key with given passphrase Fatal: could not decrypt key with given passphrase
@ -133,23 +133,23 @@ Fatal: could not decrypt key with given passphrase
func TestUnlockFlag(t *testing.T) { func TestUnlockFlag(t *testing.T) {
datadir := tmpDatadirWithKeystore(t) datadir := tmpDatadirWithKeystore(t)
geth := runGeth(t, tomo := runTomo(t,
"--datadir", datadir, "--nat", "none", "--nodiscover", "--maxpeers", "0", "--port", "0", "--datadir", datadir, "--nat", "none", "--nodiscover", "--maxpeers", "0", "--port", "0",
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "--unlock", "f466859ead1932d743d622cb74fc058882e8648a",
"js", "testdata/empty.js") "js", "testdata/empty.js")
geth.Expect(` tomo.Expect(`
Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3 Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3
!! Unsupported terminal, password will be echoed. !! Unsupported terminal, password will be echoed.
Passphrase: {{.InputLine "foobar"}} Passphrase: {{.InputLine "foobar"}}
`) `)
geth.ExpectExit() tomo.ExpectExit()
wantMessages := []string{ wantMessages := []string{
"Unlocked account", "Unlocked account",
"=0xf466859eAD1932D743d622CB74FC058882E8648A", "=0xf466859eAD1932D743d622CB74FC058882E8648A",
} }
for _, m := range wantMessages { for _, m := range wantMessages {
if !strings.Contains(geth.StderrText(), m) { if !strings.Contains(tomo.StderrText(), m) {
t.Errorf("stderr text does not contain %q", m) t.Errorf("stderr text does not contain %q", m)
} }
} }
@ -157,11 +157,11 @@ Passphrase: {{.InputLine "foobar"}}
func TestUnlockFlagWrongPassword(t *testing.T) { func TestUnlockFlagWrongPassword(t *testing.T) {
datadir := tmpDatadirWithKeystore(t) datadir := tmpDatadirWithKeystore(t)
geth := runGeth(t, tomo := runTomo(t,
"--datadir", datadir, "--nat", "none", "--nodiscover", "--maxpeers", "0", "--port", "0", "--datadir", datadir, "--nat", "none", "--nodiscover", "--maxpeers", "0", "--port", "0",
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a") "--unlock", "f466859ead1932d743d622cb74fc058882e8648a")
defer geth.ExpectExit() defer tomo.ExpectExit()
geth.Expect(` tomo.Expect(`
Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3 Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3
!! Unsupported terminal, password will be echoed. !! Unsupported terminal, password will be echoed.
Passphrase: {{.InputLine "wrong1"}} Passphrase: {{.InputLine "wrong1"}}
@ -176,18 +176,18 @@ Fatal: Failed to unlock account f466859ead1932d743d622cb74fc058882e8648a (could
// https://github.com/ethereum/go-ethereum/issues/1785 // https://github.com/ethereum/go-ethereum/issues/1785
func TestUnlockFlagMultiIndex(t *testing.T) { func TestUnlockFlagMultiIndex(t *testing.T) {
datadir := tmpDatadirWithKeystore(t) datadir := tmpDatadirWithKeystore(t)
geth := runGeth(t, tomo := runTomo(t,
"--datadir", datadir, "--nat", "none", "--nodiscover", "--maxpeers", "0", "--port", "0", "--datadir", datadir, "--nat", "none", "--nodiscover", "--maxpeers", "0", "--port", "0",
"--unlock", "0,2", "--unlock", "0,2",
"js", "testdata/empty.js") "js", "testdata/empty.js")
geth.Expect(` tomo.Expect(`
Unlocking account 0 | Attempt 1/3 Unlocking account 0 | Attempt 1/3
!! Unsupported terminal, password will be echoed. !! Unsupported terminal, password will be echoed.
Passphrase: {{.InputLine "foobar"}} Passphrase: {{.InputLine "foobar"}}
Unlocking account 2 | Attempt 1/3 Unlocking account 2 | Attempt 1/3
Passphrase: {{.InputLine "foobar"}} Passphrase: {{.InputLine "foobar"}}
`) `)
geth.ExpectExit() tomo.ExpectExit()
wantMessages := []string{ wantMessages := []string{
"Unlocked account", "Unlocked account",
@ -195,7 +195,7 @@ Passphrase: {{.InputLine "foobar"}}
"=0x289d485D9771714CCe91D3393D764E1311907ACc", "=0x289d485D9771714CCe91D3393D764E1311907ACc",
} }
for _, m := range wantMessages { for _, m := range wantMessages {
if !strings.Contains(geth.StderrText(), m) { if !strings.Contains(tomo.StderrText(), m) {
t.Errorf("stderr text does not contain %q", m) t.Errorf("stderr text does not contain %q", m)
} }
} }
@ -203,11 +203,11 @@ Passphrase: {{.InputLine "foobar"}}
func TestUnlockFlagPasswordFile(t *testing.T) { func TestUnlockFlagPasswordFile(t *testing.T) {
datadir := tmpDatadirWithKeystore(t) datadir := tmpDatadirWithKeystore(t)
geth := runGeth(t, tomo := runTomo(t,
"--datadir", datadir, "--nat", "none", "--nodiscover", "--maxpeers", "0", "--port", "0", "--datadir", datadir, "--nat", "none", "--nodiscover", "--maxpeers", "0", "--port", "0",
"--password", "testdata/passwords.txt", "--unlock", "0,2", "--password", "testdata/passwords.txt", "--unlock", "0,2",
"js", "testdata/empty.js") "js", "testdata/empty.js")
geth.ExpectExit() tomo.ExpectExit()
wantMessages := []string{ wantMessages := []string{
"Unlocked account", "Unlocked account",
@ -215,7 +215,7 @@ func TestUnlockFlagPasswordFile(t *testing.T) {
"=0x289d485D9771714CCe91D3393D764E1311907ACc", "=0x289d485D9771714CCe91D3393D764E1311907ACc",
} }
for _, m := range wantMessages { for _, m := range wantMessages {
if !strings.Contains(geth.StderrText(), m) { if !strings.Contains(tomo.StderrText(), m) {
t.Errorf("stderr text does not contain %q", m) t.Errorf("stderr text does not contain %q", m)
} }
} }
@ -223,29 +223,29 @@ func TestUnlockFlagPasswordFile(t *testing.T) {
func TestUnlockFlagPasswordFileWrongPassword(t *testing.T) { func TestUnlockFlagPasswordFileWrongPassword(t *testing.T) {
datadir := tmpDatadirWithKeystore(t) datadir := tmpDatadirWithKeystore(t)
geth := runGeth(t, tomo := runTomo(t,
"--datadir", datadir, "--nat", "none", "--nodiscover", "--maxpeers", "0", "--port", "0", "--datadir", datadir, "--nat", "none", "--nodiscover", "--maxpeers", "0", "--port", "0",
"--password", "testdata/wrong-passwords.txt", "--unlock", "0,2") "--password", "testdata/wrong-passwords.txt", "--unlock", "0,2")
defer geth.ExpectExit() defer tomo.ExpectExit()
geth.Expect(` tomo.Expect(`
Fatal: Failed to unlock account 0 (could not decrypt key with given passphrase) Fatal: Failed to unlock account 0 (could not decrypt key with given passphrase)
`) `)
} }
func TestUnlockFlagAmbiguous(t *testing.T) { func TestUnlockFlagAmbiguous(t *testing.T) {
store := filepath.Join("..", "..", "accounts", "keystore", "testdata", "dupes") store := filepath.Join("..", "..", "accounts", "keystore", "testdata", "dupes")
geth := runGeth(t, tomo := runTomo(t,
"--keystore", store, "--nat", "none", "--nodiscover", "--maxpeers", "0", "--port", "0", "--keystore", store, "--nat", "none", "--nodiscover", "--maxpeers", "0", "--port", "0",
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "--unlock", "f466859ead1932d743d622cb74fc058882e8648a",
"js", "testdata/empty.js") "js", "testdata/empty.js")
defer geth.ExpectExit() defer tomo.ExpectExit()
// Helper for the expect template, returns absolute keystore path. // Helper for the expect template, returns absolute keystore path.
geth.SetTemplateFunc("keypath", func(file string) string { tomo.SetTemplateFunc("keypath", func(file string) string {
abs, _ := filepath.Abs(filepath.Join(store, file)) abs, _ := filepath.Abs(filepath.Join(store, file))
return abs return abs
}) })
geth.Expect(` tomo.Expect(`
Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3 Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3
!! Unsupported terminal, password will be echoed. !! Unsupported terminal, password will be echoed.
Passphrase: {{.InputLine "foobar"}} Passphrase: {{.InputLine "foobar"}}
@ -257,14 +257,14 @@ Your passphrase unlocked keystore://{{keypath "1"}}
In order to avoid this warning, you need to remove the following duplicate key files: In order to avoid this warning, you need to remove the following duplicate key files:
keystore://{{keypath "2"}} keystore://{{keypath "2"}}
`) `)
geth.ExpectExit() tomo.ExpectExit()
wantMessages := []string{ wantMessages := []string{
"Unlocked account", "Unlocked account",
"=0xf466859eAD1932D743d622CB74FC058882E8648A", "=0xf466859eAD1932D743d622CB74FC058882E8648A",
} }
for _, m := range wantMessages { for _, m := range wantMessages {
if !strings.Contains(geth.StderrText(), m) { if !strings.Contains(tomo.StderrText(), m) {
t.Errorf("stderr text does not contain %q", m) t.Errorf("stderr text does not contain %q", m)
} }
} }
@ -272,17 +272,17 @@ In order to avoid this warning, you need to remove the following duplicate key f
func TestUnlockFlagAmbiguousWrongPassword(t *testing.T) { func TestUnlockFlagAmbiguousWrongPassword(t *testing.T) {
store := filepath.Join("..", "..", "accounts", "keystore", "testdata", "dupes") store := filepath.Join("..", "..", "accounts", "keystore", "testdata", "dupes")
geth := runGeth(t, tomo := runTomo(t,
"--keystore", store, "--nat", "none", "--nodiscover", "--maxpeers", "0", "--port", "0", "--keystore", store, "--nat", "none", "--nodiscover", "--maxpeers", "0", "--port", "0",
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a") "--unlock", "f466859ead1932d743d622cb74fc058882e8648a")
defer geth.ExpectExit() defer tomo.ExpectExit()
// Helper for the expect template, returns absolute keystore path. // Helper for the expect template, returns absolute keystore path.
geth.SetTemplateFunc("keypath", func(file string) string { tomo.SetTemplateFunc("keypath", func(file string) string {
abs, _ := filepath.Abs(filepath.Join(store, file)) abs, _ := filepath.Abs(filepath.Join(store, file))
return abs return abs
}) })
geth.Expect(` tomo.Expect(`
Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3 Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3
!! Unsupported terminal, password will be echoed. !! Unsupported terminal, password will be echoed.
Passphrase: {{.InputLine "wrong"}} Passphrase: {{.InputLine "wrong"}}
@ -292,5 +292,5 @@ Multiple key files exist for address f466859ead1932d743d622cb74fc058882e8648a:
Testing your passphrase against all of them... Testing your passphrase against all of them...
Fatal: None of the listed files could be unlocked. Fatal: None of the listed files could be unlocked.
`) `)
geth.ExpectExit() tomo.ExpectExit()
} }

View file

@ -36,7 +36,7 @@ import (
var bugCommand = cli.Command{ var bugCommand = cli.Command{
Action: utils.MigrateFlags(reportBug), Action: utils.MigrateFlags(reportBug),
Name: "bug", Name: "bug",
Usage: "opens a window to report a bug on the geth repo", Usage: "opens a window to report a bug on the tomo repo",
ArgsUsage: " ", ArgsUsage: " ",
Category: "MISCELLANEOUS COMMANDS", Category: "MISCELLANEOUS COMMANDS",
} }

View file

@ -74,7 +74,7 @@ type ethstatsConfig struct {
URL string `toml:",omitempty"` URL string `toml:",omitempty"`
} }
type gethConfig struct { type tomoConfig struct {
Eth eth.Config Eth eth.Config
Shh whisper.Config Shh whisper.Config
Node node.Config Node node.Config
@ -82,7 +82,7 @@ type gethConfig struct {
Dashboard dashboard.Config Dashboard dashboard.Config
} }
func loadConfig(file string, cfg *gethConfig) error { func loadConfig(file string, cfg *tomoConfig) error {
f, err := os.Open(file) f, err := os.Open(file)
if err != nil { if err != nil {
return err return err
@ -103,13 +103,13 @@ func defaultNodeConfig() node.Config {
cfg.Version = params.VersionWithCommit(gitCommit) cfg.Version = params.VersionWithCommit(gitCommit)
cfg.HTTPModules = append(cfg.HTTPModules, "eth", "shh") cfg.HTTPModules = append(cfg.HTTPModules, "eth", "shh")
cfg.WSModules = append(cfg.WSModules, "eth", "shh") cfg.WSModules = append(cfg.WSModules, "eth", "shh")
cfg.IPCPath = "geth.ipc" cfg.IPCPath = "tomo.ipc"
return cfg return cfg
} }
func makeConfigNode(ctx *cli.Context) (*node.Node, gethConfig) { func makeConfigNode(ctx *cli.Context) (*node.Node, tomoConfig) {
// Load defaults. // Load defaults.
cfg := gethConfig{ cfg := tomoConfig{
Eth: eth.DefaultConfig, Eth: eth.DefaultConfig,
Shh: whisper.DefaultConfig, Shh: whisper.DefaultConfig,
Node: defaultNodeConfig(), Node: defaultNodeConfig(),

View file

@ -41,7 +41,7 @@ var (
Flags: append(append(append(nodeFlags, rpcFlags...), consoleFlags...), whisperFlags...), Flags: append(append(append(nodeFlags, rpcFlags...), consoleFlags...), whisperFlags...),
Category: "CONSOLE COMMANDS", Category: "CONSOLE COMMANDS",
Description: ` Description: `
The Geth console is an interactive shell for the JavaScript runtime environment The Tomo console is an interactive shell for the JavaScript runtime environment
which exposes a node admin interface as well as the Ðapp JavaScript API. which exposes a node admin interface as well as the Ðapp JavaScript API.
See https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console.`, See https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console.`,
} }
@ -54,10 +54,10 @@ See https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console.`,
Flags: append(consoleFlags, utils.DataDirFlag), Flags: append(consoleFlags, utils.DataDirFlag),
Category: "CONSOLE COMMANDS", Category: "CONSOLE COMMANDS",
Description: ` Description: `
The Geth console is an interactive shell for the JavaScript runtime environment The Tomo console is an interactive shell for the JavaScript runtime environment
which exposes a node admin interface as well as the Ðapp JavaScript API. which exposes a node admin interface as well as the Ðapp JavaScript API.
See https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console. See https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console.
This command allows to open a console on a running geth node.`, This command allows to open a console on a running tomo node.`,
} }
javascriptCommand = cli.Command{ javascriptCommand = cli.Command{
@ -73,7 +73,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/JavaScript-Cons
} }
) )
// localConsole starts a new geth node, attaching a JavaScript console to it at the // localConsole starts a new tomo node, attaching a JavaScript console to it at the
// same time. // same time.
func localConsole(ctx *cli.Context) error { func localConsole(ctx *cli.Context) error {
// Create and start the node based on the CLI flags // Create and start the node based on the CLI flags
@ -84,7 +84,7 @@ func localConsole(ctx *cli.Context) error {
// Attach to the newly started node and start the JavaScript console // Attach to the newly started node and start the JavaScript console
client, err := node.Attach() client, err := node.Attach()
if err != nil { if err != nil {
utils.Fatalf("Failed to attach to the inproc geth: %v", err) utils.Fatalf("Failed to attach to the inproc tomo: %v", err)
} }
config := console.Config{ config := console.Config{
DataDir: utils.MakeDataDir(ctx), DataDir: utils.MakeDataDir(ctx),
@ -111,10 +111,10 @@ func localConsole(ctx *cli.Context) error {
return nil return nil
} }
// remoteConsole will connect to a remote geth instance, attaching a JavaScript // remoteConsole will connect to a remote tomo instance, attaching a JavaScript
// console to it. // console to it.
func remoteConsole(ctx *cli.Context) error { func remoteConsole(ctx *cli.Context) error {
// Attach to a remotely running geth instance and start the JavaScript console // Attach to a remotely running tomo instance and start the JavaScript console
endpoint := ctx.Args().First() endpoint := ctx.Args().First()
if endpoint == "" { if endpoint == "" {
path := node.DefaultDataDir() path := node.DefaultDataDir()
@ -128,11 +128,11 @@ func remoteConsole(ctx *cli.Context) error {
path = filepath.Join(path, "rinkeby") path = filepath.Join(path, "rinkeby")
} }
} }
endpoint = fmt.Sprintf("%s/geth.ipc", path) endpoint = fmt.Sprintf("%s/tomo.ipc", path)
} }
client, err := dialRPC(endpoint) client, err := dialRPC(endpoint)
if err != nil { if err != nil {
utils.Fatalf("Unable to attach to remote geth: %v", err) utils.Fatalf("Unable to attach to remote tomo: %v", err)
} }
config := console.Config{ config := console.Config{
DataDir: utils.MakeDataDir(ctx), DataDir: utils.MakeDataDir(ctx),
@ -161,7 +161,7 @@ func remoteConsole(ctx *cli.Context) error {
// dialRPC returns a RPC client which connects to the given endpoint. // dialRPC returns a RPC client which connects to the given endpoint.
// The check for empty endpoint implements the defaulting logic // The check for empty endpoint implements the defaulting logic
// for "geth attach" and "geth monitor" with no argument. // for "tomo attach" and "tomo monitor" with no argument.
func dialRPC(endpoint string) (*rpc.Client, error) { func dialRPC(endpoint string) (*rpc.Client, error) {
if endpoint == "" { if endpoint == "" {
endpoint = node.DefaultIPCEndpoint(clientIdentifier) endpoint = node.DefaultIPCEndpoint(clientIdentifier)
@ -173,7 +173,7 @@ func dialRPC(endpoint string) (*rpc.Client, error) {
return rpc.Dial(endpoint) return rpc.Dial(endpoint)
} }
// ephemeralConsole starts a new geth node, attaches an ephemeral JavaScript // ephemeralConsole starts a new tomo node, attaches an ephemeral JavaScript
// console to it, executes each of the files specified as arguments and tears // console to it, executes each of the files specified as arguments and tears
// everything down. // everything down.
func ephemeralConsole(ctx *cli.Context) error { func ephemeralConsole(ctx *cli.Context) error {
@ -185,7 +185,7 @@ func ephemeralConsole(ctx *cli.Context) error {
// Attach to the newly started node and start the JavaScript console // Attach to the newly started node and start the JavaScript console
client, err := node.Attach() client, err := node.Attach()
if err != nil { if err != nil {
utils.Fatalf("Failed to attach to the inproc geth: %v", err) utils.Fatalf("Failed to attach to the inproc tomo: %v", err)
} }
config := console.Config{ config := console.Config{
DataDir: utils.MakeDataDir(ctx), DataDir: utils.MakeDataDir(ctx),

View file

@ -40,25 +40,25 @@ const (
func TestConsoleWelcome(t *testing.T) { func TestConsoleWelcome(t *testing.T) {
coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182" coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182"
// Start a geth console, make sure it's cleaned up and terminate the console // Start a tomo console, make sure it's cleaned up and terminate the console
geth := runGeth(t, tomo := runTomo(t,
"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none", "--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none",
"--etherbase", coinbase, "--shh", "--etherbase", coinbase, "--shh",
"console") "console")
// Gather all the infos the welcome message needs to contain // Gather all the infos the welcome message needs to contain
geth.SetTemplateFunc("goos", func() string { return runtime.GOOS }) tomo.SetTemplateFunc("goos", func() string { return runtime.GOOS })
geth.SetTemplateFunc("goarch", func() string { return runtime.GOARCH }) tomo.SetTemplateFunc("goarch", func() string { return runtime.GOARCH })
geth.SetTemplateFunc("gover", runtime.Version) tomo.SetTemplateFunc("gover", runtime.Version)
geth.SetTemplateFunc("gethver", func() string { return params.Version }) tomo.SetTemplateFunc("tomover", func() string { return params.Version })
geth.SetTemplateFunc("niltime", func() string { return time.Unix(0, 0).Format(time.RFC1123) }) tomo.SetTemplateFunc("niltime", func() string { return time.Unix(0, 0).Format(time.RFC1123) })
geth.SetTemplateFunc("apis", func() string { return ipcAPIs }) tomo.SetTemplateFunc("apis", func() string { return ipcAPIs })
// Verify the actual welcome message to the required template // Verify the actual welcome message to the required template
geth.Expect(` tomo.Expect(`
Welcome to the Geth JavaScript console! Welcome to the Tomo JavaScript console!
instance: Geth/v{{gethver}}/{{goos}}-{{goarch}}/{{gover}} instance: tomo/v{{tomover}}/{{goos}}-{{goarch}}/{{gover}}
coinbase: {{.Etherbase}} coinbase: {{.Etherbase}}
at block: 0 ({{niltime}}) at block: 0 ({{niltime}})
datadir: {{.Datadir}} datadir: {{.Datadir}}
@ -66,7 +66,7 @@ at block: 0 ({{niltime}})
> {{.InputLine "exit"}} > {{.InputLine "exit"}}
`) `)
geth.ExpectExit() tomo.ExpectExit()
} }
// Tests that a console can be attached to a running node via various means. // Tests that a console can be attached to a running node via various means.
@ -75,57 +75,57 @@ func TestIPCAttachWelcome(t *testing.T) {
coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182" coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182"
var ipc string var ipc string
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
ipc = `\\.\pipe\geth` + strconv.Itoa(trulyRandInt(100000, 999999)) ipc = `\\.\pipe\tomo` + strconv.Itoa(trulyRandInt(100000, 999999))
} else { } else {
ws := tmpdir(t) ws := tmpdir(t)
defer os.RemoveAll(ws) defer os.RemoveAll(ws)
ipc = filepath.Join(ws, "geth.ipc") ipc = filepath.Join(ws, "tomo.ipc")
} }
// Note: we need --shh because testAttachWelcome checks for default // Note: we need --shh because testAttachWelcome checks for default
// list of ipc modules and shh is included there. // list of ipc modules and shh is included there.
geth := runGeth(t, tomo := runTomo(t,
"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none", "--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none",
"--etherbase", coinbase, "--shh", "--ipcpath", ipc) "--etherbase", coinbase, "--shh", "--ipcpath", ipc)
time.Sleep(2 * time.Second) // Simple way to wait for the RPC endpoint to open time.Sleep(2 * time.Second) // Simple way to wait for the RPC endpoint to open
testAttachWelcome(t, geth, "ipc:"+ipc, ipcAPIs) testAttachWelcome(t, tomo, "ipc:"+ipc, ipcAPIs)
geth.Interrupt() tomo.Interrupt()
geth.ExpectExit() tomo.ExpectExit()
} }
func TestHTTPAttachWelcome(t *testing.T) { func TestHTTPAttachWelcome(t *testing.T) {
coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182" coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182"
port := strconv.Itoa(trulyRandInt(1024, 65536)) // Yeah, sometimes this will fail, sorry :P port := strconv.Itoa(trulyRandInt(1024, 65536)) // Yeah, sometimes this will fail, sorry :P
geth := runGeth(t, tomo := runTomo(t,
"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none", "--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none",
"--etherbase", coinbase, "--rpc", "--rpcport", port) "--etherbase", coinbase, "--rpc", "--rpcport", port)
time.Sleep(2 * time.Second) // Simple way to wait for the RPC endpoint to open time.Sleep(2 * time.Second) // Simple way to wait for the RPC endpoint to open
testAttachWelcome(t, geth, "http://localhost:"+port, httpAPIs) testAttachWelcome(t, tomo, "http://localhost:"+port, httpAPIs)
geth.Interrupt() tomo.Interrupt()
geth.ExpectExit() tomo.ExpectExit()
} }
func TestWSAttachWelcome(t *testing.T) { func TestWSAttachWelcome(t *testing.T) {
coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182" coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182"
port := strconv.Itoa(trulyRandInt(1024, 65536)) // Yeah, sometimes this will fail, sorry :P port := strconv.Itoa(trulyRandInt(1024, 65536)) // Yeah, sometimes this will fail, sorry :P
geth := runGeth(t, tomo := runTomo(t,
"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none", "--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none",
"--etherbase", coinbase, "--ws", "--wsport", port) "--etherbase", coinbase, "--ws", "--wsport", port)
time.Sleep(2 * time.Second) // Simple way to wait for the RPC endpoint to open time.Sleep(2 * time.Second) // Simple way to wait for the RPC endpoint to open
testAttachWelcome(t, geth, "ws://localhost:"+port, httpAPIs) testAttachWelcome(t, tomo, "ws://localhost:"+port, httpAPIs)
geth.Interrupt() tomo.Interrupt()
geth.ExpectExit() tomo.ExpectExit()
} }
func testAttachWelcome(t *testing.T, geth *testgeth, endpoint, apis string) { func testAttachWelcome(t *testing.T, tomo *testtomo, endpoint, apis string) {
// Attach to a running geth note and terminate immediately // Attach to a running tomo note and terminate immediately
attach := runGeth(t, "attach", endpoint) attach := runTomo(t, "attach", endpoint)
defer attach.ExpectExit() defer attach.ExpectExit()
attach.CloseStdin() attach.CloseStdin()
@ -133,18 +133,18 @@ func testAttachWelcome(t *testing.T, geth *testgeth, endpoint, apis string) {
attach.SetTemplateFunc("goos", func() string { return runtime.GOOS }) attach.SetTemplateFunc("goos", func() string { return runtime.GOOS })
attach.SetTemplateFunc("goarch", func() string { return runtime.GOARCH }) attach.SetTemplateFunc("goarch", func() string { return runtime.GOARCH })
attach.SetTemplateFunc("gover", runtime.Version) attach.SetTemplateFunc("gover", runtime.Version)
attach.SetTemplateFunc("gethver", func() string { return params.Version }) attach.SetTemplateFunc("tomover", func() string { return params.Version })
attach.SetTemplateFunc("etherbase", func() string { return geth.Etherbase }) attach.SetTemplateFunc("etherbase", func() string { return tomo.Etherbase })
attach.SetTemplateFunc("niltime", func() string { return time.Unix(0, 0).Format(time.RFC1123) }) attach.SetTemplateFunc("niltime", func() string { return time.Unix(0, 0).Format(time.RFC1123) })
attach.SetTemplateFunc("ipc", func() bool { return strings.HasPrefix(endpoint, "ipc") }) attach.SetTemplateFunc("ipc", func() bool { return strings.HasPrefix(endpoint, "ipc") })
attach.SetTemplateFunc("datadir", func() string { return geth.Datadir }) attach.SetTemplateFunc("datadir", func() string { return tomo.Datadir })
attach.SetTemplateFunc("apis", func() string { return apis }) attach.SetTemplateFunc("apis", func() string { return apis })
// Verify the actual welcome message to the required template // Verify the actual welcome message to the required template
attach.Expect(` attach.Expect(`
Welcome to the Geth JavaScript console! Welcome to the Tomo JavaScript console!
instance: Geth/v{{gethver}}/{{goos}}-{{goarch}}/{{gover}} instance: tomo/v{{tomover}}/{{goos}}-{{goarch}}/{{gover}}
coinbase: {{etherbase}} coinbase: {{etherbase}}
at block: 0 ({{niltime}}){{if ipc}} at block: 0 ({{niltime}}){{if ipc}}
datadir: {{datadir}}{{end}} datadir: {{datadir}}{{end}}

View file

@ -106,21 +106,21 @@ func testDAOForkBlockNewChain(t *testing.T, test int, genesis string, expectBloc
datadir := tmpdir(t) datadir := tmpdir(t)
defer os.RemoveAll(datadir) defer os.RemoveAll(datadir)
// Start a Geth instance with the requested flags set and immediately terminate // Start a tomo instance with the requested flags set and immediately terminate
if genesis != "" { if genesis != "" {
json := filepath.Join(datadir, "genesis.json") json := filepath.Join(datadir, "genesis.json")
if err := ioutil.WriteFile(json, []byte(genesis), 0600); err != nil { if err := ioutil.WriteFile(json, []byte(genesis), 0600); err != nil {
t.Fatalf("test %d: failed to write genesis file: %v", test, err) t.Fatalf("test %d: failed to write genesis file: %v", test, err)
} }
runGeth(t, "--datadir", datadir, "init", json).WaitExit() runTomo(t, "--datadir", datadir, "init", json).WaitExit()
} else { } else {
// Force chain initialization // Force chain initialization
args := []string{"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none", "--ipcdisable", "--datadir", datadir} args := []string{"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none", "--ipcdisable", "--datadir", datadir}
geth := runGeth(t, append(args, []string{"--exec", "2+2", "console"}...)...) tomo := runTomo(t, append(args, []string{"--exec", "2+2", "console"}...)...)
geth.WaitExit() tomo.WaitExit()
} }
// Retrieve the DAO config flag from the database // Retrieve the DAO config flag from the database
path := filepath.Join(datadir, "geth", "chaindata") path := filepath.Join(datadir, "tomo", "chaindata")
db, err := ethdb.NewLDBDatabase(path, 0, 0) db, err := ethdb.NewLDBDatabase(path, 0, 0)
if err != nil { if err != nil {
t.Fatalf("test %d: failed to open test database: %v", test, err) t.Fatalf("test %d: failed to open test database: %v", test, err)

View file

@ -84,7 +84,7 @@ var customGenesisTests = []struct {
}, },
} }
// Tests that initializing Geth with a custom genesis block and chain definitions // Tests that initializing tomo with a custom genesis block and chain definitions
// work properly. // work properly.
func TestCustomGenesis(t *testing.T) { func TestCustomGenesis(t *testing.T) {
for i, tt := range customGenesisTests { for i, tt := range customGenesisTests {
@ -97,14 +97,14 @@ func TestCustomGenesis(t *testing.T) {
if err := ioutil.WriteFile(json, []byte(tt.genesis), 0600); err != nil { if err := ioutil.WriteFile(json, []byte(tt.genesis), 0600); err != nil {
t.Fatalf("test %d: failed to write genesis file: %v", i, err) t.Fatalf("test %d: failed to write genesis file: %v", i, err)
} }
runGeth(t, "--datadir", datadir, "init", json).WaitExit() runTomo(t, "--datadir", datadir, "init", json).WaitExit()
// Query the custom genesis block // Query the custom genesis block
geth := runGeth(t, tomo := runTomo(t,
"--datadir", datadir, "--maxpeers", "0", "--port", "0", "--datadir", datadir, "--maxpeers", "0", "--port", "0",
"--nodiscover", "--nat", "none", "--ipcdisable", "--nodiscover", "--nat", "none", "--ipcdisable",
"--exec", tt.query, "console") "--exec", tt.query, "console")
geth.ExpectRegexp(tt.result) tomo.ExpectRegexp(tt.result)
geth.ExpectExit() tomo.ExpectExit()
} }
} }

View file

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>. // along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
// geth is the official command-line client for Ethereum. // tomo is the official command-line client for Ethereum.
package main package main
import ( import (
@ -39,7 +39,7 @@ import (
) )
const ( const (
clientIdentifier = "geth" // Client identifier to advertise over the network clientIdentifier = "tomo" // Client identifier to advertise over the network
) )
var ( var (
@ -143,8 +143,8 @@ var (
) )
func init() { func init() {
// Initialize the CLI app and start Geth // Initialize the CLI app and start tomo
app.Action = geth app.Action = tomo
app.HideVersion = true // we have a command to print the version app.HideVersion = true // we have a command to print the version
app.Copyright = "Copyright 2013-2017 The go-ethereum Authors" app.Copyright = "Copyright 2013-2017 The go-ethereum Authors"
app.Commands = []cli.Command{ app.Commands = []cli.Command{
@ -209,10 +209,10 @@ func main() {
} }
} }
// geth is the main entry point into the system if no special subcommand is ran. // tomo is the main entry point into the system if no special subcommand is ran.
// It creates a default node based on the command line arguments and runs it in // It creates a default node based on the command line arguments and runs it in
// blocking mode, waiting for it to be shut down. // blocking mode, waiting for it to be shut down.
func geth(ctx *cli.Context) error { func tomo(ctx *cli.Context) error {
node := makeFullNode(ctx) node := makeFullNode(ctx)
startNode(ctx, node) startNode(ctx, node)
node.Wait() node.Wait()

View file

@ -80,7 +80,7 @@ The output of this command is supposed to be machine-readable.
func makecache(ctx *cli.Context) error { func makecache(ctx *cli.Context) error {
args := ctx.Args() args := ctx.Args()
if len(args) != 2 { if len(args) != 2 {
utils.Fatalf(`Usage: geth makecache <block number> <outputdir>`) utils.Fatalf(`Usage: tomo makecache <block number> <outputdir>`)
} }
block, err := strconv.ParseUint(args[0], 0, 64) block, err := strconv.ParseUint(args[0], 0, 64)
if err != nil { if err != nil {
@ -95,7 +95,7 @@ func makecache(ctx *cli.Context) error {
func makedag(ctx *cli.Context) error { func makedag(ctx *cli.Context) error {
args := ctx.Args() args := ctx.Args()
if len(args) != 2 { if len(args) != 2 {
utils.Fatalf(`Usage: geth makedag <block number> <outputdir>`) utils.Fatalf(`Usage: tomo makedag <block number> <outputdir>`)
} }
block, err := strconv.ParseUint(args[0], 0, 64) block, err := strconv.ParseUint(args[0], 0, 64)
if err != nil { if err != nil {
@ -123,17 +123,17 @@ func version(ctx *cli.Context) error {
} }
func license(_ *cli.Context) error { func license(_ *cli.Context) error {
fmt.Println(`Geth is free software: you can redistribute it and/or modify fmt.Println(`Tomo is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Geth is distributed in the hope that it will be useful, Tomo is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with geth. If not, see <http://www.gnu.org/licenses/>.`) along with tomo. If not, see <http://www.gnu.org/licenses/>.`)
return nil return nil
} }

View file

@ -55,7 +55,7 @@ var (
ArgsUsage: " ", ArgsUsage: " ",
Category: "MONITOR COMMANDS", Category: "MONITOR COMMANDS",
Description: ` Description: `
The Geth monitor is a tool to collect and visualize various internal metrics The tomo monitor is a tool to collect and visualize various internal metrics
gathered by the node, supporting different chart types as well as the capacity gathered by the node, supporting different chart types as well as the capacity
to display multiple metrics simultaneously. to display multiple metrics simultaneously.
`, `,
@ -76,7 +76,7 @@ func monitor(ctx *cli.Context) error {
// Attach to an Ethereum node over IPC or RPC // Attach to an Ethereum node over IPC or RPC
endpoint := ctx.String(monitorCommandAttachFlag.Name) endpoint := ctx.String(monitorCommandAttachFlag.Name)
if client, err = dialRPC(endpoint); err != nil { if client, err = dialRPC(endpoint); err != nil {
utils.Fatalf("Unable to attach to geth node: %v", err) utils.Fatalf("Unable to attach to tomo node: %v", err)
} }
defer client.Close() defer client.Close()
@ -93,7 +93,7 @@ func monitor(ctx *cli.Context) error {
if len(list) > 0 { if len(list) > 0 {
utils.Fatalf("No metrics specified.\n\nAvailable:\n - %s", strings.Join(list, "\n - ")) utils.Fatalf("No metrics specified.\n\nAvailable:\n - %s", strings.Join(list, "\n - "))
} else { } else {
utils.Fatalf("No metrics collected by geth (--%s).\n", utils.MetricsEnabledFlag.Name) utils.Fatalf("No metrics collected by tomo (--%s).\n", utils.MetricsEnabledFlag.Name)
} }
} }
sort.Strings(monitored) sort.Strings(monitored)
@ -158,7 +158,7 @@ func monitor(ctx *cli.Context) error {
return nil return nil
} }
// retrieveMetrics contacts the attached geth node and retrieves the entire set // retrieveMetrics contacts the attached tomo node and retrieves the entire set
// of collected system metrics. // of collected system metrics.
func retrieveMetrics(client *rpc.Client) (map[string]interface{}, error) { func retrieveMetrics(client *rpc.Client) (map[string]interface{}, error) {
var metrics map[string]interface{} var metrics map[string]interface{}

View file

@ -27,14 +27,14 @@ import (
) )
func tmpdir(t *testing.T) string { func tmpdir(t *testing.T) string {
dir, err := ioutil.TempDir("", "geth-test") dir, err := ioutil.TempDir("", "tomo-test")
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
return dir return dir
} }
type testgeth struct { type testtomo struct {
*cmdtest.TestCmd *cmdtest.TestCmd
// template variables for expect // template variables for expect
@ -43,8 +43,8 @@ type testgeth struct {
} }
func init() { func init() {
// Run the app if we've been exec'd as "geth-test" in runGeth. // Run the app if we've been exec'd as "tomo-test" in runGeth.
reexec.Register("geth-test", func() { reexec.Register("tomo-test", func() {
if err := app.Run(os.Args); err != nil { if err := app.Run(os.Args); err != nil {
fmt.Fprintln(os.Stderr, err) fmt.Fprintln(os.Stderr, err)
os.Exit(1) os.Exit(1)
@ -61,10 +61,10 @@ func TestMain(m *testing.M) {
os.Exit(m.Run()) os.Exit(m.Run())
} }
// spawns geth with the given command line args. If the args don't set --datadir, the // spawns tomo with the given command line args. If the args don't set --datadir, the
// child g gets a temporary data directory. // child g gets a temporary data directory.
func runGeth(t *testing.T, args ...string) *testgeth { func runTomo(t *testing.T, args ...string) *testtomo {
tt := &testgeth{} tt := &testtomo{}
tt.TestCmd = cmdtest.NewTestCmd(t, tt) tt.TestCmd = cmdtest.NewTestCmd(t, tt)
for i, arg := range args { for i, arg := range args {
switch { switch {
@ -90,9 +90,9 @@ func runGeth(t *testing.T, args ...string) *testgeth {
}() }()
} }
// Boot "geth". This actually runs the test binary but the TestMain // Boot "tomo". This actually runs the test binary but the TestMain
// function will prevent any tests from running. // function will prevent any tests from running.
tt.Run("geth-test", args...) tt.Run("tomo-test", args...)
return tt return tt
} }

View file

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>. // along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
// Contains the geth command usage template and generator. // Contains the tomo command usage template and generator.
package main package main

View file

@ -729,7 +729,7 @@ func setIPC(ctx *cli.Context, cfg *node.Config) {
} }
// makeDatabaseHandles raises out the number of allowed file handles per process // makeDatabaseHandles raises out the number of allowed file handles per process
// for Geth and returns half of the allowance to assign to the database. // for tomo and returns half of the allowance to assign to the database.
func makeDatabaseHandles() int { func makeDatabaseHandles() int {
limit, err := fdlimit.Current() limit, err := fdlimit.Current()
if err != nil { if err != nil {
@ -761,7 +761,7 @@ func MakeAddress(ks *keystore.KeyStore, account string) (accounts.Account, error
log.Warn("-------------------------------------------------------------------") log.Warn("-------------------------------------------------------------------")
log.Warn("Referring to accounts by order in the keystore folder is dangerous!") log.Warn("Referring to accounts by order in the keystore folder is dangerous!")
log.Warn("This functionality is deprecated and will be removed in the future!") log.Warn("This functionality is deprecated and will be removed in the future!")
log.Warn("Please use explicit addresses! (can search via `geth account list`)") log.Warn("Please use explicit addresses! (can search via `tomo account list`)")
log.Warn("-------------------------------------------------------------------") log.Warn("-------------------------------------------------------------------")
accs := ks.Accounts() accs := ks.Accounts()
@ -1276,11 +1276,11 @@ func MakeConsolePreloads(ctx *cli.Context) []string {
// This is a temporary function used for migrating old command/flags to the // This is a temporary function used for migrating old command/flags to the
// new format. // new format.
// //
// e.g. geth account new --keystore /tmp/mykeystore --lightkdf // e.g. tomo account new --keystore /tmp/mykeystore --lightkdf
// //
// is equivalent after calling this method with: // is equivalent after calling this method with:
// //
// geth --keystore /tmp/mykeystore --lightkdf account new // tomo --keystore /tmp/mykeystore --lightkdf account new
// //
// This allows the use of the existing configuration functionality. // This allows the use of the existing configuration functionality.
// When all flags are migrated this function can be removed and the existing // When all flags are migrated this function can be removed and the existing

View file

@ -570,6 +570,13 @@ func (c *Clique) Prepare(chain consensus.ChainReader, header *types.Header) erro
// Finalize implements consensus.Engine, ensuring no uncles are set, nor block // Finalize implements consensus.Engine, ensuring no uncles are set, nor block
// rewards given, and returns the final block. // rewards given, and returns the final block.
func (c *Clique) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error) { func (c *Clique) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error) {
// set block reward
// FIXME: unit Ether could be too plump
chainReward := new(big.Int).SetUint64(chain.Config().Clique.Reward * params.Ether)
reward := new(big.Int).Set(chainReward)
state.AddBalance(header.Coinbase, reward)
// No block rewards in PoA, so the state remains as is and uncles are dropped // No block rewards in PoA, so the state remains as is and uncles are dropped
header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number)) header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number))
header.UncleHash = types.CalcUncleHash(nil) header.UncleHash = types.CalcUncleHash(nil)

View file

@ -272,8 +272,8 @@ func (c *Console) AutoCompleteInput(line string, pos int) (string, []string, str
// Welcome show summary of current Geth instance and some metadata about the // Welcome show summary of current Geth instance and some metadata about the
// console's available modules. // console's available modules.
func (c *Console) Welcome() { func (c *Console) Welcome() {
// Print some generic Geth metadata // Print some generic Tomo metadata
fmt.Fprintf(c.printer, "Welcome to the Geth JavaScript console!\n\n") fmt.Fprintf(c.printer, "Welcome to the Tomo JavaScript console!\n\n")
c.jsre.Run(` c.jsre.Run(`
console.log("instance: " + web3.version.node); console.log("instance: " + web3.version.node);
console.log("coinbase: " + eth.coinbase); console.log("coinbase: " + eth.coinbase);

View file

@ -124,7 +124,7 @@ func (tt *TestCmd) matchExactOutput(want []byte) error {
// Find the mismatch position. // Find the mismatch position.
for i := 0; i < n; i++ { for i := 0; i < n; i++ {
if want[i] != buf[i] { if want[i] != buf[i] {
return fmt.Errorf("Output mismatch at ◊:\n---------------- (stdout text)\n%s%s\n---------------- (expected text)\n%s", return fmt.Errorf("Output mismatch at ◊:\n---------------- (stdout text)\n%s%s\n---------------- (expected text)\n%s",
buf[:i], buf[i:n], want) buf[:i], buf[i:n], want)
} }
} }

View file

@ -135,6 +135,7 @@ func (c *EthashConfig) String() string {
type CliqueConfig struct { type CliqueConfig struct {
Period uint64 `json:"period"` // Number of seconds between blocks to enforce Period uint64 `json:"period"` // Number of seconds between blocks to enforce
Epoch uint64 `json:"epoch"` // Epoch length to reset votes and checkpoint Epoch uint64 `json:"epoch"` // Epoch length to reset votes and checkpoint
Reward uint64 `json:"reward"` // Block reward - unit Ether
} }
// String implements the stringer interface, returning the consensus engine details. // String implements the stringer interface, returning the consensus engine details.

View file

@ -4,7 +4,7 @@ default: build
build: build:
go build -o bin/swarm github.com/ethereum/go-ethereum/cmd/swarm go build -o bin/swarm github.com/ethereum/go-ethereum/cmd/swarm
go build -o bin/geth github.com/ethereum/go-ethereum/cmd/geth go build -o bin/tomo github.com/ethereum/go-ethereum/cmd/tomo
go build -o bin/bootnode github.com/ethereum/go-ethereum/cmd/bootnode go build -o bin/bootnode github.com/ethereum/go-ethereum/cmd/bootnode
cluster: build cluster: build