Documentation ¶
Index ¶
- Constants
- type AppModule
- type Keeper
- func (k *Keeper) ApplyTransaction(ctx sdk.Context, tx *ethtypes.Transaction, feePayerAddr string) (*types.MsgEthereumTxResponse, error)
- func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*types.MsgEthereumTxResponse, error)
- func (k *Keeper) RefundGas(ctx sdk.Context, msg core.Message, leftoverGas uint64, feePayer string, ...) error
- func (k *Keeper) SetHooks(eh types.EvmHooks) *Keeper
- func (k *Keeper) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error)
Constants ¶
const ( EventEIP1559Burnt = "eip1559_burnt" AttributeKeyBaseFee = "base_fee" AttributeKeyBurntFee = "burnt_fee" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppModule ¶
AppModule implements an application module for the evm module.
func NewAppModule ¶
func NewAppModule( k *keeper.Keeper, ak types.AccountKeeper, bankKeeper types.BankKeeper, ss types.Subspace, ) AppModule
NewAppModule creates a new AppModule object
func (AppModule) RegisterServices ¶
func (am AppModule) RegisterServices(cfg module.Configurator)
RegisterServices registers a GRPC query service to respond to the module-specific GRPC queries.
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func (*Keeper) ApplyTransaction ¶
func (k *Keeper) ApplyTransaction(ctx sdk.Context, tx *ethtypes.Transaction, feePayerAddr string) (*types.MsgEthereumTxResponse, error)
ApplyTransaction runs and attempts to perform a state transition with the given transaction (i.e Message), that will only be persisted (committed) to the underlying KVStore if the transaction does not fail.
Gas tracking ¶
Ethereum consumes gas according to the EVM opcodes instead of general reads and writes to store. Because of this, the state transition needs to ignore the SDK gas consumption mechanism defined by the GasKVStore and instead consume the amount of gas used by the VM execution. The amount of gas used is tracked by the EVM and returned in the execution result.
Prior to the execution, the starting tx gas meter is saved and replaced with an infinite gas meter in a new context in order to ignore the SDK gas consumption config values (read, write, has, delete). After the execution, the gas used from the message execution will be added to the starting gas consumed, taking into consideration the amount of gas returned. Finally, the context is updated with the EVM gas consumed value prior to returning.
For relevant discussion see: https://github.com/cosmos/cosmos-sdk/discussions/9072
func (*Keeper) EthereumTx ¶
func (k *Keeper) EthereumTx( goCtx context.Context, msg *types.MsgEthereumTx, ) (*types.MsgEthereumTxResponse, error)
EthereumTx implements the gRPC MsgServer interface. It receives a transaction which is then executed (i.e applied) against the go-ethereum EVM. The provided SDK Context is set to the Keeper so that it can implements and call the StateDB methods without receiving it as a function parameter.
func (*Keeper) RefundGas ¶
func (k *Keeper) RefundGas(ctx sdk.Context, msg core.Message, leftoverGas uint64, feePayer string, denom string) error
RefundGas transfers the leftover gas to the sender of the message, caped to half of the total gas consumed in the transaction. Additionally, the function sets the total gas consumed to the value returned by the EVM execution, thus ignoring the previous intrinsic gas consumed during in the AnteHandler.
func (*Keeper) SetHooks ¶
SetHooks sets the hooks for the EVM module It should be called only once during initialization, it panic if called more than once.
func (*Keeper) UpdateParams ¶
func (k *Keeper) UpdateParams( goCtx context.Context, msg *types.MsgUpdateParams, ) (*types.MsgUpdateParamsResponse, error)