From 3a46922e0192754d6aa64c2ac3d248d810f25b7b Mon Sep 17 00:00:00 2001 From: SatpalSandhu61 Date: Thu, 1 Aug 2019 16:37:26 +0100 Subject: [PATCH] Added the Constantinople flag and upgraded to work with quorum v2.2.4. Also restored the homestead flag that was incorrectly removed previously when byzantium was enabled. --- client/ethclient.go | 2 +- cmd/istanbul/setup/cmd.go | 6 +++--- common/transactions.go | 2 +- common/utils.go | 6 +++--- genesis/genesis.go | 13 +++++++------ go.mod | 3 ++- go.sum | 7 +++++++ 7 files changed, 24 insertions(+), 15 deletions(-) diff --git a/client/ethclient.go b/client/ethclient.go index 93f76f1c..2bcfc461 100644 --- a/client/ethclient.go +++ b/client/ethclient.go @@ -192,7 +192,7 @@ func (c *client) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (*big.In if err != nil { return nil, err } - return gas, nil + return new(big.Int).SetUint64(gas), nil } // SendRawTransaction injects a signed transaction into the pending pool for execution. diff --git a/cmd/istanbul/setup/cmd.go b/cmd/istanbul/setup/cmd.go index 52a29196..1f011489 100644 --- a/cmd/istanbul/setup/cmd.go +++ b/cmd/istanbul/setup/cmd.go @@ -28,7 +28,7 @@ import ( "strings" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/p2p/discover" + "github.com/ethereum/go-ethereum/p2p/discv5" istcommon "github.com/jpmorganchase/istanbul-tools/common" "github.com/jpmorganchase/istanbul-tools/docker/compose" "github.com/jpmorganchase/istanbul-tools/genesis" @@ -79,8 +79,8 @@ func gen(ctx *cli.Context) error { v := &validatorInfo{ Address: addrs[i], Nodekey: nodekeys[i], - NodeInfo: discover.NewNode( - discover.PubkeyID(&keys[i].PublicKey), + NodeInfo: discv5.NewNode( + discv5.PubkeyID(&keys[i].PublicKey), net.ParseIP("0.0.0.0"), 0, uint16(30303)).String(), diff --git a/common/transactions.go b/common/transactions.go index 8f327a6d..4426ea99 100644 --- a/common/transactions.go +++ b/common/transactions.go @@ -33,7 +33,7 @@ var ( ) func SendEther(client client.Client, from *ecdsa.PrivateKey, to common.Address, amount *big.Int, nonce uint64) error { - tx := types.NewTransaction(nonce, to, amount, big.NewInt(DefaultGasLimit), big.NewInt(0).SetInt64(DefaultGasPrice), []byte{}) + tx := types.NewTransaction(nonce, to, amount, uint64(DefaultGasLimit), big.NewInt(0).SetInt64(DefaultGasPrice), []byte{}) signedTx, err := types.SignTx(tx, types.HomesteadSigner{}, from) if err != nil { log.Error("Failed to sign transaction", "tx", tx, "err", err) diff --git a/common/utils.go b/common/utils.go index 24f4e928..046d3f4e 100644 --- a/common/utils.go +++ b/common/utils.go @@ -29,7 +29,7 @@ import ( "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p/discover" + "github.com/ethereum/go-ethereum/p2p/discv5" uuid "github.com/satori/go.uuid" ) @@ -129,8 +129,8 @@ func GenerateStaticNodesAt(dir string, nodekeys []string, ipAddrs []string) (fil log.Error("Failed to create key from hex", "hex", nodekey, "err", err) return "" } - node := discover.NewNode( - discover.PubkeyID(&key.PublicKey), + node := discv5.NewNode( + discv5.PubkeyID(&key.PublicKey), net.ParseIP(ipAddrs[i]), 0, uint16(30303)) diff --git a/genesis/genesis.go b/genesis/genesis.go index dfc6bde4..68933f69 100644 --- a/genesis/genesis.go +++ b/genesis/genesis.go @@ -44,12 +44,13 @@ func New(options ...Option) *core.Genesis { Difficulty: big.NewInt(InitDifficulty), Alloc: make(core.GenesisAlloc), Config: ¶ms.ChainConfig{ - ChainId: big.NewInt(10), - HomesteadBlock: big.NewInt(1), - ByzantiumBlock: big.NewInt(1), - EIP150Block: big.NewInt(1), - EIP155Block: big.NewInt(1), - EIP158Block: big.NewInt(1), + ChainID: big.NewInt(10), + HomesteadBlock: big.NewInt(1), + ByzantiumBlock: big.NewInt(1), + ConstantinopleBlock: big.NewInt(1), + EIP150Block: big.NewInt(1), + EIP155Block: big.NewInt(1), + EIP158Block: big.NewInt(1), Istanbul: ¶ms.IstanbulConfig{ ProposerPolicy: uint64(istanbul.DefaultConfig.ProposerPolicy), Epoch: istanbul.DefaultConfig.Epoch, diff --git a/go.mod b/go.mod index baa7a221..20dd3be7 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/jpmorganchase/istanbul-tools -replace github.com/ethereum/go-ethereum => github.com/jpmorganchase/quorum v2.1.1+incompatible +replace github.com/ethereum/go-ethereum => github.com/jpmorganchase/quorum v2.2.4+incompatible replace github.com/Sirupsen/logrus => github.com/sirupsen/logrus v1.1.1 @@ -13,6 +13,7 @@ require ( github.com/aristanetworks/goarista v0.0.0-20181130030053-f7cbe917ef62 // indirect github.com/btcsuite/btcd v0.0.0-20181130015935-7d2daa5bfef2 // indirect github.com/cespare/cp v1.1.1 // indirect + github.com/deckarep/golang-set v1.7.1 // indirect github.com/docker/distribution v0.0.0-20181129231500-d9e12182359e // indirect github.com/docker/docker v0.0.0-20170504205632-89658bed64c2 github.com/docker/go-connections v0.4.0 diff --git a/go.sum b/go.sum index 74b67a54..bbbd4e38 100644 --- a/go.sum +++ b/go.sum @@ -17,6 +17,8 @@ github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46f github.com/cespare/cp v1.1.1/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deckarep/golang-set v1.7.1 h1:SCQV0S6gTtp6itiFrTqI+pfmJ4LN85S1YzhDf9rTHJQ= +github.com/deckarep/golang-set v1.7.1/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= github.com/docker/distribution v0.0.0-20181129231500-d9e12182359e/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v0.0.0-20170504205632-89658bed64c2/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= @@ -59,6 +61,10 @@ github.com/jackpal/go-nat-pmp v0.0.0-20181021192511-d89d09f6f332/go.mod h1:QPH04 github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jpmorganchase/quorum v2.1.1+incompatible h1:epTAQm3YLLh17pF/VlMI/JWDugegUG6ZMq2onz+Cork= github.com/jpmorganchase/quorum v2.1.1+incompatible/go.mod h1:DR/b2dsUf3s/e+ucBn6RhC9w+ouhJQp8qwZehgULebY= +github.com/jpmorganchase/quorum v2.2.3+incompatible h1:ORAD4djgouZMpRNRUOUIQqkkiRo5pPL5uyJ557t7Mm4= +github.com/jpmorganchase/quorum v2.2.3+incompatible/go.mod h1:DR/b2dsUf3s/e+ucBn6RhC9w+ouhJQp8qwZehgULebY= +github.com/jpmorganchase/quorum v2.2.4+incompatible h1:b++tFU1KfHsa3Wplb5F2Xiq13ajSN+iO60eHyDmQMkU= +github.com/jpmorganchase/quorum v2.2.4+incompatible/go.mod h1:DR/b2dsUf3s/e+ucBn6RhC9w+ouhJQp8qwZehgULebY= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/juju/ratelimit v0.0.0-20170523012141-5b9ff8664717/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk= github.com/karalabe/hid v0.0.0-20181128192157-d815e0c1a2e2/go.mod h1:YvbcH+3Wo6XPs9nkgTY3u19KXLauXW+J5nB7hEHuX0A= @@ -122,6 +128,7 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180926160741-c2ed4eda69e7/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181023152157-44b849a8bc13 h1:ICvJQ9FL9kAAfwGwpoAmcE1O51M0zE++iVRxQ3xyiGE= golang.org/x/sys v0.0.0-20181023152157-44b849a8bc13/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=