Skip to content

Commit 719db02

Browse files
s7v7nislandscp-wjhan
authored andcommitted
core/vm: clean up some dead functions (ethereum#24851)
1 parent a223f2d commit 719db02

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
@@ -592,7 +592,7 @@ func (c *blake2F) Run(input []byte) ([]byte, error) {
592592
// Parse the input into the Blake2b call parameters
593593
var (
594594
rounds = binary.BigEndian.Uint32(input[0:4])
595-
final = (input[212] == blake2FFinalBlockBytes)
595+
final = input[212] == blake2FFinalBlockBytes
596596

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

core/vm/instructions.go

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

487487
func opRandom(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) {
488-
v := new(uint256.Int).SetBytes((interpreter.evm.Context.Random.Bytes()))
488+
v := new(uint256.Int).SetBytes(interpreter.evm.Context.Random.Bytes())
489489
scope.Stack.push(v)
490490
return nil, nil
491491
}

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)