core/vm: clean up some dead functions (#24851)

This commit is contained in:
s7v7nislands 2022-05-11 13:03:35 +08:00 committed by GitHub
parent 8a008ee0e6
commit 24c590cbec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 34 deletions

View File

@ -591,7 +591,7 @@ func (c *blake2F) Run(input []byte) ([]byte, error) {
// Parse the input into the Blake2b call parameters // Parse the input into the Blake2b call parameters
var ( var (
rounds = binary.BigEndian.Uint32(input[0:4]) rounds = binary.BigEndian.Uint32(input[0:4])
final = (input[212] == blake2FFinalBlockBytes) final = input[212] == blake2FFinalBlockBytes
h [8]uint64 h [8]uint64
m [16]uint64 m [16]uint64

View File

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

View File

@ -17,8 +17,6 @@
package vm package vm
import ( import (
"fmt"
"github.com/holiman/uint256" "github.com/holiman/uint256"
) )
@ -68,7 +66,7 @@ func (m *Memory) Resize(size uint64) {
} }
} }
// Get returns offset + size as a new slice // GetCopy returns offset + size as a new slice
func (m *Memory) GetCopy(offset, size int64) (cpy []byte) { func (m *Memory) GetCopy(offset, size int64) (cpy []byte) {
if size == 0 { if size == 0 {
return nil return nil
@ -106,18 +104,3 @@ func (m *Memory) Len() int {
func (m *Memory) Data() []byte { func (m *Memory) Data() []byte {
return m.store return m.store
} }
// Print dumps the content of the memory.
func (m *Memory) Print() {
fmt.Printf("### mem %d bytes ###\n", len(m.store))
if len(m.store) > 0 {
addr := 0
for i := 0; i+32 <= len(m.store); i += 32 {
fmt.Printf("%03d: % x\n", addr, m.store[i:i+32])
addr++
}
} else {
fmt.Println("-- empty --")
}
fmt.Println("####################")
}

View File

@ -17,7 +17,6 @@
package vm package vm
import ( import (
"fmt"
"sync" "sync"
"github.com/holiman/uint256" "github.com/holiman/uint256"
@ -81,16 +80,3 @@ func (st *Stack) peek() *uint256.Int {
func (st *Stack) Back(n int) *uint256.Int { func (st *Stack) Back(n int) *uint256.Int {
return &st.data[st.len()-n-1] return &st.data[st.len()-n-1]
} }
// Print dumps the content of the stack
func (st *Stack) Print() {
fmt.Println("### stack ###")
if len(st.data) > 0 {
for i, val := range st.data {
fmt.Printf("%-3d %s\n", i, val.String())
}
} else {
fmt.Println("-- empty --")
}
fmt.Println("#############")
}