all: cleanup imports (#524)

This commit is contained in:
Federico Kunze Küllmer
2021-09-03 18:06:36 +00:00
committed by GitHub
parent 945fa64853
commit c73ce0f812
30 changed files with 238 additions and 247 deletions
+6 -6
View File
@@ -3,7 +3,7 @@ package importer
import (
"math/big"
ethcmn "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
ethcons "github.com/ethereum/go-ethereum/consensus"
ethstate "github.com/ethereum/go-ethereum/core/state"
ethtypes "github.com/ethereum/go-ethereum/core/types"
@@ -20,7 +20,7 @@ import (
// NOTE: Ethermint will distribute the fees out to validators, so the structure
// and functionality of this is a WIP and subject to change.
type ChainContext struct {
Coinbase ethcmn.Address
Coinbase common.Address
headersByNumber map[uint64]*ethtypes.Header
}
@@ -48,7 +48,7 @@ func (cc *ChainContext) SetHeader(number uint64, header *ethtypes.Header) {
//
// TODO: The Cosmos SDK supports retreiving such information in contexts and
// multi-store, so this will be need to be integrated.
func (cc *ChainContext) GetHeader(_ ethcmn.Hash, number uint64) *ethtypes.Header {
func (cc *ChainContext) GetHeader(_ common.Hash, number uint64) *ethtypes.Header {
if header, ok := cc.headersByNumber[number]; ok {
return header
}
@@ -62,7 +62,7 @@ func (cc *ChainContext) GetHeader(_ ethcmn.Hash, number uint64) *ethtypes.Header
//
// NOTE: Ethermint will distribute the fees out to validators, so the structure
// and functionality of this is a WIP and subject to change.
func (cc *ChainContext) Author(_ *ethtypes.Header) (ethcmn.Address, error) {
func (cc *ChainContext) Author(_ *ethtypes.Header) (common.Address, error) {
return cc.Coinbase, nil
}
@@ -119,8 +119,8 @@ func (cc *ChainContext) Seal(_ ethcons.ChainHeaderReader, _ *ethtypes.Block, _ c
// SealHash implements Ethereum's consensus.Engine interface. It returns the
// hash of a block prior to it being sealed.
func (cc *ChainContext) SealHash(header *ethtypes.Header) ethcmn.Hash {
return ethcmn.Hash{}
func (cc *ChainContext) SealHash(header *ethtypes.Header) common.Hash {
return common.Hash{}
}
// VerifyHeader implements Ethereum's consensus.Engine interface. It currently
+3 -3
View File
@@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/require"
ethcmn "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
ethcons "github.com/ethereum/go-ethereum/consensus"
ethcore "github.com/ethereum/go-ethereum/core"
ethtypes "github.com/ethereum/go-ethereum/core/types"
@@ -47,8 +47,8 @@ func TestChainContextGetHeader(t *testing.T) {
}
cc.SetHeader(uint64(header.Number.Int64()), header)
require.Equal(t, header, cc.GetHeader(ethcmn.Hash{}, uint64(header.Number.Int64())))
require.Nil(t, cc.GetHeader(ethcmn.Hash{}, 0))
require.Equal(t, header, cc.GetHeader(common.Hash{}, uint64(header.Number.Int64())))
require.Nil(t, cc.GetHeader(common.Hash{}, 0))
}
func TestChainContextAuthor(t *testing.T) {
+7 -7
View File
@@ -35,12 +35,12 @@ package importer
// evmkeeper "github.com/tharsis/ethermint/x/evm/keeper"
// evmtypes "github.com/tharsis/ethermint/x/evm/types"
// ethcmn "github.com/ethereum/go-ethereum/common"
// "github.com/ethereum/go-ethereum/common"
// "github.com/ethereum/go-ethereum/consensus/ethash"
// ethcore "github.com/ethereum/go-ethereum/core"
// ethtypes "github.com/ethereum/go-ethereum/core/types"
// ethvm "github.com/ethereum/go-ethereum/core/vm"
// ethcrypto "github.com/ethereum/go-ethereum/crypto"
// "github.com/ethereum/go-ethereum/crypto"
// ethparams "github.com/ethereum/go-ethereum/params"
// ethrlp "github.com/ethereum/go-ethereum/rlp"
@@ -56,7 +56,7 @@ package importer
// flagBlockchain string
// flagCPUProfile string
// genInvestor = ethcmn.HexToAddress("0x756F45E3FA69347A9A973A725E3C98bC4db0b5a0")
// genInvestor = common.HexToAddress("0x756F45E3FA69347A9A973A725E3C98bC4db0b5a0")
// logger = tmlog.NewNopLogger()
@@ -125,7 +125,7 @@ package importer
// sort.Strings(genAddrs)
// for _, addrStr := range genAddrs {
// addr := ethcmn.HexToAddress(addrStr)
// addr := common.HexToAddress(addrStr)
// acc := genBlock.Alloc[addr]
// evmKeeper.AddBalance(addr, acc.Balance)
@@ -348,7 +348,7 @@ package importer
// // Function is also pulled from go-ethereum 1.9 because of the incompatible usage
// // Ref: https://github.com/ethereum/go-ethereum/blob/52f2461774bcb8cdd310f86b4bc501df5b783852/core/state_processor.go#L88
// func applyTransaction(
// config *ethparams.ChainConfig, bc ethcore.ChainContext, author *ethcmn.Address,
// config *ethparams.ChainConfig, bc ethcore.ChainContext, author *common.Address,
// gp *ethcore.GasPool, evmKeeper *evmkeeper.Keeper, header *ethtypes.Header,
// tx *ethtypes.Transaction, usedGas *uint64, cfg ethvm.Config,
// ) (*ethtypes.Receipt, uint64, error) {
@@ -376,7 +376,7 @@ package importer
// return nil, execResult.UsedGas, err
// }
// root := ethcmn.Hash{}.Bytes()
// root := common.Hash{}.Bytes()
// *usedGas += execResult.UsedGas
// // Create a new receipt for the transaction, storing the intermediate root and gas used by the tx
@@ -387,7 +387,7 @@ package importer
// // if the transaction created a contract, store the creation address in the receipt.
// if msg.To() == nil {
// receipt.ContractAddress = ethcrypto.CreateAddress(vmenv.TxContext.Origin, tx.Nonce())
// receipt.ContractAddress = crypto.CreateAddress(vmenv.TxContext.Origin, tx.Nonce())
// }
// // Set the receipt logs and create a bloom for filtering