From 8efa8a6707ecab3cc1790c31c70454c933e56cd4 Mon Sep 17 00:00:00 2001 From: Silas Davis Date: Tue, 31 Jan 2017 22:03:53 +0000 Subject: [PATCH 01/10] Target develop for v0.16.1 --- version/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version/version.go b/version/version.go index d38381a33..dcf8c5c2c 100644 --- a/version/version.go +++ b/version/version.go @@ -129,4 +129,4 @@ func (version *VersionIdentifier) MatchesMinorVersion( // IMPORTANT: Eris-DB version must be on the last line of this file for // the deployment script tests/build_tool.sh to pick up the right label. -const VERSION = "0.16.0" +const VERSION = "0.16.1" From 0d011ac47d08bc54769c764bd7b5a9798667e74e Mon Sep 17 00:00:00 2001 From: Benjamin Bollen Date: Wed, 1 Feb 2017 12:56:32 +0100 Subject: [PATCH 02/10] version: update patch version to v0.16.1 in VersionIdentifier --- config/templates.go | 36 ++++++++++++++++++------------------ version/version.go | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/config/templates.go b/config/templates.go index 66a4e5b88..f38cbecab 100644 --- a/config/templates.go +++ b/config/templates.go @@ -16,22 +16,22 @@ package config -const headerCopyright = `# Copyright 2015, 2016 Eris Industries (UK) Ltd. -# This file is part of Eris-RT -# Eris-RT is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Eris-RT is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Eris-RT. If not, see . - -# This is a TOML configuration for Eris-DB chains generated by Eris-CM +const headerCopyright = `# Copyright 2015-2017 Monax Industries Limited. +# This file is part of the Monax platform (Monax) + +# Monax is free software: you can use, redistribute it and/or modify +# it only under the terms of the GNU General Public License, version +# 3, as published by the Free Software Foundation. + +# Monax is distributed WITHOUT ANY WARRANTY pursuant to +# the terms of the Gnu General Public Licence, version 3, including +# (but not limited to) Clause 15 thereof. See the text of the +# GNU General Public License, version 3 for full terms. + +# You should have received a copy of the GNU General Public License, +# version 3, with Monax. If not, see . + +# This is a TOML configuration for Eris-DB chains generated by Eris. ` @@ -205,7 +205,7 @@ const sectionTendermint = ` ################################################################################ ## ## Tendermint -## version 0.6.0 +## version 0.6 ## ## in-process execution of Tendermint consensus engine ## @@ -300,7 +300,7 @@ const sectionErisMint = ` ################################################################################ ## ## Eris-Mint -## version 0.16.0 +## version 0.16 ## ## The original Ethereum virtual machine with IAVL merkle trees ## and tendermint/go-wire encoding diff --git a/version/version.go b/version/version.go index dcf8c5c2c..6dfd478df 100644 --- a/version/version.go +++ b/version/version.go @@ -34,7 +34,7 @@ const ( // Minor version component of the current release erisVersionMinor = 16 // Patch version component of the current release - erisVersionPatch = 0 + erisVersionPatch = 1 ) var erisVersion *VersionIdentifier From 2eb0b0d389fda05a71dfd173420bf9e324788cc0 Mon Sep 17 00:00:00 2001 From: Benjamin Bollen Date: Sat, 11 Feb 2017 16:40:23 +0100 Subject: [PATCH 03/10] circle: deploy version tagged image from develop --- circle.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/circle.yml b/circle.yml index f2cc9173a..54189a8cb 100644 --- a/circle.yml +++ b/circle.yml @@ -55,6 +55,13 @@ deployment: - docker push quay.io/eris/db # push the updated documentation - docs/build.sh + develop: + branch: develop + commands: + - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS quay.io + # build docker image and tag the image with the version + - tests/build_tool.sh + - docker push quay.io/eris/db master: branch: master commands: @@ -77,6 +84,3 @@ deployment: - docker push quay.io/eris/db # push the updated documentation - docs/build.sh - - - From fdb205b1d3aec57ceb84b7e7db9b826a2c06bfc4 Mon Sep 17 00:00:00 2001 From: Silas Davis Date: Tue, 21 Feb 2017 01:55:01 +0000 Subject: [PATCH 04/10] Minimum unviable Tendermint upgrade --- glide.lock | 174 +++++++++++++++++++++---------------- glide.yaml | 5 +- util/hell/cmd/hell/main.go | 1 - 3 files changed, 100 insertions(+), 80 deletions(-) diff --git a/glide.lock b/glide.lock index 62620c5de..c226621ad 100644 --- a/glide.lock +++ b/glide.lock @@ -1,12 +1,12 @@ -hash: f1f85c5d4b9520217cc6fa9fd7b7e97790e737def9bc08ab45d53d5db729c779 -updated: 2016-09-14T20:54:48.289839938+02:00 +hash: 310aa7c7435ad7dd1c3eb6772a42065b5f506e38e195107bdbfb1584833add9a +updated: 2017-02-21T01:43:41.814044634Z imports: - name: github.com/Azure/go-ansiterm version: 388960b655244e76e24c75f48631564eaefade62 subpackages: - winterm - name: github.com/btcsuite/btcd - version: 7de7bddba9d9a8b0b7490931e346e8f10d0bdb7f + version: 153dca5c1e4b5d1ea1523592495e5bedfa503391 subpackages: - btcec - name: github.com/btcsuite/fastsha256 @@ -20,9 +20,15 @@ imports: - name: github.com/bugsnag/panicwrap version: d6191e27ad06236eaad65d79e49a08b03b9f8029 - name: github.com/BurntSushi/toml - version: f0aeabca5a127c4078abb8c8d64298b147264b55 + version: 99064174e013895bbd9b025c31100bd1d9b590ca - name: github.com/davecgh/go-spew version: 5215b55f46b2b919f50a1df0eaa5886afe4e3b3d +- name: github.com/eapache/channels + version: 47238d5aae8c0fefd518ef2bee46290909cf8263 +- name: github.com/eapache/queue + version: 44cc805cf13205b55f69e14bcb69867d1ae92f98 +- name: github.com/ebuchman/fail-test + version: c1eddaa09da2b4017351245b0d43234955276798 - name: github.com/eris-ltd/eris-keys version: 114ebc77443db9a153692233294e48bc7e184215 - name: github.com/fsnotify/fsnotify @@ -32,37 +38,53 @@ imports: subpackages: - binding - render +- name: github.com/go-kit/kit + version: f66b0e13579bfc5a48b9e2a94b1209c107ea1f41 + subpackages: + - log +- name: github.com/go-logfmt/logfmt + version: 390ab7935ee28ec6b286364bba9b4dd6410cb3d5 - name: github.com/go-stack/stack version: 100eb0c0a9c5b306ca2fb4f165df21d80ada4b82 +- name: github.com/gogo/protobuf + version: f9114dace7bd920b32f943b3c73fafbcbab2bf31 - name: github.com/golang/protobuf - version: 0c1f6d65b5a189c2250d10e71a5506f06f9fa0a0 + version: 8ee79997227bf9b34611aee7946ae64735e6fd93 subpackages: - proto - name: github.com/golang/snappy version: d9eb7a3d35ec988b8585d4a0068e462c27d28380 - name: github.com/gorilla/websocket - version: a68708917c6a4f06314ab4e52493cc61359c9d42 + version: 17634340a83afe0cab595e40fbc63f6ffa1d8915 - name: github.com/hashicorp/hcl version: da486364306ed66c218be9b7953e19173447c18b subpackages: - hcl/ast - hcl/parser - - hcl/token - - json/parser - hcl/scanner - hcl/strconv + - hcl/token + - json/parser - json/scanner - json/token +- name: github.com/inconshreveable/log15 + version: 46a701a619de90c65a78c04d1a58bf02585e9701 + subpackages: + - term - name: github.com/inconshreveable/mousetrap version: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75 +- name: github.com/jmhodges/levigo + version: c42d9e0ca023e2198120196f842701bb4c55d7b9 - name: github.com/magiconair/properties version: c265cfa48dda6474e208715ca93e987829f572f8 - name: github.com/manucorporat/sse version: ee05b128a739a0fb76c7ebd3ae4810c1de808d6d +- name: github.com/Masterminds/glide + version: 84607742b10f492430762d038e954236bbaf23f7 - name: github.com/mattn/go-colorable - version: 9056b7a9f2d1f2d96498d6d146acd1f9d5ed3d59 + version: d228849504861217f796da67fae4f6e347643f15 - name: github.com/mattn/go-isatty - version: 56b76bdf51f7708750eac80fa38b952bb9f32639 + version: 30a891c33c7cde7b02a981314b4228ec99380cca - name: github.com/mitchellh/mapstructure version: d2dd0262208475919e1a362f675cfc0e7c10e905 - name: github.com/naoina/toml @@ -72,7 +94,7 @@ imports: subpackages: - difflib - name: github.com/Sirupsen/logrus - version: f3cfb454f4c209e6668c95216c4744b8fddb2356 + version: d26492970760ca5d33129d2d799e34be5c4782eb - name: github.com/spf13/cast version: 27b586b42e29bec072fe7379259cc719e1289da6 - name: github.com/spf13/cobra @@ -80,117 +102,135 @@ imports: - name: github.com/spf13/jwalterweatherman version: 33c24e77fb80341fe7130ee7c594256ff08ccc46 - name: github.com/spf13/pflag - version: 367864438f1b1a3c7db4da06a2f55b144e6784e0 + version: 25f8b5b07aece3207895bf19f7ab517eb3b22a40 - name: github.com/spf13/viper version: c1ccc378a054ea8d4e38d8c67f6938d4760b53dd +- name: github.com/streadway/simpleuuid + version: 6617b501e485b77e61b98cd533aefff9e258b5a7 - name: github.com/stretchr/testify version: d77da356e56a7428ad25149ca77381849a6a5232 subpackages: - assert - name: github.com/syndtr/goleveldb - version: fa5b5c78794bc5c18f330361059f871ae8c2b9d6 + version: 23851d93a2292dcc56e71a18ec9e0624d84a0f65 subpackages: - leveldb - - leveldb/errors - - leveldb/opt - leveldb/cache - leveldb/comparer + - leveldb/errors - leveldb/filter - leveldb/iterator - leveldb/journal - leveldb/memdb + - leveldb/opt - leveldb/storage - leveldb/table - leveldb/util +- name: github.com/tendermint/abci + version: 699d45bc678865b004b90213bf88a950f420973b + subpackages: + - client + - example/counter + - example/dummy + - example/nil + - server + - types - name: github.com/tendermint/ed25519 - version: fdac6641497281ed1cc368687ec6377e96e02b24 + version: 1f52c6f8b8a5c7908aff4497c186af344b428925 subpackages: - edwards25519 - extra25519 - name: github.com/tendermint/flowcontrol version: 84d9671090430e8ec80e35b339907e0579b999eb +- name: github.com/tendermint/go-autofile + version: 0416e0aa9c68205aa44844096f9f151ada9d0405 - name: github.com/tendermint/go-clist - version: 634527f5b60fd7c71ca811262493df2ad65ee0ca + version: 3baa390bbaf7634251c42ad69a8682e7e3990552 - name: github.com/tendermint/go-common - version: dcfa46af1341d03b80d32e4901019d1668b978b9 + version: e289af53b6bf6af28da129d9ef64389a4cf7987f + subpackages: + - test - name: github.com/tendermint/go-config - version: cfcef384d64b94e50909596e39b32ffb3cc20573 + version: e64b424499acd0eb9856b88e10c0dff41628c0d6 - name: github.com/tendermint/go-crypto - version: 41cfb7b677f4e16cdfd22b6ce0946c89919fbc7b + version: 4b11d62bdb324027ea01554e5767b71174680ba0 - name: github.com/tendermint/go-db - version: 31fdd21c7eaeed53e0ea7ca597fb1e960e2988a5 + version: 72f6dacd22a686cdf7fcd60286503e3aceda77ba - name: github.com/tendermint/go-events - version: 7b75ca7bb55aa25e9ef765eb8c0b69486b227357 + version: fddee66d90305fccb6f6d84d16c34fa65ea5b7f6 +- name: github.com/tendermint/go-flowrate + version: a20c98e61957faa93b4014fbd902f20ab9317a6a + subpackages: + - flowrate - name: github.com/tendermint/go-logger - version: 529efe50eab1a8a9c111d55f4de4ecd95f482761 + version: cefb3a45c0bf3c493a04e9bcd9b1540528be59f2 - name: github.com/tendermint/go-merkle - version: 05042c6ab9cad51d12e4cecf717ae68e3b1409a8 + version: 7a86b4486f2cd84ac885c5bbc609fdee2905f5d1 - name: github.com/tendermint/go-p2p - version: 5bd7692323ec60d6461678f09b5024a952164151 + version: 3d98f675f30dc4796546b8b890f895926152fa8d subpackages: - upnp - name: github.com/tendermint/go-rpc - version: 479510be0e80dd9e5d6b1f941adad168df0af85f + version: fcea0cda21f64889be00a0f4b6d13266b1a76ee7 subpackages: - client - server - types - name: github.com/tendermint/go-wire - version: 3b0adbc86ed8425eaed98516165b6788d9f4de7a + version: 2f3b7aafe21c80b19b6ee3210ecb3e3d07c7a471 - name: github.com/tendermint/log15 - version: 9545b249b3aacafa97f79e0838b02b274adc6f5f + version: ae0f3d6450da9eac7074b439c8e1c3cabf0d5ce6 subpackages: - term - name: github.com/tendermint/tendermint - version: aaea0c5d2e3ecfbf29f2608f9d43649ec7f07f50 + version: 764091dfbb035f1b28da4b067526e04c6a849966 subpackages: - - node - - proxy - - types - - version - - consensus - - rpc/core/types - blockchain + - consensus - mempool + - node + - proxy - rpc/core + - rpc/core/types - state -- name: github.com/tendermint/tmsp - version: 73e5c3cb7bbee2f9c49792e5a0fcbcab442bf7dc - subpackages: - - client - types - - example/dummy - - example/nil + - version +- name: github.com/tendermint/tmsp + version: f41bc5f11969e22b357d94b4247403fd62d40445 - name: github.com/tommy351/gin-cors version: dc91dec6313ae4db53481bf3b29cf6b94bf80357 - name: golang.org/x/crypto - version: f3241ce8505855877cc8a9717bd61a0f7c4ea83c + version: 7c6cc321c680f03b9ef0764448e780704f486b51 subpackages: - - ripemd160 + - curve25519 + - nacl/box - nacl/secretbox - openpgp/armor - - nacl/box + - openpgp/errors - poly1305 + - ripemd160 - salsa20/salsa - - openpgp/errors - - curve25519 - name: golang.org/x/net - version: de35ec43e7a9aabd6a9c54d2898220ea7e44de7d + version: 60c41d1de8da134c05b7b40154a9a82bf5b7edb9 subpackages: - - http2 - context - - netutil - - trace + - http2 - http2/hpack - idna - - lex/httplex - internal/timeseries - name: golang.org/x/sys - version: 62bee037599929a6e9146f29d10dd5208c43507d + version: d75a52659825e75fff6158388dddc6a5b04f9ba5 subpackages: - unix +- name: golang.org/x/text + version: 44f4f658a783b0cee41fe0a23b8fc91d9c120558 + subpackages: + - secure/bidirule + - transform + - unicode/bidi + - unicode/norm - name: google.golang.org/grpc - version: e78224b060cf3215247b7be455f80ea22e469b66 + version: 50955793b0183f9de69bd78e2ec251cf20aab121 subpackages: - codes - credentials @@ -198,8 +238,10 @@ imports: - internal - metadata - naming - - transport - peer + - stats + - tap + - transport - name: gopkg.in/fatih/set.v0 version: 27c40922c40b43fe04554d8223a402af3ea333f3 - name: gopkg.in/go-playground/validator.v8 @@ -208,26 +250,4 @@ imports: version: ecde8c8f16df93a994dda8936c8f60f0c26c28ab - name: gopkg.in/yaml.v2 version: a83829b6f1293c91addabc89d0571c246397bbf4 -- name: github.com/go-kit/kit - version: f66b0e13579bfc5a48b9e2a94b1209c107ea1f41 - subpackages: - - log -- name: github.com/eapache/channels - version: 47238d5aae8c0fefd518ef2bee46290909cf8263 -- name: github.com/eapache/queue - version: 44cc805cf13205b55f69e14bcb69867d1ae92f98 -- name: github.com/go-logfmt/logfmt - version: 390ab7935ee28ec6b286364bba9b4dd6410cb3d5 -- name: github.com/go-stack/stack - version: 100eb0c0a9c5b306ca2fb4f165df21d80ada4b82 -- name: github.com/Sirupsen/logrus - version: d26492970760ca5d33129d2d799e34be5c4782eb -- name: github.com/inconshreveable/log15 - version: 46a701a619de90c65a78c04d1a58bf02585e9701 - subpackages: - - term -- name: github.com/streadway/simpleuuid - version: 6617b501e485b77e61b98cd533aefff9e258b5a7 -- name: github.com/Masterminds/glide - version: 84607742b10f492430762d038e954236bbaf23f7 -devImports: [] +testImports: [] diff --git a/glide.yaml b/glide.yaml index d832bc221..ed8e097c2 100644 --- a/glide.yaml +++ b/glide.yaml @@ -3,11 +3,12 @@ import: - package: github.com/eris-ltd/eris-keys - package: github.com/spf13/cobra - package: github.com/spf13/viper -- package: github.com/tendermint/tendermint - package: github.com/gin-gonic/gin - package: github.com/gorilla/websocket - package: github.com/naoina/toml - package: github.com/stretchr/testify +- package: github.com/tendermint/tendermint + version: ~0.8.0 - package: github.com/tommy351/gin-cors - package: golang.org/x/crypto subpackages: @@ -30,4 +31,4 @@ import: version: ^0.11.0 - package: github.com/streadway/simpleuuid - package: github.com/Masterminds/glide - version: ~0.12.3 \ No newline at end of file + version: ~0.12.3 diff --git a/util/hell/cmd/hell/main.go b/util/hell/cmd/hell/main.go index 6736e496f..fdefa1f85 100644 --- a/util/hell/cmd/hell/main.go +++ b/util/hell/cmd/hell/main.go @@ -110,7 +110,6 @@ func main() { overrideLockFile.Imports = append(overrideLockFile.Imports, cfg.LockFromDependency(dep)) mergedLockFile, err := hell.MergeGlideLockFiles(baseLockFile, overrideLockFile) - fmt.Printf("%#v\n", mergedLockFile.Imports) if err != nil { msg.Die("Could not merge lock files: %s\n", err) } From 85988b24c2a28a8f6ee902e1424a95f76f2c45d3 Mon Sep 17 00:00:00 2001 From: Silas Davis Date: Tue, 21 Feb 2017 03:33:25 +0000 Subject: [PATCH 05/10] Hacked away until buildable and runnable with 0.8.0 --- config/templates.go | 12 +- consensus/config.go | 3 - consensus/tendermint/local_client.go | 270 ------------------------- consensus/tendermint/tendermint.go | 11 +- consensus/tendermint/version.go | 2 +- consensus/tmsp/server.go | 211 ------------------- consensus/tmsp/version.go | 37 ---- consensus/types/consensus_engine.go | 4 +- core/core.go | 2 +- event/events.go | 4 +- glide.lock | 2 - manager/eris-mint/eris-mint.go | 42 ++-- manager/eris-mint/pipe.go | 26 +-- manager/eris-mint/version.go | 3 +- manager/manager.go | 2 +- manager/types/application.go | 26 +-- rpc/tendermint/core/types/responses.go | 4 +- rpc/tendermint/core/websocket.go | 2 +- rpc/tendermint/test/config.go | 16 +- rpc/tendermint/test/rpc_client_test.go | 2 +- test/mock/pipe.go | 4 +- 21 files changed, 78 insertions(+), 607 deletions(-) delete mode 100644 consensus/tendermint/local_client.go delete mode 100644 consensus/tmsp/server.go delete mode 100644 consensus/tmsp/version.go diff --git a/config/templates.go b/config/templates.go index f38cbecab..36da48589 100644 --- a/config/templates.go +++ b/config/templates.go @@ -86,7 +86,7 @@ const separatorChainConsensus = ` const sectionChainConsensus = ` [chain.consensus] # consensus defines the module to use for consensus and # this will define the peer-to-peer consensus network; - # accepted values are ("noops", "tmsp",) "tendermint" + # accepted values are ("noops", "abci",) "tendermint" name = "{{.Name}}" # version is the major and minor semantic version; # the version will be asserted on @@ -184,17 +184,17 @@ const separatorModules = ` ` // TODO: [ben] make configurable -const sectionTmsp = ` +const sectionabci = ` ################################################################################ ## -## Tendermint Socket Protocol (TMSP) +## Tendermint Socket Protocol (abci) ## version 0.6.0 ## -## TMSP expects a tendermint consensus process to run and connect to Eris-DB +## abci expects a tendermint consensus process to run and connect to Eris-DB ## ################################################################################ -[tmsp] +[abci] # listener address for accepting tendermint socket protocol connections listener = "tcp://0.0.0.0:46658" @@ -244,7 +244,7 @@ private_validator_file = "priv_validator.json" # NOTE: value is ignored when run in-process as RPC is # handled by [servers.tendermint] rpc_laddr = "0.0.0.0:46657" - # proxy application address - used for tmsp connections, + # proxy application address - used for abci connections, # and this port should not be exposed for in-process Tendermint proxy_app = "tcp://127.0.0.1:46658" diff --git a/consensus/config.go b/consensus/config.go index d676d8c21..951b4cf3e 100644 --- a/consensus/config.go +++ b/consensus/config.go @@ -22,7 +22,6 @@ package consensus import ( // noops "github.com/eris-ltd/eris-db/consensus/noops" tendermint "github.com/eris-ltd/eris-db/consensus/tendermint" - tmsp "github.com/eris-ltd/eris-db/consensus/tmsp" ) //------------------------------------------------------------------------------ @@ -34,8 +33,6 @@ func AssertValidConsensusModule(name, minorVersionString string) bool { // noops should not have any external interfaces that can change // over iterations return true - case "tmsp": - return minorVersionString == tmsp.GetTmspVersion().GetMinorVersionString() case "tendermint": return minorVersionString == tendermint.GetTendermintVersion().GetMinorVersionString() case "bigchaindb": diff --git a/consensus/tendermint/local_client.go b/consensus/tendermint/local_client.go deleted file mode 100644 index 97b732cac..000000000 --- a/consensus/tendermint/local_client.go +++ /dev/null @@ -1,270 +0,0 @@ -// Copyright 2015, 2016 Eris Industries (UK) Ltd. -// This file is part of Eris-RT - -// Eris-RT is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Eris-RT is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Eris-RT. If not, see . - -// version provides the current Eris-DB version and a VersionIdentifier -// for the modules to identify their version with. - -// This file is originally based on github.com/tendermint/tmsp/client/... -// .../local_client.go - -package tendermint - -import ( - "sync" - - tmsp_client "github.com/tendermint/tmsp/client" - tmsp_types "github.com/tendermint/tmsp/types" - - manager_types "github.com/eris-ltd/eris-db/manager/types" -) - -// NOTE [ben] Compiler check to ensure localClient successfully implements -// tendermint/tmsp/client -var _ tmsp_client.Client = (*localClient)(nil) - -type localClient struct { - mtx *sync.Mutex - Application manager_types.Application - Callback tmsp_client.Callback -} - -func NewLocalClient(mtx *sync.Mutex, app manager_types.Application) *localClient { - if mtx == nil { - mtx = new(sync.Mutex) - } - return &localClient{ - mtx: mtx, - Application: app, - } -} - -func (app *localClient) SetResponseCallback(cb tmsp_client.Callback) { - app.mtx.Lock() - defer app.mtx.Unlock() - app.Callback = cb -} - -// TODO: change manager_types.Application to include Error()? -func (app *localClient) Error() error { - return nil -} - -func (app *localClient) Stop() bool { - return true -} - -func (app *localClient) FlushAsync() *tmsp_client.ReqRes { - // Do nothing - return newLocalReqRes(tmsp_types.ToRequestFlush(), nil) -} - -func (app *localClient) EchoAsync(msg string) *tmsp_client.ReqRes { - return app.callback( - tmsp_types.ToRequestEcho(msg), - tmsp_types.ToResponseEcho(msg), - ) -} - -func (app *localClient) InfoAsync() *tmsp_client.ReqRes { - app.mtx.Lock() - info := app.Application.Info() - app.mtx.Unlock() - return app.callback( - tmsp_types.ToRequestInfo(), - tmsp_types.ToResponseInfo(info), - ) -} - -func (app *localClient) SetOptionAsync(key string, value string) *tmsp_client.ReqRes { - app.mtx.Lock() - log := app.Application.SetOption(key, value) - app.mtx.Unlock() - return app.callback( - tmsp_types.ToRequestSetOption(key, value), - tmsp_types.ToResponseSetOption(log), - ) -} - -func (app *localClient) AppendTxAsync(tx []byte) *tmsp_client.ReqRes { - app.mtx.Lock() - res := app.Application.AppendTx(tx) - app.mtx.Unlock() - return app.callback( - tmsp_types.ToRequestAppendTx(tx), - tmsp_types.ToResponseAppendTx(res.Code, res.Data, res.Log), - ) -} - -func (app *localClient) CheckTxAsync(tx []byte) *tmsp_client.ReqRes { - app.mtx.Lock() - res := app.Application.CheckTx(tx) - app.mtx.Unlock() - return app.callback( - tmsp_types.ToRequestCheckTx(tx), - tmsp_types.ToResponseCheckTx(res.Code, res.Data, res.Log), - ) -} - -func (app *localClient) QueryAsync(tx []byte) *tmsp_client.ReqRes { - app.mtx.Lock() - res := app.Application.Query(tx) - app.mtx.Unlock() - return app.callback( - tmsp_types.ToRequestQuery(tx), - tmsp_types.ToResponseQuery(res.Code, res.Data, res.Log), - ) -} - -func (app *localClient) CommitAsync() *tmsp_client.ReqRes { - app.mtx.Lock() - res := app.Application.Commit() - app.mtx.Unlock() - return app.callback( - tmsp_types.ToRequestCommit(), - tmsp_types.ToResponseCommit(res.Code, res.Data, res.Log), - ) -} - -func (app *localClient) InitChainAsync(validators []*tmsp_types.Validator) *tmsp_client.ReqRes { - app.mtx.Lock() - if bcApp, ok := app.Application.(tmsp_types.BlockchainAware); ok { - bcApp.InitChain(validators) - } - reqRes := app.callback( - tmsp_types.ToRequestInitChain(validators), - tmsp_types.ToResponseInitChain(), - ) - app.mtx.Unlock() - return reqRes -} - -func (app *localClient) BeginBlockAsync(height uint64) *tmsp_client.ReqRes { - app.mtx.Lock() - if bcApp, ok := app.Application.(tmsp_types.BlockchainAware); ok { - bcApp.BeginBlock(height) - } - app.mtx.Unlock() - return app.callback( - tmsp_types.ToRequestBeginBlock(height), - tmsp_types.ToResponseBeginBlock(), - ) -} - -func (app *localClient) EndBlockAsync(height uint64) *tmsp_client.ReqRes { - app.mtx.Lock() - var validators []*tmsp_types.Validator - if bcApp, ok := app.Application.(tmsp_types.BlockchainAware); ok { - validators = bcApp.EndBlock(height) - } - app.mtx.Unlock() - return app.callback( - tmsp_types.ToRequestEndBlock(height), - tmsp_types.ToResponseEndBlock(validators), - ) -} - -//------------------------------------------------------- - -func (app *localClient) FlushSync() error { - return nil -} - -func (app *localClient) EchoSync(msg string) (res tmsp_types.Result) { - return tmsp_types.OK.SetData([]byte(msg)) -} - -func (app *localClient) InfoSync() (res tmsp_types.Result) { - app.mtx.Lock() - info := app.Application.Info() - app.mtx.Unlock() - return tmsp_types.OK.SetData([]byte(info)) -} - -func (app *localClient) SetOptionSync(key string, value string) (res tmsp_types.Result) { - app.mtx.Lock() - log := app.Application.SetOption(key, value) - app.mtx.Unlock() - return tmsp_types.OK.SetLog(log) -} - -func (app *localClient) AppendTxSync(tx []byte) (res tmsp_types.Result) { - app.mtx.Lock() - res = app.Application.AppendTx(tx) - app.mtx.Unlock() - return res -} - -func (app *localClient) CheckTxSync(tx []byte) (res tmsp_types.Result) { - app.mtx.Lock() - res = app.Application.CheckTx(tx) - app.mtx.Unlock() - return res -} - -func (app *localClient) QuerySync(query []byte) (res tmsp_types.Result) { - app.mtx.Lock() - res = app.Application.Query(query) - app.mtx.Unlock() - return res -} - -func (app *localClient) CommitSync() (res tmsp_types.Result) { - app.mtx.Lock() - res = app.Application.Commit() - app.mtx.Unlock() - return res -} - -func (app *localClient) InitChainSync(validators []*tmsp_types.Validator) (err error) { - app.mtx.Lock() - if bcApp, ok := app.Application.(tmsp_types.BlockchainAware); ok { - bcApp.InitChain(validators) - } - app.mtx.Unlock() - return nil -} - -func (app *localClient) BeginBlockSync(height uint64) (err error) { - app.mtx.Lock() - if bcApp, ok := app.Application.(tmsp_types.BlockchainAware); ok { - bcApp.BeginBlock(height) - } - app.mtx.Unlock() - return nil -} - -func (app *localClient) EndBlockSync(height uint64) (changedValidators []*tmsp_types.Validator, err error) { - app.mtx.Lock() - if bcApp, ok := app.Application.(tmsp_types.BlockchainAware); ok { - changedValidators = bcApp.EndBlock(height) - } - app.mtx.Unlock() - return changedValidators, nil -} - -//------------------------------------------------------- - -func (app *localClient) callback(req *tmsp_types.Request, res *tmsp_types.Response) *tmsp_client.ReqRes { - app.Callback(req, res) - return newLocalReqRes(req, res) -} - -func newLocalReqRes(req *tmsp_types.Request, res *tmsp_types.Response) *tmsp_client.ReqRes { - reqRes := tmsp_client.NewReqRes(req) - reqRes.Response = res - reqRes.SetDone() - return reqRes -} diff --git a/consensus/tendermint/tendermint.go b/consensus/tendermint/tendermint.go index 5adc08e1a..c0c3b3a7b 100644 --- a/consensus/tendermint/tendermint.go +++ b/consensus/tendermint/tendermint.go @@ -23,15 +23,14 @@ import ( "fmt" "path" "strings" - "sync" + abci_types "github.com/tendermint/abci/types" crypto "github.com/tendermint/go-crypto" p2p "github.com/tendermint/go-p2p" tendermint_consensus "github.com/tendermint/tendermint/consensus" node "github.com/tendermint/tendermint/node" proxy "github.com/tendermint/tendermint/proxy" tendermint_types "github.com/tendermint/tendermint/types" - tmsp_types "github.com/tendermint/tmsp/types" edb_event "github.com/eris-ltd/eris-db/event" @@ -125,10 +124,8 @@ func NewTendermint(moduleConfig *config.ModuleConfig, tmintConfig.Set("rpc_laddr", "") } - newNode := node.NewNode(tmintConfig, privateValidator, func(_, _ string, - hash []byte) proxy.AppConn { - return NewLocalClient(new(sync.Mutex), application) - }) + newNode := node.NewNode(tmintConfig, privateValidator, + proxy.NewLocalClientCreator(application)) listener := p2p.NewDefaultListener("tcp", tmintConfig.GetString("node_laddr"), tmintConfig.GetBool("skip_upnp")) @@ -235,7 +232,7 @@ func (tendermint *Tendermint) Events() edb_event.EventEmitter { } func (tendermint *Tendermint) BroadcastTransaction(transaction []byte, - callback func(*tmsp_types.Response)) error { + callback func(*abci_types.Response)) error { return tendermint.tmintNode.MempoolReactor().BroadcastTx(transaction, callback) } diff --git a/consensus/tendermint/version.go b/consensus/tendermint/version.go index 870d1313b..cc7f18075 100644 --- a/consensus/tendermint/version.go +++ b/consensus/tendermint/version.go @@ -30,7 +30,7 @@ const ( // Major version component of the current release tendermintVersionMajorConst uint8 = 0 // Minor version component of the current release - tendermintVersionMinorConst uint8 = 6 + tendermintVersionMinorConst uint8 = 8 // Patch version component of the current release tendermintVersionPatchConst uint8 = 0 ) diff --git a/consensus/tmsp/server.go b/consensus/tmsp/server.go deleted file mode 100644 index 62abb9d64..000000000 --- a/consensus/tmsp/server.go +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright 2015, 2016 Eris Industries (UK) Ltd. -// This file is part of Eris-RT - -// Eris-RT is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Eris-RT is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Eris-RT. If not, see . - -// Taken originally from github.com/tendermint/tmsp/server.go - -package tmsp - -import ( - "bufio" - "fmt" - "io" - "net" - "strings" - "sync" - - . "github.com/tendermint/go-common" - tmsp_types "github.com/tendermint/tmsp/types" - - manager_types "github.com/eris-ltd/eris-db/manager/types" -) - -// var maxNumberConnections = 2 - -type Server struct { - QuitService - - proto string - addr string - listener net.Listener - - appMtx sync.Mutex - app manager_types.Application -} - -func NewServer(protoAddr string, app manager_types.Application) (*Server, error) { - parts := strings.SplitN(protoAddr, "://", 2) - proto, addr := parts[0], parts[1] - s := &Server{ - proto: proto, - addr: addr, - listener: nil, - app: app, - } - s.QuitService = *NewQuitService(nil, "TMSPServer", s) - _, err := s.Start() // Just start it - return s, err -} - -func (s *Server) OnStart() error { - s.QuitService.OnStart() - ln, err := net.Listen(s.proto, s.addr) - if err != nil { - return err - } - s.listener = ln - go s.acceptConnectionsRoutine() - return nil -} - -func (s *Server) OnStop() { - s.QuitService.OnStop() - s.listener.Close() -} - -func (s *Server) acceptConnectionsRoutine() { - // semaphore := make(chan struct{}, maxNumberConnections) - - for { - // semaphore <- struct{}{} - - // Accept a connection - fmt.Println("Waiting for new connection...") - conn, err := s.listener.Accept() - if err != nil { - if !s.IsRunning() { - return // Ignore error from listener closing. - } - Exit("Failed to accept connection: " + err.Error()) - } else { - fmt.Println("Accepted a new connection") - } - - closeConn := make(chan error, 2) // Push to signal connection closed - responses := make(chan *tmsp_types.Response, 1000) // A channel to buffer responses - - // Read requests from conn and deal with them - go s.handleRequests(closeConn, conn, responses) - // Pull responses from 'responses' and write them to conn. - go s.handleResponses(closeConn, responses, conn) - - go func() { - // Wait until signal to close connection - errClose := <-closeConn - if errClose != nil { - fmt.Printf("Connection error: %v\n", errClose) - } else { - fmt.Println("Connection was closed.") - } - - // Close the connection - err := conn.Close() - if err != nil { - fmt.Printf("Error in closing connection: %v\n", err) - } - - // <-semaphore - }() - } -} - -// Read requests from conn and deal with them -func (s *Server) handleRequests(closeConn chan error, conn net.Conn, responses chan<- *tmsp_types.Response) { - var count int - var bufReader = bufio.NewReader(conn) - for { - - var req = &tmsp_types.Request{} - err := tmsp_types.ReadMessage(bufReader, req) - if err != nil { - if err == io.EOF { - closeConn <- fmt.Errorf("Connection closed by client") - } else { - closeConn <- fmt.Errorf("Error in handleRequests: %v", err.Error()) - } - return - } - s.appMtx.Lock() - count++ - s.handleRequest(req, responses) - s.appMtx.Unlock() - } -} - -func (s *Server) handleRequest(req *tmsp_types.Request, responses chan<- *tmsp_types.Response) { - switch r := req.Value.(type) { - case *tmsp_types.Request_Echo: - responses <- tmsp_types.ToResponseEcho(r.Echo.Message) - case *tmsp_types.Request_Flush: - responses <- tmsp_types.ToResponseFlush() - case *tmsp_types.Request_Info: - data := s.app.Info() - responses <- tmsp_types.ToResponseInfo(data) - case *tmsp_types.Request_SetOption: - so := r.SetOption - logStr := s.app.SetOption(so.Key, so.Value) - responses <- tmsp_types.ToResponseSetOption(logStr) - case *tmsp_types.Request_AppendTx: - res := s.app.AppendTx(r.AppendTx.Tx) - responses <- tmsp_types.ToResponseAppendTx(res.Code, res.Data, res.Log) - case *tmsp_types.Request_CheckTx: - res := s.app.CheckTx(r.CheckTx.Tx) - responses <- tmsp_types.ToResponseCheckTx(res.Code, res.Data, res.Log) - case *tmsp_types.Request_Commit: - res := s.app.Commit() - responses <- tmsp_types.ToResponseCommit(res.Code, res.Data, res.Log) - case *tmsp_types.Request_Query: - res := s.app.Query(r.Query.Query) - responses <- tmsp_types.ToResponseQuery(res.Code, res.Data, res.Log) - case *tmsp_types.Request_InitChain: - if app, ok := s.app.(tmsp_types.BlockchainAware); ok { - app.InitChain(r.InitChain.Validators) - responses <- tmsp_types.ToResponseInitChain() - } else { - responses <- tmsp_types.ToResponseInitChain() - } - case *tmsp_types.Request_EndBlock: - if app, ok := s.app.(tmsp_types.BlockchainAware); ok { - validators := app.EndBlock(r.EndBlock.Height) - responses <- tmsp_types.ToResponseEndBlock(validators) - } else { - responses <- tmsp_types.ToResponseEndBlock(nil) - } - default: - responses <- tmsp_types.ToResponseException("Unknown request") - } -} - -// Pull responses from 'responses' and write them to conn. -func (s *Server) handleResponses(closeConn chan error, responses <-chan *tmsp_types.Response, conn net.Conn) { - var count int - var bufWriter = bufio.NewWriter(conn) - for { - var res = <-responses - err := tmsp_types.WriteMessage(res, bufWriter) - if err != nil { - closeConn <- fmt.Errorf("Error in handleResponses: %v", err.Error()) - return - } - if _, ok := res.Value.(*tmsp_types.Response_Flush); ok { - err = bufWriter.Flush() - if err != nil { - closeConn <- fmt.Errorf("Error in handleValue: %v", err.Error()) - return - } - } - count++ - } -} diff --git a/consensus/tmsp/version.go b/consensus/tmsp/version.go deleted file mode 100644 index 266b37d79..000000000 --- a/consensus/tmsp/version.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2015, 2016 Eris Industries (UK) Ltd. -// This file is part of Eris-RT - -// Eris-RT is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Eris-RT is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Eris-RT. If not, see . - -package tmsp - -import ( - version "github.com/eris-ltd/eris-db/version" -) - -const ( - // Client identifier to advertise over the network - tmspClientIdentifier = "tmsp" - // Major version component of the current release - tmspVersionMajor = 0 - // Minor version component of the current release - tmspVersionMinor = 6 - // Patch version component of the current release - tmspVersionPatch = 0 -) - -func GetTmspVersion() *version.VersionIdentifier { - return version.New(tmspClientIdentifier, tmspVersionMajor, tmspVersionMinor, - tmspVersionPatch) -} diff --git a/consensus/types/consensus_engine.go b/consensus/types/consensus_engine.go index ea02d3b2e..52eb9d0b9 100644 --- a/consensus/types/consensus_engine.go +++ b/consensus/types/consensus_engine.go @@ -5,7 +5,7 @@ import ( "github.com/eris-ltd/eris-db/txs" "github.com/tendermint/go-crypto" "github.com/tendermint/go-p2p" - tmsp_types "github.com/tendermint/tmsp/types" + abci_types "github.com/tendermint/abci/types" ) type ConsensusEngine interface { @@ -20,7 +20,7 @@ type ConsensusEngine interface { // Memory pool BroadcastTransaction(transaction []byte, - callback func(*tmsp_types.Response)) error + callback func(*abci_types.Response)) error // Events // For consensus events like NewBlock diff --git a/core/core.go b/core/core.go index 6c58d1a33..9ce189aae 100644 --- a/core/core.go +++ b/core/core.go @@ -40,7 +40,7 @@ import ( // Core is the high-level structure type Core struct { chainId string - evsw *events.EventSwitch + evsw events.EventSwitch pipe definitions.Pipe tendermintPipe definitions.TendermintPipe } diff --git a/event/events.go b/event/events.go index ec790a9ed..65e439e5a 100644 --- a/event/events.go +++ b/event/events.go @@ -44,7 +44,7 @@ type EventEmitter interface { Unsubscribe(subId string) error } -func NewEvents(eventSwitch *go_events.EventSwitch, logger loggers.InfoTraceLogger) *events { +func NewEvents(eventSwitch go_events.EventSwitch, logger loggers.InfoTraceLogger) *events { return &events{eventSwitch: eventSwitch, logger: logging.WithScope(logger, "Events")} } @@ -57,7 +57,7 @@ func Multiplex(events ...EventEmitter) *multiplexedEvents { // The events struct has methods for working with events. type events struct { - eventSwitch *go_events.EventSwitch + eventSwitch go_events.EventSwitch logger loggers.InfoTraceLogger } diff --git a/glide.lock b/glide.lock index c226621ad..6887d752d 100644 --- a/glide.lock +++ b/glide.lock @@ -195,8 +195,6 @@ imports: - state - types - version -- name: github.com/tendermint/tmsp - version: f41bc5f11969e22b357d94b4247403fd62d40445 - name: github.com/tommy351/gin-cors version: dc91dec6313ae4db53481bf3b29cf6b94bf80357 - name: golang.org/x/crypto diff --git a/manager/eris-mint/eris-mint.go b/manager/eris-mint/eris-mint.go index 29050723a..899bbec89 100644 --- a/manager/eris-mint/eris-mint.go +++ b/manager/eris-mint/eris-mint.go @@ -24,7 +24,7 @@ import ( tendermint_events "github.com/tendermint/go-events" wire "github.com/tendermint/go-wire" - tmsp "github.com/tendermint/tmsp/types" + abci "github.com/tendermint/abci/types" "github.com/eris-ltd/eris-db/logging" "github.com/eris-ltd/eris-db/logging/loggers" @@ -47,7 +47,7 @@ type ErisMint struct { checkCache *sm.BlockCache // for CheckTx (eg. so we get nonces right) evc *tendermint_events.EventCache - evsw *tendermint_events.EventSwitch + evsw tendermint_events.EventSwitch nTxs int // count txs in a block logger loggers.InfoTraceLogger @@ -57,9 +57,9 @@ type ErisMint struct { // eris-db/manager/types.Application var _ manager_types.Application = (*ErisMint)(nil) -// NOTE: [ben] also automatically implements tmsp.Application, +// NOTE: [ben] also automatically implements abci.Application, // undesired but unharmful -// var _ tmsp.Application = (*ErisMint)(nil) +// var _ abci.Application = (*ErisMint)(nil) func (app *ErisMint) GetState() *sm.State { app.mtx.Lock() @@ -74,7 +74,7 @@ func (app *ErisMint) GetCheckCache() *sm.BlockCache { return app.checkCache } -func NewErisMint(s *sm.State, evsw *tendermint_events.EventSwitch, logger loggers.InfoTraceLogger) *ErisMint { +func NewErisMint(s *sm.State, evsw tendermint_events.EventSwitch, logger loggers.InfoTraceLogger) *ErisMint { return &ErisMint{ state: s, cache: sm.NewBlockCache(s), @@ -86,8 +86,8 @@ func NewErisMint(s *sm.State, evsw *tendermint_events.EventSwitch, logger logger } // Implements manager/types.Application -func (app *ErisMint) Info() (info string) { - return "ErisDB" +func (app *ErisMint) Info() (info abci.ResponseInfo) { + return abci.ResponseInfo{} } // Implements manager/types.Application @@ -96,7 +96,7 @@ func (app *ErisMint) SetOption(key string, value string) (log string) { } // Implements manager/types.Application -func (app *ErisMint) AppendTx(txBytes []byte) tmsp.Result { +func (app *ErisMint) DeliverTx(txBytes []byte) abci.Result { app.nTxs += 1 // XXX: if we had tx ids we could cache the decoded txs on CheckTx @@ -106,45 +106,45 @@ func (app *ErisMint) AppendTx(txBytes []byte) tmsp.Result { buf := bytes.NewBuffer(txBytes) wire.ReadBinaryPtr(tx, buf, len(txBytes), &n, &err) if err != nil { - return tmsp.NewError(tmsp.CodeType_EncodingError, fmt.Sprintf("Encoding error: %v", err)) + return abci.NewError(abci.CodeType_EncodingError, fmt.Sprintf("Encoding error: %v", err)) } err = sm.ExecTx(app.cache, *tx, true, app.evc) if err != nil { - return tmsp.NewError(tmsp.CodeType_InternalError, fmt.Sprintf("Internal error: %v", err)) + return abci.NewError(abci.CodeType_InternalError, fmt.Sprintf("Internal error: %v", err)) } receipt := txs.GenerateReceipt(app.state.ChainID, *tx) receiptBytes := wire.BinaryBytes(receipt) - return tmsp.NewResultOK(receiptBytes, "Success") + return abci.NewResultOK(receiptBytes, "Success") } // Implements manager/types.Application -func (app *ErisMint) CheckTx(txBytes []byte) tmsp.Result { +func (app *ErisMint) CheckTx(txBytes []byte) abci.Result { var n int var err error tx := new(txs.Tx) buf := bytes.NewBuffer(txBytes) wire.ReadBinaryPtr(tx, buf, len(txBytes), &n, &err) if err != nil { - return tmsp.NewError(tmsp.CodeType_EncodingError, fmt.Sprintf("Encoding error: %v", err)) + return abci.NewError(abci.CodeType_EncodingError, fmt.Sprintf("Encoding error: %v", err)) } - // TODO: map ExecTx errors to sensible TMSP error codes + // TODO: map ExecTx errors to sensible abci error codes err = sm.ExecTx(app.checkCache, *tx, false, nil) if err != nil { - return tmsp.NewError(tmsp.CodeType_InternalError, fmt.Sprintf("Internal error: %v", err)) + return abci.NewError(abci.CodeType_InternalError, fmt.Sprintf("Internal error: %v", err)) } receipt := txs.GenerateReceipt(app.state.ChainID, *tx) receiptBytes := wire.BinaryBytes(receipt) - return tmsp.NewResultOK(receiptBytes, "Success") + return abci.NewResultOK(receiptBytes, "Success") } // Implements manager/types.Application // Commit the state (called at end of block) // NOTE: CheckTx/AppendTx must not run concurrently with Commit - // the mempool should run during AppendTxs, but lock for Commit and Update -func (app *ErisMint) Commit() (res tmsp.Result) { +func (app *ErisMint) Commit() (res abci.Result) { app.mtx.Lock() // the lock protects app.state defer app.mtx.Unlock() @@ -175,10 +175,10 @@ func (app *ErisMint) Commit() (res tmsp.Result) { // MARMOT: appHash := app.state.Hash() fmt.Printf("\n\nMARMOT COMMIT: %X\n\n", appHash) - // return tmsp.NewResultOK(app.state.Hash(), "Success") - return tmsp.NewResultOK(appHash, "Success") + // return abci.NewResultOK(app.state.Hash(), "Success") + return abci.NewResultOK(appHash, "Success") } -func (app *ErisMint) Query(query []byte) (res tmsp.Result) { - return tmsp.NewResultOK(nil, "Success") +func (app *ErisMint) Query(query []byte) (res abci.Result) { + return abci.NewResultOK(nil, "Success") } diff --git a/manager/eris-mint/pipe.go b/manager/eris-mint/pipe.go index 014de6620..9fda3eb6c 100644 --- a/manager/eris-mint/pipe.go +++ b/manager/eris-mint/pipe.go @@ -20,13 +20,13 @@ import ( "bytes" "fmt" + abci_types "github.com/tendermint/abci/types" tm_common "github.com/tendermint/go-common" crypto "github.com/tendermint/go-crypto" db "github.com/tendermint/go-db" go_events "github.com/tendermint/go-events" wire "github.com/tendermint/go-wire" tm_types "github.com/tendermint/tendermint/types" - tmsp_types "github.com/tendermint/tmsp/types" "github.com/eris-ltd/eris-db/account" blockchain_types "github.com/eris-ltd/eris-db/blockchain/types" @@ -71,7 +71,7 @@ var _ definitions.Pipe = (*erisMintPipe)(nil) var _ definitions.TendermintPipe = (*erisMintPipe)(nil) func NewErisMintPipe(moduleConfig *config.ModuleConfig, - eventSwitch *go_events.EventSwitch, + eventSwitch go_events.EventSwitch, logger loggers.InfoTraceLogger) (*erisMintPipe, error) { startedState, genesisDoc, err := startState(moduleConfig.DataDir, @@ -144,8 +144,8 @@ func NewErisMintPipe(moduleConfig *config.ModuleConfig, func startState(dataDir, backend, genesisFile, chainId string) (*state.State, *genesis.GenesisDoc, error) { // avoid Tendermints PanicSanity and return a clean error - if backend != db.DBBackendMemDB && - backend != db.DBBackendLevelDB { + if backend != db.MemDBBackendStr && + backend != db.LevelDBBackendStr { return nil, nil, fmt.Errorf("Database backend %s is not supported by %s", backend, GetErisMintVersion) } @@ -534,7 +534,7 @@ func (pipe *erisMintPipe) ListNames() (*rpc_tm_types.ResultListNames, error) { } func (pipe *erisMintPipe) broadcastTx(tx txs.Tx, - callback func(res *tmsp_types.Response)) (*rpc_tm_types.ResultBroadcastTx, error) { + callback func(res *abci_types.Response)) (*rpc_tm_types.ResultBroadcastTx, error) { txBytes, err := txs.EncodeTx(tx) if err != nil { @@ -554,9 +554,9 @@ func (pipe *erisMintPipe) BroadcastTxAsync(tx txs.Tx) (*rpc_tm_types.ResultBroad } func (pipe *erisMintPipe) BroadcastTxSync(tx txs.Tx) (*rpc_tm_types.ResultBroadcastTx, error) { - responseChannel := make(chan *tmsp_types.Response, 1) + responseChannel := make(chan *abci_types.Response, 1) _, err := pipe.broadcastTx(tx, - func(res *tmsp_types.Response) { + func(res *abci_types.Response) { responseChannel <- res }) if err != nil { @@ -564,7 +564,7 @@ func (pipe *erisMintPipe) BroadcastTxSync(tx txs.Tx) (*rpc_tm_types.ResultBroadc } // NOTE: [ben] This Response is set in /consensus/tendermint/local_client.go // a call to Application, here implemented by ErisMint, over local callback, - // or TMSP RPC call. Hence the result is determined by ErisMint/erismint.go + // or abci RPC call. Hence the result is determined by ErisMint/erismint.go // CheckTx() Result (Result converted to ReqRes into Response returned here) // NOTE: [ben] BroadcastTx just calls CheckTx in Tendermint (oddly... [Silas]) response := <-responseChannel @@ -578,17 +578,17 @@ func (pipe *erisMintPipe) BroadcastTxSync(tx txs.Tx) (*rpc_tm_types.ResultBroadc Log: responseCheckTx.Log, } switch responseCheckTx.Code { - case tmsp_types.CodeType_OK: + case abci_types.CodeType_OK: return resultBroadCastTx, nil - case tmsp_types.CodeType_EncodingError: + case abci_types.CodeType_EncodingError: return resultBroadCastTx, fmt.Errorf(resultBroadCastTx.Log) - case tmsp_types.CodeType_InternalError: + case abci_types.CodeType_InternalError: return resultBroadCastTx, fmt.Errorf(resultBroadCastTx.Log) default: logging.InfoMsg(pipe.logger, "Unknown error returned from Tendermint CheckTx on BroadcastTxSync", "application", GetErisMintVersion().GetVersionString(), - "TMSP_code_type", responseCheckTx.Code, - "TMSP_log", responseCheckTx.Log, + "abci_code_type", responseCheckTx.Code, + "abci_log", responseCheckTx.Log, ) return resultBroadCastTx, fmt.Errorf("Unknown error returned: " + responseCheckTx.Log) } diff --git a/manager/eris-mint/version.go b/manager/eris-mint/version.go index ad15d4a34..e6ca9a4c2 100644 --- a/manager/eris-mint/version.go +++ b/manager/eris-mint/version.go @@ -36,8 +36,7 @@ const ( // Define the compatible consensus engines this application manager // is compatible and has been tested with. var compatibleConsensus = [...]string{ - "tendermint-0.6", - // "tmsp-0.6", + "tendermint-0.8", } func GetErisMintVersion() *version.VersionIdentifier { diff --git a/manager/manager.go b/manager/manager.go index 6f71aefa9..9251aeed5 100644 --- a/manager/manager.go +++ b/manager/manager.go @@ -36,7 +36,7 @@ import ( // of an application. It is feasible this will be insufficient to support // different types of applications later down the line. func NewApplicationPipe(moduleConfig *config.ModuleConfig, - evsw *events.EventSwitch, logger loggers.InfoTraceLogger, + evsw events.EventSwitch, logger loggers.InfoTraceLogger, consensusMinorVersion string) (definitions.Pipe, error) { switch moduleConfig.Name { diff --git a/manager/types/application.go b/manager/types/application.go index cfcf2b82c..3ab29f6d4 100644 --- a/manager/types/application.go +++ b/manager/types/application.go @@ -17,10 +17,10 @@ package types import ( - // TODO: [ben] this is currently only used for tmsp result type; but should - // be removed as tmsp dependencies shouldn't feature in the application + // TODO: [ben] this is currently only used for abci result type; but should + // be removed as abci dependencies shouldn't feature in the application // manager - tmsp_types "github.com/tendermint/tmsp/types" + abci_types "github.com/tendermint/abci/types" ) // NOTE: [ben] this interface is likely to be changed. Currently it is taken @@ -32,16 +32,16 @@ type Application interface { // Info returns application information as a string // NOTE: [ben] likely to move - Info() (info string) + Info() (info abci_types.ResponseInfo) // Set application option (e.g. mode=mempool, mode=consensus) // NOTE: [ben] taken from tendermint, but it is unclear what the use is, - // specifically, when will tendermint call this over tmsp ? + // specifically, when will tendermint call this over abci ? SetOption(key string, value string) (log string) // Append transaction applies a transaction to the state regardless of // whether the transaction is valid or not. - // Currently AppendTx is taken from tmsp, and returns a result. + // Currently AppendTx is taken from abci, and returns a result. // This will be altered, as AppendTransaction needs to more strongly reflect // the theoretical logic: // Append(StateN, Transaction) = StateN+1 @@ -51,18 +51,18 @@ type Application interface { // TODO: implementation notes: // 1. at this point the transaction should already be strongly typed // 2. - AppendTx(tx []byte) tmsp_types.Result + DeliverTx(tx []byte) abci_types.Result // Check Transaction validates a transaction before being allowed into the // consensus' engine memory pool. This is the original defintion and - // intention as taken from tmsp, but should be remapped to the more + // intention as taken from abci, but should be remapped to the more // general concept of basic, cheap verification; // Check Transaction does not alter the state, but does require an immutable // copy of the state. In particular there is no consensus on ordering yet. // TODO: implementation notes: // 1. at this point the transaction should already be strongly typed // 2. - CheckTx(tx []byte) tmsp_types.Result + CheckTx(tx []byte) abci_types.Result // Commit returns the root hash of the current application state // NOTE: [ben] Because the concept of the block has been erased here @@ -70,14 +70,14 @@ type Application interface { // the opposit the principle of explicit stateless functions. // This will be amended when we introduce the concept of (streaming) // blocks in the pipe. - Commit() tmsp_types.Result + Commit() abci_types.Result // Query for state. This query request is not passed over the p2p network // and is called from Tendermint rpc directly up to the application. // NOTE: [ben] Eris-DB will give preference to queries from the local client // directly over the Eris-DB rpc. // We will support this for Tendermint compatibility. - Query(query []byte) tmsp_types.Result + Query(query []byte) abci_types.Result } // Tendermint has a separate interface for reintroduction of blocks @@ -85,7 +85,7 @@ type BlockchainAware interface { // Initialise the blockchain // validators: genesis validators from tendermint core - InitChain(validators []*tmsp_types.Validator) + InitChain(validators []*abci_types.Validator) // Signals the beginning of a block; // NOTE: [ben] currently not supported by tendermint @@ -95,5 +95,5 @@ type BlockchainAware interface { // validators: changed validators from app to Tendermint // NOTE: [ben] currently not supported by tendermint // not yet well defined what the change set contains. - EndBlock(height uint64) (validators []*tmsp_types.Validator) + EndBlock(height uint64) (validators []*abci_types.Validator) } diff --git a/rpc/tendermint/core/types/responses.go b/rpc/tendermint/core/types/responses.go index 98b72fbbd..87d9eeafc 100644 --- a/rpc/tendermint/core/types/responses.go +++ b/rpc/tendermint/core/types/responses.go @@ -12,7 +12,7 @@ import ( "github.com/tendermint/go-p2p" "github.com/tendermint/go-rpc/types" "github.com/tendermint/go-wire" - tmsptypes "github.com/tendermint/tmsp/types" + abcitypes "github.com/tendermint/abci/types" ) type ResultGetStorage struct { @@ -111,7 +111,7 @@ type ResultGetAccount struct { } type ResultBroadcastTx struct { - Code tmsptypes.CodeType `json:"code"` + Code abcitypes.CodeType `json:"code"` Data []byte `json:"data"` Log string `json:"log"` } diff --git a/rpc/tendermint/core/websocket.go b/rpc/tendermint/core/websocket.go index 6824b78e0..846ddfdc2 100644 --- a/rpc/tendermint/core/websocket.go +++ b/rpc/tendermint/core/websocket.go @@ -35,7 +35,7 @@ type TendermintWebsocketServer struct { } func NewTendermintWebsocketServer(config *server.ServerConfig, - tendermintPipe definitions.TendermintPipe, evsw *events.EventSwitch) ( + tendermintPipe definitions.TendermintPipe, evsw events.EventSwitch) ( *TendermintWebsocketServer, error) { if tendermintPipe == nil { diff --git a/rpc/tendermint/test/config.go b/rpc/tendermint/test/config.go index fcf964bbf..ee5bd5a20 100644 --- a/rpc/tendermint/test/config.go +++ b/rpc/tendermint/test/config.go @@ -40,12 +40,12 @@ genesis_file = "genesis.json" [chain.consensus] # consensus defines the module to use for consensus and # this will define the peer-to-peer consensus network; - # accepted values are "noops", "tmsp", "tendermint" + # accepted values are "noops", "abci", "tendermint" name = "tendermint" # version is the major and minor semantic version; # the version will be asserted on major_version = 0 - minor_version = 6 + minor_version = 8 # relative path to consensus' module root folder relative_root = "tendermint" @@ -123,21 +123,19 @@ genesis_file = "genesis.json" ################################################################################ ## -## Tendermint Socket Protocol (TMSP) -## version 0.6.0 +## Tendermint Socket Protocol (abci) ## -## TMSP expects a tendermint consensus process to run and connect to Eris-DB +## abci expects a tendermint consensus process to run and connect to Eris-DB ## ################################################################################ -[tmsp] +[abci] # listener address for accepting tendermint socket protocol connections listener = "tcp://0.0.0.0:46658" ################################################################################ -## +##yeah we had partial support for that with TMSP ## Tendermint -## version 0.6.0 ## ## in-process execution of Tendermint consensus engine ## @@ -174,7 +172,7 @@ private_validator_file = "priv_validator.json" # NOTE: value is ignored when run in-process as RPC is # handled by [servers.tendermint] rpc_laddr = "" - # proxy application address - used for tmsp connections, + # proxy application address - used for abci connections, # and this port should not be exposed for in-process Tendermint proxy_app = "tcp://127.0.0.1:46658" diff --git a/rpc/tendermint/test/rpc_client_test.go b/rpc/tendermint/test/rpc_client_test.go index 7183f2df8..ba5f472a0 100644 --- a/rpc/tendermint/test/rpc_client_test.go +++ b/rpc/tendermint/test/rpc_client_test.go @@ -295,7 +295,7 @@ func TestBlockchainInfo(t *testing.T) { lastBlockHash := resp.BlockMetas[nBlocks-1].Hash for i := nBlocks - 2; i >= 0; i-- { - assert.Equal(t, lastBlockHash, resp.BlockMetas[i].Header.LastBlockHash, + assert.Equal(t, lastBlockHash, resp.BlockMetas[i].Header.LastCommitHash, "Blockchain should be a hash tree!") lastBlockHash = resp.BlockMetas[i].Hash } diff --git a/test/mock/pipe.go b/test/mock/pipe.go index ecd245ec8..cfa192c9c 100644 --- a/test/mock/pipe.go +++ b/test/mock/pipe.go @@ -18,7 +18,7 @@ import ( "github.com/tendermint/go-crypto" "github.com/tendermint/go-p2p" mintTypes "github.com/tendermint/tendermint/types" - tmsp_types "github.com/tendermint/tmsp/types" + abci_types "github.com/tendermint/abci/types" ) // Base struct. @@ -165,7 +165,7 @@ type consensusEngine struct { } func (cons *consensusEngine) BroadcastTransaction(transaction []byte, - callback func(*tmsp_types.Response)) error { + callback func(*abci_types.Response)) error { return nil } From 43f2647f31f8ae69bfb8f9e6b63c42a3b5326e8c Mon Sep 17 00:00:00 2001 From: Silas Davis Date: Wed, 22 Feb 2017 23:21:42 +0000 Subject: [PATCH 06/10] Remove integration tag WIP --- rpc/tendermint/test/common.go | 1 - rpc/tendermint/test/common_test.go | 1 - rpc/tendermint/test/rpc_client_test.go | 1 - rpc/tendermint/test/websocket_client_test.go | 1 - 4 files changed, 4 deletions(-) diff --git a/rpc/tendermint/test/common.go b/rpc/tendermint/test/common.go index fa16978da..3f3dc1992 100644 --- a/rpc/tendermint/test/common.go +++ b/rpc/tendermint/test/common.go @@ -1,4 +1,3 @@ -// +build integration // Space above here matters // Copyright 2017 Monax Industries Limited diff --git a/rpc/tendermint/test/common_test.go b/rpc/tendermint/test/common_test.go index 5b2a1455c..0ffdc1bf2 100644 --- a/rpc/tendermint/test/common_test.go +++ b/rpc/tendermint/test/common_test.go @@ -1,4 +1,3 @@ -// +build integration // Space above here matters // Copyright 2017 Monax Industries Limited diff --git a/rpc/tendermint/test/rpc_client_test.go b/rpc/tendermint/test/rpc_client_test.go index ed75ff02a..7f5e9f8e7 100644 --- a/rpc/tendermint/test/rpc_client_test.go +++ b/rpc/tendermint/test/rpc_client_test.go @@ -1,4 +1,3 @@ -// +build integration // Space above here matters // Copyright 2017 Monax Industries Limited diff --git a/rpc/tendermint/test/websocket_client_test.go b/rpc/tendermint/test/websocket_client_test.go index 5f799041f..da0771ff9 100644 --- a/rpc/tendermint/test/websocket_client_test.go +++ b/rpc/tendermint/test/websocket_client_test.go @@ -1,4 +1,3 @@ -// +build integration // Space above here matters // Copyright 2017 Monax Industries Limited From 4626fa2ddab44c67b68328f938797dd8c07405ba Mon Sep 17 00:00:00 2001 From: Silas Davis Date: Thu, 23 Feb 2017 22:36:04 +0000 Subject: [PATCH 07/10] Update config for 0.8.0 --- consensus/tendermint/config.go | 18 +++++++++++++++--- rpc/tendermint/test/common_test.go | 1 + rpc/tendermint/test/rpc_client_test.go | 1 + rpc/tendermint/test/websocket_client_test.go | 1 + util/snatives/templates/solidity_templates.go | 4 +--- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/consensus/tendermint/config.go b/consensus/tendermint/config.go index c55115f72..4d9fe8415 100644 --- a/consensus/tendermint/config.go +++ b/consensus/tendermint/config.go @@ -51,6 +51,11 @@ func GetTendermintConfig(loadedConfig *viper.Viper) *TendermintConfig { //------------------------------------------------------------------------------ // Tendermint defaults +// +// Contract +// + + func (tmintConfig *TendermintConfig) AssertTendermintDefaults(chainId, workDir, dataDir, rootDir string) { @@ -64,6 +69,8 @@ func (tmintConfig *TendermintConfig) AssertTendermintDefaults(chainId, workDir, tmintConfig.SetDefault("fast_sync", true) tmintConfig.SetDefault("skip_upnp", false) tmintConfig.SetDefault("addrbook_file", path.Join(rootDir, "addrbook.json")) + tmintConfig.SetDefault("addrbook_strict", true) // disable to allow connections locally + tmintConfig.SetDefault("pex_reactor", false) // enable for peer exchange tmintConfig.SetDefault("priv_validator_file", path.Join(rootDir, "priv_validator.json")) tmintConfig.SetDefault("db_backend", "leveldb") tmintConfig.SetDefault("db_dir", dataDir) @@ -71,10 +78,12 @@ func (tmintConfig *TendermintConfig) AssertTendermintDefaults(chainId, workDir, tmintConfig.SetDefault("rpc_laddr", "") tmintConfig.SetDefault("prof_laddr", "") tmintConfig.SetDefault("revision_file", path.Join(workDir, "revision")) - tmintConfig.SetDefault("cswal", path.Join(dataDir, "cswal")) - tmintConfig.SetDefault("cswal_light", false) + tmintConfig.SetDefault("cs_wal_dir", path.Join(dataDir,"cs.wal")) + tmintConfig.SetDefault("cs_wal_light", false) + tmintConfig.SetDefault("filter_peers", false) - tmintConfig.SetDefault("block_size", 10000) + tmintConfig.SetDefault("block_size", 10000) // max number of txs + tmintConfig.SetDefault("block_part_size", 65536) // part size 64K tmintConfig.SetDefault("disable_data_hash", false) tmintConfig.SetDefault("timeout_propose", 3000) tmintConfig.SetDefault("timeout_propose_delta", 500) @@ -83,9 +92,12 @@ func (tmintConfig *TendermintConfig) AssertTendermintDefaults(chainId, workDir, tmintConfig.SetDefault("timeout_precommit", 1000) tmintConfig.SetDefault("timeout_precommit_delta", 500) tmintConfig.SetDefault("timeout_commit", 1000) + // make progress asap (no `timeout_commit`) on full precommit votes + tmintConfig.SetDefault("skip_timeout_commit", false) tmintConfig.SetDefault("mempool_recheck", true) tmintConfig.SetDefault("mempool_recheck_empty", true) tmintConfig.SetDefault("mempool_broadcast", true) + tmintConfig.SetDefault("mempool_wal_dir", path.Join(dataDir, "mempool.wal")) } //------------------------------------------------------------------------------ diff --git a/rpc/tendermint/test/common_test.go b/rpc/tendermint/test/common_test.go index 0ffdc1bf2..5b2a1455c 100644 --- a/rpc/tendermint/test/common_test.go +++ b/rpc/tendermint/test/common_test.go @@ -1,3 +1,4 @@ +// +build integration // Space above here matters // Copyright 2017 Monax Industries Limited diff --git a/rpc/tendermint/test/rpc_client_test.go b/rpc/tendermint/test/rpc_client_test.go index 7f5e9f8e7..ed75ff02a 100644 --- a/rpc/tendermint/test/rpc_client_test.go +++ b/rpc/tendermint/test/rpc_client_test.go @@ -1,3 +1,4 @@ +// +build integration // Space above here matters // Copyright 2017 Monax Industries Limited diff --git a/rpc/tendermint/test/websocket_client_test.go b/rpc/tendermint/test/websocket_client_test.go index da0771ff9..5f799041f 100644 --- a/rpc/tendermint/test/websocket_client_test.go +++ b/rpc/tendermint/test/websocket_client_test.go @@ -1,3 +1,4 @@ +// +build integration // Space above here matters // Copyright 2017 Monax Industries Limited diff --git a/util/snatives/templates/solidity_templates.go b/util/snatives/templates/solidity_templates.go index cc6cabd2d..eda2c5558 100644 --- a/util/snatives/templates/solidity_templates.go +++ b/util/snatives/templates/solidity_templates.go @@ -157,12 +157,10 @@ func (function *solidityFunction) solidity(indentLevel uint) (string, error) { return buf.String(), nil } - // -// Contract +// Utility // - func comment(comment string) string { commentLines := make([]string, 0, 5) for _, line := range strings.Split(comment, "\n") { From 072af537211a461b01b225cd687a6226ebdc51e8 Mon Sep 17 00:00:00 2001 From: Benjamin Bollen Date: Fri, 24 Feb 2017 12:07:53 +0100 Subject: [PATCH 08/10] consensus, manager, rpc: fmt --- consensus/tendermint/config.go | 3 +-- consensus/types/consensus_engine.go | 2 +- manager/eris-mint/eris-mint.go | 2 +- manager/eris-mint/evm/snative.go | 4 ++-- manager/eris-mint/evm/snative_test.go | 2 +- rpc/tendermint/core/types/responses.go | 2 +- rpc/tendermint/test/common.go | 1 - test/mock/pipe.go | 2 +- 8 files changed, 8 insertions(+), 10 deletions(-) diff --git a/consensus/tendermint/config.go b/consensus/tendermint/config.go index 4d9fe8415..b8c89d241 100644 --- a/consensus/tendermint/config.go +++ b/consensus/tendermint/config.go @@ -55,7 +55,6 @@ func GetTendermintConfig(loadedConfig *viper.Viper) *TendermintConfig { // Contract // - func (tmintConfig *TendermintConfig) AssertTendermintDefaults(chainId, workDir, dataDir, rootDir string) { @@ -78,7 +77,7 @@ func (tmintConfig *TendermintConfig) AssertTendermintDefaults(chainId, workDir, tmintConfig.SetDefault("rpc_laddr", "") tmintConfig.SetDefault("prof_laddr", "") tmintConfig.SetDefault("revision_file", path.Join(workDir, "revision")) - tmintConfig.SetDefault("cs_wal_dir", path.Join(dataDir,"cs.wal")) + tmintConfig.SetDefault("cs_wal_dir", path.Join(dataDir, "cs.wal")) tmintConfig.SetDefault("cs_wal_light", false) tmintConfig.SetDefault("filter_peers", false) diff --git a/consensus/types/consensus_engine.go b/consensus/types/consensus_engine.go index 78abe9251..191bc6e4c 100644 --- a/consensus/types/consensus_engine.go +++ b/consensus/types/consensus_engine.go @@ -17,9 +17,9 @@ package types import ( "github.com/eris-ltd/eris-db/event" "github.com/eris-ltd/eris-db/txs" + abci_types "github.com/tendermint/abci/types" "github.com/tendermint/go-crypto" "github.com/tendermint/go-p2p" - abci_types "github.com/tendermint/abci/types" ) type ConsensusEngine interface { diff --git a/manager/eris-mint/eris-mint.go b/manager/eris-mint/eris-mint.go index c0071df3b..9ba184418 100644 --- a/manager/eris-mint/eris-mint.go +++ b/manager/eris-mint/eris-mint.go @@ -20,9 +20,9 @@ import ( "sync" "time" + abci "github.com/tendermint/abci/types" tendermint_events "github.com/tendermint/go-events" wire "github.com/tendermint/go-wire" - abci "github.com/tendermint/abci/types" "github.com/eris-ltd/eris-db/logging" "github.com/eris-ltd/eris-db/logging/loggers" diff --git a/manager/eris-mint/evm/snative.go b/manager/eris-mint/evm/snative.go index c03d2bcd7..b30858109 100644 --- a/manager/eris-mint/evm/snative.go +++ b/manager/eris-mint/evm/snative.go @@ -190,8 +190,8 @@ func SNativeContracts() map[string]*SNativeContractDescription { if _, ok := contractMap[contract.Name]; ok { // If this happens we have a pseudo compile time error that will be caught // on native.go init() - panic(fmt.Errorf("Duplicate contract with name %s defined. " + - "Contract names must be unique.", contract.Name)) + panic(fmt.Errorf("Duplicate contract with name %s defined. "+ + "Contract names must be unique.", contract.Name)) } contractMap[contract.Name] = contract } diff --git a/manager/eris-mint/evm/snative_test.go b/manager/eris-mint/evm/snative_test.go index da0572b45..a60b62e15 100644 --- a/manager/eris-mint/evm/snative_test.go +++ b/manager/eris-mint/evm/snative_test.go @@ -20,12 +20,12 @@ import ( "strings" + "github.com/eris-ltd/eris-db/manager/eris-mint/evm/abi" . "github.com/eris-ltd/eris-db/manager/eris-mint/evm/opcodes" "github.com/eris-ltd/eris-db/manager/eris-mint/evm/sha3" ptypes "github.com/eris-ltd/eris-db/permission/types" . "github.com/eris-ltd/eris-db/word256" "github.com/stretchr/testify/assert" - "github.com/eris-ltd/eris-db/manager/eris-mint/evm/abi" ) // Compiling the Permissions solidity contract at diff --git a/rpc/tendermint/core/types/responses.go b/rpc/tendermint/core/types/responses.go index f5f7c8a30..220ace4b4 100644 --- a/rpc/tendermint/core/types/responses.go +++ b/rpc/tendermint/core/types/responses.go @@ -22,11 +22,11 @@ import ( tendermint_types "github.com/tendermint/tendermint/types" consensus_types "github.com/eris-ltd/eris-db/consensus/types" + abcitypes "github.com/tendermint/abci/types" "github.com/tendermint/go-crypto" "github.com/tendermint/go-p2p" "github.com/tendermint/go-rpc/types" "github.com/tendermint/go-wire" - abcitypes "github.com/tendermint/abci/types" ) type ResultGetStorage struct { diff --git a/rpc/tendermint/test/common.go b/rpc/tendermint/test/common.go index 3f3dc1992..8151401f6 100644 --- a/rpc/tendermint/test/common.go +++ b/rpc/tendermint/test/common.go @@ -1,4 +1,3 @@ - // Space above here matters // Copyright 2017 Monax Industries Limited // diff --git a/test/mock/pipe.go b/test/mock/pipe.go index 51f9ce366..c3c1f3355 100644 --- a/test/mock/pipe.go +++ b/test/mock/pipe.go @@ -29,10 +29,10 @@ import ( "github.com/eris-ltd/eris-db/txs" "github.com/eris-ltd/eris-db/logging/loggers" + abci_types "github.com/tendermint/abci/types" "github.com/tendermint/go-crypto" "github.com/tendermint/go-p2p" mintTypes "github.com/tendermint/tendermint/types" - abci_types "github.com/tendermint/abci/types" ) // Base struct. From 0684d6d014ae880a6d45cdf21fecf0ac9368653b Mon Sep 17 00:00:00 2001 From: Benjamin Bollen Date: Fri, 24 Feb 2017 18:30:14 +0100 Subject: [PATCH 09/10] rpc/tendermint: fix TestBlockchainInfo as block metadata has restructured on tendermint 0.8 --- rpc/tendermint/test/rpc_client_test.go | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/rpc/tendermint/test/rpc_client_test.go b/rpc/tendermint/test/rpc_client_test.go index ed75ff02a..d53ff9d71 100644 --- a/rpc/tendermint/test/rpc_client_test.go +++ b/rpc/tendermint/test/rpc_client_test.go @@ -292,6 +292,8 @@ func TestNameReg(t *testing.T) { func TestBlockchainInfo(t *testing.T) { wsc := newWSClient() testWithAllClients(t, func(t *testing.T, clientName string, client rpcclient.Client) { + // wait a mimimal number of blocks to ensure that the later query for block + // headers has a non-trivial length nBlocks := 4 waitNBlocks(t, wsc, nBlocks) @@ -299,20 +301,25 @@ func TestBlockchainInfo(t *testing.T) { if err != nil { t.Fatalf("Failed to get blockchain info: %v", err) } - //TODO: [Silas] reintroduce this when Tendermint changes logic to fire - // NewBlock after saving a block - // see https://github.com/tendermint/tendermint/issues/273 - //assert.Equal(t, 4, resp.LastHeight, "Last height should be 4 after waiting for first 4 blocks") + lastBlockHeight := resp.LastHeight + nMetaBlocks := len(resp.BlockMetas) + assert.True(t, nMetaBlocks <= lastBlockHeight, + "Logically number of block metas should be equal or less than block height.") assert.True(t, nBlocks <= len(resp.BlockMetas), - "Should see at least 4 BlockMetas after waiting for first 4 blocks") - - lastBlockHash := resp.BlockMetas[nBlocks-1].Hash - for i := nBlocks - 2; i >= 0; i-- { - assert.Equal(t, lastBlockHash, resp.BlockMetas[i].Header.LastCommitHash, + "Should see at least 4 BlockMetas after waiting for 4 blocks") + // For the maximum number (default to 20) of retrieved block headers, + // check that they correctly chain to each other. + lastBlockHash := resp.BlockMetas[nMetaBlocks-1].Hash + for i := nMetaBlocks - 2; i >= 0; i-- { + // the blockhash in header of height h should be identical to the hash + // in the LastBlockID of the header of block height h+1. + assert.Equal(t, lastBlockHash, resp.BlockMetas[i].Header.LastBlockID.Hash, "Blockchain should be a hash tree!") lastBlockHash = resp.BlockMetas[i].Hash } + // Now retrieve only two blockheaders (h=1, and h=2) and check that we got + // two results. resp, err = edbcli.BlockchainInfo(client, 1, 2) assert.NoError(t, err) assert.Equal(t, 2, len(resp.BlockMetas), From 8af5ac097832fe954d2a4e2936a117ee923760d3 Mon Sep 17 00:00:00 2001 From: Benjamin Bollen Date: Fri, 24 Feb 2017 19:05:39 +0100 Subject: [PATCH 10/10] version: rewind - this is still on 0.16.0 --- version/version.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version/version.go b/version/version.go index 200259900..103c787d1 100644 --- a/version/version.go +++ b/version/version.go @@ -32,7 +32,7 @@ const ( // Minor version component of the current release erisVersionMinor = 16 // Patch version component of the current release - erisVersionPatch = 1 + erisVersionPatch = 0 ) var erisVersion *VersionIdentifier @@ -127,4 +127,4 @@ func (version *VersionIdentifier) MatchesMinorVersion( // IMPORTANT: Eris-DB version must be on the last line of this file for // the deployment script tests/build_tool.sh to pick up the right label. -const VERSION = "0.16.1" +const VERSION = "0.16.0"