forked from cerc-io/laconicd-deprecated
+1
-1
@@ -17,7 +17,7 @@ import (
|
||||
func InitGenesis(
|
||||
ctx sdk.Context,
|
||||
k *keeper.Keeper,
|
||||
accountKeeper types.AccountKeeper, // nolint: interfacer
|
||||
accountKeeper types.AccountKeeper,
|
||||
data types.GenesisState,
|
||||
) []abci.ValidatorUpdate {
|
||||
k.WithContext(ctx)
|
||||
|
||||
@@ -58,7 +58,6 @@ func (suite *EvmTestSuite) SetupTest() {
|
||||
suite.signer = tests.NewSigner(privKey)
|
||||
suite.ethSigner = ethtypes.LatestSignerForChainID(suite.chainID)
|
||||
suite.from = common.BytesToAddress(privKey.PubKey().Address().Bytes())
|
||||
|
||||
}
|
||||
|
||||
func TestEvmTestSuite(t *testing.T) {
|
||||
|
||||
@@ -123,7 +123,6 @@ func (k Keeper) ValidatorAccount(c context.Context, req *types.QueryValidatorAcc
|
||||
}
|
||||
|
||||
return &res, nil
|
||||
|
||||
}
|
||||
|
||||
// Balance implements the Query/Balance gRPC method
|
||||
@@ -261,12 +260,11 @@ func (k Keeper) BlockLogs(c context.Context, req *types.QueryBlockLogsRequest) (
|
||||
|
||||
return false, nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
|
||||
var txsLogs = []types.TransactionLogs{}
|
||||
txsLogs := []types.TransactionLogs{}
|
||||
for _, txHash := range mapOrder {
|
||||
if len(logs[txHash]) > 0 {
|
||||
txsLogs = append(txsLogs, types.TransactionLogs{Hash: txHash, Logs: logs[txHash]})
|
||||
@@ -481,7 +479,6 @@ func (k Keeper) TraceTx(c context.Context, req *types.QueryTraceTxRequest) (*typ
|
||||
ethCfg := params.ChainConfig.EthereumConfig(k.eip155ChainID)
|
||||
signer := ethtypes.MakeSigner(ethCfg, big.NewInt(ctx.BlockHeight()))
|
||||
coreMessage, err := req.Msg.AsMessage(signer)
|
||||
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
@@ -489,8 +486,8 @@ func (k Keeper) TraceTx(c context.Context, req *types.QueryTraceTxRequest) (*typ
|
||||
switch {
|
||||
case req.TraceConfig != nil && req.TraceConfig.Tracer != "":
|
||||
timeout := defaultTraceTimeout
|
||||
//TODO change timeout to time.duration
|
||||
//Used string to comply with go ethereum
|
||||
// TODO change timeout to time.duration
|
||||
// Used string to comply with go ethereum
|
||||
if req.TraceConfig.Timeout != "" {
|
||||
if timeout, err = time.ParseDuration(req.TraceConfig.Timeout); err != nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "timeout value: %s", err.Error())
|
||||
@@ -530,7 +527,6 @@ func (k Keeper) TraceTx(c context.Context, req *types.QueryTraceTxRequest) (*typ
|
||||
k.SetTxIndexTransient(uint64(req.TxIndex))
|
||||
|
||||
res, err := k.ApplyMessage(evm, coreMessage, ethCfg, true)
|
||||
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
@@ -538,7 +534,7 @@ func (k Keeper) TraceTx(c context.Context, req *types.QueryTraceTxRequest) (*typ
|
||||
// Depending on the tracer type, format and return the trace result data.
|
||||
switch tracer := tracer.(type) {
|
||||
case *vm.StructLogger:
|
||||
//TODO Return proper returnValue
|
||||
// TODO Return proper returnValue
|
||||
result := types.ExecutionResult{
|
||||
Gas: res.GasUsed,
|
||||
Failed: res.Failed(),
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
grpctypes "github.com/cosmos/cosmos-sdk/types/grpc"
|
||||
)
|
||||
|
||||
//Not valid Ethereum address
|
||||
// Not valid Ethereum address
|
||||
const invalidAddress = "0x0000"
|
||||
|
||||
func (suite *KeeperTestSuite) TestQueryAccount() {
|
||||
@@ -101,7 +101,8 @@ func (suite *KeeperTestSuite) TestQueryCosmosAccount() {
|
||||
malleate func()
|
||||
expPass bool
|
||||
}{
|
||||
{"invalid address",
|
||||
{
|
||||
"invalid address",
|
||||
func() {
|
||||
expAccount = &types.QueryCosmosAccountResponse{
|
||||
CosmosAddress: sdk.AccAddress(common.Address{}.Bytes()).String(),
|
||||
@@ -178,7 +179,8 @@ func (suite *KeeperTestSuite) TestQueryBalance() {
|
||||
malleate func()
|
||||
expPass bool
|
||||
}{
|
||||
{"invalid address",
|
||||
{
|
||||
"invalid address",
|
||||
func() {
|
||||
expBalance = "0"
|
||||
req = &types.QueryBalanceRequest{
|
||||
@@ -236,7 +238,8 @@ func (suite *KeeperTestSuite) TestQueryStorage() {
|
||||
malleate func()
|
||||
expPass bool
|
||||
}{
|
||||
{"invalid address",
|
||||
{
|
||||
"invalid address",
|
||||
func() {
|
||||
req = &types.QueryStorageRequest{
|
||||
Address: invalidAddress,
|
||||
@@ -291,7 +294,8 @@ func (suite *KeeperTestSuite) TestQueryCode() {
|
||||
malleate func()
|
||||
expPass bool
|
||||
}{
|
||||
{"invalid address",
|
||||
{
|
||||
"invalid address",
|
||||
func() {
|
||||
req = &types.QueryCodeRequest{
|
||||
Address: invalidAddress,
|
||||
@@ -346,7 +350,8 @@ func (suite *KeeperTestSuite) TestQueryTxLogs() {
|
||||
malleate func()
|
||||
expPass bool
|
||||
}{
|
||||
{"empty hash",
|
||||
{
|
||||
"empty hash",
|
||||
func() {
|
||||
req = &types.QueryTxLogsRequest{
|
||||
Hash: common.Hash{}.String(),
|
||||
@@ -354,7 +359,8 @@ func (suite *KeeperTestSuite) TestQueryTxLogs() {
|
||||
},
|
||||
false,
|
||||
},
|
||||
{"logs not found",
|
||||
{
|
||||
"logs not found",
|
||||
func() {
|
||||
hash := common.BytesToHash([]byte("hash"))
|
||||
req = &types.QueryTxLogsRequest{
|
||||
@@ -423,7 +429,8 @@ func (suite *KeeperTestSuite) TestQueryBlockLogs() {
|
||||
malleate func()
|
||||
expPass bool
|
||||
}{
|
||||
{"empty hash",
|
||||
{
|
||||
"empty hash",
|
||||
func() {
|
||||
req = &types.QueryBlockLogsRequest{
|
||||
Hash: common.Hash{}.String(),
|
||||
@@ -431,7 +438,8 @@ func (suite *KeeperTestSuite) TestQueryBlockLogs() {
|
||||
},
|
||||
false,
|
||||
},
|
||||
{"logs not found",
|
||||
{
|
||||
"logs not found",
|
||||
func() {
|
||||
hash := common.BytesToHash([]byte("hash"))
|
||||
req = &types.QueryBlockLogsRequest{
|
||||
@@ -443,7 +451,6 @@ func (suite *KeeperTestSuite) TestQueryBlockLogs() {
|
||||
{
|
||||
"success",
|
||||
func() {
|
||||
|
||||
hash := common.BytesToHash([]byte("block_hash"))
|
||||
expLogs = []types.TransactionLogs{
|
||||
{
|
||||
@@ -533,7 +540,8 @@ func (suite *KeeperTestSuite) TestQueryBlockBloom() {
|
||||
malleate func()
|
||||
expPass bool
|
||||
}{
|
||||
{"bad height",
|
||||
{
|
||||
"bad height",
|
||||
func() {
|
||||
req = &types.QueryBlockBloomRequest{Height: -2}
|
||||
},
|
||||
@@ -550,7 +558,8 @@ func (suite *KeeperTestSuite) TestQueryBlockBloom() {
|
||||
},
|
||||
true,
|
||||
},
|
||||
{"bloom not found for height",
|
||||
{
|
||||
"bloom not found for height",
|
||||
func() {
|
||||
req = &types.QueryBlockBloomRequest{Height: 100}
|
||||
bloom := ethtypes.BytesToBloom([]byte("bloom"))
|
||||
@@ -614,7 +623,8 @@ func (suite *KeeperTestSuite) TestQueryValidatorAccount() {
|
||||
malleate func()
|
||||
expPass bool
|
||||
}{
|
||||
{"invalid address",
|
||||
{
|
||||
"invalid address",
|
||||
func() {
|
||||
expAccount = &types.QueryValidatorAccountResponse{
|
||||
AccountAddress: sdk.AccAddress(common.Address{}.Bytes()).String(),
|
||||
@@ -761,7 +771,7 @@ func (suite *KeeperTestSuite) TestEstimateGas() {
|
||||
|
||||
func (suite *KeeperTestSuite) TestTraceTx() {
|
||||
ctx := sdk.WrapSDKContext(suite.ctx)
|
||||
//TODO deploy contract that triggers internal transactions
|
||||
// TODO deploy contract that triggers internal transactions
|
||||
var (
|
||||
txMsg *types.MsgEthereumTx
|
||||
traceConfig *types.TraceConfig
|
||||
@@ -795,10 +805,10 @@ func (suite *KeeperTestSuite) TestTraceTx() {
|
||||
for _, tc := range testCases {
|
||||
suite.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
||||
suite.SetupTest()
|
||||
//Deploy contract
|
||||
// Deploy contract
|
||||
contractAddr := suite.DeployTestContract(suite.T(), suite.address, sdk.NewIntWithDecimal(1000, 18).BigInt())
|
||||
suite.Commit()
|
||||
//Generate token transfer transaction
|
||||
// Generate token transfer transaction
|
||||
txMsg = suite.TransferERC20Token(suite.T(), contractAddr, suite.address, common.HexToAddress("0x378c50D9264C63F3F92B806d4ee56E9D86FfB3Ec"), sdk.NewIntWithDecimal(1, 18).BigInt())
|
||||
suite.Commit()
|
||||
|
||||
@@ -818,5 +828,4 @@ func (suite *KeeperTestSuite) TestTraceTx() {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,7 @@ import (
|
||||
"github.com/tharsis/ethermint/x/evm/types"
|
||||
)
|
||||
|
||||
var (
|
||||
_ types.EvmHooks = MultiEvmHooks{}
|
||||
)
|
||||
var _ types.EvmHooks = MultiEvmHooks{}
|
||||
|
||||
// MultiEvmHooks combine multiple evm hooks, all hook functions are run in array sequence
|
||||
type MultiEvmHooks []types.EvmHooks
|
||||
|
||||
@@ -66,7 +66,6 @@ func NewKeeper(
|
||||
ak types.AccountKeeper, bankKeeper types.BankKeeper, sk types.StakingKeeper,
|
||||
tracer string, debug bool,
|
||||
) *Keeper {
|
||||
|
||||
// ensure evm module account is set
|
||||
if addr := ak.GetModuleAddress(types.ModuleName); addr == nil {
|
||||
panic("the EVM module account has not been set")
|
||||
@@ -241,7 +240,7 @@ func (k Keeper) GetAllTxLogs(ctx sdk.Context) []types.TransactionLogs {
|
||||
defer iter.Close()
|
||||
|
||||
mapOrder := []string{}
|
||||
var mapLogs = make(map[string][]*types.Log)
|
||||
mapLogs := make(map[string][]*types.Log)
|
||||
for ; iter.Valid(); iter.Next() {
|
||||
var txLog types.Log
|
||||
k.cdc.MustUnmarshal(iter.Value(), &txLog)
|
||||
@@ -272,7 +271,7 @@ func (k Keeper) GetTxLogs(txHash common.Hash) []*ethtypes.Log {
|
||||
|
||||
// We store the logs with key equal to txHash.Bytes() | sdk.Uint64ToBigEndian(uint64(log.Index)),
|
||||
// therefore, we set the end boundary(excluded) to txHash.Bytes() | uint64.Max -> []byte
|
||||
var end = txHash.Bytes()
|
||||
end := txHash.Bytes()
|
||||
end = append(end, []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}...)
|
||||
|
||||
iter := store.Iterator(txHash.Bytes(), end)
|
||||
@@ -293,7 +292,7 @@ func (k Keeper) SetLogs(txHash common.Hash, logs []*ethtypes.Log) {
|
||||
store := prefix.NewStore(k.Ctx().KVStore(k.storeKey), types.KeyPrefixLogs)
|
||||
|
||||
for _, log := range logs {
|
||||
var key = txHash.Bytes()
|
||||
key := txHash.Bytes()
|
||||
key = append(key, sdk.Uint64ToBigEndian(uint64(log.Index))...)
|
||||
txIndexLog := types.NewLogFromEth(log)
|
||||
bz := k.cdc.MustMarshal(txIndexLog)
|
||||
@@ -305,7 +304,7 @@ func (k Keeper) SetLogs(txHash common.Hash, logs []*ethtypes.Log) {
|
||||
func (k Keeper) SetLog(log *ethtypes.Log) {
|
||||
store := prefix.NewStore(k.Ctx().KVStore(k.storeKey), types.KeyPrefixLogs)
|
||||
|
||||
var key = log.TxHash.Bytes()
|
||||
key := log.TxHash.Bytes()
|
||||
key = append(key, sdk.Uint64ToBigEndian(uint64(log.Index))...)
|
||||
|
||||
txIndexLog := types.NewLogFromEth(log)
|
||||
@@ -319,7 +318,7 @@ func (k Keeper) DeleteTxLogs(ctx sdk.Context, txHash common.Hash) {
|
||||
|
||||
// We store the logs with key equal to txHash.Bytes() | sdk.Uint64ToBigEndian(uint64(log.Index)),
|
||||
// therefore, we set the end boundary(excluded) to txHash.Bytes() | uint64.Max -> []byte
|
||||
var end = txHash.Bytes()
|
||||
end := txHash.Bytes()
|
||||
end = append(end, []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}...)
|
||||
|
||||
iter := store.Iterator(txHash.Bytes(), end)
|
||||
@@ -361,7 +360,6 @@ func (k Keeper) GetAccountStorage(ctx sdk.Context, address common.Address) (type
|
||||
storage = append(storage, types.NewState(key, value))
|
||||
return false
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return types.Storage{}, err
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ func (suite *KeeperTestSuite) DeployTestContract(t require.TestingT, owner commo
|
||||
return crypto.CreateAddress(suite.address, nonce)
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TransferERC20Token(t require.TestingT, contractAddr common.Address, from common.Address, to common.Address, amount *big.Int) *types.MsgEthereumTx {
|
||||
func (suite *KeeperTestSuite) TransferERC20Token(t require.TestingT, contractAddr, from, to common.Address, amount *big.Int) *types.MsgEthereumTx {
|
||||
ctx := sdk.WrapSDKContext(suite.ctx)
|
||||
chainID := suite.app.EvmKeeper.ChainID()
|
||||
|
||||
|
||||
@@ -51,7 +51,6 @@ func (suite *KeeperTestSuite) TestGetHashFn() {
|
||||
"case 1.3: hash calculated from Tendermint header",
|
||||
uint64(suite.ctx.BlockHeight()),
|
||||
func() {
|
||||
|
||||
suite.ctx = suite.ctx.WithBlockHeader(header)
|
||||
suite.app.EvmKeeper.WithContext(suite.ctx)
|
||||
},
|
||||
|
||||
@@ -484,7 +484,6 @@ func (k *Keeper) Suicide(addr common.Address) bool {
|
||||
|
||||
// setSuicided sets a single byte to the transient store and marks the address as suicided
|
||||
func (k Keeper) setSuicided(ctx sdk.Context, addr common.Address) {
|
||||
|
||||
store := prefix.NewStore(ctx.TransientStore(k.transientKey), types.KeyPrefixTransientSuicided)
|
||||
store.Set(addr.Bytes(), []byte{1})
|
||||
}
|
||||
@@ -585,7 +584,7 @@ func (k *Keeper) AddressInAccessList(addr common.Address) bool {
|
||||
}
|
||||
|
||||
// SlotInAccessList checks if the address and the slots are registered in the transient store
|
||||
func (k *Keeper) SlotInAccessList(addr common.Address, slot common.Hash) (addressOk bool, slotOk bool) {
|
||||
func (k *Keeper) SlotInAccessList(addr common.Address, slot common.Hash) (addressOk, slotOk bool) {
|
||||
addressOk = k.AddressInAccessList(addr)
|
||||
slotOk = k.addressSlotInAccessList(addr, slot)
|
||||
return addressOk, slotOk
|
||||
|
||||
@@ -178,7 +178,6 @@ func (suite *KeeperTestSuite) TestGetNonce() {
|
||||
|
||||
nonce := suite.app.EvmKeeper.GetNonce(tc.address)
|
||||
suite.Require().Equal(tc.expectedNonce, nonce)
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -248,7 +247,6 @@ func (suite *KeeperTestSuite) TestGetCodeHash() {
|
||||
|
||||
for _, tc := range testCases {
|
||||
suite.Run(tc.name, func() {
|
||||
|
||||
tc.malleate()
|
||||
|
||||
hash := suite.app.EvmKeeper.GetCodeHash(tc.address)
|
||||
@@ -296,7 +294,6 @@ func (suite *KeeperTestSuite) TestSetCode() {
|
||||
|
||||
for _, tc := range testCases {
|
||||
suite.Run(tc.name, func() {
|
||||
|
||||
prev := suite.app.EvmKeeper.GetCode(tc.address)
|
||||
suite.app.EvmKeeper.SetCode(tc.address, tc.code)
|
||||
post := suite.app.EvmKeeper.GetCode(tc.address)
|
||||
@@ -338,7 +335,6 @@ func (suite *KeeperTestSuite) TestRefund() {
|
||||
|
||||
for _, tc := range testCases {
|
||||
suite.Run(tc.name, func() {
|
||||
|
||||
tc.malleate()
|
||||
|
||||
if tc.expPanic {
|
||||
@@ -374,7 +370,6 @@ func (suite *KeeperTestSuite) TestState() {
|
||||
|
||||
for _, tc := range testCases {
|
||||
suite.Run(tc.name, func() {
|
||||
|
||||
suite.app.EvmKeeper.SetState(suite.address, tc.key, tc.value)
|
||||
value := suite.app.EvmKeeper.GetState(suite.address, tc.key)
|
||||
suite.Require().Equal(tc.value, value)
|
||||
@@ -385,9 +380,9 @@ func (suite *KeeperTestSuite) TestState() {
|
||||
func (suite *KeeperTestSuite) TestCommittedState() {
|
||||
suite.SetupTest()
|
||||
|
||||
var key = common.BytesToHash([]byte("key"))
|
||||
var value1 = common.BytesToHash([]byte("value1"))
|
||||
var value2 = common.BytesToHash([]byte("value2"))
|
||||
key := common.BytesToHash([]byte("key"))
|
||||
value1 := common.BytesToHash([]byte("value1"))
|
||||
value2 := common.BytesToHash([]byte("value2"))
|
||||
|
||||
suite.app.EvmKeeper.SetState(suite.address, key, value1)
|
||||
|
||||
@@ -474,10 +469,9 @@ func (suite *KeeperTestSuite) TestEmpty() {
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestSnapshot() {
|
||||
|
||||
var key = common.BytesToHash([]byte("key"))
|
||||
var value1 = common.BytesToHash([]byte("value1"))
|
||||
var value2 = common.BytesToHash([]byte("value2"))
|
||||
key := common.BytesToHash([]byte("key"))
|
||||
value1 := common.BytesToHash([]byte("value1"))
|
||||
value2 := common.BytesToHash([]byte("value2"))
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
|
||||
@@ -133,7 +133,6 @@ func (suite *KeeperTestSuite) TestCheckSenderBalance() {
|
||||
} else {
|
||||
suite.Require().Error(err, "invalid test %d passed", i)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -206,7 +205,6 @@ func (suite *KeeperTestSuite) TestDeductTxCostsFromUserBalance() {
|
||||
}
|
||||
|
||||
for i, tc := range testCases {
|
||||
|
||||
suite.Run(tc.name, func() {
|
||||
suite.SetupTest()
|
||||
suite.app.EvmKeeper.AddBalance(suite.address, hundredInt.BigInt())
|
||||
@@ -251,7 +249,6 @@ func (suite *KeeperTestSuite) TestDeductTxCostsFromUserBalance() {
|
||||
suite.Require().Error(err, "invalid test %d passed", i)
|
||||
suite.Require().Nil(fees, "invalid test %d passed. fees value must be nil", i)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,9 +9,7 @@ import (
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
)
|
||||
|
||||
var (
|
||||
ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry())
|
||||
)
|
||||
var ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry())
|
||||
|
||||
type (
|
||||
ExtensionOptionsEthereumTxI interface{}
|
||||
|
||||
@@ -14,7 +14,6 @@ type caseAny struct {
|
||||
}
|
||||
|
||||
func TestPackTxData(t *testing.T) {
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
txData TxData
|
||||
|
||||
@@ -32,9 +32,7 @@ const (
|
||||
codeErrInvalidBaseFee
|
||||
)
|
||||
|
||||
var (
|
||||
ErrPostTxProcessing = errors.New("failed to execute post processing")
|
||||
)
|
||||
var ErrPostTxProcessing = errors.New("failed to execute post processing")
|
||||
|
||||
var (
|
||||
// ErrInvalidState returns an error resulting from an invalid Storage State.
|
||||
@@ -92,7 +90,7 @@ var (
|
||||
// NewExecErrorWithReason unpacks the revert return bytes and returns a wrapped error
|
||||
// with the return reason.
|
||||
func NewExecErrorWithReason(revertReason []byte) *RevertError {
|
||||
var result = common.CopyBytes(revertReason)
|
||||
result := common.CopyBytes(revertReason)
|
||||
reason, errUnpack := abi.UnpackRevert(result)
|
||||
err := errors.New("execution reverted")
|
||||
if errUnpack == nil {
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/status-im/keycard-go/hexutils"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var revertSelector = crypto.Keccak256([]byte("Error(string)"))[:4]
|
||||
|
||||
func TestNewExecErrorWithReason(t *testing.T) {
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
errorMessage string
|
||||
|
||||
@@ -31,7 +31,6 @@ func TestGenesisTestSuite(t *testing.T) {
|
||||
}
|
||||
|
||||
func (suite *GenesisTestSuite) TestValidateGenesisAccount() {
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
genesisAccount GenesisAccount
|
||||
@@ -84,7 +83,6 @@ func (suite *GenesisTestSuite) TestValidateGenesisAccount() {
|
||||
}
|
||||
|
||||
func (suite *GenesisTestSuite) TestValidateGenesis() {
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
genState *GenesisState
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
// NewTransactionLogs creates a new NewTransactionLogs instance.
|
||||
func NewTransactionLogs(hash common.Hash, logs []*Log) TransactionLogs { // nolint: interfacer
|
||||
func NewTransactionLogs(hash common.Hash, logs []*Log) TransactionLogs {
|
||||
return TransactionLogs{
|
||||
Hash: hash.String(),
|
||||
Logs: logs,
|
||||
@@ -19,7 +19,7 @@ func NewTransactionLogs(hash common.Hash, logs []*Log) TransactionLogs { // noli
|
||||
}
|
||||
|
||||
// NewTransactionLogsFromEth creates a new NewTransactionLogs instance using []*ethtypes.Log.
|
||||
func NewTransactionLogsFromEth(hash common.Hash, ethlogs []*ethtypes.Log) TransactionLogs { // nolint: interfacer
|
||||
func NewTransactionLogsFromEth(hash common.Hash, ethlogs []*ethtypes.Log) TransactionLogs {
|
||||
return TransactionLogs{
|
||||
Hash: hash.String(),
|
||||
Logs: NewLogsFromEth(ethlogs),
|
||||
|
||||
@@ -37,7 +37,6 @@ func NewTx(
|
||||
gasLimit uint64, gasPrice *big.Int, input []byte, accesses *ethtypes.AccessList,
|
||||
) *MsgEthereumTx {
|
||||
return newMsgEthereumTx(chainID, nonce, to, amount, gasLimit, gasPrice, input, accesses)
|
||||
|
||||
}
|
||||
|
||||
// NewTxContract returns a reference to a new Ethereum transaction
|
||||
|
||||
@@ -58,7 +58,7 @@ func (s State) Validate() error {
|
||||
}
|
||||
|
||||
// NewState creates a new State instance
|
||||
func NewState(key, value common.Hash) State { // nolint: interfacer
|
||||
func NewState(key, value common.Hash) State {
|
||||
return State{
|
||||
Key: key.String(),
|
||||
Value: value.String(),
|
||||
|
||||
@@ -68,11 +68,10 @@ func UnwrapEthereumMsg(tx *sdk.Tx) (*MsgEthereumTx, error) {
|
||||
}
|
||||
|
||||
// BinSearch execute the binary search and hone in on an executable gas limit
|
||||
func BinSearch(lo uint64, hi uint64, executable func(uint64) (bool, *MsgEthereumTxResponse, error)) (uint64, error) {
|
||||
func BinSearch(lo, hi uint64, executable func(uint64) (bool, *MsgEthereumTxResponse, error)) (uint64, error) {
|
||||
for lo+1 < hi {
|
||||
mid := (hi + lo) / 2
|
||||
failed, _, err := executable(mid)
|
||||
|
||||
// If the error is not nil(consensus error), it means the provided message
|
||||
// call or transaction will never be accepted no matter how much gas it is
|
||||
// assigned. Return the error directly, don't struggle any more.
|
||||
|
||||
@@ -14,7 +14,6 @@ func InitGenesis(
|
||||
k keeper.Keeper,
|
||||
data types.GenesisState,
|
||||
) []abci.ValidatorUpdate {
|
||||
|
||||
k.SetParams(ctx, data.Params)
|
||||
k.SetBaseFee(ctx, data.BaseFee.BigInt())
|
||||
k.SetBlockGasUsed(ctx, data.BlockGas)
|
||||
|
||||
@@ -25,7 +25,6 @@ type Keeper struct {
|
||||
func NewKeeper(
|
||||
cdc codec.BinaryCodec, storeKey sdk.StoreKey, paramSpace paramtypes.Subspace,
|
||||
) Keeper {
|
||||
|
||||
// set KeyTable if it has not already been set
|
||||
if !paramSpace.HasKeyTable() {
|
||||
paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable())
|
||||
|
||||
Reference in New Issue
Block a user