Skip to content

Commit

Permalink
Simplify evmConstructor
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeniy-scherbina committed Feb 23, 2024
1 parent bc891ae commit 7fb6ed5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
4 changes: 1 addition & 3 deletions x/evm/keeper/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ func (k *Keeper) NewEVM(
tracer vm.EVMLogger,
stateDB vm.StateDB,
) evm.EVM {
goCtx := sdk.WrapSDKContext(ctx)

blockCtx := vm.BlockContext{

Check failure on line 55 in x/evm/keeper/state_transition.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

blockCtx declared and not used (typecheck)
CanTransfer: core.CanTransfer,
Transfer: core.Transfer,
Expand All @@ -72,7 +70,7 @@ func (k *Keeper) NewEVM(
tracer = k.Tracer(ctx, msg, cfg.ChainConfig)
}
vmConfig := k.VMConfig(ctx, msg, cfg, tracer)

Check failure on line 72 in x/evm/keeper/state_transition.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

vmConfig declared and not used (typecheck)
return k.evmConstructor(goCtx, blockCtx, txCtx, stateDB, cfg.ChainConfig, vmConfig, k.customPrecompiles)
return k.evmConstructor(blockCtx, txCtx, stateDB, cfg.ChainConfig, vmConfig, k.customPrecompiles)
}

// GetHashFn implements vm.GetHashFunc for Ethermint. It handles 3 cases:
Expand Down
4 changes: 1 addition & 3 deletions x/evm/vm/geth/geth.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package geth

import (
"context"
"math/big"

"github.com/ethereum/go-ethereum/common"
Expand All @@ -41,7 +40,6 @@ type EVM struct {
// the default precompiled contracts and the EVM concrete implementation from
// geth.
func NewEVM(
goCtx context.Context,
blockCtx vm.BlockContext,
txCtx vm.TxContext,
stateDB vm.StateDB,
Expand All @@ -50,7 +48,7 @@ func NewEVM(
_ evm.PrecompiledContracts, // unused
) evm.EVM {
return &EVM{
EVM: vm.NewEVMWithContext(goCtx, blockCtx, txCtx, stateDB, chainConfig, config),
EVM: vm.NewEVM(blockCtx, txCtx, stateDB, chainConfig, config),
}
}

Expand Down
2 changes: 0 additions & 2 deletions x/evm/vm/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package vm

import (
"context"
"math/big"

"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -76,7 +75,6 @@ type EVM interface {
// Constructor defines the function used to instantiate the EVM on
// each state transition.
type Constructor func(
goCtx context.Context,
blockCtx vm.BlockContext,
txCtx vm.TxContext,
stateDB vm.StateDB,
Expand Down

0 comments on commit 7fb6ed5

Please sign in to comment.