@@ -3,16 +3,13 @@ package vm
3
3
import (
4
4
"math/big"
5
5
6
- "github.com/ethereum/go-ethereum/ethutil"
7
6
"github.com/ethereum/go-ethereum/state"
8
7
)
9
8
10
9
type ClosureRef interface {
11
10
ReturnGas (* big.Int , * big.Int )
12
11
Address () []byte
13
12
SetCode ([]byte )
14
- GetStorage (* big.Int ) * ethutil.Value
15
- SetStorage (* big.Int , * ethutil.Value )
16
13
}
17
14
18
15
type Closure struct {
@@ -41,10 +38,6 @@ func NewClosure(msg *state.Message, caller ClosureRef, object ClosureRef, code [
41
38
return c
42
39
}
43
40
44
- func (c * Closure ) GetValue (x uint64 ) * ethutil.Value {
45
- return c .GetRangeValue (x , 1 )
46
- }
47
-
48
41
func (c * Closure ) GetOp (x uint64 ) OpCode {
49
42
return OpCode (c .GetByte (x ))
50
43
}
@@ -65,30 +58,12 @@ func (c *Closure) GetBytes(x, y int) []byte {
65
58
return c .Code [x : x + y ]
66
59
}
67
60
68
- func (c * Closure ) GetRangeValue (x , y uint64 ) * ethutil. Value {
61
+ func (c * Closure ) GetRangeValue (x , y uint64 ) [] byte {
69
62
if x >= uint64 (len (c .Code )) || y >= uint64 (len (c .Code )) {
70
- return ethutil .NewValue (0 )
71
- }
72
-
73
- partial := c .Code [x : x + y ]
74
-
75
- return ethutil .NewValue (partial )
76
- }
77
-
78
- /*
79
- * State storage functions
80
- */
81
- func (c * Closure ) SetStorage (x * big.Int , val * ethutil.Value ) {
82
- c .object .SetStorage (x , val )
83
- }
84
-
85
- func (c * Closure ) GetStorage (x * big.Int ) * ethutil.Value {
86
- m := c .object .GetStorage (x )
87
- if m == nil {
88
- return ethutil .EmptyValue ()
63
+ return nil
89
64
}
90
65
91
- return m
66
+ return c . Code [ x : x + y ]
92
67
}
93
68
94
69
func (c * Closure ) Return (ret []byte ) []byte {
@@ -123,10 +98,6 @@ func (c *Closure) ReturnGas(gas, price *big.Int) {
123
98
/*
124
99
* Set / Get
125
100
*/
126
- func (c * Closure ) Caller () ClosureRef {
127
- return c .caller
128
- }
129
-
130
101
func (c * Closure ) Address () []byte {
131
102
return c .object .Address ()
132
103
}
0 commit comments