Skip to content

Commit

Permalink
Temporary Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeniy-scherbina committed Apr 18, 2024
1 parent 4bdbc06 commit a31da58
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 36 deletions.
18 changes: 8 additions & 10 deletions x/evm/vm/geth/geth.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/precompile/contract"

evm "github.com/evmos/ethermint/x/evm/vm"
)

Expand Down Expand Up @@ -67,14 +65,14 @@ func (e EVM) Config() vm.Config {
return e.EVM.Config
}

// Precompile returns the precompiled contract associated with the given address
// and the current chain configuration. If the contract cannot be found it returns
// nil.
func (e EVM) Precompile(addr common.Address) (p contract.StatefulPrecompiledContract, found bool) {
precompiles := GetPrecompiles(e.ChainConfig(), e.EVM.Context.BlockNumber)
p, found = precompiles[addr]
return p, found
}
//// Precompile returns the precompiled contract associated with the given address
//// and the current chain configuration. If the contract cannot be found it returns
//// nil.
//func (e EVM) Precompile(addr common.Address) (p contract.StatefulPrecompiledContract, found bool) {

Check failure on line 71 in x/evm/vm/geth/geth.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

commentFormatting: put a space between `//` and comment text (gocritic)
// precompiles := GetPrecompiles(e.ChainConfig(), e.EVM.Context.BlockNumber)
// p, found = precompiles[addr]
// return p, found
//}

// ActivePrecompiles returns a list of all the active precompiled contract addresses
// for the current chain configuration.
Expand Down
50 changes: 25 additions & 25 deletions x/evm/vm/geth/precompiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,28 @@
// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE
package geth

import (
"math/big"

"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/params"

evm "github.com/evmos/ethermint/x/evm/vm"
)

// GetPrecompiles returns all the precompiled contracts defined given the
// current chain configuration and block height.
func GetPrecompiles(cfg *params.ChainConfig, blockNumber *big.Int) evm.StatefulPrecompiledContracts {
var precompiles evm.StatefulPrecompiledContracts
switch {
case cfg.IsBerlin(blockNumber):
precompiles = vm.PrecompiledContractsBerlin
case cfg.IsIstanbul(blockNumber):
precompiles = vm.PrecompiledContractsIstanbul
case cfg.IsByzantium(blockNumber):
precompiles = vm.PrecompiledContractsByzantium
default:
precompiles = vm.PrecompiledContractsHomestead
}
return precompiles
}
//import (

Check failure on line 18 in x/evm/vm/geth/precompiles.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

commentFormatting: put a space between `//` and comment text (gocritic)
// "math/big"
//
// "github.com/ethereum/go-ethereum/core/vm"
// "github.com/ethereum/go-ethereum/params"
//
// evm "github.com/evmos/ethermint/x/evm/vm"
//)
//
//// GetPrecompiles returns all the precompiled contracts defined given the
//// current chain configuration and block height.
//func GetPrecompiles(cfg *params.ChainConfig, blockNumber *big.Int) evm.StatefulPrecompiledContracts {
// var precompiles evm.StatefulPrecompiledContracts
// switch {
// case cfg.IsBerlin(blockNumber):
// precompiles = vm.PrecompiledContractsBerlin
// case cfg.IsIstanbul(blockNumber):
// precompiles = vm.PrecompiledContractsIstanbul
// case cfg.IsByzantium(blockNumber):
// precompiles = vm.PrecompiledContractsByzantium
// default:
// precompiles = vm.PrecompiledContractsHomestead
// }
// return precompiles
//}
2 changes: 1 addition & 1 deletion x/evm/vm/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type EVM interface {
ChainConfig() *params.ChainConfig

ActivePrecompiles(rules params.Rules) []common.Address
Precompile(addr common.Address) (contract.StatefulPrecompiledContract, bool)
//Precompile(addr common.Address) (contract.StatefulPrecompiledContract, bool)

Check failure on line 65 in x/evm/vm/interface.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

commentFormatting: put a space between `//` and comment text (gocritic)
RunPrecompiledContract(
p StatefulPrecompiledContract,
addr common.Address,
Expand Down

0 comments on commit a31da58

Please sign in to comment.