Skip to content

Commit

Permalink
state: drop unused noop structs
Browse files Browse the repository at this point in the history
  • Loading branch information
lmittmann committed Jul 29, 2023
1 parent f5f7977 commit fae2f79
Showing 1 changed file with 0 additions and 68 deletions.
68 changes: 0 additions & 68 deletions w3vm/state/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import (
"testing"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/trie"
"github.com/holiman/uint256"
"github.com/lmittmann/w3/internal/mod"
"github.com/lmittmann/w3/internal/module"
Expand Down Expand Up @@ -65,72 +63,6 @@ func (i uint256OrHash) MarshalText() ([]byte, error) {
return (*uint256.Int)(&i).MarshalText()
}

////////////////////////////////////////////////////////////////////////////////////////////////////
// KeyValueStore ///////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////

// noopKeyValueStore implements a [ethdb.KeyValueStore] that does nothing.
type noopKeyValueStore struct {
ethdb.KeyValueStore
}

// ethdb.KeyValueReader methods
func (*noopKeyValueStore) Get(key []byte) ([]byte, error) { panic("not implemented") }
func (*noopKeyValueStore) Has(key []byte) (bool, error) { panic("not implemented") }

// ethdb.KeyValueWriter methods
func (*noopKeyValueStore) Put(key, value []byte) error { panic("not implemented") }
func (*noopKeyValueStore) Delete(key []byte) error { panic("not implemented") }

// ethdb.KeyValueStater methods
func (*noopKeyValueStore) Stat(property string) (string, error) { panic("not implemented") }

// ethdb.Batcher methods
func (*noopKeyValueStore) NewBatch() ethdb.Batch { return new(noopBatch) }
func (*noopKeyValueStore) NewBatchWithSize(size int) ethdb.Batch { return new(noopBatch) }

// ethdb.Iteratee methods
func (noopKeyValueStore) NewIterator(prefix, start []byte) ethdb.Iterator {
panic("not implemented")
}

// eth.Compacter methods
func (*noopKeyValueStore) Compact(start, limit []byte) error { panic("not implemented") }

// ethdb.Snapshotter methods
func (*noopKeyValueStore) Snapshot() int { panic("not implemented") }

// io.Closer methods
func (*noopKeyValueStore) Close() error { return nil }

// noopBatch implements a [ethdb.Batch] that does nothing.
type noopBatch struct {
ethdb.Batch
}

func (*noopBatch) Put(key, value []byte) error { return nil }
func (*noopBatch) Delete(key []byte) error { panic("not implemented") }

func (*noopBatch) ValueSize() int { return 0 }
func (*noopBatch) Write() error { return nil }
func (*noopBatch) Reset() {}
func (*noopBatch) Replay(w ethdb.KeyValueWriter) error { return nil }

type noopNodeIterator struct {
trie.NodeIterator
}

func (*noopNodeIterator) Next(bool) bool { return false }
func (*noopNodeIterator) Error() error { return nil }
func (*noopNodeIterator) Parent() common.Hash { return hash0 }
func (*noopNodeIterator) Path() []byte { return nil }
func (*noopNodeIterator) NodeBlob() []byte { return nil }
func (*noopNodeIterator) Leaf() bool { return false }
func (*noopNodeIterator) LeafKey() []byte { return nil }
func (*noopNodeIterator) LeafBlob() []byte { return nil }
func (*noopNodeIterator) LeafProof() [][]byte { return nil }
func (*noopNodeIterator) AddResolver(trie.NodeResolver) {}

////////////////////////////////////////////////////////////////////////////////////////////////////
// Testing ////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit fae2f79

Please sign in to comment.