Skip to content

Commit 24c590c

Browse files
authored
core/vm: clean up some dead functions (#24851)
1 parent 8a008ee commit 24c590c

File tree

4 files changed

+3
-34
lines changed

4 files changed

+3
-34
lines changed

core/vm/contracts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ func (c *blake2F) Run(input []byte) ([]byte, error) {
591591
// Parse the input into the Blake2b call parameters
592592
var (
593593
rounds = binary.BigEndian.Uint32(input[0:4])
594-
final = (input[212] == blake2FFinalBlockBytes)
594+
final = input[212] == blake2FFinalBlockBytes
595595

596596
h [8]uint64
597597
m [16]uint64

core/vm/instructions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ func opDifficulty(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext)
478478
}
479479

480480
func opRandom(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) {
481-
v := new(uint256.Int).SetBytes((interpreter.evm.Context.Random.Bytes()))
481+
v := new(uint256.Int).SetBytes(interpreter.evm.Context.Random.Bytes())
482482
scope.Stack.push(v)
483483
return nil, nil
484484
}

core/vm/memory.go

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
package vm
1818

1919
import (
20-
"fmt"
21-
2220
"github.com/holiman/uint256"
2321
)
2422

@@ -68,7 +66,7 @@ func (m *Memory) Resize(size uint64) {
6866
}
6967
}
7068

71-
// Get returns offset + size as a new slice
69+
// GetCopy returns offset + size as a new slice
7270
func (m *Memory) GetCopy(offset, size int64) (cpy []byte) {
7371
if size == 0 {
7472
return nil
@@ -106,18 +104,3 @@ func (m *Memory) Len() int {
106104
func (m *Memory) Data() []byte {
107105
return m.store
108106
}
109-
110-
// Print dumps the content of the memory.
111-
func (m *Memory) Print() {
112-
fmt.Printf("### mem %d bytes ###\n", len(m.store))
113-
if len(m.store) > 0 {
114-
addr := 0
115-
for i := 0; i+32 <= len(m.store); i += 32 {
116-
fmt.Printf("%03d: % x\n", addr, m.store[i:i+32])
117-
addr++
118-
}
119-
} else {
120-
fmt.Println("-- empty --")
121-
}
122-
fmt.Println("####################")
123-
}

core/vm/stack.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package vm
1818

1919
import (
20-
"fmt"
2120
"sync"
2221

2322
"github.com/holiman/uint256"
@@ -81,16 +80,3 @@ func (st *Stack) peek() *uint256.Int {
8180
func (st *Stack) Back(n int) *uint256.Int {
8281
return &st.data[st.len()-n-1]
8382
}
84-
85-
// Print dumps the content of the stack
86-
func (st *Stack) Print() {
87-
fmt.Println("### stack ###")
88-
if len(st.data) > 0 {
89-
for i, val := range st.data {
90-
fmt.Printf("%-3d %s\n", i, val.String())
91-
}
92-
} else {
93-
fmt.Println("-- empty --")
94-
}
95-
fmt.Println("#############")
96-
}

0 commit comments

Comments
 (0)