From 4a8a4662cce0b9c74c5e1e1bcb73ca47bc5d79dd Mon Sep 17 00:00:00 2001 From: Miguel Hervas Date: Mon, 5 Oct 2020 11:23:39 -0700 Subject: [PATCH] New GSRPC and substrate chain rc6 version (#528) --- .travis.yml | 2 +- Dockerfile | 4 +++- chains/substrate/connection.go | 13 +++++++------ docker-compose-e2e.yml | 4 ++-- e2e/fungible_test.go | 2 +- go.mod | 6 ++---- go.sum | 8 ++++---- shared/substrate/submit.go | 26 ++++++++++++++------------ 8 files changed, 34 insertions(+), 31 deletions(-) diff --git a/.travis.yml b/.travis.yml index bf1a7966a..0091897f3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ install: - sudo add-apt-repository -y ppa:ethereum/ethereum - sudo apt-get update - sudo apt-get install ethereum - - wget -P $HOME/bin/ https://chainbridge.ams3.digitaloceanspaces.com/subkey && chmod +x $HOME/bin/subkey && subkey --version + - wget -P $HOME/bin/ https://chainbridge.ams3.digitaloceanspaces.com/subkey-rc6 && mv $HOME/bin/subkey-rc6 $HOME/bin/subkey && chmod +x $HOME/bin/subkey && subkey --version jobs: include: diff --git a/Dockerfile b/Dockerfile index 6e878799c..5ffe89a75 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,9 @@ RUN cd cmd/chainbridge && go build -o /bridge . # # final stage FROM debian:stretch-slim RUN apt-get -y update && apt-get -y upgrade && apt-get install ca-certificates wget -y -RUN wget -P /usr/local/bin/ https://chainbridge.ams3.digitaloceanspaces.com/subkey && chmod +x /usr/local/bin/subkey +RUN wget -P /usr/local/bin/ https://chainbridge.ams3.digitaloceanspaces.com/subkey-rc6 \ + && mv /usr/local/bin/subkey-rc6 /usr/local/bin/subkey \ + && chmod +x /usr/local/bin/subkey RUN subkey --version COPY --from=builder /bridge ./ diff --git a/chains/substrate/connection.go b/chains/substrate/connection.go index a6c950659..e08829323 100644 --- a/chains/substrate/connection.go +++ b/chains/substrate/connection.go @@ -116,12 +116,13 @@ func (c *Connection) SubmitTx(method utils.Method, args ...interface{}) error { // Sign the extrinsic o := types.SignatureOptions{ - BlockHash: c.genesisHash, - Era: types.ExtrinsicEra{IsMortalEra: false}, - GenesisHash: c.genesisHash, - Nonce: types.NewUCompactFromUInt(uint64(c.nonce)), - SpecVersion: rv.SpecVersion, - Tip: types.NewUCompactFromUInt(0), + BlockHash: c.genesisHash, + Era: types.ExtrinsicEra{IsMortalEra: false}, + GenesisHash: c.genesisHash, + Nonce: types.NewUCompactFromUInt(uint64(c.nonce)), + SpecVersion: rv.SpecVersion, + Tip: types.NewUCompactFromUInt(0), + TransactionVersion: 1, } err = ext.Sign(*c.key, o) diff --git a/docker-compose-e2e.yml b/docker-compose-e2e.yml index 855a81c2b..0cfb07d6f 100644 --- a/docker-compose-e2e.yml +++ b/docker-compose-e2e.yml @@ -16,8 +16,8 @@ services: - "8546:8545" sub-chain: - image: "chainsafe/chainbridge-substrate-chain:v1.0.0" + image: "chainsafe/chainbridge-substrate-chain:v1.1.0" container_name: sub-chain command: chainbridge-substrate-chain --dev --alice --ws-external --rpc-external ports: - - "9944:9944" \ No newline at end of file + - "9944:9944" diff --git a/e2e/fungible_test.go b/e2e/fungible_test.go index 208a7c463..49a4f1346 100644 --- a/e2e/fungible_test.go +++ b/e2e/fungible_test.go @@ -151,7 +151,7 @@ func testErc20SubstrateRoundTrip(t *testing.T, ctx *testContext) { // Repeat the process in the opposite direction expectedEthBalance = ethtest.Erc20BalanceOf(t, ctx.ethA.Client, ctx.ethA.TestContracts.Erc20Sub, ethRecipient) expectedSubBalance = subtest.BalanceOf(t, ctx.subClient, subRecipient) - feePerTx := big.NewInt(10143) + feePerTx := big.NewInt(125000143) nonce = subtest.GetDepositNonce(t, ctx.subClient, EthAChainId) + 1 log.Info("Asserted resulting balance", "owner", ethRecipient, "balance", expectedEthBalance.String()) diff --git a/go.mod b/go.mod index b7e0b3a90..a1991a75a 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,7 @@ require ( github.com/ChainSafe/chainbridge-utils v1.0.3 github.com/ChainSafe/log15 v1.0.0 github.com/aristanetworks/goarista v0.0.0-20200609010056-95bcf8053598 // indirect - github.com/btcsuite/btcd v0.20.1-beta // indirect - github.com/centrifuge/go-substrate-rpc-client v2.0.0-alpha.5+incompatible + github.com/centrifuge/go-substrate-rpc-client v2.0.0-rc6-0+incompatible github.com/deckarep/golang-set v1.7.1 // indirect github.com/ethereum/go-ethereum v1.9.17 github.com/gorilla/websocket v1.4.2 // indirect @@ -17,5 +16,4 @@ require ( github.com/stretchr/testify v1.4.0 github.com/urfave/cli/v2 v2.2.0 golang.org/x/net v0.0.0-20200707034311-ab3426394381 // indirect - golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae // indirect -) \ No newline at end of file +) diff --git a/go.sum b/go.sum index 2102e70d9..a66b4d36d 100644 --- a/go.sum +++ b/go.sum @@ -15,10 +15,8 @@ github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbt github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/ChainSafe/chainbridge-substrate-events v0.0.0-20200715141113-87198532025e h1:c7NSjEfp13ua566bC2KSNmyx0Cvj1cciO2klsFIQv2I= github.com/ChainSafe/chainbridge-substrate-events v0.0.0-20200715141113-87198532025e/go.mod h1:H5fNH57wn/j1oLifOnWEqYbfJZcOWzr7jZjKKrUckSQ= -github.com/ChainSafe/chainbridge-utils v1.0.1 h1:qxg0So8/XsiixiHCeZ2tn69IM7aGevhwRNby+xAfWGs= -github.com/ChainSafe/chainbridge-utils v1.0.1/go.mod h1:jX+LT1patbRwukvjQl/4oJsKZvx3ujZubdXz8ZWlMXo= -github.com/ChainSafe/chainbridge-utils v1.0.2 h1:4HaFV0H7oiIB1TlV1AjH/kYu+3GBYgNsvovpNstI3iI= -github.com/ChainSafe/chainbridge-utils v1.0.2/go.mod h1:T5cOZhxdY4x0DrE0EqOnMwAPE8d4bNGqiPfN16o1rzc= +github.com/ChainSafe/chainbridge-utils v1.0.3 h1:a8pa5N11uo2wzgzNV9QkSocFrbkO+HiWCiihKDnkuAg= +github.com/ChainSafe/chainbridge-utils v1.0.3/go.mod h1:T5cOZhxdY4x0DrE0EqOnMwAPE8d4bNGqiPfN16o1rzc= github.com/ChainSafe/log15 v1.0.0 h1:vRDVtWtVwIH5uSCBvgTTZh6FA58UBJ6+QiiypaZfBf8= github.com/ChainSafe/log15 v1.0.0/go.mod h1:5v1+ALHtdW0NfAeeoYyKmzCAMcAeqkdhIg4uxXWIgOg= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= @@ -66,6 +64,8 @@ github.com/centrifuge/go-substrate-rpc-client v2.0.0-alpha.3+incompatible h1:d8h github.com/centrifuge/go-substrate-rpc-client v2.0.0-alpha.3+incompatible/go.mod h1:GBMLH8MQs5g4FcrytcMm9uRgBnTL1LIkNTue6lUPhZU= github.com/centrifuge/go-substrate-rpc-client v2.0.0-alpha.5+incompatible h1:QzFk38HaqnzjQ6DHra5WxcTf+KxbB0Hitg+72LEPVJI= github.com/centrifuge/go-substrate-rpc-client v2.0.0-alpha.5+incompatible/go.mod h1:GBMLH8MQs5g4FcrytcMm9uRgBnTL1LIkNTue6lUPhZU= +github.com/centrifuge/go-substrate-rpc-client v2.0.0-rc6-0+incompatible h1:+H/LOoOMiAlww9xayOEAxa4mF6Tp+AgzzJDE9pQ37D8= +github.com/centrifuge/go-substrate-rpc-client v2.0.0-rc6-0+incompatible/go.mod h1:GBMLH8MQs5g4FcrytcMm9uRgBnTL1LIkNTue6lUPhZU= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= diff --git a/shared/substrate/submit.go b/shared/substrate/submit.go index deeaaa895..521222c5b 100644 --- a/shared/substrate/submit.go +++ b/shared/substrate/submit.go @@ -38,12 +38,13 @@ func SubmitTx(client *Client, method Method, args ...interface{}) error { // Sign the extrinsic o := types.SignatureOptions{ - BlockHash: client.Genesis, - Era: types.ExtrinsicEra{IsMortalEra: false}, - GenesisHash: client.Genesis, - Nonce: types.NewUCompactFromUInt(uint64(acct.Nonce)), - SpecVersion: rv.SpecVersion, - Tip: types.NewUCompactFromUInt(0), + BlockHash: client.Genesis, + Era: types.ExtrinsicEra{IsMortalEra: false}, + GenesisHash: client.Genesis, + Nonce: types.NewUCompactFromUInt(uint64(acct.Nonce)), + SpecVersion: rv.SpecVersion, + Tip: types.NewUCompactFromUInt(0), + TransactionVersion: 1, } err = ext.Sign(*client.Key, o) if err != nil { @@ -96,12 +97,13 @@ func BatchSubmit(client *Client, calls []types.Call) error { // Sign the extrinsic o := types.SignatureOptions{ - BlockHash: client.Genesis, - Era: types.ExtrinsicEra{IsMortalEra: false}, - GenesisHash: client.Genesis, - Nonce: types.NewUCompactFromUInt(uint64(acct.Nonce)), - SpecVersion: rv.SpecVersion, - Tip: types.NewUCompactFromUInt(0), + BlockHash: client.Genesis, + Era: types.ExtrinsicEra{IsMortalEra: false}, + GenesisHash: client.Genesis, + Nonce: types.NewUCompactFromUInt(uint64(acct.Nonce)), + SpecVersion: rv.SpecVersion, + Tip: types.NewUCompactFromUInt(0), + TransactionVersion: 1, } wg := &sync.WaitGroup{}