From f1862a382d117ed24ce32bcc8f0e633960c89f46 Mon Sep 17 00:00:00 2001
From: Silas Davis <silas@erisindustries.com>
Date: Tue, 10 May 2016 16:19:07 +0100
Subject: [PATCH] fix txs references and fix more tests

---
 config/config.go                  |   9 +++
 erisdb/erisdbss/http.go           |   9 +--
 erisdb/erisdbss/server_manager.go |  20 +++---
 erisdb/event_cache_test.go        |   4 +-
 evm/test/log_event_test.go        |   4 +-
 evm/test/vm_test.go               |   6 +-
 glide.lock                        |  20 +++---
 glide.yaml                        |   4 +-
 state/permissions_test.go         | 106 +++++++++++++++---------------
 state/state_test.go               |  98 +++++++++++++--------------
 test/mock/mock_web_api_test.go    |   7 +-
 test/server/scumbag.go            |  20 +++---
 test/web_api/query_test.go        |  18 ++---
 test/web_api/web_api_test.go      |  16 +++--
 14 files changed, 179 insertions(+), 162 deletions(-)

diff --git a/config/config.go b/config/config.go
index 84fff16a..7c14d3c8 100644
--- a/config/config.go
+++ b/config/config.go
@@ -141,3 +141,12 @@ func WriteErisDBConfig(filePath string, cfg *ErisDBConfig) error {
 	}
 	return files.WriteAndBackup(filePath, bts)
 }
+
+// Write a server configuration file.
+func WriteServerConfig(filePath string, cfg *ServerConfig) error {
+	bts, err := toml.Marshal(*cfg)
+	if err != nil {
+		return err
+	}
+	return files.WriteAndBackup(filePath, bts)
+}
diff --git a/erisdb/erisdbss/http.go b/erisdb/erisdbss/http.go
index 7ea8b390..d01865ea 100644
--- a/erisdb/erisdbss/http.go
+++ b/erisdb/erisdbss/http.go
@@ -3,14 +3,15 @@ package erisdbss
 import (
 	"bytes"
 	"encoding/json"
-	"github.com/eris-ltd/eris-db/server"
+	"net/http"
+	"os"
+
+	"github.com/eris-ltd/eris-db/config"
 	stypes "github.com/eris-ltd/eris-db/state/types"
 	"github.com/gin-gonic/gin"
 	. "github.com/tendermint/go-common"
 	"github.com/tendermint/go-wire"
 	tmtypes "github.com/tendermint/tendermint/types"
-	"net/http"
-	"os"
 )
 
 const TendermintConfigDefault = `# This is a TOML config file.
@@ -68,7 +69,7 @@ func NewServerServer(baseDir string) *ServerServer {
 }
 
 // Start the server.
-func (this *ServerServer) Start(config *server.ServerConfig, router *gin.Engine) {
+func (this *ServerServer) Start(config *config.ServerConfig, router *gin.Engine) {
 	router.POST("/server", this.handleFunc)
 	this.running = true
 }
diff --git a/erisdb/erisdbss/server_manager.go b/erisdb/erisdbss/server_manager.go
index 6cb8c44f..34faeb71 100644
--- a/erisdb/erisdbss/server_manager.go
+++ b/erisdb/erisdbss/server_manager.go
@@ -3,16 +3,18 @@ package erisdbss
 import (
 	"bufio"
 	"fmt"
-	"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"
 	"strings"
 	"sync"
 	"time"
+
+	"github.com/eris-ltd/eris-db/config"
+	"github.com/eris-ltd/eris-db/files"
+	"github.com/eris-ltd/eris-db/server"
+	. "github.com/tendermint/go-common"
+	"github.com/tendermint/go-wire"
 )
 
 const (
@@ -161,17 +163,17 @@ func reap(sm *ServerManager) {
 func (this *ServerManager) add(data *RequestData) (*ResponseData, error) {
 	this.mtx.Lock()
 	defer this.mtx.Unlock()
-	config := server.DefaultServerConfig()
+	cfg := config.DefaultServerConfig()
 	// Port is PORT_BASE + a value between 1 and the max number of servers.
 	id, errId := this.idPool.GetId()
 	if errId != nil {
 		return nil, errId
 	}
 	port := uint16(PORT_BASE + id)
-	config.Bind.Port = port
+	cfg.Bind.Port = port
 
 	folderName := fmt.Sprintf("testnode%d", port)
-	workDir, errCWD := this.createWorkDir(data, config, folderName)
+	workDir, errCWD := this.createWorkDir(data, &cfg, folderName)
 	if errCWD != nil {
 		return nil, errCWD
 	}
@@ -220,7 +222,7 @@ func (this *ServerManager) killAll() {
 // Old folders are cleared out. before creating them, and the server will
 // clean out all of this servers workdir (defaults to ~/.edbservers) when
 // starting and when stopping.
-func (this *ServerManager) createWorkDir(data *RequestData, config *server.ServerConfig, folderName string) (string, error) {
+func (this *ServerManager) createWorkDir(data *RequestData, cfg *config.ServerConfig, folderName string) (string, error) {
 
 	workDir := path.Join(this.baseDir, folderName)
 	os.RemoveAll(workDir)
@@ -256,7 +258,7 @@ func (this *ServerManager) createWorkDir(data *RequestData, config *server.Serve
 	log.Info("File written.", "name", genesisName)
 
 	// Write server config.
-	errWC := server.WriteServerConfig(scName, config)
+	errWC := config.WriteServerConfig(scName, cfg)
 	if errWC != nil {
 		return "", errWC
 	}
diff --git a/erisdb/event_cache_test.go b/erisdb/event_cache_test.go
index cfcef01d..d0f0ac25 100644
--- a/erisdb/event_cache_test.go
+++ b/erisdb/event_cache_test.go
@@ -7,9 +7,9 @@ import (
 	"testing"
 	"time"
 
+	"github.com/eris-ltd/eris-db/txs"
 	"github.com/stretchr/testify/assert"
 	"github.com/tendermint/go-events"
-	"github.com/eris-ltd/eris-db/txs"
 )
 
 var mockInterval = 10 * time.Millisecond
@@ -48,7 +48,7 @@ func (this *mockEventEmitter) Subscribe(subId, eventId string, callback func(eve
 	go func() {
 		for {
 			if !me.shutdown {
-				me.f(types.EventDataNewBlock{})
+				me.f(txs.EventDataNewBlock{})
 			} else {
 				return
 			}
diff --git a/evm/test/log_event_test.go b/evm/test/log_event_test.go
index 3bbe6156..0d7b308c 100644
--- a/evm/test/log_event_test.go
+++ b/evm/test/log_event_test.go
@@ -40,12 +40,12 @@ func TestLog4(t *testing.T) {
 	if err != nil {
 		t.Errorf("Failed to start eventSwitch: %v", err)
 	}
-	eventID := types.EventStringLogEvent(account2.Address.Postfix(20))
+	eventID := txs.EventStringLogEvent(account2.Address.Postfix(20))
 
 	doneChan := make(chan struct{}, 1)
 
 	eventSwitch.AddListenerForEvent("test", eventID, func(event events.EventData) {
-		logEvent := event.(types.EventDataLog)
+		logEvent := event.(txs.EventDataLog)
 		// No need to test address as this event would not happen if it wasn't correct
 		if !reflect.DeepEqual(logEvent.Topics, expectedTopics) {
 			t.Errorf("Event topics are wrong. Got: %v. Expected: %v", logEvent.Topics, expectedTopics)
diff --git a/evm/test/vm_test.go b/evm/test/vm_test.go
index 08181aba..a31d44eb 100644
--- a/evm/test/vm_test.go
+++ b/evm/test/vm_test.go
@@ -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 events.EventData) {
+	evsw.AddListenerForEvent("test", txs.EventStringAccCall(subscribeAddr), func(msg events.EventData) {
 		ch <- msg
 	})
 	evc := events.NewEventCache(evsw)
@@ -174,9 +174,9 @@ func runVMWaitEvents(t *testing.T, ourVm *VM, caller, callee *Account, subscribe
 	}()
 	msg := <-ch
 	switch ev := msg.(type) {
-	case types.EventDataTx:
+	case txs.EventDataTx:
 		return ev.Exception
-	case types.EventDataCall:
+	case txs.EventDataCall:
 		return ev.Exception
 	case string:
 		return ev
diff --git a/glide.lock b/glide.lock
index fec9549d..6de9d77a 100644
--- a/glide.lock
+++ b/glide.lock
@@ -1,8 +1,8 @@
-hash: 03fc6626a41c42482068e6bb7c691f003d555d21ef8ee6d4d358ca0994b2975d
-updated: 2016-05-05T14:28:48.951275503+01:00
+hash: a6917bb6310c1da8c811026f209ba9d0d51783a8e8b83e3eb73df9fc4b14f46f
+updated: 2016-05-10T15:55:18.049756292+01:00
 imports:
 - name: github.com/btcsuite/btcd
-  version: 0d7f52660096c5a22f2cb95c102e0693f773a593
+  version: 2554caee5919958c0d4b41db8035f0e12ce6f624
   subpackages:
   - btcec
 - name: github.com/btcsuite/fastsha256
@@ -39,8 +39,6 @@ imports:
   version: 751171607256bb66e64c9f0220c00662420c38e9
   subpackages:
   - ast
-- name: github.com/sfreiberg/gotwilio
-  version: f024bbefe80fdb7bcc8c43b6add05dae97744e0e
 - name: github.com/stretchr/testify
   version: 6cb3b85ef5a0efef77caef88363ec4d4b5c0976d
 - name: github.com/syndtr/goleveldb
@@ -65,14 +63,12 @@ imports:
   - extra25519
 - name: github.com/tendermint/flowcontrol
   version: 84d9671090430e8ec80e35b339907e0579b999eb
-- name: github.com/tendermint/go-alert
-  version: b824a5721dd8bdda6e5f3033ea35df3d82e4516d
 - name: github.com/tendermint/go-clist
   version: 634527f5b60fd7c71ca811262493df2ad65ee0ca
 - name: github.com/tendermint/go-common
   version: dcfa46af1341d03b80d32e4901019d1668b978b9
 - name: github.com/tendermint/go-config
-  version: 4a3947582fc1b0b42967fbda4836437538e6b94c
+  version: 150209dfcfdc7042dd8efc120e97398ea936e53e
 - name: github.com/tendermint/go-crypto
   version: 41cfb7b677f4e16cdfd22b6ce0946c89919fbc7b
 - name: github.com/tendermint/go-db
@@ -80,7 +76,7 @@ imports:
 - name: github.com/tendermint/go-events
   version: 7b75ca7bb55aa25e9ef765eb8c0b69486b227357
 - name: github.com/tendermint/go-logger
-  version: 84391b36d3f5960e691c688d06b768708f0fa2f3
+  version: 529efe50eab1a8a9c111d55f4de4ecd95f482761
 - name: github.com/tendermint/go-merkle
   version: 05042c6ab9cad51d12e4cecf717ae68e3b1409a8
 - name: github.com/tendermint/go-p2p
@@ -88,7 +84,7 @@ imports:
   subpackages:
   - upnp
 - name: github.com/tendermint/go-rpc
-  version: e8538d606aa9700da03f748f61d734e8cbc1438b
+  version: 1d9e89812adc202811b7fb8e9e0837e73adadb43
   subpackages:
   - server
   - client
@@ -113,7 +109,7 @@ imports:
   - state
   - version
 - name: github.com/tendermint/tmsp
-  version: 9a8d40b87cceeb44117c6ae08fa0ff636747d3c8
+  version: 7ffd2899092f47110a5ffebe20247a9b7f80f4ad
   subpackages:
   - server
   - types
@@ -123,7 +119,7 @@ imports:
 - name: github.com/tommy351/gin-cors
   version: dc91dec6313ae4db53481bf3b29cf6b94bf80357
 - name: golang.org/x/crypto
-  version: 019870fc9d457ee8abd13a2e93e3f2a3b55b7119
+  version: 91ab96ae987aef3e74ab78b3aaf026109d206148
   subpackages:
   - ripemd160
   - nacl/secretbox
diff --git a/glide.yaml b/glide.yaml
index f7fb8925..afa08d6b 100644
--- a/glide.yaml
+++ b/glide.yaml
@@ -6,6 +6,7 @@ import:
 - package: github.com/tendermint/ed25519
 - package: github.com/tendermint/go-common
 - package: github.com/tendermint/go-config
+  version: 150209dfcfdc7042dd8efc120e97398ea936e53e
 - package: github.com/tendermint/go-crypto
 - package: github.com/tendermint/go-db
   version: develop
@@ -13,13 +14,14 @@ import:
 - package: github.com/tendermint/go-logger
 - package: github.com/tendermint/go-merkle
 - package: github.com/tendermint/go-p2p
+  version: 78c9d526c31d5ae06d5793b865d25a9407b635dc
 - package: github.com/stretchr/testify
 - package: github.com/tendermint/go-rpc
 - package: github.com/tendermint/go-wire
   version: 3b0adbc86ed8425eaed98516165b6788d9f4de7a
 - package: github.com/tendermint/log15
 - package: github.com/tendermint/tendermint
-  version: develop
+  version: a31b718cff5a3ae95377fa4488ac303f8ec2da2f
   subpackages:
   - config/tendermint
   - consensus
diff --git a/state/permissions_test.go b/state/permissions_test.go
index 0651c3c8..9d06de9c 100644
--- a/state/permissions_test.go
+++ b/state/permissions_test.go
@@ -153,7 +153,7 @@ func TestSendFails(t *testing.T) {
 	// send txs
 
 	// simple send tx should fail
-	tx := types.NewSendTx()
+	tx := txs.NewSendTx()
 	if err := tx.AddInput(blockCache, user[0].PubKey, 5); err != nil {
 		t.Fatal(err)
 	}
@@ -166,7 +166,7 @@ func TestSendFails(t *testing.T) {
 	}
 
 	// simple send tx with call perm should fail
-	tx = types.NewSendTx()
+	tx = txs.NewSendTx()
 	if err := tx.AddInput(blockCache, user[2].PubKey, 5); err != nil {
 		t.Fatal(err)
 	}
@@ -179,7 +179,7 @@ func TestSendFails(t *testing.T) {
 	}
 
 	// simple send tx with create perm should fail
-	tx = types.NewSendTx()
+	tx = txs.NewSendTx()
 	if err := tx.AddInput(blockCache, user[3].PubKey, 5); err != nil {
 		t.Fatal(err)
 	}
@@ -195,7 +195,7 @@ func TestSendFails(t *testing.T) {
 	acc := blockCache.GetAccount(user[3].Address)
 	acc.Permissions.Base.Set(ptypes.Send, true)
 	blockCache.UpdateAccount(acc)
-	tx = types.NewSendTx()
+	tx = txs.NewSendTx()
 	if err := tx.AddInput(blockCache, user[3].PubKey, 5); err != nil {
 		t.Fatal(err)
 	}
@@ -220,7 +220,7 @@ func TestName(t *testing.T) {
 	// name txs
 
 	// simple name tx without perm should fail
-	tx, err := types.NewNameTx(st, user[0].PubKey, "somename", "somedata", 10000, 100)
+	tx, err := txs.NewNameTx(st, user[0].PubKey, "somename", "somedata", 10000, 100)
 	if err != nil {
 		t.Fatal(err)
 	}
@@ -232,7 +232,7 @@ func TestName(t *testing.T) {
 	}
 
 	// simple name tx with perm should pass
-	tx, err = types.NewNameTx(st, user[1].PubKey, "somename", "somedata", 10000, 100)
+	tx, err = txs.NewNameTx(st, user[1].PubKey, "somename", "somedata", 10000, 100)
 	if err != nil {
 		t.Fatal(err)
 	}
@@ -255,7 +255,7 @@ func TestCallFails(t *testing.T) {
 	// call txs
 
 	// simple call tx should fail
-	tx, _ := types.NewCallTx(blockCache, user[0].PubKey, user[4].Address, nil, 100, 100, 100)
+	tx, _ := txs.NewCallTx(blockCache, user[0].PubKey, user[4].Address, nil, 100, 100, 100)
 	tx.Sign(chainID, user[0])
 	if err := ExecTx(blockCache, tx, true, nil); err == nil {
 		t.Fatal("Expected error")
@@ -264,7 +264,7 @@ func TestCallFails(t *testing.T) {
 	}
 
 	// simple call tx with send permission should fail
-	tx, _ = types.NewCallTx(blockCache, user[1].PubKey, user[4].Address, nil, 100, 100, 100)
+	tx, _ = txs.NewCallTx(blockCache, user[1].PubKey, user[4].Address, nil, 100, 100, 100)
 	tx.Sign(chainID, user[1])
 	if err := ExecTx(blockCache, tx, true, nil); err == nil {
 		t.Fatal("Expected error")
@@ -273,7 +273,7 @@ func TestCallFails(t *testing.T) {
 	}
 
 	// simple call tx with create permission should fail
-	tx, _ = types.NewCallTx(blockCache, user[3].PubKey, user[4].Address, nil, 100, 100, 100)
+	tx, _ = txs.NewCallTx(blockCache, user[3].PubKey, user[4].Address, nil, 100, 100, 100)
 	tx.Sign(chainID, user[3])
 	if err := ExecTx(blockCache, tx, true, nil); err == nil {
 		t.Fatal("Expected error")
@@ -285,7 +285,7 @@ func TestCallFails(t *testing.T) {
 	// create txs
 
 	// simple call create tx should fail
-	tx, _ = types.NewCallTx(blockCache, user[0].PubKey, nil, nil, 100, 100, 100)
+	tx, _ = txs.NewCallTx(blockCache, user[0].PubKey, nil, nil, 100, 100, 100)
 	tx.Sign(chainID, user[0])
 	if err := ExecTx(blockCache, tx, true, nil); err == nil {
 		t.Fatal("Expected error")
@@ -294,7 +294,7 @@ func TestCallFails(t *testing.T) {
 	}
 
 	// simple call create tx with send perm should fail
-	tx, _ = types.NewCallTx(blockCache, user[1].PubKey, nil, nil, 100, 100, 100)
+	tx, _ = txs.NewCallTx(blockCache, user[1].PubKey, nil, nil, 100, 100, 100)
 	tx.Sign(chainID, user[1])
 	if err := ExecTx(blockCache, tx, true, nil); err == nil {
 		t.Fatal("Expected error")
@@ -303,7 +303,7 @@ func TestCallFails(t *testing.T) {
 	}
 
 	// simple call create tx with call perm should fail
-	tx, _ = types.NewCallTx(blockCache, user[2].PubKey, nil, nil, 100, 100, 100)
+	tx, _ = txs.NewCallTx(blockCache, user[2].PubKey, nil, nil, 100, 100, 100)
 	tx.Sign(chainID, user[2])
 	if err := ExecTx(blockCache, tx, true, nil); err == nil {
 		t.Fatal("Expected error")
@@ -320,7 +320,7 @@ func TestSendPermission(t *testing.T) {
 	blockCache := NewBlockCache(st)
 
 	// A single input, having the permission, should succeed
-	tx := types.NewSendTx()
+	tx := txs.NewSendTx()
 	if err := tx.AddInput(blockCache, user[0].PubKey, 5); err != nil {
 		t.Fatal(err)
 	}
@@ -331,7 +331,7 @@ func TestSendPermission(t *testing.T) {
 	}
 
 	// Two inputs, one with permission, one without, should fail
-	tx = types.NewSendTx()
+	tx = txs.NewSendTx()
 	if err := tx.AddInput(blockCache, user[0].PubKey, 5); err != nil {
 		t.Fatal(err)
 	}
@@ -372,7 +372,7 @@ func TestCallPermission(t *testing.T) {
 	st.UpdateAccount(simpleAcc)
 
 	// A single input, having the permission, should succeed
-	tx, _ := types.NewCallTx(blockCache, user[0].PubKey, simpleContractAddr, nil, 100, 100, 100)
+	tx, _ := txs.NewCallTx(blockCache, user[0].PubKey, simpleContractAddr, nil, 100, 100, 100)
 	tx.Sign(chainID, user[0])
 	if err := ExecTx(blockCache, tx, true, nil); err != nil {
 		t.Fatal("Transaction failed", err)
@@ -396,11 +396,11 @@ func TestCallPermission(t *testing.T) {
 	blockCache.UpdateAccount(caller1Acc)
 
 	// A single input, having the permission, but the contract doesn't have permission
-	tx, _ = types.NewCallTx(blockCache, user[0].PubKey, caller1ContractAddr, nil, 100, 10000, 100)
+	tx, _ = txs.NewCallTx(blockCache, user[0].PubKey, caller1ContractAddr, nil, 100, 10000, 100)
 	tx.Sign(chainID, user[0])
 
 	// we need to subscribe to the Call event to detect the exception
-	_, exception := execTxWaitEvent(t, blockCache, tx, types.EventStringAccCall(caller1ContractAddr)) //
+	_, exception := execTxWaitEvent(t, blockCache, tx, txs.EventStringAccCall(caller1ContractAddr)) //
 	if exception == "" {
 		t.Fatal("Expected exception")
 	}
@@ -412,11 +412,11 @@ func TestCallPermission(t *testing.T) {
 	// A single input, having the permission, and the contract has permission
 	caller1Acc.Permissions.Base.Set(ptypes.Call, true)
 	blockCache.UpdateAccount(caller1Acc)
-	tx, _ = types.NewCallTx(blockCache, user[0].PubKey, caller1ContractAddr, nil, 100, 10000, 100)
+	tx, _ = txs.NewCallTx(blockCache, user[0].PubKey, caller1ContractAddr, nil, 100, 10000, 100)
 	tx.Sign(chainID, user[0])
 
 	// we need to subscribe to the Call event to detect the exception
-	_, exception = execTxWaitEvent(t, blockCache, tx, types.EventStringAccCall(caller1ContractAddr)) //
+	_, exception = execTxWaitEvent(t, blockCache, tx, txs.EventStringAccCall(caller1ContractAddr)) //
 	if exception != "" {
 		t.Fatal("Unexpected exception:", exception)
 	}
@@ -442,11 +442,11 @@ func TestCallPermission(t *testing.T) {
 	blockCache.UpdateAccount(caller1Acc)
 	blockCache.UpdateAccount(caller2Acc)
 
-	tx, _ = types.NewCallTx(blockCache, user[0].PubKey, caller2ContractAddr, nil, 100, 10000, 100)
+	tx, _ = txs.NewCallTx(blockCache, user[0].PubKey, caller2ContractAddr, nil, 100, 10000, 100)
 	tx.Sign(chainID, user[0])
 
 	// we need to subscribe to the Call event to detect the exception
-	_, exception = execTxWaitEvent(t, blockCache, tx, types.EventStringAccCall(caller1ContractAddr)) //
+	_, exception = execTxWaitEvent(t, blockCache, tx, txs.EventStringAccCall(caller1ContractAddr)) //
 	if exception == "" {
 		t.Fatal("Expected exception")
 	}
@@ -460,11 +460,11 @@ func TestCallPermission(t *testing.T) {
 	caller1Acc.Permissions.Base.Set(ptypes.Call, true)
 	blockCache.UpdateAccount(caller1Acc)
 
-	tx, _ = types.NewCallTx(blockCache, user[0].PubKey, caller2ContractAddr, nil, 100, 10000, 100)
+	tx, _ = txs.NewCallTx(blockCache, user[0].PubKey, caller2ContractAddr, nil, 100, 10000, 100)
 	tx.Sign(chainID, user[0])
 
 	// we need to subscribe to the Call event to detect the exception
-	_, exception = execTxWaitEvent(t, blockCache, tx, types.EventStringAccCall(caller1ContractAddr)) //
+	_, exception = execTxWaitEvent(t, blockCache, tx, txs.EventStringAccCall(caller1ContractAddr)) //
 	if exception != "" {
 		t.Fatal("Unexpected exception", exception)
 	}
@@ -486,7 +486,7 @@ func TestCreatePermission(t *testing.T) {
 	createCode := wrapContractForCreate(contractCode)
 
 	// A single input, having the permission, should succeed
-	tx, _ := types.NewCallTx(blockCache, user[0].PubKey, nil, createCode, 100, 100, 100)
+	tx, _ := txs.NewCallTx(blockCache, user[0].PubKey, nil, createCode, 100, 100, 100)
 	tx.Sign(chainID, user[0])
 	if err := ExecTx(blockCache, tx, true, nil); err != nil {
 		t.Fatal("Transaction failed", err)
@@ -511,7 +511,7 @@ func TestCreatePermission(t *testing.T) {
 	createFactoryCode := wrapContractForCreate(factoryCode)
 
 	// A single input, having the permission, should succeed
-	tx, _ = types.NewCallTx(blockCache, user[0].PubKey, nil, createFactoryCode, 100, 100, 100)
+	tx, _ = txs.NewCallTx(blockCache, user[0].PubKey, nil, createFactoryCode, 100, 100, 100)
 	tx.Sign(chainID, user[0])
 	if err := ExecTx(blockCache, tx, true, nil); err != nil {
 		t.Fatal("Transaction failed", err)
@@ -531,10 +531,10 @@ func TestCreatePermission(t *testing.T) {
 	fmt.Println("\n###### CALL THE FACTORY (FAIL)")
 
 	// A single input, having the permission, should succeed
-	tx, _ = types.NewCallTx(blockCache, user[0].PubKey, contractAddr, createCode, 100, 100, 100)
+	tx, _ = txs.NewCallTx(blockCache, user[0].PubKey, contractAddr, createCode, 100, 100, 100)
 	tx.Sign(chainID, user[0])
 	// we need to subscribe to the Call event to detect the exception
-	_, exception := execTxWaitEvent(t, blockCache, tx, types.EventStringAccCall(contractAddr)) //
+	_, exception := execTxWaitEvent(t, blockCache, tx, txs.EventStringAccCall(contractAddr)) //
 	if exception == "" {
 		t.Fatal("expected exception")
 	}
@@ -547,10 +547,10 @@ func TestCreatePermission(t *testing.T) {
 	blockCache.UpdateAccount(contractAcc)
 
 	// A single input, having the permission, should succeed
-	tx, _ = types.NewCallTx(blockCache, user[0].PubKey, contractAddr, createCode, 100, 100, 100)
+	tx, _ = txs.NewCallTx(blockCache, user[0].PubKey, contractAddr, createCode, 100, 100, 100)
 	tx.Sign(chainID, user[0])
 	// we need to subscribe to the Call event to detect the exception
-	_, exception = execTxWaitEvent(t, blockCache, tx, types.EventStringAccCall(contractAddr)) //
+	_, exception = execTxWaitEvent(t, blockCache, tx, txs.EventStringAccCall(contractAddr)) //
 	if exception != "" {
 		t.Fatal("unexpected exception", exception)
 	}
@@ -574,10 +574,10 @@ func TestCreatePermission(t *testing.T) {
 	blockCache.UpdateAccount(contractAcc)
 
 	// this should call the 0 address but not create ...
-	tx, _ = types.NewCallTx(blockCache, user[0].PubKey, contractAddr, createCode, 100, 10000, 100)
+	tx, _ = txs.NewCallTx(blockCache, user[0].PubKey, contractAddr, createCode, 100, 10000, 100)
 	tx.Sign(chainID, user[0])
 	// we need to subscribe to the Call event to detect the exception
-	_, exception = execTxWaitEvent(t, blockCache, tx, types.EventStringAccCall(zeroAddr)) //
+	_, exception = execTxWaitEvent(t, blockCache, tx, txs.EventStringAccCall(zeroAddr)) //
 	if exception != "" {
 		t.Fatal("unexpected exception", exception)
 	}
@@ -597,7 +597,7 @@ func TestBondPermission(t *testing.T) {
 
 	//------------------------------
 	// one bonder without permission should fail
-	tx, _ := types.NewBondTx(user[1].PubKey)
+	tx, _ := txs.NewBondTx(user[1].PubKey)
 	if err := tx.AddInput(blockCache, user[1].PubKey, 5); err != nil {
 		t.Fatal(err)
 	}
@@ -628,7 +628,7 @@ func TestBondPermission(t *testing.T) {
 	blockCache.UpdateAccount(bondAcc)
 	//------------------------------
 	// one bonder with permission and an input without send should fail
-	tx, _ = types.NewBondTx(user[1].PubKey)
+	tx, _ = txs.NewBondTx(user[1].PubKey)
 	if err := tx.AddInput(blockCache, user[2].PubKey, 5); err != nil {
 		t.Fatal(err)
 	}
@@ -653,7 +653,7 @@ func TestBondPermission(t *testing.T) {
 	sendAcc := blockCache.GetAccount(user[2].Address)
 	sendAcc.Permissions.Base.Set(ptypes.Send, true)
 	blockCache.UpdateAccount(sendAcc)
-	tx, _ = types.NewBondTx(user[1].PubKey)
+	tx, _ = txs.NewBondTx(user[1].PubKey)
 	if err := tx.AddInput(blockCache, user[2].PubKey, 5); err != nil {
 		t.Fatal(err)
 	}
@@ -675,7 +675,7 @@ func TestBondPermission(t *testing.T) {
 	// one bonder with permission and an input with bond should pass
 	sendAcc.Permissions.Base.Set(ptypes.Bond, true)
 	blockCache.UpdateAccount(sendAcc)
-	tx, _ = types.NewBondTx(user[1].PubKey)
+	tx, _ = txs.NewBondTx(user[1].PubKey)
 	if err := tx.AddInput(blockCache, user[2].PubKey, 5); err != nil {
 		t.Fatal(err)
 	}
@@ -695,7 +695,7 @@ func TestBondPermission(t *testing.T) {
 	blockCache.UpdateAccount(bondAcc)
 	//------------------------------
 	// one bonder with permission and an input from that bonder and an input without send or bond should fail
-	tx, _ = types.NewBondTx(user[1].PubKey)
+	tx, _ = txs.NewBondTx(user[1].PubKey)
 	if err := tx.AddInput(blockCache, user[1].PubKey, 5); err != nil {
 		t.Fatal(err)
 	}
@@ -725,7 +725,7 @@ func TestCreateAccountPermission(t *testing.T) {
 	// SendTx to unknown account
 
 	// A single input, having the permission, should succeed
-	tx := types.NewSendTx()
+	tx := txs.NewSendTx()
 	if err := tx.AddInput(blockCache, user[0].PubKey, 5); err != nil {
 		t.Fatal(err)
 	}
@@ -736,7 +736,7 @@ func TestCreateAccountPermission(t *testing.T) {
 	}
 
 	// Two inputs, both with send, one with create, one without, should fail
-	tx = types.NewSendTx()
+	tx = txs.NewSendTx()
 	if err := tx.AddInput(blockCache, user[0].PubKey, 5); err != nil {
 		t.Fatal(err)
 	}
@@ -753,7 +753,7 @@ func TestCreateAccountPermission(t *testing.T) {
 	}
 
 	// Two inputs, both with send, one with create, one without, two ouputs (one known, one unknown) should fail
-	tx = types.NewSendTx()
+	tx = txs.NewSendTx()
 	if err := tx.AddInput(blockCache, user[0].PubKey, 5); err != nil {
 		t.Fatal(err)
 	}
@@ -774,7 +774,7 @@ func TestCreateAccountPermission(t *testing.T) {
 	acc := blockCache.GetAccount(user[1].Address)
 	acc.Permissions.Base.Set(ptypes.CreateAccount, true)
 	blockCache.UpdateAccount(acc)
-	tx = types.NewSendTx()
+	tx = txs.NewSendTx()
 	if err := tx.AddInput(blockCache, user[0].PubKey, 5); err != nil {
 		t.Fatal(err)
 	}
@@ -789,7 +789,7 @@ func TestCreateAccountPermission(t *testing.T) {
 	}
 
 	// Two inputs, both with send, both with create, two outputs (one known, one unknown) should pass
-	tx = types.NewSendTx()
+	tx = txs.NewSendTx()
 	if err := tx.AddInput(blockCache, user[0].PubKey, 5); err != nil {
 		t.Fatal(err)
 	}
@@ -826,11 +826,11 @@ func TestCreateAccountPermission(t *testing.T) {
 	blockCache.UpdateAccount(caller1Acc)
 
 	// A single input, having the permission, but the contract doesn't have permission
-	txCall, _ := types.NewCallTx(blockCache, user[0].PubKey, caller1ContractAddr, nil, 100, 10000, 100)
+	txCall, _ := txs.NewCallTx(blockCache, user[0].PubKey, caller1ContractAddr, nil, 100, 10000, 100)
 	txCall.Sign(chainID, user[0])
 
 	// we need to subscribe to the Call event to detect the exception
-	_, exception := execTxWaitEvent(t, blockCache, txCall, types.EventStringAccCall(caller1ContractAddr)) //
+	_, exception := execTxWaitEvent(t, blockCache, txCall, txs.EventStringAccCall(caller1ContractAddr)) //
 	if exception == "" {
 		t.Fatal("Expected exception")
 	}
@@ -841,11 +841,11 @@ func TestCreateAccountPermission(t *testing.T) {
 	caller1Acc.Permissions.Base.Set(ptypes.Call, true)
 	blockCache.UpdateAccount(caller1Acc)
 	// A single input, having the permission, but the contract doesn't have permission
-	txCall, _ = types.NewCallTx(blockCache, user[0].PubKey, caller1ContractAddr, nil, 100, 10000, 100)
+	txCall, _ = txs.NewCallTx(blockCache, user[0].PubKey, caller1ContractAddr, nil, 100, 10000, 100)
 	txCall.Sign(chainID, user[0])
 
 	// we need to subscribe to the Call event to detect the exception
-	_, exception = execTxWaitEvent(t, blockCache, txCall, types.EventStringAccCall(caller1ContractAddr)) //
+	_, exception = execTxWaitEvent(t, blockCache, txCall, txs.EventStringAccCall(caller1ContractAddr)) //
 	if exception != "" {
 		t.Fatal("Unexpected exception", exception)
 	}
@@ -1066,7 +1066,7 @@ var ExceptionTimeOut = "timed out waiting for event"
 
 // run ExecTx and wait for the Call event on given addr
 // returns the msg data and an error/exception
-func execTxWaitEvent(t *testing.T, blockCache *BlockCache, tx types.Tx, eventid string) (interface{}, string) {
+func execTxWaitEvent(t *testing.T, blockCache *BlockCache, tx txs.Tx, eventid string) (interface{}, string) {
 	evsw := events.NewEventSwitch()
 	evsw.Start()
 	ch := make(chan interface{})
@@ -1089,9 +1089,9 @@ func execTxWaitEvent(t *testing.T, blockCache *BlockCache, tx types.Tx, eventid
 	}
 
 	switch ev := msg.(type) {
-	case types.EventDataTx:
+	case txs.EventDataTx:
 		return ev, ev.Exception
-	case types.EventDataCall:
+	case txs.EventDataCall:
 		return ev, ev.Exception
 	case string:
 		return nil, ev
@@ -1123,10 +1123,10 @@ func testSNativeCALL(t *testing.T, expectPass bool, blockCache *BlockCache, doug
 	doug.Code = contractCode
 	blockCache.UpdateAccount(doug)
 	addr = doug.Address
-	tx, _ := types.NewCallTx(blockCache, user[0].PubKey, addr, data, 100, 10000, 100)
+	tx, _ := txs.NewCallTx(blockCache, user[0].PubKey, addr, data, 100, 10000, 100)
 	tx.Sign(chainID, user[0])
-	fmt.Println("subscribing to", types.EventStringAccCall(snativeAddress))
-	ev, exception := execTxWaitEvent(t, blockCache, tx, types.EventStringAccCall(snativeAddress))
+	fmt.Println("subscribing to", txs.EventStringAccCall(snativeAddress))
+	ev, exception := execTxWaitEvent(t, blockCache, tx, txs.EventStringAccCall(snativeAddress))
 	if exception == ExceptionTimeOut {
 		t.Fatal("Timed out waiting for event")
 	}
@@ -1134,7 +1134,7 @@ func testSNativeCALL(t *testing.T, expectPass bool, blockCache *BlockCache, doug
 		if exception != "" {
 			t.Fatal("Unexpected exception", exception)
 		}
-		evv := ev.(types.EventDataCall)
+		evv := ev.(txs.EventDataCall)
 		ret := evv.Return
 		if err := f(ret); err != nil {
 			t.Fatal(err)
@@ -1160,7 +1160,7 @@ func testSNativeTx(t *testing.T, expectPass bool, blockCache *BlockCache, perm p
 		acc.Permissions.Base.Set(perm, true)
 		blockCache.UpdateAccount(acc)
 	}
-	tx, _ := types.NewPermissionsTx(blockCache, user[0].PubKey, snativeArgs)
+	tx, _ := txs.NewPermissionsTx(blockCache, user[0].PubKey, snativeArgs)
 	tx.Sign(chainID, user[0])
 	err := ExecTx(blockCache, tx, true, nil)
 	if expectPass {
diff --git a/state/state_test.go b/state/state_test.go
index b35e5bee..eba2226b 100644
--- a/state/state_test.go
+++ b/state/state_test.go
@@ -15,7 +15,7 @@ func init() {
 	tendermint_test.ResetConfig("state_test")
 }
 
-func execTxWithState(state *State, tx types.Tx, runCall bool) error {
+func execTxWithState(state *State, tx txs.Tx, runCall bool) error {
 	cache := NewBlockCache(state)
 	if err := ExecTx(cache, tx, runCall, nil); err != nil {
 		return err
@@ -25,7 +25,7 @@ func execTxWithState(state *State, tx types.Tx, runCall bool) error {
 	}
 }
 
-func execTxWithStateNewBlock(state *State, tx types.Tx, runCall bool) error {
+func execTxWithStateNewBlock(state *State, tx txs.Tx, runCall bool) error {
 	if err := execTxWithState(state, tx, runCall); err != nil {
 		return err
 	}
@@ -76,7 +76,7 @@ func TestCopyState(t *testing.T) {
 }
 
 /*
-func makeBlock(t *testing.T, state *State, validation *tmtypes.Commit, txs []types.Tx) *tmtypes.Block {
+func makeBlock(t *testing.T, state *State, validation *tmtypes.Commit, txs []txs.Tx) *tmtypes.Block {
 	if validation == nil {
 		validation = &tmtypes.Commit{}
 	}
@@ -186,7 +186,7 @@ func TestTxSequence(t *testing.T) {
 	// The tx should only pass when i == 1.
 	for i := -1; i < 3; i++ {
 		sequence := acc0.Sequence + i
-		tx := types.NewSendTx()
+		tx := txs.NewSendTx()
 		tx.AddInputWithNonce(acc0PubKey, 1, sequence)
 		tx.AddOutput(acc1.Address, 1)
 		tx.Inputs[0].Signature = privAccounts[0].Sign(state.ChainID, tx)
@@ -221,7 +221,7 @@ func TestTxSequence(t *testing.T) {
 func TestNameTxs(t *testing.T) {
 	state, privAccounts, _ := RandGenesisState(3, true, 1000, 1, true, 1000)
 
-	types.MinNameRegistrationPeriod = 5
+	txs.MinNameRegistrationPeriod = 5
 	startingBlock := state.LastBlockHeight
 
 	// try some bad names. these should all fail
@@ -230,8 +230,8 @@ func TestNameTxs(t *testing.T) {
 	fee := int64(1000)
 	numDesiredBlocks := 5
 	for _, name := range names {
-		amt := fee + int64(numDesiredBlocks)*types.NameByteCostMultiplier*types.NameBlockCostMultiplier*types.NameBaseCost(name, data)
-		tx, _ := types.NewNameTx(state, privAccounts[0].PubKey, name, data, amt, fee)
+		amt := fee + int64(numDesiredBlocks)*txs.NameByteCostMultiplier*txs.NameBlockCostMultiplier*txs.NameBaseCost(name, data)
+		tx, _ := txs.NewNameTx(state, privAccounts[0].PubKey, name, data, amt, fee)
 		tx.Sign(state.ChainID, privAccounts[0])
 
 		if err := execTxWithState(state, tx, true); err == nil {
@@ -243,8 +243,8 @@ func TestNameTxs(t *testing.T) {
 	name := "hold_it_chum"
 	datas := []string{"cold&warm", "!@#$%^&*()", "<<<>>>>", "because why would you ever need a ~ or a & or even a % in a json file? make your case and we'll talk"}
 	for _, data := range datas {
-		amt := fee + int64(numDesiredBlocks)*types.NameByteCostMultiplier*types.NameBlockCostMultiplier*types.NameBaseCost(name, data)
-		tx, _ := types.NewNameTx(state, privAccounts[0].PubKey, name, data, amt, fee)
+		amt := fee + int64(numDesiredBlocks)*txs.NameByteCostMultiplier*txs.NameBlockCostMultiplier*txs.NameBaseCost(name, data)
+		tx, _ := txs.NewNameTx(state, privAccounts[0].PubKey, name, data, amt, fee)
 		tx.Sign(state.ChainID, privAccounts[0])
 
 		if err := execTxWithState(state, tx, true); err == nil {
@@ -252,7 +252,7 @@ func TestNameTxs(t *testing.T) {
 		}
 	}
 
-	validateEntry := func(t *testing.T, entry *types.NameRegEntry, name, data string, addr []byte, expires int) {
+	validateEntry := func(t *testing.T, entry *txs.NameRegEntry, name, data string, addr []byte, expires int) {
 
 		if entry == nil {
 			t.Fatalf("Could not find name %s", name)
@@ -274,8 +274,8 @@ func TestNameTxs(t *testing.T) {
 	// try a good one, check data, owner, expiry
 	name = "@looking_good/karaoke_bar.broadband"
 	data = "on this side of neptune there are 1234567890 people: first is OMNIVORE+-3. Or is it. Ok this is pretty restrictive. No exclamations :(. Faces tho :')"
-	amt := fee + int64(numDesiredBlocks)*types.NameByteCostMultiplier*types.NameBlockCostMultiplier*types.NameBaseCost(name, data)
-	tx, _ := types.NewNameTx(state, privAccounts[0].PubKey, name, data, amt, fee)
+	amt := fee + int64(numDesiredBlocks)*txs.NameByteCostMultiplier*txs.NameBlockCostMultiplier*txs.NameBaseCost(name, data)
+	tx, _ := txs.NewNameTx(state, privAccounts[0].PubKey, name, data, amt, fee)
 	tx.Sign(state.ChainID, privAccounts[0])
 	if err := execTxWithState(state, tx, true); err != nil {
 		t.Fatal(err)
@@ -284,7 +284,7 @@ func TestNameTxs(t *testing.T) {
 	validateEntry(t, entry, name, data, privAccounts[0].Address, startingBlock+numDesiredBlocks)
 
 	// fail to update it as non-owner, in same block
-	tx, _ = types.NewNameTx(state, privAccounts[1].PubKey, name, data, amt, fee)
+	tx, _ = txs.NewNameTx(state, privAccounts[1].PubKey, name, data, amt, fee)
 	tx.Sign(state.ChainID, privAccounts[1])
 	if err := execTxWithState(state, tx, true); err == nil {
 		t.Fatal("Expected error")
@@ -292,7 +292,7 @@ func TestNameTxs(t *testing.T) {
 
 	// update it as owner, just to increase expiry, in same block
 	// NOTE: we have to resend the data or it will clear it (is this what we want?)
-	tx, _ = types.NewNameTx(state, privAccounts[0].PubKey, name, data, amt, fee)
+	tx, _ = txs.NewNameTx(state, privAccounts[0].PubKey, name, data, amt, fee)
 	tx.Sign(state.ChainID, privAccounts[0])
 	if err := execTxWithStateNewBlock(state, tx, true); err != nil {
 		t.Fatal(err)
@@ -301,7 +301,7 @@ func TestNameTxs(t *testing.T) {
 	validateEntry(t, entry, name, data, privAccounts[0].Address, startingBlock+numDesiredBlocks*2)
 
 	// update it as owner, just to increase expiry, in next block
-	tx, _ = types.NewNameTx(state, privAccounts[0].PubKey, name, data, amt, fee)
+	tx, _ = txs.NewNameTx(state, privAccounts[0].PubKey, name, data, amt, fee)
 	tx.Sign(state.ChainID, privAccounts[0])
 	if err := execTxWithStateNewBlock(state, tx, true); err != nil {
 		t.Fatal(err)
@@ -311,7 +311,7 @@ func TestNameTxs(t *testing.T) {
 
 	// fail to update it as non-owner
 	state.LastBlockHeight = entry.Expires - 1
-	tx, _ = types.NewNameTx(state, privAccounts[1].PubKey, name, data, amt, fee)
+	tx, _ = txs.NewNameTx(state, privAccounts[1].PubKey, name, data, amt, fee)
 	tx.Sign(state.ChainID, privAccounts[1])
 	if err := execTxWithState(state, tx, true); err == nil {
 		t.Fatal("Expected error")
@@ -319,7 +319,7 @@ func TestNameTxs(t *testing.T) {
 
 	// once expires, non-owner succeeds
 	state.LastBlockHeight = entry.Expires
-	tx, _ = types.NewNameTx(state, privAccounts[1].PubKey, name, data, amt, fee)
+	tx, _ = txs.NewNameTx(state, privAccounts[1].PubKey, name, data, amt, fee)
 	tx.Sign(state.ChainID, privAccounts[1])
 	if err := execTxWithState(state, tx, true); err != nil {
 		t.Fatal(err)
@@ -331,8 +331,8 @@ func TestNameTxs(t *testing.T) {
 	data = "In the beginning there was no thing, not even the beginning. It hadn't been here, no there, nor for that matter anywhere, not especially because it had not to even exist, let alone to not. Nothing especially odd about that."
 	oldCredit := amt - fee
 	numDesiredBlocks = 10
-	amt = fee + (int64(numDesiredBlocks)*types.NameByteCostMultiplier*types.NameBlockCostMultiplier*types.NameBaseCost(name, data) - oldCredit)
-	tx, _ = types.NewNameTx(state, privAccounts[1].PubKey, name, data, amt, fee)
+	amt = fee + (int64(numDesiredBlocks)*txs.NameByteCostMultiplier*txs.NameBlockCostMultiplier*txs.NameBaseCost(name, data) - oldCredit)
+	tx, _ = txs.NewNameTx(state, privAccounts[1].PubKey, name, data, amt, fee)
 	tx.Sign(state.ChainID, privAccounts[1])
 	if err := execTxWithState(state, tx, true); err != nil {
 		t.Fatal(err)
@@ -343,7 +343,7 @@ func TestNameTxs(t *testing.T) {
 	// test removal
 	amt = fee
 	data = ""
-	tx, _ = types.NewNameTx(state, privAccounts[1].PubKey, name, data, amt, fee)
+	tx, _ = txs.NewNameTx(state, privAccounts[1].PubKey, name, data, amt, fee)
 	tx.Sign(state.ChainID, privAccounts[1])
 	if err := execTxWithStateNewBlock(state, tx, true); err != nil {
 		t.Fatal(err)
@@ -357,8 +357,8 @@ func TestNameTxs(t *testing.T) {
 	// test removal by key1 after expiry
 	name = "looking_good/karaoke_bar"
 	data = "some data"
-	amt = fee + int64(numDesiredBlocks)*types.NameByteCostMultiplier*types.NameBlockCostMultiplier*types.NameBaseCost(name, data)
-	tx, _ = types.NewNameTx(state, privAccounts[0].PubKey, name, data, amt, fee)
+	amt = fee + int64(numDesiredBlocks)*txs.NameByteCostMultiplier*txs.NameBlockCostMultiplier*txs.NameBaseCost(name, data)
+	tx, _ = txs.NewNameTx(state, privAccounts[0].PubKey, name, data, amt, fee)
 	tx.Sign(state.ChainID, privAccounts[0])
 	if err := execTxWithState(state, tx, true); err != nil {
 		t.Fatal(err)
@@ -369,7 +369,7 @@ func TestNameTxs(t *testing.T) {
 
 	amt = fee
 	data = ""
-	tx, _ = types.NewNameTx(state, privAccounts[1].PubKey, name, data, amt, fee)
+	tx, _ = txs.NewNameTx(state, privAccounts[1].PubKey, name, data, amt, fee)
 	tx.Sign(state.ChainID, privAccounts[1])
 	if err := execTxWithStateNewBlock(state, tx, true); err != nil {
 		t.Fatal(err)
@@ -394,17 +394,17 @@ func TestTxs(t *testing.T) {
 	// SendTx.
 	{
 		state := state.Copy()
-		tx := &types.SendTx{
-			Inputs: []*types.TxInput{
-				&types.TxInput{
+		tx := &txs.SendTx{
+			Inputs: []*txs.TxInput{
+				&txs.TxInput{
 					Address:  acc0.Address,
 					Amount:   1,
 					Sequence: acc0.Sequence + 1,
 					PubKey:   acc0PubKey,
 				},
 			},
-			Outputs: []*types.TxOutput{
-				&types.TxOutput{
+			Outputs: []*txs.TxOutput{
+				&txs.TxOutput{
 					Address: acc1.Address,
 					Amount:  1,
 				},
@@ -434,8 +434,8 @@ func TestTxs(t *testing.T) {
 		newAcc1 := state.GetAccount(acc1.Address)
 		newAcc1.Code = []byte{0x60}
 		state.UpdateAccount(newAcc1)
-		tx := &types.CallTx{
-			Input: &types.TxInput{
+		tx := &txs.CallTx{
+			Input: &txs.TxInput{
 				Address:  acc0.Address,
 				Amount:   1,
 				Sequence: acc0.Sequence + 1,
@@ -483,8 +483,8 @@ proof-of-work chain as proof of what happened while they were gone `
 		entryAmount := int64(10000)
 
 		state := state.Copy()
-		tx := &types.NameTx{
-			Input: &types.TxInput{
+		tx := &txs.NameTx{
+			Input: &txs.TxInput{
 				Address:  acc0.Address,
 				Amount:   entryAmount,
 				Sequence: acc0.Sequence + 1,
@@ -517,7 +517,7 @@ proof-of-work chain as proof of what happened while they were gone `
 		tx.Input.Sequence += 1
 		tx.Input.Signature = privAccounts[0].Sign(state.ChainID, tx)
 		err = execTxWithState(state, tx, true)
-		if _, ok := err.(types.ErrTxInvalidString); !ok {
+		if _, ok := err.(txs.ErrTxInvalidString); !ok {
 			t.Errorf("Expected invalid string error. Got: %s", err.Error())
 		}
 	}
@@ -526,18 +526,18 @@ proof-of-work chain as proof of what happened while they were gone `
 	/*
 		{
 			state := state.Copy()
-			tx := &types.BondTx{
+			tx := &txs.BondTx{
 				PubKey: acc0PubKey.(crypto.PubKeyEd25519),
-				Inputs: []*types.TxInput{
-					&types.TxInput{
+				Inputs: []*txs.TxInput{
+					&txs.TxInput{
 						Address:  acc0.Address,
 						Amount:   1,
 						Sequence: acc0.Sequence + 1,
 						PubKey:   acc0PubKey,
 					},
 				},
-				UnbondTo: []*types.TxOutput{
-					&types.TxOutput{
+				UnbondTo: []*txs.TxOutput{
+					&txs.TxOutput{
 						Address: acc0.Address,
 						Amount:  1,
 					},
@@ -596,7 +596,7 @@ func TestSuicide(t *testing.T) {
 	state.UpdateAccount(newAcc1)
 
 	// send call tx with no data, cause suicide
-	tx := types.NewCallTxWithNonce(acc0PubKey, acc1.Address, nil, sendingAmount, 1000, 0, acc0.Sequence+1)
+	tx := txs.NewCallTxWithNonce(acc0PubKey, acc1.Address, nil, sendingAmount, 1000, 0, acc0.Sequence+1)
 	tx.Input.Signature = privAccounts[0].Sign(state.ChainID, tx)
 
 	// we use cache instead of execTxWithState so we can run the tx twice
@@ -638,18 +638,18 @@ func TestAddValidator(t *testing.T) {
 
 	// The first privAccount will become a validator
 	acc0 := privAccounts[0]
-	bondTx := &types.BondTx{
+	bondTx := &txs.BondTx{
 		PubKey: acc0.PubKey.(account.PubKeyEd25519),
-		Inputs: []*types.TxInput{
-			&types.TxInput{
+		Inputs: []*txs.TxInput{
+			&txs.TxInput{
 				Address:  acc0.Address,
 				Amount:   1000,
 				Sequence: 1,
 				PubKey:   acc0.PubKey,
 			},
 		},
-		UnbondTo: []*types.TxOutput{
-			&types.TxOutput{
+		UnbondTo: []*txs.TxOutput{
+			&txs.TxOutput{
 				Address: acc0.Address,
 				Amount:  1000,
 			},
@@ -659,7 +659,7 @@ func TestAddValidator(t *testing.T) {
 	bondTx.Inputs[0].Signature = acc0.Sign(s0.ChainID, bondTx)
 
 	// Make complete block and blockParts
-	block0 := makeBlock(t, s0, nil, []types.Tx{bondTx})
+	block0 := makeBlock(t, s0, nil, []txs.Tx{bondTx})
 	block0Parts := block0.MakePartSet()
 
 	// Sanity check
@@ -683,18 +683,18 @@ func TestAddValidator(t *testing.T) {
 
 	// The validation for the next block should only require 1 signature
 	// (the new validator wasn't active for block0)
-	precommit0 := &types.Vote{
+	precommit0 := &txs.Vote{
 		Height:           1,
 		Round:            0,
-		Type:             types.VoteTypePrecommit,
+		Type:             txs.VoteTypePrecommit,
 		BlockHash:        block0.Hash(),
 		BlockPartsHeader: block0Parts.Header(),
 	}
 	privValidators[0].SignVote(s0.ChainID, precommit0)
 
 	block1 := makeBlock(t, s0,
-		&types.Validation{
-			Precommits: []*types.Vote{
+		&txs.Validation{
+			Precommits: []*txs.Vote{
 				precommit0,
 			},
 		}, nil,
diff --git a/test/mock/mock_web_api_test.go b/test/mock/mock_web_api_test.go
index 324bc1c8..a621833d 100644
--- a/test/mock/mock_web_api_test.go
+++ b/test/mock/mock_web_api_test.go
@@ -11,6 +11,7 @@ import (
 
 	// edb "github.com/eris-ltd/erisdb/erisdb"
 	"github.com/eris-ltd/eris-db/account"
+	"github.com/eris-ltd/eris-db/config"
 	edb "github.com/eris-ltd/eris-db/erisdb"
 	ep "github.com/eris-ltd/eris-db/erisdb/pipe"
 	"github.com/eris-ltd/eris-db/rpc"
@@ -50,10 +51,10 @@ func (this *MockSuite) SetupSuite() {
 	evtSubs := edb.NewEventSubscriptions(pipe.Events())
 	// The server
 	restServer := edb.NewRestServer(codec, pipe, evtSubs)
-	sConf := server.DefaultServerConfig()
+	sConf := config.DefaultServerConfig()
 	sConf.Bind.Port = 31402
 	// Create a server process.
-	proc := server.NewServeProcess(sConf, restServer)
+	proc := server.NewServeProcess(&sConf, restServer)
 	err := proc.Start()
 	if err != nil {
 		panic(err)
@@ -173,7 +174,7 @@ func (this *MockSuite) TestGetValidators() {
 
 func (this *MockSuite) TestGetNameRegEntry() {
 	resp := this.get("/namereg/" + this.testData.GetNameRegEntry.Input.Name)
-	ret := &types.NameRegEntry{}
+	ret := &txs.NameRegEntry{}
 	errD := this.codec.Decode(ret, resp.Body)
 	this.NoError(errD)
 	this.Equal(ret, this.testData.GetNameRegEntry.Output)
diff --git a/test/server/scumbag.go b/test/server/scumbag.go
index 80720601..85851099 100644
--- a/test/server/scumbag.go
+++ b/test/server/scumbag.go
@@ -2,12 +2,14 @@ package server
 
 import (
 	"encoding/json"
-	"github.com/gin-gonic/gin"
-	"github.com/tendermint/log15"
-	"github.com/eris-ltd/eris-db/rpc"
-	"github.com/eris-ltd/eris-db/server"
 	"os"
 	"runtime"
+
+	"github.com/eris-ltd/eris-db/config"
+	"github.com/eris-ltd/eris-db/rpc"
+	"github.com/eris-ltd/eris-db/server"
+	"github.com/gin-gonic/gin"
+	"github.com/tendermint/log15"
 )
 
 func init() {
@@ -27,7 +29,7 @@ func NewScumbagServer() server.Server {
 	return &ScumbagServer{}
 }
 
-func (this *ScumbagServer) Start(sc *server.ServerConfig, g *gin.Engine) {
+func (this *ScumbagServer) Start(sc *config.ServerConfig, g *gin.Engine) {
 	g.GET("/scumbag", func(c *gin.Context) {
 		c.String(200, "Scumbag")
 	})
@@ -56,14 +58,14 @@ func NewScumsocketServer(maxConnections uint) *server.WebSocketServer {
 }
 
 func NewServeScumbag() *server.ServeProcess {
-	cfg := server.DefaultServerConfig()
+	cfg := config.DefaultServerConfig()
 	cfg.Bind.Port = uint16(31400)
-	return server.NewServeProcess(cfg, NewScumbagServer())
+	return server.NewServeProcess(&cfg, NewScumbagServer())
 }
 
 func NewServeScumSocket(wsServer *server.WebSocketServer) *server.ServeProcess {
-	cfg := server.DefaultServerConfig()
+	cfg := config.DefaultServerConfig()
 	cfg.WebSocket.WebSocketEndpoint = "/scumsocket"
 	cfg.Bind.Port = uint16(31401)
-	return server.NewServeProcess(cfg, wsServer)
+	return server.NewServeProcess(&cfg, wsServer)
 }
diff --git a/test/web_api/query_test.go b/test/web_api/query_test.go
index 883bdacb..1c094b2d 100644
--- a/test/web_api/query_test.go
+++ b/test/web_api/query_test.go
@@ -4,18 +4,20 @@ package web_api
 import (
 	"bytes"
 	"fmt"
-	"github.com/stretchr/testify/suite"
+	"io/ioutil"
+	"net/http"
+	"os"
+	"path"
+	"testing"
+
+	"github.com/eris-ltd/eris-db/config"
 	edb "github.com/eris-ltd/eris-db/erisdb"
 	ess "github.com/eris-ltd/eris-db/erisdb/erisdbss"
 	ep "github.com/eris-ltd/eris-db/erisdb/pipe"
 	"github.com/eris-ltd/eris-db/rpc"
 	"github.com/eris-ltd/eris-db/server"
 	fd "github.com/eris-ltd/eris-db/test/testdata/filters"
-	"io/ioutil"
-	"net/http"
-	"os"
-	"path"
-	"testing"
+	"github.com/stretchr/testify/suite"
 )
 
 const QS_URL = "http://localhost:31403/server"
@@ -32,9 +34,9 @@ type QuerySuite struct {
 func (this *QuerySuite) SetupSuite() {
 	baseDir := path.Join(os.TempDir(), "/.edbservers")
 	ss := ess.NewServerServer(baseDir)
-	cfg := server.DefaultServerConfig()
+	cfg := config.DefaultServerConfig()
 	cfg.Bind.Port = uint16(31403)
-	proc := server.NewServeProcess(cfg, ss)
+	proc := server.NewServeProcess(&cfg, ss)
 	err := proc.Start()
 	if err != nil {
 		panic(err)
diff --git a/test/web_api/web_api_test.go b/test/web_api/web_api_test.go
index 3becfd0a..c1eaf57c 100644
--- a/test/web_api/web_api_test.go
+++ b/test/web_api/web_api_test.go
@@ -6,7 +6,14 @@ import (
 	"encoding/hex"
 	"fmt"
 	// edb "github.com/eris-ltd/erisdb/erisdb"
+	"io/ioutil"
+	"net/http"
+	"os"
+	"path"
+	"testing"
+
 	"github.com/eris-ltd/eris-db/account"
+	"github.com/eris-ltd/eris-db/config"
 	edb "github.com/eris-ltd/eris-db/erisdb"
 	ess "github.com/eris-ltd/eris-db/erisdb/erisdbss"
 	ep "github.com/eris-ltd/eris-db/erisdb/pipe"
@@ -15,11 +22,6 @@ import (
 	td "github.com/eris-ltd/eris-db/test/testdata/testdata"
 	"github.com/gin-gonic/gin"
 	"github.com/stretchr/testify/suite"
-	"io/ioutil"
-	"net/http"
-	"os"
-	"path"
-	"testing"
 )
 
 const WAPIS_URL = "http://localhost:31404/server"
@@ -37,9 +39,9 @@ func (this *WebApiSuite) SetupSuite() {
 	gin.SetMode(gin.ReleaseMode)
 	baseDir := path.Join(os.TempDir(), "/.edbservers")
 	ss := ess.NewServerServer(baseDir)
-	cfg := server.DefaultServerConfig()
+	cfg := config.DefaultServerConfig()
 	cfg.Bind.Port = uint16(31404)
-	proc := server.NewServeProcess(cfg, ss)
+	proc := server.NewServeProcess(&cfg, ss)
 	err := proc.Start()
 	if err != nil {
 		panic(err)
-- 
GitLab