diff --git a/app/app.go b/app/app.go index 27f31950d4..fa99458e6d 100644 --- a/app/app.go +++ b/app/app.go @@ -34,6 +34,8 @@ type Basecoin struct { logger log.Logger } +var _ abci.Application = &Basecoin{} + // NewBasecoin - create a new instance of the basecoin application func NewBasecoin(handler basecoin.Handler, eyesCli *eyes.Client, logger log.Logger) *Basecoin { state := sm.NewState(eyesCli, logger.With("module", "state")) diff --git a/cmd/basecoin/commands/utils.go b/cmd/basecoin/commands/utils.go deleted file mode 100644 index 8df68faac1..0000000000 --- a/cmd/basecoin/commands/utils.go +++ /dev/null @@ -1,23 +0,0 @@ -package commands - -import "encoding/hex" - -// Returns true for non-empty hex-string prefixed with "0x" -func isHex(s string) bool { - if len(s) > 2 && s[:2] == "0x" { - _, err := hex.DecodeString(s[2:]) - if err != nil { - return false - } - return true - } - return false -} - -// StripHex remove the first two hex bytes -func StripHex(s string) string { - if isHex(s) { - return s[2:] - } - return s -} diff --git a/cmd/basecoin/commands/utils_test.go b/cmd/basecoin/commands/utils_test.go deleted file mode 100644 index 692fec7433..0000000000 --- a/cmd/basecoin/commands/utils_test.go +++ /dev/null @@ -1,24 +0,0 @@ -package commands - -import ( - "encoding/hex" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestHex(t *testing.T) { - assert := assert.New(t) - - //test isHex - hexNoPrefix := hex.EncodeToString([]byte("foobar")) - hexWPrefix := "0x" + hexNoPrefix - str := "foobar" - strWPrefix := "0xfoobar" - - assert.True(isHex(hexWPrefix), "isHex not identifying hex with 0x prefix") - assert.False(isHex(hexNoPrefix), "isHex shouldn't identify hex without 0x prefix") - assert.False(isHex(str), "isHex shouldn't identify non-hex string") - assert.False(isHex(strWPrefix), "isHex shouldn't identify non-hex string with 0x prefix") - assert.True(StripHex(hexWPrefix) == hexNoPrefix, "StripHex doesn't remove first two characters") -} diff --git a/modules/auth/tx.go b/modules/auth/tx.go index 71d660ad4e..26e2b94b68 100644 --- a/modules/auth/tx.go +++ b/modules/auth/tx.go @@ -63,7 +63,6 @@ type OneSig struct { Signed `json:"signature"` } -//Interfaces to fulfill var _ keys.Signable = &OneSig{} var _ basecoin.TxLayer = &OneSig{} @@ -135,7 +134,6 @@ type MultiSig struct { Sigs []Signed `json:"signatures"` } -//Interfaces to fulfill var _ keys.Signable = &MultiSig{} var _ basecoin.TxLayer = &MultiSig{} diff --git a/modules/base/tx.go b/modules/base/tx.go index 95c9299523..b4f2cd2b78 100644 --- a/modules/base/tx.go +++ b/modules/base/tx.go @@ -21,10 +21,6 @@ func init() { RegisterImplementation(ChainTx{}, TypeChainTx, ByteChainTx) } -//Interfaces to fulfill -var _ basecoin.TxInner = &MultiTx{} -var _ basecoin.TxInner = &ChainTx{} - /**** MultiTx ******/ // MultiTx - a transaction containing multiple transactions @@ -32,6 +28,8 @@ type MultiTx struct { Txs []basecoin.Tx `json:"txs"` } +var _ basecoin.TxInner = &MultiTx{} + //nolint - TxInner Functions func NewMultiTx(txs ...basecoin.Tx) basecoin.Tx { return (MultiTx{Txs: txs}).Wrap() @@ -57,6 +55,8 @@ type ChainTx struct { ChainID string `json:"chain_id"` } +var _ basecoin.TxInner = &ChainTx{} + //nolint - TxInner Functions func NewChainTx(chainID string, tx basecoin.Tx) basecoin.Tx { return (ChainTx{Tx: tx, ChainID: chainID}).Wrap()