Skip to content

Commit

Permalink
bug: Pass precompiles to evm implementaion
Browse files Browse the repository at this point in the history
  • Loading branch information
dudong2 committed Sep 27, 2024
1 parent e3895d3 commit 3673909
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion x/evm/keeper/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (k *Keeper) NewEVM(
return bytes.Compare(active[i].Bytes(), active[j].Bytes()) < 0
})

return k.evmConstructor(blockCtx, txCtx, stateDB, cfg.ChainConfig, vmConfig, k.customPrecompiles)
return k.evmConstructor(blockCtx, txCtx, stateDB, cfg.ChainConfig, vmConfig, contracts, active)
}

// GetHashFn implements vm.GetHashFunc for Ethermint. It handles 3 cases:
Expand Down
7 changes: 5 additions & 2 deletions x/evm/vm/geth/geth.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,14 @@ func NewEVM(
stateDB vm.StateDB,
chainConfig *params.ChainConfig,
config vm.Config,
_ evm.PrecompiledContracts, // unused
precompiles evm.PrecompiledContracts,
activePrecompiles []common.Address,
) evm.EVM {
return &EVM{
evm := &EVM{
EVM: vm.NewEVM(blockCtx, txCtx, stateDB, chainConfig, config),
}
evm.WithPrecompiles(precompiles, activePrecompiles)
return evm
}

// Context returns the EVM's Block Context
Expand Down
3 changes: 2 additions & 1 deletion x/evm/vm/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,6 @@ type Constructor func(
stateDB vm.StateDB,
chainConfig *params.ChainConfig,
config vm.Config,
customPrecompiles PrecompiledContracts,
precompiles PrecompiledContracts,
activePrecompiles []common.Address,
) EVM

0 comments on commit 3673909

Please sign in to comment.