Skip to content

Commit

Permalink
Remove unused code (#1604)
Browse files Browse the repository at this point in the history
* Remove graphql, legacy options

* Remove CODEOWNERS

* Remove EWASM and custom EVM interpreter
  • Loading branch information
vorot93 authored and AskAlexSharov committed Apr 6, 2021
1 parent 52e232c commit 5280973
Show file tree
Hide file tree
Showing 79 changed files with 137 additions and 7,322 deletions.
22 changes: 0 additions & 22 deletions .github/CODEOWNERS

This file was deleted.

4 changes: 2 additions & 2 deletions accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func NewSimulatedBackendWithDatabase(database *ethdb.ObjectDatabase, alloc core.
config: genesis.Config,
txCacher: txCacher,
}
backend.events = filters.NewEventSystem(&filterBackend{database, backend}, false)
backend.events = filters.NewEventSystem(&filterBackend{database, backend})
backend.emptyPendingBlock()
return backend
}
Expand All @@ -137,7 +137,7 @@ func NewSimulatedBackendWithConfig(alloc core.GenesisAlloc, config *params.Chain
config: genesis.Config,
txCacher: txCacher,
}
backend.events = filters.NewEventSystem(&filterBackend{database, backend}, false)
backend.events = filters.NewEventSystem(&filterBackend{database, backend})
backend.emptyPendingBlock()
return backend
}
Expand Down
111 changes: 0 additions & 111 deletions accounts/keystore/account_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package keystore

import (
"fmt"
"io/ioutil"
"math/rand"
"os"
"path/filepath"
Expand Down Expand Up @@ -294,113 +293,3 @@ func TestCacheFind(t *testing.T) {
}
}
}

func waitForAccounts(wantAccounts []accounts.Account, ks *KeyStore) error {
var list []accounts.Account
for d := 200 * time.Millisecond; d < 8*time.Second; d *= 2 {
list = ks.Accounts()
if reflect.DeepEqual(list, wantAccounts) {
// ks should have also received change notifications
select {
case <-ks.changes:
default:
return fmt.Errorf("wasn't notified of new accounts")
}
return nil
}
time.Sleep(d)
}
return fmt.Errorf("\ngot %v\nwant %v", list, wantAccounts)
}

// TestUpdatedKeyfileContents tests that updating the contents of a keystore file
// is noticed by the watcher, and the account cache is updated accordingly
func TestUpdatedKeyfileContents(t *testing.T) {
t.Skip("This test is unstable")

t.Parallel()

// Create a temporary kesytore to test with
rand.Seed(time.Now().UnixNano())
dir := filepath.Join(os.TempDir(), fmt.Sprintf("eth-keystore-watch-test-%d-%d", os.Getpid(), rand.Int()))
ks := NewKeyStore(dir, LightScryptN, LightScryptP)

list := ks.Accounts()
if len(list) > 0 {
t.Error("initial account list not empty:", list)
}
time.Sleep(100 * time.Millisecond)

// Create the directory and copy a key file into it.
os.MkdirAll(dir, 0700)
defer os.RemoveAll(dir)
file := filepath.Join(dir, "aaa")

// Place one of our testfiles in there
if err := cp.CopyFile(file, cachetestAccounts[0].URL.Path); err != nil {
t.Fatal(err)
}

// ks should see the account.
wantAccounts := []accounts.Account{cachetestAccounts[0]}
wantAccounts[0].URL = accounts.URL{Scheme: KeyStoreScheme, Path: file}
if err := waitForAccounts(wantAccounts, ks); err != nil {
t.Error(err)
return
}

// needed so that modTime of `file` is different to its current value after forceCopyFile
time.Sleep(1000 * time.Millisecond)

// Now replace file contents
if err := forceCopyFile(file, cachetestAccounts[1].URL.Path); err != nil {
t.Fatal(err)
return
}
wantAccounts = []accounts.Account{cachetestAccounts[1]}
wantAccounts[0].URL = accounts.URL{Scheme: KeyStoreScheme, Path: file}
if err := waitForAccounts(wantAccounts, ks); err != nil {
t.Errorf("First replacement failed")
t.Error(err)
return
}

// needed so that modTime of `file` is different to its current value after forceCopyFile
time.Sleep(1000 * time.Millisecond)

// Now replace file contents again
if err := forceCopyFile(file, cachetestAccounts[2].URL.Path); err != nil {
t.Fatal(err)
return
}
wantAccounts = []accounts.Account{cachetestAccounts[2]}
wantAccounts[0].URL = accounts.URL{Scheme: KeyStoreScheme, Path: file}
if err := waitForAccounts(wantAccounts, ks); err != nil {
t.Errorf("Second replacement failed")
t.Error(err)
return
}

// needed so that modTime of `file` is different to its current value after ioutil.WriteFile
time.Sleep(1000 * time.Millisecond)

// Now replace file contents with crap
if err := ioutil.WriteFile(file, []byte("foo"), 0644); err != nil {
t.Fatal(err)
return
}
if err := waitForAccounts([]accounts.Account{}, ks); err != nil {
t.Errorf("Emptying account file failed")
t.Error(err)
return
}
}

// forceCopyFile is like cp.CopyFile, but doesn't complain if the destination exists.
func forceCopyFile(dst, src string) error {
data, err := ioutil.ReadFile(src)
if err != nil {
return err
}
return ioutil.WriteFile(dst, data, 0644)
}
22 changes: 0 additions & 22 deletions cmd/devp2p/nodesetcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ var filterFlags = map[string]nodeFilterC{
"-ip": {1, ipFilter},
"-min-age": {1, minAgeFilter},
"-eth-network": {1, ethFilter},
"-les-server": {0, lesFilter},
"-snap": {0, snapFilter},
}

func parseFilters(args []string) ([]nodeFilter, error) {
Expand Down Expand Up @@ -183,23 +181,3 @@ func ethFilter(args []string) (nodeFilter, error) {
}
return f, nil
}

func lesFilter(args []string) (nodeFilter, error) {
f := func(n nodeJSON) bool {
var les struct {
_ []rlp.RawValue `rlp:"tail"`
}
return n.N.Load(enr.WithEntry("les", &les)) == nil
}
return f, nil
}

func snapFilter(args []string) (nodeFilter, error) {
f := func(n nodeJSON) bool {
var snap struct {
_ []rlp.RawValue `rlp:"tail"`
}
return n.N.Load(enr.WithEntry("snap", &snap)) == nil
}
return f, nil
}
6 changes: 0 additions & 6 deletions cmd/evm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,6 @@ var (
Name: "noreturndata",
Usage: "disable return data output",
}
EVMInterpreterFlag = cli.StringFlag{
Name: "vm.evm",
Usage: "External EVM configuration (default = built-in interpreter)",
Value: "",
}
)

var stateTransitionCommand = cli.Command{
Expand Down Expand Up @@ -185,7 +180,6 @@ func init() {
DisableStackFlag,
DisableStorageFlag,
DisableReturnDataFlag,
EVMInterpreterFlag,
}
app.Commands = []cli.Command{
compileCommand,
Expand Down
5 changes: 2 additions & 3 deletions cmd/evm/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,8 @@ func runCmd(ctx *cli.Context) error {
Coinbase: genesisConfig.Coinbase,
BlockNumber: new(big.Int).SetUint64(genesisConfig.Number),
EVMConfig: vm.Config{
Tracer: tracer,
Debug: ctx.GlobalBool(DebugFlag.Name) || ctx.GlobalBool(MachineFlag.Name),
EVMInterpreter: ctx.GlobalString(EVMInterpreterFlag.Name),
Tracer: tracer,
Debug: ctx.GlobalBool(DebugFlag.Name) || ctx.GlobalBool(MachineFlag.Name),
},
}

Expand Down
27 changes: 0 additions & 27 deletions cmd/hack/hack.go
Original file line number Diff line number Diff line change
Expand Up @@ -1892,10 +1892,6 @@ func main() {
}
defer pprof.StopCPUProfile()
}
//db := ethdb.MustOpen("/home/akhounov/.ethereum/geth/chaindata")
//db := ethdb.MustOpen(node.DefaultDataDir() + "/geth/chaindata")
//check(err)
//defer db.Close()
if *action == "cfg" {
flow.TestGenCfg()
}
Expand All @@ -1907,39 +1903,18 @@ func main() {
if *action == "syncChart" {
mychart()
}
//testRebuild()
if *action == "testRewind" {
testRewind(*chaindata, *block, *rewind)
}
//hashFile()
//buildHashFromFile()
if *action == "testResolve" {
testResolve(*chaindata)
}
//rlpIndices()
//printFullNodeRLPs()
//testStartup()
//testDifficulty()
//testRewindTests()
//if *reset != -1 {
// testReset(uint64(*reset))
//}
if *action == "testBlockHashes" {
testBlockHashes(*chaindata, *block, common.HexToHash(*hash))
}
//printBuckets(db)
//printTxHashes()
//relayoutKeys()
//upgradeBlocks()
//compareTries()
if *action == "invTree" {
invTree("root", "right", "diff", *name)
}
//invTree("iw", "ir", "id", *block, true)
//loadAccount()
//printBranches(uint64(*block))
//extractTrie(*block)
//repair()
if *action == "readAccount" {
readAccount(*chaindata, common.HexToAddress(*account), uint64(*block), uint64(*rewind))
}
Expand All @@ -1952,8 +1927,6 @@ func main() {
if *action == "nextIncarnation" {
nextIncarnation(*chaindata, common.HexToHash(*account))
}
//repairCurrent()
//fmt.Printf("\u00b3\n")
if *action == "dumpStorage" {
dumpStorage()
}
Expand Down
8 changes: 0 additions & 8 deletions cmd/integration/commands/refetence_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,14 +368,6 @@ MainLoop:
return ctx.Err()
case <-commitEvery.C:
log.Info("Progress", "bucket", bucket, "key", fmt.Sprintf("%x", k))
//if err2 := dstTx.Commit(ctx); err2 != nil {
// return err2
//}
//dstTx, err = dst.Begin(ctx, nil, ethdb.RW)
//if err != nil {
// return err
//}
//c = dstTx.Cursor(bucket)
}
}
prevK = nil
Expand Down
16 changes: 0 additions & 16 deletions cmd/state/commands/check_change_sets.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,22 +174,6 @@ func CheckChangeSets(genesis *core.Genesis, blockNum uint64, chaindata string, h
}

if !match {
//fmt.Printf("\n\n")
//fmt.Printf("All in DB: ==========================\n")
//j := 0
//err = changeset.Walk(historyDb, dbutils.PlainAccountChangeSetBucket, dbutils.EncodeBlockNumber(blockNum), 8*8, func(blockN uint64, k, v []byte) (bool, error) {
// fmt.Printf("%d: 0x%x: %x\n", j, k, v)
// j++
// return true, nil
//})
//if err != nil {
// return err
//}
//fmt.Printf("All Expected: ==========================\n")
//for ii, c := range accountChanges.Changes {
// fmt.Printf("%d: 0x%x: %x\n", ii, c.Key, c.Value)
//}

return fmt.Errorf("check change set failed")
}

Expand Down
20 changes: 1 addition & 19 deletions cmd/state/commands/opcode_tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,28 +575,10 @@ func OpcodeTracer(genesis *core.Genesis, blockNum uint64, chaindata string, numB
for j := range t.Opcodes {
o := &t.Opcodes[j]
//only print to the summary the opcodes that are interesting
//isRStackUsed := o.MaxRStack != 0
isOpFault := o.Fault != ""
if isOpFault { // && !isRStackUsed {
if isOpFault {
fmt.Fprintf(ot.fsumWriter, "Opcode FAULT\tb=%d taddr=%s TxF=%s opF=%s tx=%s\n", blockNum, t.TxAddr, t.Fault, t.OpcodeFault, t.TxHash.String())
fmt.Fprint(ot.fsumWriter, "\n")

//print the stack
//if l := o.StackTop.Len(); l>0 {
// fmt.Fprintf(ot.summary, "\t%d:", o.MaxStack)
// for i := 0; i < l; i++ {
// fmt.Fprintf(ot.summary, "%x ", o.StackTop.Back(i))
// }
//}

//print the Rstack
//if o.MaxRStack > 0 {
// fmt.Fprintf(ot.fsumWriter, "\trs:%d:", o.MaxRStack)
// //fmt.Printf("return stack used in block %d, tx %s", BlockNum)
// for i := 0; i < o.MaxRStack; i++ {
// fmt.Fprintf(ot.fsumWriter, "%x ", o.RetStackTop[i])
// }
//}
}
}
isTxFault := t.Fault != ""
Expand Down
37 changes: 0 additions & 37 deletions cmd/utils/diskusage.go

This file was deleted.

Loading

0 comments on commit 5280973

Please sign in to comment.