core/vm: add opcode to string mapping

This commit is contained in:
rjl493456442 2018-07-19 10:13:44 +08:00
parent 3146ebbd17
commit 918aaba346
2 changed files with 4 additions and 2 deletions

View file

@ -320,7 +320,7 @@ func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte
} }
// create creates a new contract using code as deployment code. // create creates a new contract using code as deployment code.
func (evm *EVM) create(caller ContractRef, code []byte, gas uint64, value *big.Int, address common.Address) (ret []byte, contractAddr common.Address, leftOverGas uint64, err error) { func (evm *EVM) create(caller ContractRef, code []byte, gas uint64, value *big.Int, address common.Address) ([]byte, common.Address, uint64, error) {
// Depth check execution. Fail if we're trying to execute above the // Depth check execution. Fail if we're trying to execute above the
// limit. // limit.
if evm.depth > int(params.CallCreateDepth) { if evm.depth > int(params.CallCreateDepth) {
@ -360,7 +360,7 @@ func (evm *EVM) create(caller ContractRef, code []byte, gas uint64, value *big.I
} }
start := time.Now() start := time.Now()
ret, err = run(evm, contract, nil) ret, err := run(evm, contract, nil)
// check whether the max code size has been exceeded // check whether the max code size has been exceeded
maxCodeSizeExceeded := evm.ChainConfig().IsEIP158(evm.BlockNumber) && len(ret) > params.MaxCodeSize maxCodeSizeExceeded := evm.ChainConfig().IsEIP158(evm.BlockNumber) && len(ret) > params.MaxCodeSize

View file

@ -371,6 +371,7 @@ var opCodeToString = map[OpCode]string{
RETURN: "RETURN", RETURN: "RETURN",
CALLCODE: "CALLCODE", CALLCODE: "CALLCODE",
DELEGATECALL: "DELEGATECALL", DELEGATECALL: "DELEGATECALL",
CREATE2: "CREATE2",
STATICCALL: "STATICCALL", STATICCALL: "STATICCALL",
REVERT: "REVERT", REVERT: "REVERT",
SELFDESTRUCT: "SELFDESTRUCT", SELFDESTRUCT: "SELFDESTRUCT",
@ -522,6 +523,7 @@ var stringToOp = map[string]OpCode{
"LOG3": LOG3, "LOG3": LOG3,
"LOG4": LOG4, "LOG4": LOG4,
"CREATE": CREATE, "CREATE": CREATE,
"CREATE2": CREATE2,
"CALL": CALL, "CALL": CALL,
"RETURN": RETURN, "RETURN": RETURN,
"CALLCODE": CALLCODE, "CALLCODE": CALLCODE,