Merge pull request #485 from cosmos/bez/upgrade-geth-1.8.16
Upgrade geth and cleanup
This commit is contained in:
commit
b1b4d2e348
35
Gopkg.lock
generated
35
Gopkg.lock
generated
@ -57,6 +57,14 @@
|
||||
revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73"
|
||||
version = "v1.1.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:e47d51dab652d26c3fba6f8cba403f922d02757a82abdc77e90df7948daf296e"
|
||||
name = "github.com/deckarep/golang-set"
|
||||
packages = ["."]
|
||||
pruneopts = "T"
|
||||
revision = "cbaa98ba5575e67703b32b4b19f73c91f3c4159e"
|
||||
version = "v1.7.1"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:67d0b50be0549e610017cb91e0b0b745ec0cad7c613bc8e18ff2d1c1fc8825a7"
|
||||
@ -66,7 +74,7 @@
|
||||
revision = "0bce6a6887123b67a60366d2c9fe2dfb74289d2e"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:3238a0c355a81640974751f7d3bab21bf91035165f75c2c457959425c0422a4b"
|
||||
digest = "1:c24d17ef5d37ae7215811cf1cade45822faa232d6bcfbadff30bbeba52225a98"
|
||||
name = "github.com/ethereum/go-ethereum"
|
||||
packages = [
|
||||
".",
|
||||
@ -80,6 +88,7 @@
|
||||
"common/hexutil",
|
||||
"common/math",
|
||||
"common/mclock",
|
||||
"common/prque",
|
||||
"consensus",
|
||||
"consensus/ethash",
|
||||
"consensus/misc",
|
||||
@ -93,7 +102,6 @@
|
||||
"crypto/bn256/cloudflare",
|
||||
"crypto/bn256/google",
|
||||
"crypto/ecies",
|
||||
"crypto/randentropy",
|
||||
"crypto/secp256k1",
|
||||
"crypto/sha3",
|
||||
"eth/downloader",
|
||||
@ -114,8 +122,8 @@
|
||||
"trie",
|
||||
]
|
||||
pruneopts = "T"
|
||||
revision = "dea1ce052a10cd7d401a5c04f83f371a06fe293c"
|
||||
version = "v1.8.11"
|
||||
revision = "477eb0933b9529f7deeccc233cc815fe34a8ea56"
|
||||
version = "v1.8.16"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:0b9c3ad6c948d57a379da9c4e1cdd989b1c73ddc5ec8673f52a9539ce60a109b"
|
||||
@ -427,6 +435,7 @@
|
||||
digest = "1:bfa444982d49ce4ca1360599270a94de12a573ccd3bf04493c79bee09da3170b"
|
||||
name = "golang.org/x/sys"
|
||||
packages = [
|
||||
"cpu",
|
||||
"unix",
|
||||
"windows",
|
||||
]
|
||||
@ -510,22 +519,6 @@
|
||||
revision = "168a6198bcb0ef175f7dacec0b8691fc141dc9b8"
|
||||
version = "v1.13.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:3ccd10c863188cfe0d936fcfe6a055c95362e43af8e7039e33baade846928e74"
|
||||
name = "gopkg.in/fatih/set.v0"
|
||||
packages = ["."]
|
||||
pruneopts = "T"
|
||||
revision = "57907de300222151a123d29255ed17f5ed43fad3"
|
||||
version = "v0.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "v2"
|
||||
digest = "1:dae137be246befa42ce4b48c0feff2c5796b8a5027139a283f31a21173744410"
|
||||
name = "gopkg.in/karalabe/cookiejar.v2"
|
||||
packages = ["collections/prque"]
|
||||
pruneopts = "T"
|
||||
revision = "8dcd6a7f4951f6ff3ee9cbb919a06d8925822e57"
|
||||
|
||||
[[projects]]
|
||||
branch = "v2"
|
||||
digest = "1:3d3f9391ab615be8655ae0d686a1564f3fec413979bb1aaf018bac1ec1bb1cc7"
|
||||
@ -548,7 +541,6 @@
|
||||
"github.com/cosmos/cosmos-sdk/x/params",
|
||||
"github.com/cosmos/cosmos-sdk/x/slashing",
|
||||
"github.com/cosmos/cosmos-sdk/x/stake",
|
||||
"github.com/cosmos/cosmos-sdk/x/stake/types",
|
||||
"github.com/ethereum/go-ethereum/common",
|
||||
"github.com/ethereum/go-ethereum/common/hexutil",
|
||||
"github.com/ethereum/go-ethereum/common/math",
|
||||
@ -569,7 +561,6 @@
|
||||
"github.com/ethereum/go-ethereum/trie",
|
||||
"github.com/hashicorp/golang-lru",
|
||||
"github.com/pkg/errors",
|
||||
"github.com/stretchr/testify/assert",
|
||||
"github.com/stretchr/testify/require",
|
||||
"github.com/stretchr/testify/suite",
|
||||
"github.com/tendermint/tendermint/abci/types",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[[constraint]]
|
||||
name = "github.com/ethereum/go-ethereum"
|
||||
version = "=1.8.11"
|
||||
version = "=1.8.16"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/cosmos/cosmos-sdk"
|
||||
|
29
Makefile
29
Makefile
@ -16,7 +16,7 @@ PACKAGES=$(shell go list ./... | grep -v '/vendor/')
|
||||
COMMIT_HASH := $(shell git rev-parse --short HEAD)
|
||||
BUILD_FLAGS = -tags netgo -ldflags "-X github.com/cosmos/ethermint/version.GitCommit=${COMMIT_HASH}"
|
||||
DOCKER_TAG = unstable
|
||||
DOCKER_IMAGE = tendermint/ethermint
|
||||
DOCKER_IMAGE = cosmos/ethermint
|
||||
ETHERMINT_DAEMON_BINARY = emintd
|
||||
ETHERMINT_CLI_BINARY = emintcli
|
||||
|
||||
@ -43,8 +43,9 @@ clean:
|
||||
@rm -rf ./build ./vendor
|
||||
|
||||
update-tools:
|
||||
@echo "--> Updating golang dependencies"
|
||||
go get -u -v $(DEP) $(GOLINT) $(GOMETALINTER) $(UNCONVERT) $(INEFFASSIGN) $(MISSPELL) $(ERRCHECK) $(UNPARAM) $(GOCYCLO)
|
||||
@echo "--> Updating vendor dependencies"
|
||||
go get -u -v $(DEP) $(GOLINT) $(GOMETALINTER) $(UNCONVERT) $(INEFFASSIGN) $(MISSPELL) $(ERRCHECK) $(UNPARAM)
|
||||
|
||||
|
||||
############################
|
||||
### Tools / Dependencies ###
|
||||
@ -62,7 +63,6 @@ INEFFASSIGN = github.com/gordonklaus/ineffassign
|
||||
MISSPELL = github.com/client9/misspell/cmd/misspell
|
||||
ERRCHECK = github.com/kisielk/errcheck
|
||||
UNPARAM = mvdan.cc/unparam
|
||||
GOCYCLO = github.com/alecthomas/gocyclo
|
||||
|
||||
DEP_CHECK := $(shell command -v dep 2> /dev/null)
|
||||
GOLINT_CHECK := $(shell command -v golint 2> /dev/null)
|
||||
@ -72,7 +72,6 @@ INEFFASSIGN_CHECK := $(shell command -v ineffassign 2> /dev/null)
|
||||
MISSPELL_CHECK := $(shell command -v misspell 2> /dev/null)
|
||||
ERRCHECK_CHECK := $(shell command -v errcheck 2> /dev/null)
|
||||
UNPARAM_CHECK := $(shell command -v unparam 2> /dev/null)
|
||||
GOCYCLO_CHECK := $(shell command -v gocyclo 2> /dev/null)
|
||||
|
||||
tools:
|
||||
ifdef DEP_CHECK
|
||||
@ -123,12 +122,6 @@ else
|
||||
@echo "--> Installing unparam"
|
||||
go get -v $(UNPARAM)
|
||||
endif
|
||||
ifdef GOCYCLO_CHECK
|
||||
@echo "goyclo is already installed. Run 'make update-tools' to update."
|
||||
else
|
||||
@echo "--> Installing goyclo"
|
||||
go get -v $(GOCYCLO)
|
||||
endif
|
||||
|
||||
deps:
|
||||
@rm -rf vendor/
|
||||
@ -139,26 +132,20 @@ deps:
|
||||
### Testing / Misc. ###
|
||||
#######################
|
||||
|
||||
TEST_PACKAGES=$(shell go list ./... | grep -v github.com/cosmos/ethermint/cmd/test)
|
||||
|
||||
test: test-unit
|
||||
|
||||
test-unit:
|
||||
@go test -v $(TEST_PACKAGES)
|
||||
@go test -v --vet=off $(PACKAGES)
|
||||
|
||||
test-race:
|
||||
@go test -v -race $(TEST_PACKAGES)
|
||||
@go test -v --vet=off -race $(PACKAGES)
|
||||
|
||||
test-cli:
|
||||
@echo "NO CLI TESTS"
|
||||
|
||||
test-lint:
|
||||
@echo "--> Running gometalinter"
|
||||
@gometalinter.v2 --config=gometalinter.json ./...
|
||||
@!(gometalinter.v2 --disable-all --enable='errcheck' --vendor ./... | grep -v "client/")
|
||||
@find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" | xargs gofmt -d -s
|
||||
@dep status >/dev/null 2>&1
|
||||
@!(grep -n branch Gopkg.toml)
|
||||
@echo "--> Running gometalinter..."
|
||||
@gometalinter.v2 --config=gometalinter.json --exclude=vendor ./...
|
||||
|
||||
godocs:
|
||||
@echo "--> Wait a few seconds and visit http://localhost:6060/pkg/github.com/cosmos/ethermint"
|
||||
|
@ -64,8 +64,8 @@ func (cc *ChainContext) Author(_ *ethtypes.Header) (ethcmn.Address, error) {
|
||||
return cc.Coinbase, nil
|
||||
}
|
||||
|
||||
// APIs implements Ethereum's core.ChainContext interface. It currently
|
||||
// performs a no-op.
|
||||
// APIs implements Ethereum's consensus.Engine interface. It currently performs
|
||||
// a no-op.
|
||||
//
|
||||
// TODO: Do we need to support such RPC APIs? This will tie into a bigger
|
||||
// discussion on if we want to support web3.
|
||||
@ -73,13 +73,13 @@ func (cc *ChainContext) APIs(_ ethcons.ChainReader) []ethrpc.API {
|
||||
return nil
|
||||
}
|
||||
|
||||
// CalcDifficulty implements Ethereum's core.ChainContext interface. It
|
||||
// currently performs a no-op.
|
||||
// CalcDifficulty implements Ethereum's consensus.Engine interface. It currently
|
||||
// performs a no-op.
|
||||
func (cc *ChainContext) CalcDifficulty(_ ethcons.ChainReader, _ uint64, _ *ethtypes.Header) *big.Int {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Finalize implements Ethereum's core.ChainContext interface. It currently
|
||||
// Finalize implements Ethereum's consensus.Engine interface. It currently
|
||||
// performs a no-op.
|
||||
//
|
||||
// TODO: Figure out if this needs to be hooked up to any part of the ABCI?
|
||||
@ -90,7 +90,7 @@ func (cc *ChainContext) Finalize(
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// Prepare implements Ethereum's core.ChainContext interface. It currently
|
||||
// Prepare implements Ethereum's consensus.Engine interface. It currently
|
||||
// performs a no-op.
|
||||
//
|
||||
// TODO: Figure out if this needs to be hooked up to any part of the ABCI?
|
||||
@ -98,15 +98,21 @@ func (cc *ChainContext) Prepare(_ ethcons.ChainReader, _ *ethtypes.Header) error
|
||||
return nil
|
||||
}
|
||||
|
||||
// Seal implements Ethereum's core.ChainContext interface. It currently
|
||||
// Seal implements Ethereum's consensus.Engine interface. It currently
|
||||
// performs a no-op.
|
||||
//
|
||||
// TODO: Figure out if this needs to be hooked up to any part of the ABCI?
|
||||
func (cc *ChainContext) Seal(_ ethcons.ChainReader, _ *ethtypes.Block, _ <-chan struct{}) (*ethtypes.Block, error) {
|
||||
return nil, nil
|
||||
func (cc *ChainContext) Seal(_ ethcons.ChainReader, _ *ethtypes.Block, _ chan<- *ethtypes.Block, _ <-chan struct{}) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// VerifyHeader implements Ethereum's core.ChainContext interface. It currently
|
||||
// SealHash implements Ethereum's consensus.Engine interface. It returns the
|
||||
// hash of a block prior to it being sealed.
|
||||
func (cc *ChainContext) SealHash(header *ethtypes.Header) ethcmn.Hash {
|
||||
return ethcmn.Hash{}
|
||||
}
|
||||
|
||||
// VerifyHeader implements Ethereum's consensus.Engine interface. It currently
|
||||
// performs a no-op.
|
||||
//
|
||||
// TODO: Figure out if this needs to be hooked up to any part of the Cosmos SDK
|
||||
@ -115,7 +121,7 @@ func (cc *ChainContext) VerifyHeader(_ ethcons.ChainReader, _ *ethtypes.Header,
|
||||
return nil
|
||||
}
|
||||
|
||||
// VerifyHeaders implements Ethereum's core.ChainContext interface. It
|
||||
// VerifyHeaders implements Ethereum's consensus.Engine interface. It
|
||||
// currently performs a no-op.
|
||||
//
|
||||
// TODO: Figure out if this needs to be hooked up to any part of the Cosmos SDK
|
||||
@ -124,7 +130,7 @@ func (cc *ChainContext) VerifyHeaders(_ ethcons.ChainReader, _ []*ethtypes.Heade
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// VerifySeal implements Ethereum's core.ChainContext interface. It currently
|
||||
// VerifySeal implements Ethereum's consensus.Engine interface. It currently
|
||||
// performs a no-op.
|
||||
//
|
||||
// TODO: Figure out if this needs to be hooked up to any part of the Cosmos SDK
|
||||
@ -133,8 +139,15 @@ func (cc *ChainContext) VerifySeal(_ ethcons.ChainReader, _ *ethtypes.Header) er
|
||||
return nil
|
||||
}
|
||||
|
||||
// VerifyUncles implements Ethereum's core.ChainContext interface. It currently
|
||||
// VerifyUncles implements Ethereum's consensus.Engine interface. It currently
|
||||
// performs a no-op.
|
||||
func (cc *ChainContext) VerifyUncles(_ ethcons.ChainReader, _ *ethtypes.Block) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Close implements Ethereum's consensus.Engine interface. It terminates any
|
||||
// background threads maintained by the consensus engine. It currently performs
|
||||
// a no-op.
|
||||
func (cc *ChainContext) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
@ -86,9 +86,8 @@ func TestChainContextPrepare(t *testing.T) {
|
||||
func TestChainContextSeal(t *testing.T) {
|
||||
cc := NewChainContext()
|
||||
|
||||
block, err := cc.Seal(nil, nil, nil)
|
||||
err := cc.Seal(nil, nil, nil, nil)
|
||||
require.Nil(t, err)
|
||||
require.Nil(t, block)
|
||||
}
|
||||
|
||||
func TestChainContextVerifyHeader(t *testing.T) {
|
||||
|
@ -1,8 +1,15 @@
|
||||
{
|
||||
"Linters": {
|
||||
"vet": "go tool vet -composites=false :PATH:LINE:MESSAGE"
|
||||
},
|
||||
"Enable": ["golint", "vet", "ineffassign", "unparam", "unconvert", "misspell", "gocyclo"],
|
||||
},
|
||||
"Enable": [
|
||||
"golint",
|
||||
"vet",
|
||||
"ineffassign",
|
||||
"unparam",
|
||||
"unconvert",
|
||||
"misspell"
|
||||
],
|
||||
"Deadline": "500s",
|
||||
"Vendor": true,
|
||||
"Cyclo": 11
|
||||
|
@ -9,7 +9,8 @@ import (
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
)
|
||||
|
||||
// returns the master list of public APIs for use with StartHTTPEndpoint
|
||||
// GetRPCAPIs returns the master list of public APIs for use with
|
||||
// StartHTTPEndpoint.
|
||||
func GetRPCAPIs() []rpc.API {
|
||||
return []rpc.API{
|
||||
{
|
||||
|
@ -2,10 +2,13 @@ package rpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/cosmos/ethermint/version"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type apisTestSuite struct {
|
||||
@ -56,10 +59,18 @@ func startAPIServer() (context.CancelFunc, int, error) {
|
||||
RPCAddr: "127.0.0.1",
|
||||
RPCPort: randomPort(),
|
||||
}
|
||||
timeouts := rpc.HTTPTimeouts{
|
||||
ReadTimeout: 5 * time.Second,
|
||||
WriteTimeout: 5 * time.Second,
|
||||
IdleTimeout: 5 * time.Second,
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
_, err := StartHTTPEndpoint(ctx, config, GetRPCAPIs())
|
||||
|
||||
_, err := StartHTTPEndpoint(ctx, config, GetRPCAPIs(), timeouts)
|
||||
if err != nil {
|
||||
return cancel, 0, err
|
||||
}
|
||||
|
||||
return cancel, config.RPCPort, nil
|
||||
}
|
||||
|
@ -3,16 +3,19 @@ package rpc
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
)
|
||||
|
||||
// StartHTTPEndpoint starts the Tendermint Web3-compatible RPC layer. Consumes a Context for cancellation, a config
|
||||
// struct, and a list of rpc.API interfaces that will be automatically wired into a JSON-RPC webserver.
|
||||
func StartHTTPEndpoint(ctx context.Context, config *Config, apis []rpc.API) (*rpc.Server, error) {
|
||||
// StartHTTPEndpoint starts the Tendermint Web3-compatible RPC layer. Consumes
|
||||
// a Context for cancellation, a config struct, and a list of rpc.API interfaces
|
||||
// that will be automatically wired into a JSON-RPC webserver.
|
||||
func StartHTTPEndpoint(ctx context.Context, config *Config, apis []rpc.API, timeouts rpc.HTTPTimeouts) (*rpc.Server, error) {
|
||||
uniqModules := make(map[string]string)
|
||||
for _, api := range apis {
|
||||
uniqModules[api.Namespace] = api.Namespace
|
||||
}
|
||||
|
||||
modules := make([]string, len(uniqModules))
|
||||
i := 0
|
||||
for k := range uniqModules {
|
||||
@ -21,7 +24,9 @@ func StartHTTPEndpoint(ctx context.Context, config *Config, apis []rpc.API) (*rp
|
||||
}
|
||||
|
||||
endpoint := fmt.Sprintf("%s:%d", config.RPCAddr, config.RPCPort)
|
||||
_, server, err := rpc.StartHTTPEndpoint(endpoint, apis, modules, config.RPCCORSDomains, config.RPCVHosts)
|
||||
_, server, err := rpc.StartHTTPEndpoint(
|
||||
endpoint, apis, modules, config.RPCCORSDomains, config.RPCVHosts, timeouts,
|
||||
)
|
||||
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
|
@ -4,13 +4,15 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
"github.com/stretchr/testify/require"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
type TestService struct{}
|
||||
@ -24,21 +26,34 @@ func TestStartHTTPEndpointStartStop(t *testing.T) {
|
||||
RPCAddr: "127.0.0.1",
|
||||
RPCPort: randomPort(),
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
_, err := StartHTTPEndpoint(ctx, config, []rpc.API{
|
||||
{
|
||||
Namespace: "test",
|
||||
Version: "1.0",
|
||||
Service: &TestService{},
|
||||
Public: true,
|
||||
|
||||
_, err := StartHTTPEndpoint(
|
||||
ctx, config, []rpc.API{
|
||||
{
|
||||
Namespace: "test",
|
||||
Version: "1.0",
|
||||
Service: &TestService{},
|
||||
Public: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
rpc.HTTPTimeouts{
|
||||
ReadTimeout: 5 * time.Second,
|
||||
WriteTimeout: 5 * time.Second,
|
||||
IdleTimeout: 5 * time.Second,
|
||||
},
|
||||
)
|
||||
require.Nil(t, err, "unexpected error")
|
||||
|
||||
res, err := rpcCall(config.RPCPort, "test_foo", []string{"baz"})
|
||||
require.Nil(t, err, "unexpected error")
|
||||
|
||||
resStr := res.(string)
|
||||
require.Equal(t, "baz", resStr)
|
||||
|
||||
cancel()
|
||||
|
||||
_, err = rpcCall(config.RPCPort, "test_foo", []string{"baz"})
|
||||
require.NotNil(t, err)
|
||||
}
|
||||
@ -48,12 +63,17 @@ func rpcCall(port int, method string, params []string) (interface{}, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fullBody := fmt.Sprintf(`{ "id": 1, "jsonrpc": "2.0", "method": "%s", "params": %s }`,
|
||||
method, string(parsedParams))
|
||||
|
||||
fullBody := fmt.Sprintf(
|
||||
`{ "id": 1, "jsonrpc": "2.0", "method": "%s", "params": %s }`,
|
||||
method, string(parsedParams),
|
||||
)
|
||||
|
||||
res, err := http.Post(fmt.Sprintf("http://127.0.0.1:%d", port), "application/json", strings.NewReader(fullBody))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
data, err := ioutil.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -182,7 +182,7 @@ func TestTrieCommit(t *testing.T) {
|
||||
tc.trie.TryUpdate(tc.data.key, tc.data.value)
|
||||
}
|
||||
if tc.code != nil {
|
||||
tc.trie.ethTrieDB.Insert(tc.code.hash, tc.code.blob)
|
||||
tc.trie.ethTrieDB.InsertBlob(tc.code.hash, tc.code.blob)
|
||||
}
|
||||
|
||||
root, err := tc.trie.Commit(nil)
|
||||
|
Loading…
Reference in New Issue
Block a user