From b4bf014327d2cf493084d9d4b682e7c8c662645b Mon Sep 17 00:00:00 2001
From: Ethan Buchman <ethan@coinculture.info>
Date: Sun, 14 Feb 2016 16:15:13 -0500
Subject: [PATCH] fix some tests

---
 erisdb/erisdbss/http.go            |  6 +--
 erisdb/erisdbss/server_manager.go  |  8 ++--
 erisdb/event_cache_test.go         |  3 +-
 erisdb/pipe/consensus.go           | 20 ++++++----
 erisdb/serve.go                    | 10 ++---
 evm/test/log_event_test.go         |  6 +--
 evm/test/vm_test.go                |  8 ++--
 state/state.go                     | 62 +++++++++++++++---------------
 test/mock/mock_web_api_test.go     | 21 +++++-----
 test/mock/pipe.go                  | 23 +++++------
 test/testdata/testdata/testdata.go | 39 ++++++++++---------
 txs/names.go                       |  6 +++
 txs/tx.go                          | 10 ++---
 txs/tx_test.go                     | 12 +++---
 14 files changed, 126 insertions(+), 108 deletions(-)

diff --git a/erisdb/erisdbss/http.go b/erisdb/erisdbss/http.go
index 90661e77..40f6c6a4 100644
--- a/erisdb/erisdbss/http.go
+++ b/erisdb/erisdbss/http.go
@@ -3,12 +3,12 @@ package erisdbss
 import (
 	"bytes"
 	"encoding/json"
+	"github.com/eris-ltd/eris-db/server"
+	stypes "github.com/eris-ltd/eris-db/state/types"
 	"github.com/gin-gonic/gin"
 	. "github.com/tendermint/go-common"
 	"github.com/tendermint/go-wire"
 	"github.com/tendermint/tendermint/types"
-	"github.com/eris-ltd/eris-db/server"
-	stypes "github.com/eris-ltd/eris-db/state/types"
 	"net/http"
 	"os"
 )
@@ -63,7 +63,7 @@ type ServerServer struct {
 // Create a new ServerServer with the given base directory.
 func NewServerServer(baseDir string) *ServerServer {
 	os.RemoveAll(baseDir)
-	EnsureDir(baseDir)
+	EnsureDir(baseDir, 0777)
 	return &ServerServer{serverManager: NewServerManager(100, baseDir)}
 }
 
diff --git a/erisdb/erisdbss/server_manager.go b/erisdb/erisdbss/server_manager.go
index 42f5449f..6cb8c44f 100644
--- a/erisdb/erisdbss/server_manager.go
+++ b/erisdb/erisdbss/server_manager.go
@@ -3,10 +3,10 @@ package erisdbss
 import (
 	"bufio"
 	"fmt"
-	. "github.com/tendermint/go-common"
-	"github.com/tendermint/go-wire"
 	"github.com/eris-ltd/eris-db/files"
 	"github.com/eris-ltd/eris-db/server"
+	. "github.com/tendermint/go-common"
+	"github.com/tendermint/go-wire"
 	"os"
 	"os/exec"
 	"path"
@@ -224,7 +224,7 @@ func (this *ServerManager) createWorkDir(data *RequestData, config *server.Serve
 
 	workDir := path.Join(this.baseDir, folderName)
 	os.RemoveAll(workDir)
-	errED := EnsureDir(workDir)
+	errED := EnsureDir(workDir, 0777)
 	if errED != nil {
 		return "", errED
 	}
@@ -266,7 +266,7 @@ func (this *ServerManager) createWorkDir(data *RequestData, config *server.Serve
 
 // Used to write json files using tendermints binary package.
 func writeJSON(file string, v interface{}) error {
-	var n int64
+	var n int
 	var errW error
 	fo, errC := os.Create(file)
 	if errC != nil {
diff --git a/erisdb/event_cache_test.go b/erisdb/event_cache_test.go
index 72879e69..96d22660 100644
--- a/erisdb/event_cache_test.go
+++ b/erisdb/event_cache_test.go
@@ -8,6 +8,7 @@ import (
 	"time"
 
 	"github.com/stretchr/testify/assert"
+	"github.com/tendermint/go-events"
 	"github.com/tendermint/tendermint/types"
 )
 
@@ -47,7 +48,7 @@ func (this *mockEventEmitter) Subscribe(subId, eventId string, callback func(eve
 	go func() {
 		for {
 			if !me.shutdown {
-				me.f(events.EventDataNewBlock{})
+				me.f(types.EventDataNewBlock{})
 			} else {
 				return
 			}
diff --git a/erisdb/pipe/consensus.go b/erisdb/pipe/consensus.go
index 0e28643e..982a107b 100644
--- a/erisdb/pipe/consensus.go
+++ b/erisdb/pipe/consensus.go
@@ -29,14 +29,18 @@ func (this *consensus) Validators() (*ValidatorList, error) {
 
 	s := this.erisdbApp.GetState()
 	blockHeight = s.LastBlockHeight
-	s.BondedValidators.Iterate(func(index int, val *types.Validator) bool {
-		bondedValidators = append(bondedValidators, val)
-		return false
-	})
-	s.UnbondingValidators.Iterate(func(index int, val *types.Validator) bool {
-		unbondingValidators = append(unbondingValidators, val)
-		return false
-	})
+
+	// TODO: rpc
+
+	/*
+		s.BondedValidators.Iterate(func(index int, val *types.Validator) bool {
+			bondedValidators = append(bondedValidators, val)
+			return false
+		})
+		s.UnbondingValidators.Iterate(func(index int, val *types.Validator) bool {
+			unbondingValidators = append(unbondingValidators, val)
+			return false
+		})*/
 
 	return &ValidatorList{blockHeight, bondedValidators, unbondingValidators}, nil
 }
diff --git a/erisdb/serve.go b/erisdb/serve.go
index 5ca98370..6c9f5cb4 100644
--- a/erisdb/serve.go
+++ b/erisdb/serve.go
@@ -31,10 +31,10 @@ const TENDERMINT_VERSION = "0.5.0"
 var log = log15.New("module", "eris/erisdb_server")
 var tmConfig cfg.Config
 
-// This function returns a properly configured ErisDb server process with a running
-// tendermint node attached to it. To start listening for incoming requests, call
-// 'Start()' on the process. Make sure to register any start event listeners before
-// that.
+// This function returns a properly configured ErisDb server process,
+// with a tmsp listener for talking to tendermint core.
+// To start listening for incoming requests, call 'Start()' on the process.
+// Make sure to register any start event listeners first
 func ServeErisDB(workDir string) (*server.ServeProcess, error) {
 	log.Info("ErisDB Serve initializing.")
 	errEns := EnsureDir(workDir, 0777)
@@ -63,6 +63,7 @@ func ServeErisDB(workDir string) (*server.ServeProcess, error) {
 	}
 
 	// Get tendermint configuration
+	// TODO replace
 	tmConfig = tmcfg.GetConfig(workDir)
 	tmConfig.Set("version", TENDERMINT_VERSION)
 	cfg.ApplyConfig(tmConfig) // Notify modules of new config
@@ -118,7 +119,6 @@ func ServeErisDB(workDir string) (*server.ServeProcess, error) {
 	evtSubs := NewEventSubscriptions(pipe.Events())
 	// The services.
 	tmwss := NewErisDbWsService(codec, pipe)
-	//
 	tmjs := NewErisDbJsonService(codec, pipe, evtSubs)
 	// The servers.
 	jsonServer := NewJsonRpcServer(tmjs)
diff --git a/evm/test/log_event_test.go b/evm/test/log_event_test.go
index 6df305af..3bbe6156 100644
--- a/evm/test/log_event_test.go
+++ b/evm/test/log_event_test.go
@@ -5,10 +5,10 @@ import (
 	"reflect"
 	"testing"
 
+	. "github.com/eris-ltd/eris-db/evm"
+	"github.com/eris-ltd/eris-db/txs"
 	. "github.com/tendermint/go-common"
 	"github.com/tendermint/go-events"
-	"github.com/tendermint/tendermint/types"
-	. "github.com/eris-ltd/eris-db/evm"
 )
 
 var expectedData = []byte{0x10}
@@ -44,7 +44,7 @@ func TestLog4(t *testing.T) {
 
 	doneChan := make(chan struct{}, 1)
 
-	eventSwitch.AddListenerForEvent("test", eventID, func(event types.EventData) {
+	eventSwitch.AddListenerForEvent("test", eventID, func(event events.EventData) {
 		logEvent := event.(types.EventDataLog)
 		// No need to test address as this event would not happen if it wasn't correct
 		if !reflect.DeepEqual(logEvent.Topics, expectedTopics) {
diff --git a/evm/test/vm_test.go b/evm/test/vm_test.go
index f061aa6e..08181aba 100644
--- a/evm/test/vm_test.go
+++ b/evm/test/vm_test.go
@@ -8,11 +8,11 @@ import (
 	"testing"
 	"time"
 
-	. "github.com/tendermint/go-common"
-	"github.com/tendermint/go-events"
-	"github.com/tendermint/tendermint/types"
 	. "github.com/eris-ltd/eris-db/evm"
 	ptypes "github.com/eris-ltd/eris-db/permission/types"
+	"github.com/eris-ltd/eris-db/txs"
+	. "github.com/tendermint/go-common"
+	"github.com/tendermint/go-events"
 )
 
 func newAppState() *FakeAppState {
@@ -157,7 +157,7 @@ func runVMWaitEvents(t *testing.T, ourVm *VM, caller, callee *Account, subscribe
 	evsw.Start()
 	ch := make(chan interface{})
 	fmt.Printf("subscribe to %x\n", subscribeAddr)
-	evsw.AddListenerForEvent("test", types.EventStringAccCall(subscribeAddr), func(msg types.EventData) {
+	evsw.AddListenerForEvent("test", types.EventStringAccCall(subscribeAddr), func(msg events.EventData) {
 		ch <- msg
 	})
 	evc := events.NewEventCache(evsw)
diff --git a/state/state.go b/state/state.go
index 626c6aaf..aea7f949 100644
--- a/state/state.go
+++ b/state/state.go
@@ -33,18 +33,18 @@ var (
 
 // NOTE: not goroutine-safe.
 type State struct {
-	DB                   dbm.DB
-	ChainID              string
-	LastBlockHeight      int
-	LastBlockHash        []byte
-	LastBlockParts       types.PartSetHeader
-	LastBlockTime        time.Time
-	BondedValidators     *types.ValidatorSet
-	LastBondedValidators *types.ValidatorSet
-	UnbondingValidators  *types.ValidatorSet
-	accounts             merkle.Tree // Shouldn't be accessed directly.
-	validatorInfos       merkle.Tree // Shouldn't be accessed directly.
-	nameReg              merkle.Tree // Shouldn't be accessed directly.
+	DB              dbm.DB
+	ChainID         string
+	LastBlockHeight int
+	LastBlockHash   []byte
+	LastBlockParts  types.PartSetHeader
+	LastBlockTime   time.Time
+	//	BondedValidators     *types.ValidatorSet
+	//	LastBondedValidators *types.ValidatorSet
+	//	UnbondingValidators  *types.ValidatorSet
+	accounts       merkle.Tree // Shouldn't be accessed directly.
+	validatorInfos merkle.Tree // Shouldn't be accessed directly.
+	nameReg        merkle.Tree // Shouldn't be accessed directly.
 
 	evc events.Fireable // typically an events.EventCache
 }
@@ -61,9 +61,9 @@ func LoadState(db dbm.DB) *State {
 		s.LastBlockHash = wire.ReadByteSlice(r, maxLoadStateElementSize, n, err)
 		s.LastBlockParts = wire.ReadBinary(types.PartSetHeader{}, r, maxLoadStateElementSize, n, err).(types.PartSetHeader)
 		s.LastBlockTime = wire.ReadTime(r, n, err)
-		s.BondedValidators = wire.ReadBinary(&types.ValidatorSet{}, r, maxLoadStateElementSize, n, err).(*types.ValidatorSet)
-		s.LastBondedValidators = wire.ReadBinary(&types.ValidatorSet{}, r, maxLoadStateElementSize, n, err).(*types.ValidatorSet)
-		s.UnbondingValidators = wire.ReadBinary(&types.ValidatorSet{}, r, maxLoadStateElementSize, n, err).(*types.ValidatorSet)
+		// s.BondedValidators = wire.ReadBinary(&types.ValidatorSet{}, r, maxLoadStateElementSize, n, err).(*types.ValidatorSet)
+		// s.LastBondedValidators = wire.ReadBinary(&types.ValidatorSet{}, r, maxLoadStateElementSize, n, err).(*types.ValidatorSet)
+		// s.UnbondingValidators = wire.ReadBinary(&types.ValidatorSet{}, r, maxLoadStateElementSize, n, err).(*types.ValidatorSet)
 		accountsHash := wire.ReadByteSlice(r, maxLoadStateElementSize, n, err)
 		s.accounts = merkle.NewIAVLTree(defaultAccountsCacheCapacity, db)
 		s.accounts.Load(accountsHash)
@@ -92,9 +92,9 @@ func (s *State) Save() {
 	wire.WriteByteSlice(s.LastBlockHash, buf, n, err)
 	wire.WriteBinary(s.LastBlockParts, buf, n, err)
 	wire.WriteTime(s.LastBlockTime, buf, n, err)
-	wire.WriteBinary(s.BondedValidators, buf, n, err)
-	wire.WriteBinary(s.LastBondedValidators, buf, n, err)
-	wire.WriteBinary(s.UnbondingValidators, buf, n, err)
+	// wire.WriteBinary(s.BondedValidators, buf, n, err)
+	// wire.WriteBinary(s.LastBondedValidators, buf, n, err)
+	// wire.WriteBinary(s.UnbondingValidators, buf, n, err)
 	wire.WriteByteSlice(s.accounts.Hash(), buf, n, err)
 	//wire.WriteByteSlice(s.validatorInfos.Hash(), buf, n, err)
 	wire.WriteByteSlice(s.nameReg.Hash(), buf, n, err)
@@ -109,16 +109,16 @@ func (s *State) Save() {
 // as if State were copied by value.
 func (s *State) Copy() *State {
 	return &State{
-		DB:                   s.DB,
-		ChainID:              s.ChainID,
-		LastBlockHeight:      s.LastBlockHeight,
-		LastBlockHash:        s.LastBlockHash,
-		LastBlockParts:       s.LastBlockParts,
-		LastBlockTime:        s.LastBlockTime,
-		BondedValidators:     s.BondedValidators.Copy(),     // TODO remove need for Copy() here.
-		LastBondedValidators: s.LastBondedValidators.Copy(), // That is, make updates to the validator set
-		UnbondingValidators:  s.UnbondingValidators.Copy(),  // copy the valSet lazily.
-		accounts:             s.accounts.Copy(),
+		DB:              s.DB,
+		ChainID:         s.ChainID,
+		LastBlockHeight: s.LastBlockHeight,
+		LastBlockHash:   s.LastBlockHash,
+		LastBlockParts:  s.LastBlockParts,
+		LastBlockTime:   s.LastBlockTime,
+		// BondedValidators:     s.BondedValidators.Copy(),     // TODO remove need for Copy() here.
+		// LastBondedValidators: s.LastBondedValidators.Copy(), // That is, make updates to the validator set
+		// UnbondingValidators: s.UnbondingValidators.Copy(), // copy the valSet lazily.
+		accounts: s.accounts.Copy(),
 		//validatorInfos:       s.validatorInfos.Copy(),
 		nameReg: s.nameReg.Copy(),
 		evc:     nil,
@@ -128,9 +128,9 @@ func (s *State) Copy() *State {
 // Returns a hash that represents the state data, excluding Last*
 func (s *State) Hash() []byte {
 	return merkle.SimpleHashFromMap(map[string]interface{}{
-		"BondedValidators":    s.BondedValidators,
-		"UnbondingValidators": s.UnbondingValidators,
-		"Accounts":            s.accounts,
+		//"BondedValidators":    s.BondedValidators,
+		//"UnbondingValidators": s.UnbondingValidators,
+		"Accounts": s.accounts,
 		//"ValidatorInfos":      s.validatorInfos,
 		"NameRegistry": s.nameReg,
 	})
diff --git a/test/mock/mock_web_api_test.go b/test/mock/mock_web_api_test.go
index 985b7377..324bc1c8 100644
--- a/test/mock/mock_web_api_test.go
+++ b/test/mock/mock_web_api_test.go
@@ -4,22 +4,23 @@ package mock
 import (
 	"bytes"
 	"encoding/hex"
+	"net/http"
+	"os"
+	"runtime"
+	"testing"
+
 	// edb "github.com/eris-ltd/erisdb/erisdb"
-	"github.com/gin-gonic/gin"
-	"github.com/stretchr/testify/suite"
-	"github.com/tendermint/log15"
-	ctypes "github.com/tendermint/tendermint/rpc/core/types"
-	"github.com/tendermint/tendermint/types"
 	"github.com/eris-ltd/eris-db/account"
 	edb "github.com/eris-ltd/eris-db/erisdb"
 	ep "github.com/eris-ltd/eris-db/erisdb/pipe"
 	"github.com/eris-ltd/eris-db/rpc"
 	"github.com/eris-ltd/eris-db/server"
 	td "github.com/eris-ltd/eris-db/test/testdata/testdata"
-	"net/http"
-	"os"
-	"runtime"
-	"testing"
+	"github.com/eris-ltd/eris-db/txs"
+
+	"github.com/gin-gonic/gin"
+	"github.com/stretchr/testify/suite"
+	"github.com/tendermint/log15"
 )
 
 func init() {
@@ -180,7 +181,7 @@ func (this *MockSuite) TestGetNameRegEntry() {
 
 func (this *MockSuite) TestGetNameRegEntries() {
 	resp := this.get("/namereg")
-	ret := &ctypes.ResultListNames{}
+	ret := &ep.ResultListNames{}
 	errD := this.codec.Decode(ret, resp.Body)
 	this.NoError(errD)
 	this.Equal(ret, this.testData.GetNameRegEntries.Output)
diff --git a/test/mock/pipe.go b/test/mock/pipe.go
index 3ec3966d..4126e75f 100644
--- a/test/mock/pipe.go
+++ b/test/mock/pipe.go
@@ -1,12 +1,13 @@
 package mock
 
 import (
+	"github.com/eris-ltd/eris-db/account"
 	ep "github.com/eris-ltd/eris-db/erisdb/pipe"
 	td "github.com/eris-ltd/eris-db/test/testdata/testdata"
+	types "github.com/eris-ltd/eris-db/txs"
 
-	ctypes "github.com/tendermint/tendermint/rpc/core/types"
-	"github.com/tendermint/tendermint/types"
-	"github.com/eris-ltd/eris-db/account"
+	"github.com/tendermint/go-events"
+	mintTypes "github.com/tendermint/tendermint/types"
 )
 
 // Base struct.
@@ -26,7 +27,7 @@ func NewMockPipe(td *td.TestData) ep.Pipe {
 	accounts := &accounts{td}
 	blockchain := &blockchain{td}
 	consensus := &consensus{td}
-	events := &events{td}
+	eventer := &eventer{td}
 	namereg := &namereg{td}
 	net := &net{td}
 	transactor := &transactor{td}
@@ -35,7 +36,7 @@ func NewMockPipe(td *td.TestData) ep.Pipe {
 		accounts,
 		blockchain,
 		consensus,
-		events,
+		eventer,
 		namereg,
 		net,
 		transactor,
@@ -127,7 +128,7 @@ func (this *blockchain) LatestBlockHeight() (int, error) {
 	return this.testData.GetLatestBlockHeight.Output.Height, nil
 }
 
-func (this *blockchain) LatestBlock() (*types.Block, error) {
+func (this *blockchain) LatestBlock() (*mintTypes.Block, error) {
 	return this.testData.GetLatestBlock.Output, nil
 }
 
@@ -135,7 +136,7 @@ func (this *blockchain) Blocks([]*ep.FilterData) (*ep.Blocks, error) {
 	return this.testData.GetBlocks.Output, nil
 }
 
-func (this *blockchain) Block(height int) (*types.Block, error) {
+func (this *blockchain) Block(height int) (*mintTypes.Block, error) {
 	return this.testData.GetBlock.Output, nil
 }
 
@@ -153,15 +154,15 @@ func (this *consensus) Validators() (*ep.ValidatorList, error) {
 }
 
 // Events
-type events struct {
+type eventer struct {
 	testData *td.TestData
 }
 
-func (this *events) Subscribe(subId, event string, callback func(types.EventData)) (bool, error) {
+func (this *eventer) Subscribe(subId, event string, callback func(events.EventData)) (bool, error) {
 	return true, nil
 }
 
-func (this *events) Unsubscribe(subId string) (bool, error) {
+func (this *eventer) Unsubscribe(subId string) (bool, error) {
 	return true, nil
 }
 
@@ -174,7 +175,7 @@ func (this *namereg) Entry(key string) (*types.NameRegEntry, error) {
 	return this.testData.GetNameRegEntry.Output, nil
 }
 
-func (this *namereg) Entries(filters []*ep.FilterData) (*ctypes.ResultListNames, error) {
+func (this *namereg) Entries(filters []*ep.FilterData) (*ep.ResultListNames, error) {
 	return this.testData.GetNameRegEntries.Output, nil
 }
 
diff --git a/test/testdata/testdata/testdata.go b/test/testdata/testdata/testdata.go
index 01c25f6f..e1676692 100644
--- a/test/testdata/testdata/testdata.go
+++ b/test/testdata/testdata/testdata.go
@@ -2,11 +2,13 @@ package testdata
 
 import (
 	"github.com/eris-ltd/eris-db/account"
-	ctypes "github.com/tendermint/tendermint/rpc/core/types"
-	stypes "github.com/eris-ltd/eris-db/state/types"
-	"github.com/tendermint/tendermint/types"
 	edb "github.com/eris-ltd/eris-db/erisdb"
 	ep "github.com/eris-ltd/eris-db/erisdb/pipe"
+	stypes "github.com/eris-ltd/eris-db/state/types"
+	types "github.com/eris-ltd/eris-db/txs"
+
+	"github.com/tendermint/go-wire"
+	mintTypes "github.com/tendermint/tendermint/types"
 )
 
 var testDataJson = `{
@@ -51,10 +53,7 @@ var testDataJson = `{
       ],
       "validators": [
         {
-          "pub_key": [
-            1,
-            "CB3688B7561D488A2A4834E1AEE9398BEF94844D8BDBBCA980C11E3654A45906"
-          ],
+          "pub_key": "CB3688B7561D488A2A4834E1AEE9398BEF94844D8BDBBCA980C11E3654A45906",
           "amount": 5000000000,
           "unbond_to": [
             {
@@ -65,7 +64,7 @@ var testDataJson = `{
         }
       ]
     }
-  },
+  }
   "GetAccount": {
     "input": {
       "address": "9FC1ECFCAE2A554D4D1A000D0D80F748E66359E3"
@@ -515,8 +514,8 @@ var serverDuration uint = 100
 
 type (
 	ChainData struct {
-		PrivValidator *types.PrivValidator `json:"priv_validator"`
-		Genesis       *stypes.GenesisDoc   `json:"genesis"`
+		PrivValidator *mintTypes.PrivValidator `json:"priv_validator"`
+		Genesis       *stypes.GenesisDoc       `json:"genesis"`
 	}
 
 	GetAccountData struct {
@@ -560,12 +559,12 @@ type (
 	}
 
 	GetLatestBlockData struct {
-		Output *types.Block `json:"output"`
+		Output *mintTypes.Block `json:"output"`
 	}
 
 	GetBlockData struct {
 		Input  *edb.HeightParam `json:"input"`
-		Output *types.Block     `json:"output"`
+		Output *mintTypes.Block `json:"output"`
 	}
 
 	GetBlocksData struct {
@@ -655,8 +654,8 @@ type (
 	}
 
 	GetNameRegEntriesData struct {
-		Input  *edb.FilterListParam    `json:"input"`
-		Output *ctypes.ResultListNames `json:"output"`
+		Input  *edb.FilterListParam `json:"input"`
+		Output *ep.ResultListNames  `json:"output"`
 	}
 
 	/*
@@ -704,11 +703,15 @@ type (
 )
 
 func LoadTestData() *TestData {
-	codec := edb.NewTCodec()
-	testData := &TestData{}
-	err := codec.DecodeBytes(testData, []byte(testDataJson))
+	var err error
+	//codec := edb.NewTCodec()
+	testData := TestData{}
+	testDataI := wire.ReadJSON(testData, []byte(testDataJson), &err)
+	/*err := codec.DecodeBytes(testData, []byte(testDataJson))
+	 */
 	if err != nil {
 		panic(err)
 	}
-	return testData
+	testData = testDataI.(TestData)
+	return &testData
 }
diff --git a/txs/names.go b/txs/names.go
index 2f4c8ff8..7c170141 100644
--- a/txs/names.go
+++ b/txs/names.go
@@ -53,3 +53,9 @@ func (entry *NameRegEntry) Copy() *NameRegEntry {
 	entryCopy := *entry
 	return &entryCopy
 }
+
+// XXX: vestige of an older time
+type ResultListNames struct {
+	BlockHeight int             `json:"block_height"`
+	Names       []*NameRegEntry `json:"names"`
+}
diff --git a/txs/tx.go b/txs/tx.go
index a57928d3..b7a4414e 100644
--- a/txs/tx.go
+++ b/txs/tx.go
@@ -7,13 +7,13 @@ import (
 
 	"golang.org/x/crypto/ripemd160"
 
-	. "github.com/tendermint/go-common"
-	"github.com/tendermint/go-wire"
 	acm "github.com/eris-ltd/eris-db/account"
 	ptypes "github.com/eris-ltd/eris-db/permission/types"
+	. "github.com/tendermint/go-common"
+	"github.com/tendermint/go-wire"
 
-	"github.com/tendermint/tendermint/types" // votes for dupeout ..
 	"github.com/tendermint/go-crypto"
+	"github.com/tendermint/tendermint/types" // votes for dupeout ..
 )
 
 var (
@@ -257,7 +257,7 @@ func (tx *NameTx) String() string {
 //-----------------------------------------------------------------------------
 
 type BondTx struct {
-	PubKey    crypto.PubKeyEd25519    `json:"pub_key"`
+	PubKey    crypto.PubKeyEd25519    `json:"pub_key"` // NOTE: these don't have type byte
 	Signature crypto.SignatureEd25519 `json:"signature"`
 	Inputs    []*TxInput              `json:"inputs"`
 	UnbondTo  []*TxOutput             `json:"unbond_to"`
@@ -348,7 +348,7 @@ type PermissionsTx struct {
 func (tx *PermissionsTx) WriteSignBytes(chainID string, w io.Writer, n *int, err *error) {
 	wire.WriteTo([]byte(Fmt(`{"chain_id":%s`, jsonEscape(chainID))), w, n, err)
 	wire.WriteTo([]byte(Fmt(`,"tx":[%v,{"args":"`, TxTypePermissions)), w, n, err)
-	wire.WriteJSON(tx.PermArgs, w, n, err)
+	wire.WriteJSON(&tx.PermArgs, w, n, err)
 	wire.WriteTo([]byte(`","input":`), w, n, err)
 	tx.Input.WriteSignBytes(w, n, err)
 	wire.WriteTo([]byte(`}]}`), w, n, err)
diff --git a/txs/tx_test.go b/txs/tx_test.go
index 8e772b9a..f6edc028 100644
--- a/txs/tx_test.go
+++ b/txs/tx_test.go
@@ -3,10 +3,11 @@ package types
 import (
 	"testing"
 
-	. "github.com/tendermint/go-common"
-	_ "github.com/tendermint/tendermint/config/tendermint_test"
 	acm "github.com/eris-ltd/eris-db/account"
 	ptypes "github.com/eris-ltd/eris-db/permission/types"
+	. "github.com/tendermint/go-common"
+	"github.com/tendermint/go-crypto"
+	_ "github.com/tendermint/tendermint/config/tendermint_test"
 )
 
 var chainID string
@@ -94,7 +95,7 @@ func TestBondTxSignable(t *testing.T) {
 	privKeyBytes := make([]byte, 64)
 	privAccount := acm.GenPrivAccountFromPrivKeyBytes(privKeyBytes)
 	bondTx := &BondTx{
-		PubKey: privAccount.PubKey.(acm.PubKeyEd25519),
+		PubKey: privAccount.PubKey.(crypto.PubKeyEd25519),
 		Inputs: []*TxInput{
 			&TxInput{
 				Address:  []byte("input1"),
@@ -120,7 +121,7 @@ func TestBondTxSignable(t *testing.T) {
 	}
 	signBytes := acm.SignBytes(chainID, bondTx)
 	signStr := string(signBytes)
-	expected := Fmt(`{"chain_id":"%s","tx":[17,{"inputs":[{"address":"696E70757431","amount":12345,"sequence":67890},{"address":"696E70757432","amount":111,"sequence":222}],"pub_key":[1,"3B6A27BCCEB6A42D62A3A8D02A6F0D73653215771DE243A63AC048A18B59DA29"],"unbond_to":[{"address":"6F757470757431","amount":333},{"address":"6F757470757432","amount":444}]}]}`,
+	expected := Fmt(`{"chain_id":"%s","tx":[17,{"inputs":[{"address":"696E70757431","amount":12345,"sequence":67890},{"address":"696E70757432","amount":111,"sequence":222}],"pub_key":"3B6A27BCCEB6A42D62A3A8D02A6F0D73653215771DE243A63AC048A18B59DA29","unbond_to":[{"address":"6F757470757431","amount":333},{"address":"6F757470757432","amount":444}]}]}`,
 		config.GetString("chain_id"))
 	if signStr != expected {
 		t.Errorf("Unexpected sign string for BondTx. \nGot %s\nExpected %s", signStr, expected)
@@ -168,11 +169,12 @@ func TestPermissionsTxSignable(t *testing.T) {
 			Value:      true,
 		},
 	}
+
 	signBytes := acm.SignBytes(chainID, permsTx)
 	signStr := string(signBytes)
 	expected := Fmt(`{"chain_id":"%s","tx":[32,{"args":"[2,{"address":"6164647265737331","permission":1,"value":true}]","input":{"address":"696E70757431","amount":12345,"sequence":250}}]}`,
 		config.GetString("chain_id"))
 	if signStr != expected {
-		t.Errorf("Got unexpected sign string for CallTx. Expected:\n%v\nGot:\n%v", expected, signStr)
+		t.Errorf("Got unexpected sign string for PermsTx. Expected:\n%v\nGot:\n%v", expected, signStr)
 	}
 }
-- 
GitLab