Tools configuration and linters (#215)

* tools config

* lint

* lint

* codecov
This commit is contained in:
Federico Kunze 2020-03-16 19:53:24 -03:00 committed by GitHub
parent afe7289415
commit 87b625ed50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 172 additions and 71 deletions

View File

@ -59,6 +59,27 @@ jobs:
key: go-mod-v1-{{ checksum "go.sum" }} key: go-mod-v1-{{ checksum "go.sum" }}
paths: paths:
- "/go/pkg/mod" - "/go/pkg/mod"
upload-coverage:
docker: # run the steps with Docker
# CircleCI Go images available at: https://hub.docker.com/r/circleci/golang/
- image: circleci/golang:1.13 #
working_directory: /go/src/github.com/cosmos/ethermint
steps:
- checkout
- run:
name: gather
command: |
for d in $(go list ./... | grep -v vendor); do
go test -race -coverprofile=profile.out -covermode=atomic "$d"
if [ -f profile.out ]; then
cat profile.out >> coverage.txt
rm profile.out
fi
done
- run:
name: upload
command: bash <(curl -s https://codecov.io/bash) -f coverage.txt
workflows: workflows:
version: 2 version: 2

58
.codecov.yml Normal file
View File

@ -0,0 +1,58 @@
#
# This codecov.yml is the default configuration for
# all repositories on Codecov. You may adjust the settings
# below in your own codecov.yml in your repository.
#
coverage:
precision: 2
round: down
range: 70...100
status:
# Learn more at https://docs.codecov.io/docs/commit-status
project:
default:
threshold: 1% # allow this much decrease on project
app:
target: 70%
flags: app
modules:
target: 50%
flags: modules
core:
target: 50%
flags: core
clients:
flags: clients
changes: false
comment:
layout: "reach, diff, files"
behavior: default # update if exists else create new
require_changes: true
flags:
app:
paths:
- "app/"
modules:
paths:
- "x/"
- "!x/**/client/" # ignore client package
core:
paths:
- "core/"
- "crypto/"
- "types/"
clients:
paths:
- "rpc/"
- "client/"
- "x/**/client/"
ignore:
- "docs"
- "*.md"
- "**/*.pb.go"
- "types/*.pb.go"
- "x/**/*.pb.go"

View File

@ -1,11 +1,9 @@
# This file configures github.com/golangci/golangci-lint. # run:
# # timeout for analysis, e.g. 30s, 5m, default is 1m
run: # timeout: 5m
timeout: 2m
tests: true
skip-dirs-use-default: true
linters: linters:
disable-all: true
enable: enable:
- bodyclose - bodyclose
- deadcode - deadcode
@ -13,7 +11,7 @@ linters:
- dogsled - dogsled
- errcheck - errcheck
- goconst - goconst
- gocyclo - gocritic
- gofmt - gofmt
- goimports - goimports
- golint - golint
@ -22,7 +20,10 @@ linters:
- govet - govet
- ineffassign - ineffassign
- interfacer - interfacer
- maligned
- misspell - misspell
- nakedret
- prealloc
- scopelint - scopelint
- staticcheck - staticcheck
- structcheck - structcheck
@ -30,13 +31,32 @@ linters:
- typecheck - typecheck
- unconvert - unconvert
- unused - unused
- misspell
- varcheck - varcheck
issues: issues:
exclude-rules: exclude-rules:
- text: "Use of weak random number generator"
linters:
- gosec
- text: "comment on exported var" - text: "comment on exported var"
linters: linters:
- golint - golint
- text: "ST1005:" - text: "don't use an underscore in package name"
linters: linters:
- stylecheck - golint
- text: "ST1003:"
linters:
- stylecheck
# FIXME: Disabled until golangci-lint updates stylecheck with this fix:
# https://github.com/dominikh/go-tools/issues/389
- text: "ST1016:"
linters:
- stylecheck
linters-settings:
dogsled:
max-blank-identifiers: 3
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true

View File

@ -23,7 +23,6 @@ import (
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/cosmos/ethermint/app" "github.com/cosmos/ethermint/app"
emintapp "github.com/cosmos/ethermint/app"
"github.com/cosmos/ethermint/client/genaccounts" "github.com/cosmos/ethermint/client/genaccounts"
emintcrypto "github.com/cosmos/ethermint/crypto" emintcrypto "github.com/cosmos/ethermint/crypto"
@ -38,7 +37,7 @@ import (
func main() { func main() {
cobra.EnableCommandSorting = false cobra.EnableCommandSorting = false
cdc := emintapp.MakeCodec() cdc := app.MakeCodec()
tmamino.RegisterKeyType(emintcrypto.PubKeySecp256k1{}, emintcrypto.PubKeyAminoName) tmamino.RegisterKeyType(emintcrypto.PubKeySecp256k1{}, emintcrypto.PubKeyAminoName)
tmamino.RegisterKeyType(emintcrypto.PrivKeySecp256k1{}, emintcrypto.PrivKeyAminoName) tmamino.RegisterKeyType(emintcrypto.PrivKeySecp256k1{}, emintcrypto.PrivKeyAminoName)
@ -63,12 +62,12 @@ func main() {
} }
// CLI commands to initialize the chain // CLI commands to initialize the chain
rootCmd.AddCommand( rootCmd.AddCommand(
withChainIDValidation(genutilcli.InitCmd(ctx, cdc, emintapp.ModuleBasics, emintapp.DefaultNodeHome)), withChainIDValidation(genutilcli.InitCmd(ctx, cdc, app.ModuleBasics, app.DefaultNodeHome)),
genutilcli.CollectGenTxsCmd(ctx, cdc, auth.GenesisAccountIterator{}, emintapp.DefaultNodeHome), genutilcli.CollectGenTxsCmd(ctx, cdc, auth.GenesisAccountIterator{}, app.DefaultNodeHome),
genutilcli.GenTxCmd( genutilcli.GenTxCmd(
ctx, cdc, emintapp.ModuleBasics, staking.AppModuleBasic{}, auth.GenesisAccountIterator{}, emintapp.DefaultNodeHome, emintapp.DefaultCLIHome, ctx, cdc, app.ModuleBasics, staking.AppModuleBasic{}, auth.GenesisAccountIterator{}, app.DefaultNodeHome, app.DefaultCLIHome,
), ),
genutilcli.ValidateGenesisCmd(ctx, cdc, emintapp.ModuleBasics), genutilcli.ValidateGenesisCmd(ctx, cdc, app.ModuleBasics),
// AddGenesisAccountCmd allows users to add accounts to the genesis file // AddGenesisAccountCmd allows users to add accounts to the genesis file
genaccounts.AddGenesisAccountCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome), genaccounts.AddGenesisAccountCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome),
@ -78,7 +77,7 @@ func main() {
server.AddCommands(ctx, cdc, rootCmd, newApp, exportAppStateAndTMValidators) server.AddCommands(ctx, cdc, rootCmd, newApp, exportAppStateAndTMValidators)
// prepare and add flags // prepare and add flags
executor := cli.PrepareBaseCmd(rootCmd, "EM", emintapp.DefaultNodeHome) executor := cli.PrepareBaseCmd(rootCmd, "EM", app.DefaultNodeHome)
err := executor.Execute() err := executor.Execute()
if err != nil { if err != nil {
panic(err) panic(err)
@ -86,7 +85,7 @@ func main() {
} }
func newApp(logger tmlog.Logger, db dbm.DB, traceStore io.Writer) abci.Application { func newApp(logger tmlog.Logger, db dbm.DB, traceStore io.Writer) abci.Application {
return emintapp.NewEthermintApp(logger, db, true, 0, return app.NewEthermintApp(logger, db, true, 0,
baseapp.SetPruning(store.NewPruningOptionsFromString(viper.GetString("pruning")))) baseapp.SetPruning(store.NewPruningOptionsFromString(viper.GetString("pruning"))))
} }
@ -95,7 +94,7 @@ func exportAppStateAndTMValidators(
) (json.RawMessage, []tmtypes.GenesisValidator, error) { ) (json.RawMessage, []tmtypes.GenesisValidator, error) {
if height != -1 { if height != -1 {
emintApp := emintapp.NewEthermintApp(logger, db, true, 0) emintApp := app.NewEthermintApp(logger, db, true, 0)
err := emintApp.LoadHeight(height) err := emintApp.LoadHeight(height)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
@ -103,7 +102,7 @@ func exportAppStateAndTMValidators(
return emintApp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList) return emintApp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList)
} }
emintApp := emintapp.NewEthermintApp(logger, db, true, 0) emintApp := app.NewEthermintApp(logger, db, true, 0)
return emintApp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList) return emintApp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList)
} }
@ -121,7 +120,7 @@ func withChainIDValidation(baseCmd *cobra.Command) *cobra.Command {
_, ok := new(big.Int).SetString(chainIDFlag, 10) _, ok := new(big.Int).SetString(chainIDFlag, 10)
if !ok { if !ok {
return fmt.Errorf( return fmt.Errorf(
fmt.Sprintf("Invalid chainID: %s, must be base-10 integer format", chainIDFlag)) fmt.Sprintf("invalid chainID: %s, must be base-10 integer format", chainIDFlag))
} }
return baseRunE(cmd, args) return baseRunE(cmd, args)

View File

@ -199,6 +199,7 @@ func TestImportBlocks(t *testing.T) {
blockchainInput, err := os.Open(flagBlockchain) blockchainInput, err := os.Open(flagBlockchain)
require.Nil(t, err) require.Nil(t, err)
// nolint: gosec
defer blockchainInput.Close() defer blockchainInput.Close()
// ethereum mainnet config // ethereum mainnet config

View File

@ -12,7 +12,6 @@ import (
emintcrypto "github.com/cosmos/ethermint/crypto" emintcrypto "github.com/cosmos/ethermint/crypto"
params "github.com/cosmos/ethermint/rpc/args" params "github.com/cosmos/ethermint/rpc/args"
emint "github.com/cosmos/ethermint/types" emint "github.com/cosmos/ethermint/types"
etypes "github.com/cosmos/ethermint/types"
"github.com/cosmos/ethermint/utils" "github.com/cosmos/ethermint/utils"
"github.com/cosmos/ethermint/version" "github.com/cosmos/ethermint/version"
"github.com/cosmos/ethermint/x/evm" "github.com/cosmos/ethermint/x/evm"
@ -885,7 +884,7 @@ func (e *PublicEthAPI) generateFromArgs(args params.SendTxArgs) (msg *types.Ethe
// Set default gas price // Set default gas price
// TODO: Change to min gas price from context once available through server/daemon // TODO: Change to min gas price from context once available through server/daemon
gasPrice = big.NewInt(etypes.DefaultGasPrice) gasPrice = big.NewInt(emint.DefaultGasPrice)
} }
if args.Nonce == nil { if args.Nonce == nil {

View File

@ -20,7 +20,7 @@ func NewPublicNetAPI(cliCtx context.CLIContext) *PublicNetAPI {
// parse the chainID from a integer string // parse the chainID from a integer string
intChainID, err := strconv.ParseUint(chainID, 0, 64) intChainID, err := strconv.ParseUint(chainID, 0, 64)
if err != nil { if err != nil {
panic(fmt.Sprintf("Invalid chainID: %s, must be integer format", chainID)) panic(fmt.Sprintf("invalid chainID: %s, must be integer format", chainID))
} }
return &PublicNetAPI{ return &PublicNetAPI{

View File

@ -59,15 +59,17 @@ func (acc Account) Balance() sdk.Int {
func (acc Account) SetBalance(amt sdk.Int) { func (acc Account) SetBalance(amt sdk.Int) {
coins := acc.GetCoins() coins := acc.GetCoins()
diff := amt.Sub(coins.AmountOf(DenomDefault)) diff := amt.Sub(coins.AmountOf(DenomDefault))
if diff.IsZero() { switch {
return case diff.IsPositive():
} else if diff.IsPositive() {
// Increase coins to amount // Increase coins to amount
coins = coins.Add(sdk.Coins{sdk.NewCoin(DenomDefault, diff)}) coins = coins.Add(sdk.NewCoins(sdk.NewCoin(DenomDefault, diff)))
} else { case diff.IsNegative():
// Decrease coins to amount // Decrease coins to amount
coins = coins.Sub(sdk.Coins{sdk.NewCoin(DenomDefault, diff.Neg())}) coins = coins.Sub(sdk.NewCoins(sdk.NewCoin(DenomDefault, diff.Neg())))
default:
return
} }
if err := acc.SetCoins(coins); err != nil { if err := acc.SetCoins(coins); err != nil {
panic(fmt.Sprintf("Could not set coins for address %s", acc.GetAddress())) panic(fmt.Sprintf("Could not set coins for address %s", acc.GetAddress()))
} }

View File

@ -28,10 +28,10 @@ type (
func ValidateGenesis(data GenesisState) error { func ValidateGenesis(data GenesisState) error {
for _, acct := range data.Accounts { for _, acct := range data.Accounts {
if len(acct.Address.Bytes()) == 0 { if len(acct.Address.Bytes()) == 0 {
return fmt.Errorf("Invalid GenesisAccount Error: Missing Address") return fmt.Errorf("invalid GenesisAccount Error: Missing Address")
} }
if acct.Balance == nil { if acct.Balance == nil {
return fmt.Errorf("Invalid GenesisAccount Error: Missing Balance") return fmt.Errorf("invalid GenesisAccount Error: Missing Balance")
} }
} }
return nil return nil

View File

@ -340,6 +340,7 @@ func TxDecoder(cdc *codec.Codec) sdk.TxDecoder {
// returns the sender or an error. // returns the sender or an error.
// //
// Ref: Ethereum Yellow Paper (BYZANTIUM VERSION 69351d5) Appendix F // Ref: Ethereum Yellow Paper (BYZANTIUM VERSION 69351d5) Appendix F
// nolint: gocritic
func recoverEthSig(R, S, Vb *big.Int, sigHash ethcmn.Hash) (ethcmn.Address, error) { func recoverEthSig(R, S, Vb *big.Int, sigHash ethcmn.Hash) (ethcmn.Address, error) {
if Vb.BitLen() > 8 { if Vb.BitLen() > 8 {
return ethcmn.Address{}, errors.New("invalid signature") return ethcmn.Address{}, errors.New("invalid signature")

View File

@ -42,7 +42,7 @@ func marshalAmino(td EncodableTxData) (string, error) {
return string(bz), err return string(bz), err
} }
func unmarshalAmino(td *EncodableTxData, text string) (err error) { func unmarshalAmino(td *EncodableTxData, text string) error {
return cdc.UnmarshalBinaryBare([]byte(text), td) return cdc.UnmarshalBinaryBare([]byte(text), td)
} }
@ -67,11 +67,11 @@ func (td TxData) MarshalAmino() (string, error) {
} }
// UnmarshalAmino defines custom decoding scheme for TxData // UnmarshalAmino defines custom decoding scheme for TxData
func (td *TxData) UnmarshalAmino(text string) (err error) { func (td *TxData) UnmarshalAmino(text string) error {
e := new(EncodableTxData) e := new(EncodableTxData)
err = unmarshalAmino(e, text) err := unmarshalAmino(e, text)
if err != nil { if err != nil {
return return err
} }
td.AccountNonce = e.AccountNonce td.AccountNonce = e.AccountNonce
@ -82,8 +82,9 @@ func (td *TxData) UnmarshalAmino(text string) (err error) {
price, err := utils.UnmarshalBigInt(e.Price) price, err := utils.UnmarshalBigInt(e.Price)
if err != nil { if err != nil {
return return err
} }
if td.Price != nil { if td.Price != nil {
td.Price.Set(price) td.Price.Set(price)
} else { } else {
@ -92,8 +93,9 @@ func (td *TxData) UnmarshalAmino(text string) (err error) {
amt, err := utils.UnmarshalBigInt(e.Amount) amt, err := utils.UnmarshalBigInt(e.Amount)
if err != nil { if err != nil {
return return err
} }
if td.Amount != nil { if td.Amount != nil {
td.Amount.Set(amt) td.Amount.Set(amt)
} else { } else {
@ -102,8 +104,9 @@ func (td *TxData) UnmarshalAmino(text string) (err error) {
v, err := utils.UnmarshalBigInt(e.V) v, err := utils.UnmarshalBigInt(e.V)
if err != nil { if err != nil {
return return err
} }
if td.V != nil { if td.V != nil {
td.V.Set(v) td.V.Set(v)
} else { } else {
@ -112,8 +115,9 @@ func (td *TxData) UnmarshalAmino(text string) (err error) {
r, err := utils.UnmarshalBigInt(e.R) r, err := utils.UnmarshalBigInt(e.R)
if err != nil { if err != nil {
return return err
} }
if td.R != nil { if td.R != nil {
td.R.Set(r) td.R.Set(r)
} else { } else {
@ -122,15 +126,16 @@ func (td *TxData) UnmarshalAmino(text string) (err error) {
s, err := utils.UnmarshalBigInt(e.S) s, err := utils.UnmarshalBigInt(e.S)
if err != nil { if err != nil {
return return err
} }
if td.S != nil { if td.S != nil {
td.S.Set(s) td.S.Set(s)
} else { } else {
td.S = s td.S = s
} }
return return nil
} }
// TODO: Implement JSON marshaling/ unmarshaling for this type // TODO: Implement JSON marshaling/ unmarshaling for this type

View File

@ -9,7 +9,6 @@ import (
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/ethermint/crypto" "github.com/cosmos/ethermint/crypto"
"github.com/cosmos/ethermint/utils" "github.com/cosmos/ethermint/utils"
"github.com/ethereum/go-ethereum/common"
ethcmn "github.com/ethereum/go-ethereum/common" ethcmn "github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types" ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
@ -36,12 +35,12 @@ func TestMsgEthereumTx(t *testing.T) {
func TestMsgEthereumTxValidation(t *testing.T) { func TestMsgEthereumTxValidation(t *testing.T) {
testCases := []struct { testCases := []struct {
payload []byte
amount *big.Int
gasPrice *big.Int
gasLimit uint64
nonce uint64 nonce uint64
to ethcmn.Address to ethcmn.Address
amount *big.Int
gasLimit uint64
gasPrice *big.Int
payload []byte
expectPass bool expectPass bool
}{ }{
{amount: big.NewInt(100), gasPrice: big.NewInt(100000), expectPass: true}, {amount: big.NewInt(100), gasPrice: big.NewInt(100000), expectPass: true},
@ -183,13 +182,13 @@ func TestMarshalAndUnmarshalLogs(t *testing.T) {
logs := []*ethtypes.Log{ logs := []*ethtypes.Log{
{ {
Address: common.BytesToAddress([]byte{0x11}), Address: ethcmn.BytesToAddress([]byte{0x11}),
TxHash: common.HexToHash("0x01"), TxHash: ethcmn.HexToHash("0x01"),
// May need to find workaround since Topics is required to unmarshal from JSON // May need to find workaround since Topics is required to unmarshal from JSON
Topics: []common.Hash{}, Topics: []ethcmn.Hash{},
Removed: true, Removed: true,
}, },
{Address: common.BytesToAddress([]byte{0x01, 0x11}), Topics: []common.Hash{}}, {Address: ethcmn.BytesToAddress([]byte{0x01, 0x11}), Topics: []ethcmn.Hash{}},
} }
raw, err := codec.MarshalJSONIndent(cdc, logs) raw, err := codec.MarshalJSONIndent(cdc, logs)

View File

@ -51,22 +51,18 @@ type (
// Account values can be accessed and modified through the object. // Account values can be accessed and modified through the object.
// Finally, call CommitTrie to write the modified storage trie into a database. // Finally, call CommitTrie to write the modified storage trie into a database.
stateObject struct { stateObject struct {
address ethcmn.Address code types.Code // contract bytecode, which gets set when code is loaded
stateDB *CommitStateDB
account *types.Account
// DB error. // DB error.
// State objects are used by the consensus core and VM which are // State objects are used by the consensus core and VM which are
// unable to deal with database-level errors. Any error that occurs // unable to deal with database-level errors. Any error that occurs
// during a database read is memoized here and will eventually be returned // during a database read is memoized here and will eventually be returned
// by StateDB.Commit. // by StateDB.Commit.
dbErr error dbErr error
stateDB *CommitStateDB
code types.Code // contract bytecode, which gets set when code is loaded account *types.Account
originStorage types.Storage // Storage cache of original entries to dedup rewrites originStorage types.Storage // Storage cache of original entries to dedup rewrites
dirtyStorage types.Storage // Storage entries that need to be flushed to disk dirtyStorage types.Storage // Storage entries that need to be flushed to disk
address ethcmn.Address
// cache flags // cache flags
// //
// When an object is marked suicided it will be delete from the trie during // When an object is marked suicided it will be delete from the trie during

View File

@ -14,16 +14,16 @@ import (
// StateTransition defines data to transitionDB in evm // StateTransition defines data to transitionDB in evm
type StateTransition struct { type StateTransition struct {
Sender common.Address
AccountNonce uint64
Price *big.Int
GasLimit uint64
Recipient *common.Address
Amount *big.Int
Payload []byte Payload []byte
Csdb *CommitStateDB Recipient *common.Address
AccountNonce uint64
GasLimit uint64
Price *big.Int
Amount *big.Int
ChainID *big.Int ChainID *big.Int
Csdb *CommitStateDB
THash *common.Hash THash *common.Hash
Sender common.Address
Simulate bool Simulate bool
} }

View File

@ -294,6 +294,7 @@ func (csdb *CommitStateDB) GetLogs(hash ethcmn.Hash) []*ethtypes.Log {
// Logs returns all the current logs in the state. // Logs returns all the current logs in the state.
func (csdb *CommitStateDB) Logs() []*ethtypes.Log { func (csdb *CommitStateDB) Logs() []*ethtypes.Log {
// nolint: prealloc
var logs []*ethtypes.Log var logs []*ethtypes.Log
for _, lgs := range csdb.logs { for _, lgs := range csdb.logs {
logs = append(logs, lgs...) logs = append(logs, lgs...)
@ -337,7 +338,7 @@ func (csdb *CommitStateDB) StorageTrie(addr ethcmn.Address) ethstate.Trie {
// in the cache, it will either be removed, or have it's code set and/or it's // in the cache, it will either be removed, or have it's code set and/or it's
// state (storage) updated. In addition, the state object (account) itself will // state (storage) updated. In addition, the state object (account) itself will
// be written. Finally, the root hash (version) will be returned. // be written. Finally, the root hash (version) will be returned.
func (csdb *CommitStateDB) Commit(deleteEmptyObjects bool) (root ethcmn.Hash, err error) { func (csdb *CommitStateDB) Commit(deleteEmptyObjects bool) (ethcmn.Hash, error) {
defer csdb.clearJournalAndRefund() defer csdb.clearJournalAndRefund()
// remove dirty state object entries based on the journal // remove dirty state object entries based on the journal
@ -372,7 +373,7 @@ func (csdb *CommitStateDB) Commit(deleteEmptyObjects bool) (root ethcmn.Hash, er
// NOTE: Ethereum returns the trie merkle root here, but as commitment // NOTE: Ethereum returns the trie merkle root here, but as commitment
// actually happens in the BaseApp at EndBlocker, we do not know the root at // actually happens in the BaseApp at EndBlocker, we do not know the root at
// this time. // this time.
return return ethcmn.Hash{}, nil
} }
// Finalise finalizes the state objects (accounts) state by setting their state, // Finalise finalizes the state objects (accounts) state by setting their state,

View File

@ -12,7 +12,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/params" "github.com/cosmos/cosmos-sdk/x/params"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/ethereum/go-ethereum/common"
ethcmn "github.com/ethereum/go-ethereum/common" ethcmn "github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types" ethtypes "github.com/ethereum/go-ethereum/core/types"
@ -79,7 +78,7 @@ func TestBloomFilter(t *testing.T) {
// Prepare db for logs // Prepare db for logs
tHash := ethcmn.BytesToHash([]byte{0x1}) tHash := ethcmn.BytesToHash([]byte{0x1})
stateDB.Prepare(tHash, common.Hash{}, 0) stateDB.Prepare(tHash, ethcmn.Hash{}, 0)
contractAddress := ethcmn.BigToAddress(big.NewInt(1)) contractAddress := ethcmn.BigToAddress(big.NewInt(1))

View File

@ -67,7 +67,7 @@ func DecodeReturnData(bytes []byte) (addr ethcmn.Address, bloom ethtypes.Bloom,
bloom = ethtypes.BytesToBloom(bytes[bloomIdx:returnIdx]) bloom = ethtypes.BytesToBloom(bytes[bloomIdx:returnIdx])
ret = bytes[returnIdx:] ret = bytes[returnIdx:]
} else { } else {
err = fmt.Errorf("Invalid format for encoded data, message must be an EVM state transition") err = fmt.Errorf("invalid format for encoded data, message must be an EVM state transition")
} }
return return