diff --git a/core/vm/instructions.go b/core/vm/instructions.go index 3c004c1733..7e7d92e2e3 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -875,12 +875,13 @@ func makeLog(size int) executionFunc { func opPush1(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) { var ( codeLen = uint64(len(scope.Contract.Code)) + integer = new(uint256.Int) ) *pc += 1 if *pc < codeLen { - scope.Stack.push(new(uint256.Int).SetUint64(uint64(scope.Contract.Code[*pc]))) + scope.Stack.push(integer.SetUint64(uint64(scope.Contract.Code[*pc]))) } else { - scope.Stack.push(new(uint256.Int).Clear()) + scope.Stack.push(integer.Clear()) } return nil, nil } @@ -888,9 +889,12 @@ func opPush1(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]by // make push instruction function func makePush(size uint64, pushByteSize int) executionFunc { return func(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) { - codeLen := len(scope.Contract.Code) - startMin := min(codeLen, int(*pc+1)) - endMin := min(startMin+pushByteSize, codeLen) + var ( + codeLen = len(scope.Contract.Code) + startMin = min(codeLen, int(*pc+1)) + endMin = min(startMin+pushByteSize, codeLen) + ) + scope.Stack.push(new(uint256.Int).SetBytes( common.RightPadBytes( scope.Contract.Code[startMin:endMin],