diff options
author | Wei-Ning Huang <w@dexon.org> | 2019-01-25 19:24:35 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 13:50:02 +0800 |
commit | bdfa5142e8248aacd38aafb792428f54f326c61b (patch) | |
tree | cb8a87eee233c1ccfce61d57c4f2114345ba880b /core/vm/evm.go | |
parent | c4e3beb95570d217fbed9e6db36f48abf4e2e05d (diff) | |
download | dexon-bdfa5142e8248aacd38aafb792428f54f326c61b.tar dexon-bdfa5142e8248aacd38aafb792428f54f326c61b.tar.gz dexon-bdfa5142e8248aacd38aafb792428f54f326c61b.tar.bz2 dexon-bdfa5142e8248aacd38aafb792428f54f326c61b.tar.lz dexon-bdfa5142e8248aacd38aafb792428f54f326c61b.tar.xz dexon-bdfa5142e8248aacd38aafb792428f54f326c61b.tar.zst dexon-bdfa5142e8248aacd38aafb792428f54f326c61b.zip |
core: vm: refactor governance and add node info oracle (#174)
Diffstat (limited to 'core/vm/evm.go')
-rw-r--r-- | core/vm/evm.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/vm/evm.go b/core/vm/evm.go index 2eba9c2cb..422d52ccb 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -48,8 +48,8 @@ type ( // run runs the given contract and takes care of running precompiles with a fallback to the byte code interpreter. func run(evm *EVM, contract *Contract, input []byte, readOnly bool) ([]byte, error) { if contract.CodeAddr != nil { - if *contract.CodeAddr == GovernanceContractAddress { - return RunGovernanceContract(evm, input, contract) + if o := OracleContracts[*contract.CodeAddr]; o != nil { + return RunOracleContract(o, evm, input, contract) } precompiles := PrecompiledContractsHomestead if evm.ChainConfig().IsByzantium(evm.BlockNumber) { @@ -216,7 +216,8 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas if evm.ChainConfig().IsByzantium(evm.BlockNumber) { precompiles = PrecompiledContractsByzantium } - if precompiles[addr] == nil && evm.ChainConfig().IsEIP158(evm.BlockNumber) && value.Sign() == 0 && addr != GovernanceContractAddress { + if precompiles[addr] == nil && OracleContracts[addr] == nil && + evm.ChainConfig().IsEIP158(evm.BlockNumber) && value.Sign() == 0 { // Calling a non existing account, don't do anything, but ping the tracer if evm.vmConfig.Debug && evm.depth == 0 { evm.vmConfig.Tracer.CaptureStart(caller.Address(), addr, false, input, gas, value) |