keeper

package
v0.0.0-...-17765ca Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

NewQuerier is the module level router for state queries

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers the evm module invariants

Types

type Keeper

type Keeper struct {

	// Ethermint concrete implementation on the EVM StateDB interface
	CommitStateDB *types.CommitStateDB
	// Transaction counter in a block. Used on StateSB's Prepare function.
	// It is reset to 0 every block on BeginBlock so there's no point in storing the counter
	// on the KVStore or adding it as a field on the EVM genesis state.
	TxCount int
	Bloom   *big.Int
	// contains filtered or unexported fields
}

Keeper wraps the CommitStateDB, allowing us to pass in SDK context while adhering to the StateDB interface.

func NewKeeper

func NewKeeper(
	cdc *codec.Codec, storeKey sdk.StoreKey, paramSpace params.Subspace, ak types.AccountKeeper, sk types.SupplyKeeper, bk bank.Keeper,
) *Keeper

NewKeeper generates new evm module keeper

func (*Keeper) AddBalance

func (k *Keeper) AddBalance(ctx sdk.Context, addr ethcmn.Address, amount *big.Int)

AddBalance calls CommitStateDB.AddBalance using the passed in context

func (*Keeper) AddLog

func (k *Keeper) AddLog(ctx sdk.Context, log *ethtypes.Log)

AddLog calls CommitStateDB.AddLog using the passed in context

func (*Keeper) AddPreimage

func (k *Keeper) AddPreimage(ctx sdk.Context, hash ethcmn.Hash, preimage []byte)

AddPreimage calls CommitStateDB.AddPreimage using the passed in context

func (*Keeper) AddRefund

func (k *Keeper) AddRefund(ctx sdk.Context, gas uint64)

AddRefund calls CommitStateDB.AddRefund using the passed in context

func (*Keeper) AllLogs

func (k *Keeper) AllLogs(ctx sdk.Context) []*ethtypes.Log

AllLogs calls CommitStateDB.AllLogs using the passed in context

func (Keeper) BalanceInvariant

func (k Keeper) BalanceInvariant() sdk.Invariant

BalanceInvariant checks that all auth module's EthAccounts in the application have the same balance as the EVM one.

func (*Keeper) BeginBlock

func (k *Keeper) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock)

BeginBlock sets the block hash -> block height map for the previous block height and resets the Bloom filter and the transaction count to 0.

func (*Keeper) BlockHash

func (k *Keeper) BlockHash(ctx sdk.Context) ethcmn.Hash

BlockHash calls CommitStateDB.BlockHash using the passed in context

func (*Keeper) ClearStateObjects

func (k *Keeper) ClearStateObjects(ctx sdk.Context)

ClearStateObjects calls CommitStateDB.ClearStateObjects using the passed in context

func (*Keeper) Commit

func (k *Keeper) Commit(ctx sdk.Context, deleteEmptyObjects bool) (root ethcmn.Hash, err error)

Commit calls CommitStateDB.Commit using the passed in context

func (*Keeper) Copy

func (k *Keeper) Copy(ctx sdk.Context) ethvm.StateDB

Copy calls CommitStateDB.Copy using the passed in context

func (*Keeper) CreateAccount

func (k *Keeper) CreateAccount(ctx sdk.Context, addr ethcmn.Address)

CreateAccount calls CommitStateDB.CreateAccount using the passed in context

func (*Keeper) Database

func (k *Keeper) Database(ctx sdk.Context) ethstate.Database

Database calls CommitStateDB.Database using the passed in context

func (*Keeper) DeleteLogs

func (k *Keeper) DeleteLogs(ctx sdk.Context, hash ethcmn.Hash)

DeleteLogs calls CommitStateDB.DeleteLogs using the passed in context

func (*Keeper) Empty

func (k *Keeper) Empty(ctx sdk.Context, addr ethcmn.Address) bool

Empty calls CommitStateDB.Empty using the passed in context

func (Keeper) EndBlock

func (k Keeper) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate

EndBlock updates the accounts and commits state objects to the KV Store, while deleting the empty ones. It also sets the bloom filers for the request block to the store. The EVM end block logic doesn't update the validator set, thus it returns an empty slice.

func (*Keeper) Error

func (k *Keeper) Error(ctx sdk.Context) error

Error calls CommitStateDB.Error using the passed in context

func (*Keeper) Exist

func (k *Keeper) Exist(ctx sdk.Context, addr ethcmn.Address) bool

Exist calls CommitStateDB.Exist using the passed in context

func (*Keeper) Finalise

func (k *Keeper) Finalise(ctx sdk.Context, deleteEmptyObjects bool) error

Finalise calls CommitStateDB.Finalise using the passed in context

func (*Keeper) ForEachStorage

func (k *Keeper) ForEachStorage(ctx sdk.Context, addr ethcmn.Address, cb func(key, value ethcmn.Hash) bool) error

ForEachStorage calls CommitStateDB.ForEachStorage using passed in context

func (Keeper) GetAccountStorage

func (k Keeper) GetAccountStorage(ctx sdk.Context, address common.Address) (types.Storage, error)

GetAccountStorage return state storage associated with an account

func (Keeper) GetAllTxLogs

func (k Keeper) GetAllTxLogs(ctx sdk.Context) []types.TransactionLogs

GetAllTxLogs return all the transaction logs from the store.

func (*Keeper) GetBalance

func (k *Keeper) GetBalance(ctx sdk.Context, addr ethcmn.Address) *big.Int

GetBalance calls CommitStateDB.GetBalance using the passed in context

func (Keeper) GetBlockBloom

func (k Keeper) GetBlockBloom(ctx sdk.Context, height int64) (ethtypes.Bloom, bool)

GetBlockBloom gets bloombits from block height

func (Keeper) GetBlockHash

func (k Keeper) GetBlockHash(ctx sdk.Context, hash []byte) (int64, bool)

GetBlockHash gets block height from block consensus hash

func (Keeper) GetChainConfig

func (k Keeper) GetChainConfig(ctx sdk.Context) (types.ChainConfig, bool)

GetChainConfig gets block height from block consensus hash

func (*Keeper) GetCode

func (k *Keeper) GetCode(ctx sdk.Context, addr ethcmn.Address) []byte

GetCode calls CommitStateDB.GetCode using the passed in context

func (*Keeper) GetCodeHash

func (k *Keeper) GetCodeHash(ctx sdk.Context, addr ethcmn.Address) ethcmn.Hash

GetCodeHash calls CommitStateDB.GetCodeHash using the passed in context

func (*Keeper) GetCodeSize

func (k *Keeper) GetCodeSize(ctx sdk.Context, addr ethcmn.Address) int

GetCodeSize calls CommitStateDB.GetCodeSize using the passed in context

func (*Keeper) GetCommittedState

func (k *Keeper) GetCommittedState(ctx sdk.Context, addr ethcmn.Address, hash ethcmn.Hash) ethcmn.Hash

GetCommittedState calls CommitStateDB.GetCommittedState using the passed in context

func (Keeper) GetHeightHash

func (k Keeper) GetHeightHash(ctx sdk.Context, height uint64) common.Hash

GetHeightHash returns the block header hash associated with a given block height and chain epoch number.

func (*Keeper) GetLogs

func (k *Keeper) GetLogs(ctx sdk.Context, hash ethcmn.Hash) ([]*ethtypes.Log, error)

GetLogs calls CommitStateDB.GetLogs using the passed in context

func (*Keeper) GetNonce

func (k *Keeper) GetNonce(ctx sdk.Context, addr ethcmn.Address) uint64

GetNonce calls CommitStateDB.GetNonce using the passed in context

func (*Keeper) GetOrNewStateObject

func (k *Keeper) GetOrNewStateObject(ctx sdk.Context, addr ethcmn.Address) types.StateObject

GetOrNewStateObject calls CommitStateDB.GetOrNetStateObject using the passed in context

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams returns the total set of evm parameters.

func (*Keeper) GetRefund

func (k *Keeper) GetRefund(ctx sdk.Context) uint64

GetRefund calls CommitStateDB.GetRefund using the passed in context

func (*Keeper) GetState

func (k *Keeper) GetState(ctx sdk.Context, addr ethcmn.Address, hash ethcmn.Hash) ethcmn.Hash

GetState calls CommitStateDB.GetState using the passed in context

func (*Keeper) HasSuicided

func (k *Keeper) HasSuicided(ctx sdk.Context, addr ethcmn.Address) bool

HasSuicided calls CommitStateDB.HasSuicided using the passed in context

func (*Keeper) IntermediateRoot

func (k *Keeper) IntermediateRoot(ctx sdk.Context, deleteEmptyObjects bool) error

IntermediateRoot calls CommitStateDB.IntermediateRoot using the passed in context

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) NonceInvariant

func (k Keeper) NonceInvariant() sdk.Invariant

NonceInvariant checks that all auth module's EthAccounts in the application have the same nonce sequence as the EVM.

func (*Keeper) Preimages

func (k *Keeper) Preimages(ctx sdk.Context) map[ethcmn.Hash][]byte

Preimages calls CommitStateDB.Preimages using the passed in context

func (*Keeper) Prepare

func (k *Keeper) Prepare(ctx sdk.Context, thash, bhash ethcmn.Hash, txi int)

Prepare calls CommitStateDB.Prepare using the passed in context

func (*Keeper) Reset

func (k *Keeper) Reset(ctx sdk.Context, root ethcmn.Hash) error

Reset calls CommitStateDB.Reset using the passed in context

func (*Keeper) RevertToSnapshot

func (k *Keeper) RevertToSnapshot(ctx sdk.Context, revID int)

RevertToSnapshot calls CommitStateDB.RevertToSnapshot using the passed in context

func (*Keeper) SetBalance

func (k *Keeper) SetBalance(ctx sdk.Context, addr ethcmn.Address, amount *big.Int)

SetBalance calls CommitStateDB.SetBalance using the passed in context

func (Keeper) SetBlockBloom

func (k Keeper) SetBlockBloom(ctx sdk.Context, height int64, bloom ethtypes.Bloom)

SetBlockBloom sets the mapping from block height to bloom bits

func (Keeper) SetBlockHash

func (k Keeper) SetBlockHash(ctx sdk.Context, hash []byte, height int64)

SetBlockHash sets the mapping from block consensus hash to block height

func (Keeper) SetChainConfig

func (k Keeper) SetChainConfig(ctx sdk.Context, config types.ChainConfig)

SetChainConfig sets the mapping from block consensus hash to block height

func (*Keeper) SetCode

func (k *Keeper) SetCode(ctx sdk.Context, addr ethcmn.Address, code []byte)

SetCode calls CommitStateDB.SetCode using the passed in context

func (Keeper) SetHeightHash

func (k Keeper) SetHeightHash(ctx sdk.Context, height uint64, hash common.Hash)

SetHeightHash sets the block header hash associated with a given height.

func (*Keeper) SetLogs

func (k *Keeper) SetLogs(ctx sdk.Context, hash ethcmn.Hash, logs []*ethtypes.Log) error

SetLogs calls CommitStateDB.SetLogs using the passed in context

func (*Keeper) SetNonce

func (k *Keeper) SetNonce(ctx sdk.Context, addr ethcmn.Address, nonce uint64)

SetNonce calls CommitStateDB.SetNonce using the passed in context

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets the evm parameters to the param space.

func (*Keeper) SetState

func (k *Keeper) SetState(ctx sdk.Context, addr ethcmn.Address, key, value ethcmn.Hash)

SetState calls CommitStateDB.SetState using the passed in context

func (*Keeper) Snapshot

func (k *Keeper) Snapshot(ctx sdk.Context) int

Snapshot calls CommitStateDB.Snapshot using the passed in context

func (*Keeper) StorageTrie

func (k *Keeper) StorageTrie(ctx sdk.Context, addr ethcmn.Address) ethstate.Trie

StorageTrie calls CommitStateDB.StorageTrie using the passed in context

func (*Keeper) SubBalance

func (k *Keeper) SubBalance(ctx sdk.Context, addr ethcmn.Address, amount *big.Int)

SubBalance calls CommitStateDB.SubBalance using the passed in context

func (*Keeper) SubRefund

func (k *Keeper) SubRefund(ctx sdk.Context, gas uint64)

SubRefund calls CommitStateDB.SubRefund using the passed in context

func (*Keeper) Suicide

func (k *Keeper) Suicide(ctx sdk.Context, addr ethcmn.Address) bool

Suicide calls CommitStateDB.Suicide using the passed in context

func (*Keeper) TxIndex

func (k *Keeper) TxIndex(ctx sdk.Context) int

TxIndex calls CommitStateDB.TxIndex using the passed in context

func (*Keeper) UpdateAccounts

func (k *Keeper) UpdateAccounts(ctx sdk.Context)

UpdateAccounts calls CommitStateDB.UpdateAccounts using the passed in context

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL