keeper

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: Apache-2.0 Imports: 26 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 GovKeeper

type GovKeeper interface {
	GetDepositParams(ctx sdk.Context) govtypes.DepositParams
	GetVotingParams(ctx sdk.Context) govtypes.VotingParams
}

GovKeeper defines the expected gov Keeper

type Keeper

type Keeper struct {

	// 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
	Bhash   ethcmn.Hash
	LogSize uint
	Watcher *watcher.Watcher
	// 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) AfterDepositPeriodPassed

func (k Keeper) AfterDepositPeriodPassed(_ sdk.Context, _ govTypes.Proposal)

func (Keeper) AfterSubmitProposalHandler

func (k Keeper) AfterSubmitProposalHandler(_ sdk.Context, _ govTypes.Proposal)

nolint

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) CheckMsgSubmitProposal

func (k Keeper) CheckMsgSubmitProposal(ctx sdk.Context, msg govTypes.MsgSubmitProposal) sdk.Error

CheckMsgSubmitProposal validates MsgSubmitProposal

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) 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) GenerateCSDBParams

func (k Keeper) GenerateCSDBParams() types.CommitStateDBParams

Logger returns a module-specific logger.

func (Keeper) GeneratePureCSDBParams

func (k Keeper) GeneratePureCSDBParams() types.CommitStateDBParams

GeneratePureCSDBParams generates an instance of csdb params ONLY for store setter and getter

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) 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

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) 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) GetMaxDepositPeriod

func (k Keeper) GetMaxDepositPeriod(ctx sdk.Context, content sdkGov.Content) (maxDepositPeriod time.Duration)

GetMaxDepositPeriod returns max deposit period

func (Keeper) GetMinDeposit

func (k Keeper) GetMinDeposit(ctx sdk.Context, content sdkGov.Content) (minDeposit sdk.SysCoins)

GetMinDeposit returns min deposit

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) 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) GetVotingPeriod

func (k Keeper) GetVotingPeriod(ctx sdk.Context, content sdkGov.Content) (votingPeriod time.Duration)

GetVotingPeriod returns voting period

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) RejectedHandler

func (k Keeper) RejectedHandler(_ sdk.Context, _ govTypes.Content)

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) SetCodeDirectly

func (k Keeper) SetCodeDirectly(ctx sdk.Context, hash, code []byte)

SetCodeDirectly commit code into db with no cache

func (*Keeper) SetGovKeeper

func (k *Keeper) SetGovKeeper(gk GovKeeper)

SetGovKeeper sets keeper of gov

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) 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) SetStateDirectly

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

SetStateDirectly commit one state into db with no cache

func (Keeper) VoteHandler

func (k Keeper) VoteHandler(_ sdk.Context, _ govTypes.Proposal, _ govTypes.Vote) (string, sdk.Error)

Jump to

Keyboard shortcuts

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