mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
core/vm: Add support for EVMC capabilities
This commit is contained in:
parent
3e020f09fd
commit
abe7715f1f
1 changed files with 8 additions and 2 deletions
|
|
@ -17,6 +17,7 @@
|
||||||
package vm
|
package vm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
"os"
|
"os"
|
||||||
|
|
@ -306,6 +307,11 @@ func (evm *EVMC) Run(contract *Contract, input []byte, readOnly bool) (ret []byt
|
||||||
return output, err
|
return output, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (evm *EVMC) CanRun([]byte) bool {
|
func (evm *EVMC) CanRun(code []byte) bool {
|
||||||
return true
|
cap := evmc.CapabilityEVM1
|
||||||
|
if (bytes.Equal(code[0:4], []byte("\x00asm"))) {
|
||||||
|
cap = evmc.CapabilityEWASM
|
||||||
|
}
|
||||||
|
// FIXME: Optimize. Access capabilities once.
|
||||||
|
return evm.instance.HasCapability(cap)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue