|
|
@ -22,6 +22,7 @@ import ( |
|
|
|
"os" |
|
|
|
"os" |
|
|
|
"os/signal" |
|
|
|
"os/signal" |
|
|
|
"path/filepath" |
|
|
|
"path/filepath" |
|
|
|
|
|
|
|
"slices" |
|
|
|
"strconv" |
|
|
|
"strconv" |
|
|
|
"strings" |
|
|
|
"strings" |
|
|
|
"syscall" |
|
|
|
"syscall" |
|
|
@ -36,7 +37,6 @@ import ( |
|
|
|
"github.com/ethereum/go-ethereum/core/types" |
|
|
|
"github.com/ethereum/go-ethereum/core/types" |
|
|
|
"github.com/ethereum/go-ethereum/crypto" |
|
|
|
"github.com/ethereum/go-ethereum/crypto" |
|
|
|
"github.com/ethereum/go-ethereum/ethdb" |
|
|
|
"github.com/ethereum/go-ethereum/ethdb" |
|
|
|
"github.com/ethereum/go-ethereum/internal/flags" |
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/log" |
|
|
|
"github.com/ethereum/go-ethereum/log" |
|
|
|
"github.com/ethereum/go-ethereum/rlp" |
|
|
|
"github.com/ethereum/go-ethereum/rlp" |
|
|
|
"github.com/ethereum/go-ethereum/trie" |
|
|
|
"github.com/ethereum/go-ethereum/trie" |
|
|
@ -60,7 +60,7 @@ var ( |
|
|
|
Name: "removedb", |
|
|
|
Name: "removedb", |
|
|
|
Usage: "Remove blockchain and state databases", |
|
|
|
Usage: "Remove blockchain and state databases", |
|
|
|
ArgsUsage: "", |
|
|
|
ArgsUsage: "", |
|
|
|
Flags: flags.Merge(utils.DatabaseFlags, |
|
|
|
Flags: slices.Concat(utils.DatabaseFlags, |
|
|
|
[]cli.Flag{removeStateDataFlag, removeChainDataFlag}), |
|
|
|
[]cli.Flag{removeStateDataFlag, removeChainDataFlag}), |
|
|
|
Description: ` |
|
|
|
Description: ` |
|
|
|
Remove blockchain and state databases`, |
|
|
|
Remove blockchain and state databases`, |
|
|
@ -89,7 +89,7 @@ Remove blockchain and state databases`, |
|
|
|
Action: inspect, |
|
|
|
Action: inspect, |
|
|
|
Name: "inspect", |
|
|
|
Name: "inspect", |
|
|
|
ArgsUsage: "<prefix> <start>", |
|
|
|
ArgsUsage: "<prefix> <start>", |
|
|
|
Flags: flags.Merge([]cli.Flag{ |
|
|
|
Flags: slices.Concat([]cli.Flag{ |
|
|
|
utils.SyncModeFlag, |
|
|
|
utils.SyncModeFlag, |
|
|
|
}, utils.NetworkFlags, utils.DatabaseFlags), |
|
|
|
}, utils.NetworkFlags, utils.DatabaseFlags), |
|
|
|
Usage: "Inspect the storage size for each type of data in the database", |
|
|
|
Usage: "Inspect the storage size for each type of data in the database", |
|
|
@ -99,7 +99,7 @@ Remove blockchain and state databases`, |
|
|
|
Action: checkStateContent, |
|
|
|
Action: checkStateContent, |
|
|
|
Name: "check-state-content", |
|
|
|
Name: "check-state-content", |
|
|
|
ArgsUsage: "<start (optional)>", |
|
|
|
ArgsUsage: "<start (optional)>", |
|
|
|
Flags: flags.Merge(utils.NetworkFlags, utils.DatabaseFlags), |
|
|
|
Flags: slices.Concat(utils.NetworkFlags, utils.DatabaseFlags), |
|
|
|
Usage: "Verify that state data is cryptographically correct", |
|
|
|
Usage: "Verify that state data is cryptographically correct", |
|
|
|
Description: `This command iterates the entire database for 32-byte keys, looking for rlp-encoded trie nodes. |
|
|
|
Description: `This command iterates the entire database for 32-byte keys, looking for rlp-encoded trie nodes. |
|
|
|
For each trie node encountered, it checks that the key corresponds to the keccak256(value). If this is not true, this indicates |
|
|
|
For each trie node encountered, it checks that the key corresponds to the keccak256(value). If this is not true, this indicates |
|
|
@ -109,7 +109,7 @@ a data corruption.`, |
|
|
|
Action: dbStats, |
|
|
|
Action: dbStats, |
|
|
|
Name: "stats", |
|
|
|
Name: "stats", |
|
|
|
Usage: "Print leveldb statistics", |
|
|
|
Usage: "Print leveldb statistics", |
|
|
|
Flags: flags.Merge([]cli.Flag{ |
|
|
|
Flags: slices.Concat([]cli.Flag{ |
|
|
|
utils.SyncModeFlag, |
|
|
|
utils.SyncModeFlag, |
|
|
|
}, utils.NetworkFlags, utils.DatabaseFlags), |
|
|
|
}, utils.NetworkFlags, utils.DatabaseFlags), |
|
|
|
} |
|
|
|
} |
|
|
@ -117,7 +117,7 @@ a data corruption.`, |
|
|
|
Action: dbCompact, |
|
|
|
Action: dbCompact, |
|
|
|
Name: "compact", |
|
|
|
Name: "compact", |
|
|
|
Usage: "Compact leveldb database. WARNING: May take a very long time", |
|
|
|
Usage: "Compact leveldb database. WARNING: May take a very long time", |
|
|
|
Flags: flags.Merge([]cli.Flag{ |
|
|
|
Flags: slices.Concat([]cli.Flag{ |
|
|
|
utils.SyncModeFlag, |
|
|
|
utils.SyncModeFlag, |
|
|
|
utils.CacheFlag, |
|
|
|
utils.CacheFlag, |
|
|
|
utils.CacheDatabaseFlag, |
|
|
|
utils.CacheDatabaseFlag, |
|
|
@ -131,7 +131,7 @@ corruption if it is aborted during execution'!`, |
|
|
|
Name: "get", |
|
|
|
Name: "get", |
|
|
|
Usage: "Show the value of a database key", |
|
|
|
Usage: "Show the value of a database key", |
|
|
|
ArgsUsage: "<hex-encoded key>", |
|
|
|
ArgsUsage: "<hex-encoded key>", |
|
|
|
Flags: flags.Merge([]cli.Flag{ |
|
|
|
Flags: slices.Concat([]cli.Flag{ |
|
|
|
utils.SyncModeFlag, |
|
|
|
utils.SyncModeFlag, |
|
|
|
}, utils.NetworkFlags, utils.DatabaseFlags), |
|
|
|
}, utils.NetworkFlags, utils.DatabaseFlags), |
|
|
|
Description: "This command looks up the specified database key from the database.", |
|
|
|
Description: "This command looks up the specified database key from the database.", |
|
|
@ -141,7 +141,7 @@ corruption if it is aborted during execution'!`, |
|
|
|
Name: "delete", |
|
|
|
Name: "delete", |
|
|
|
Usage: "Delete a database key (WARNING: may corrupt your database)", |
|
|
|
Usage: "Delete a database key (WARNING: may corrupt your database)", |
|
|
|
ArgsUsage: "<hex-encoded key>", |
|
|
|
ArgsUsage: "<hex-encoded key>", |
|
|
|
Flags: flags.Merge([]cli.Flag{ |
|
|
|
Flags: slices.Concat([]cli.Flag{ |
|
|
|
utils.SyncModeFlag, |
|
|
|
utils.SyncModeFlag, |
|
|
|
}, utils.NetworkFlags, utils.DatabaseFlags), |
|
|
|
}, utils.NetworkFlags, utils.DatabaseFlags), |
|
|
|
Description: `This command deletes the specified database key from the database. |
|
|
|
Description: `This command deletes the specified database key from the database. |
|
|
@ -152,7 +152,7 @@ WARNING: This is a low-level operation which may cause database corruption!`, |
|
|
|
Name: "put", |
|
|
|
Name: "put", |
|
|
|
Usage: "Set the value of a database key (WARNING: may corrupt your database)", |
|
|
|
Usage: "Set the value of a database key (WARNING: may corrupt your database)", |
|
|
|
ArgsUsage: "<hex-encoded key> <hex-encoded value>", |
|
|
|
ArgsUsage: "<hex-encoded key> <hex-encoded value>", |
|
|
|
Flags: flags.Merge([]cli.Flag{ |
|
|
|
Flags: slices.Concat([]cli.Flag{ |
|
|
|
utils.SyncModeFlag, |
|
|
|
utils.SyncModeFlag, |
|
|
|
}, utils.NetworkFlags, utils.DatabaseFlags), |
|
|
|
}, utils.NetworkFlags, utils.DatabaseFlags), |
|
|
|
Description: `This command sets a given database key to the given value. |
|
|
|
Description: `This command sets a given database key to the given value. |
|
|
@ -163,7 +163,7 @@ WARNING: This is a low-level operation which may cause database corruption!`, |
|
|
|
Name: "dumptrie", |
|
|
|
Name: "dumptrie", |
|
|
|
Usage: "Show the storage key/values of a given storage trie", |
|
|
|
Usage: "Show the storage key/values of a given storage trie", |
|
|
|
ArgsUsage: "<hex-encoded state root> <hex-encoded account hash> <hex-encoded storage trie root> <hex-encoded start (optional)> <int max elements (optional)>", |
|
|
|
ArgsUsage: "<hex-encoded state root> <hex-encoded account hash> <hex-encoded storage trie root> <hex-encoded start (optional)> <int max elements (optional)>", |
|
|
|
Flags: flags.Merge([]cli.Flag{ |
|
|
|
Flags: slices.Concat([]cli.Flag{ |
|
|
|
utils.SyncModeFlag, |
|
|
|
utils.SyncModeFlag, |
|
|
|
}, utils.NetworkFlags, utils.DatabaseFlags), |
|
|
|
}, utils.NetworkFlags, utils.DatabaseFlags), |
|
|
|
Description: "This command looks up the specified database key from the database.", |
|
|
|
Description: "This command looks up the specified database key from the database.", |
|
|
@ -173,7 +173,7 @@ WARNING: This is a low-level operation which may cause database corruption!`, |
|
|
|
Name: "freezer-index", |
|
|
|
Name: "freezer-index", |
|
|
|
Usage: "Dump out the index of a specific freezer table", |
|
|
|
Usage: "Dump out the index of a specific freezer table", |
|
|
|
ArgsUsage: "<freezer-type> <table-type> <start (int)> <end (int)>", |
|
|
|
ArgsUsage: "<freezer-type> <table-type> <start (int)> <end (int)>", |
|
|
|
Flags: flags.Merge([]cli.Flag{ |
|
|
|
Flags: slices.Concat([]cli.Flag{ |
|
|
|
utils.SyncModeFlag, |
|
|
|
utils.SyncModeFlag, |
|
|
|
}, utils.NetworkFlags, utils.DatabaseFlags), |
|
|
|
}, utils.NetworkFlags, utils.DatabaseFlags), |
|
|
|
Description: "This command displays information about the freezer index.", |
|
|
|
Description: "This command displays information about the freezer index.", |
|
|
@ -183,7 +183,7 @@ WARNING: This is a low-level operation which may cause database corruption!`, |
|
|
|
Name: "import", |
|
|
|
Name: "import", |
|
|
|
Usage: "Imports leveldb-data from an exported RLP dump.", |
|
|
|
Usage: "Imports leveldb-data from an exported RLP dump.", |
|
|
|
ArgsUsage: "<dumpfile> <start (optional)", |
|
|
|
ArgsUsage: "<dumpfile> <start (optional)", |
|
|
|
Flags: flags.Merge([]cli.Flag{ |
|
|
|
Flags: slices.Concat([]cli.Flag{ |
|
|
|
utils.SyncModeFlag, |
|
|
|
utils.SyncModeFlag, |
|
|
|
}, utils.NetworkFlags, utils.DatabaseFlags), |
|
|
|
}, utils.NetworkFlags, utils.DatabaseFlags), |
|
|
|
Description: "The import command imports the specific chain data from an RLP encoded stream.", |
|
|
|
Description: "The import command imports the specific chain data from an RLP encoded stream.", |
|
|
@ -193,7 +193,7 @@ WARNING: This is a low-level operation which may cause database corruption!`, |
|
|
|
Name: "export", |
|
|
|
Name: "export", |
|
|
|
Usage: "Exports the chain data into an RLP dump. If the <dumpfile> has .gz suffix, gzip compression will be used.", |
|
|
|
Usage: "Exports the chain data into an RLP dump. If the <dumpfile> has .gz suffix, gzip compression will be used.", |
|
|
|
ArgsUsage: "<type> <dumpfile>", |
|
|
|
ArgsUsage: "<type> <dumpfile>", |
|
|
|
Flags: flags.Merge([]cli.Flag{ |
|
|
|
Flags: slices.Concat([]cli.Flag{ |
|
|
|
utils.SyncModeFlag, |
|
|
|
utils.SyncModeFlag, |
|
|
|
}, utils.NetworkFlags, utils.DatabaseFlags), |
|
|
|
}, utils.NetworkFlags, utils.DatabaseFlags), |
|
|
|
Description: "Exports the specified chain data to an RLP encoded stream, optionally gzip-compressed.", |
|
|
|
Description: "Exports the specified chain data to an RLP encoded stream, optionally gzip-compressed.", |
|
|
@ -202,7 +202,7 @@ WARNING: This is a low-level operation which may cause database corruption!`, |
|
|
|
Action: showMetaData, |
|
|
|
Action: showMetaData, |
|
|
|
Name: "metadata", |
|
|
|
Name: "metadata", |
|
|
|
Usage: "Shows metadata about the chain status.", |
|
|
|
Usage: "Shows metadata about the chain status.", |
|
|
|
Flags: flags.Merge([]cli.Flag{ |
|
|
|
Flags: slices.Concat([]cli.Flag{ |
|
|
|
utils.SyncModeFlag, |
|
|
|
utils.SyncModeFlag, |
|
|
|
}, utils.NetworkFlags, utils.DatabaseFlags), |
|
|
|
}, utils.NetworkFlags, utils.DatabaseFlags), |
|
|
|
Description: "Shows metadata about the chain status.", |
|
|
|
Description: "Shows metadata about the chain status.", |
|
|
@ -212,7 +212,7 @@ WARNING: This is a low-level operation which may cause database corruption!`, |
|
|
|
Name: "inspect-history", |
|
|
|
Name: "inspect-history", |
|
|
|
Usage: "Inspect the state history within block range", |
|
|
|
Usage: "Inspect the state history within block range", |
|
|
|
ArgsUsage: "<address> [OPTIONAL <storage-slot>]", |
|
|
|
ArgsUsage: "<address> [OPTIONAL <storage-slot>]", |
|
|
|
Flags: flags.Merge([]cli.Flag{ |
|
|
|
Flags: slices.Concat([]cli.Flag{ |
|
|
|
utils.SyncModeFlag, |
|
|
|
utils.SyncModeFlag, |
|
|
|
&cli.Uint64Flag{ |
|
|
|
&cli.Uint64Flag{ |
|
|
|
Name: "start", |
|
|
|
Name: "start", |
|
|
|