github.com/unicornultrafoundation/go-u2u@v1.0.0-rc1.0.20240205080301-e74a83d3fadc/cmd/u2u/launcher/chaincmd.go (about)

     1  package launcher
     2  
     3  import (
     4  	"gopkg.in/urfave/cli.v1"
     5  
     6  	"github.com/unicornultrafoundation/go-u2u/cmd/utils"
     7  )
     8  
     9  var (
    10  	EvmExportMode = cli.StringFlag{
    11  		Name:  "export.evm.mode",
    12  		Usage: `EVM export mode ("full" or "ext-mpt" or "mpt")`,
    13  		Value: "mpt",
    14  	}
    15  	EvmExportExclude = cli.StringFlag{
    16  		Name:  "export.evm.exclude",
    17  		Usage: `DB of EVM keys to exclude from genesis`,
    18  	}
    19  	GenesisExportSections = cli.StringFlag{
    20  		Name:  "export.sections",
    21  		Usage: `Genesis sections to export separated by comma (e.g. "brs-1" or "ers" or "evm-2")`,
    22  		Value: "brs,ers,evm",
    23  	}
    24  	importCommand = cli.Command{
    25  		Name:      "import",
    26  		Usage:     "Import a blockchain file",
    27  		ArgsUsage: "<filename> (<filename 2> ... <filename N>) [check=false]",
    28  		Category:  "MISCELLANEOUS COMMANDS",
    29  		Description: `
    30      u2u import events
    31  
    32  The import command imports events from an RLP-encoded files.
    33  Events are fully verified by default, unless overridden by check=false flag.`,
    34  
    35  		Subcommands: []cli.Command{
    36  			{
    37  				Action:    utils.MigrateFlags(importEvents),
    38  				Name:      "events",
    39  				Usage:     "Import blockchain events",
    40  				ArgsUsage: "<filename> (<filename 2> ... <filename N>)",
    41  				Flags: []cli.Flag{
    42  					DataDirFlag,
    43  				},
    44  				Description: `
    45  The import command imports events from RLP-encoded files.
    46  Events are fully verified by default, unless overridden by --check=false flag.`,
    47  			},
    48  			{
    49  				Action:    utils.MigrateFlags(importEvm),
    50  				Name:      "evm",
    51  				Usage:     "Import EVM storage",
    52  				ArgsUsage: "<filename> (<filename 2> ... <filename N>)",
    53  				Flags: []cli.Flag{
    54  					DataDirFlag,
    55  				},
    56  				Description: `
    57      u2u import evm
    58  
    59  The import command imports EVM storage (trie nodes, code, preimages) from files.`,
    60  			},
    61  			{
    62  				Name:      "txtracer",
    63  				Usage:     "Import transaction traces",
    64  				ArgsUsage: "<filename>",
    65  				Action:    utils.MigrateFlags(importTxTracer),
    66  				Flags: []cli.Flag{
    67  					DataDirFlag,
    68  				},
    69  				Description: `
    70  			U2U import txtracer
    71  
    72  			The import command imports transaction traces and replaces the old ones 
    73  			with traces from a file.
    74  			`,
    75  			},
    76  		},
    77  	}
    78  	exportCommand = cli.Command{
    79  		Name:     "export",
    80  		Usage:    "Export blockchain",
    81  		Category: "MISCELLANEOUS COMMANDS",
    82  
    83  		Subcommands: []cli.Command{
    84  			{
    85  				Name:      "events",
    86  				Usage:     "Export blockchain events",
    87  				ArgsUsage: "<filename> [<epochFrom> <epochTo>]",
    88  				Action:    utils.MigrateFlags(exportEvents),
    89  				Flags: []cli.Flag{
    90  					DataDirFlag,
    91  				},
    92  				Description: `
    93      u2u export events
    94  
    95  Requires a first argument of the file to write to.
    96  Optional second and third arguments control the first and
    97  last epoch to write. If the file ends with .gz, the output will
    98  be gzipped
    99  `,
   100  			},
   101  			{
   102  				Name:      "genesis",
   103  				Usage:     "Export current state into a genesis file",
   104  				ArgsUsage: "<filename or dry-run> [<epochFrom> <epochTo>] [--export.evm.mode=MODE --export.evm.exclude=DB_PATH --export.sections=A,B,C]",
   105  				Action:    utils.MigrateFlags(exportGenesis),
   106  				Flags: []cli.Flag{
   107  					DataDirFlag,
   108  					EvmExportMode,
   109  					EvmExportExclude,
   110  					GenesisExportSections,
   111  				},
   112  				Description: `
   113      u2u export genesis
   114  
   115  Export current state into a genesis file.
   116  Requires a first argument of the file to write to.
   117  Optional second and third arguments control the first and
   118  last epoch to write.
   119  Pass dry-run instead of filename for calculation of hashes without exporting data.
   120  EVM export mode is configured with --export.evm.mode.
   121  `,
   122  			},
   123  			{
   124  				Name:      "evm-keys",
   125  				Usage:     "Export EVM node keys",
   126  				ArgsUsage: "<directory>",
   127  				Action:    utils.MigrateFlags(exportEvmKeys),
   128  				Flags: []cli.Flag{
   129  					DataDirFlag,
   130  				},
   131  				Description: `
   132      u2u export evm-keys
   133  
   134  Requires a first argument of the DB directory to write to.
   135  `,
   136  			},
   137  			{
   138  				Name:      "txtraces",
   139  				Usage:     "Export stored transaction traces",
   140  				ArgsUsage: "<filename> [<blockFrom> <blockTo>]",
   141  				Action:    utils.MigrateFlags(exportTxTracer),
   142  				Flags: []cli.Flag{
   143  					DataDirFlag,
   144  				},
   145  				Description: `
   146      client export txtraces
   147  
   148  Requires a first argument of the file to write to.
   149  Optional second and third arguments control the first and
   150  last block to write transaction traces. If the file ends with .gz, the output will
   151  be gzipped
   152  `,
   153  			},
   154  		},
   155  	}
   156  	deleteCommand = cli.Command{
   157  		Name:     "delete",
   158  		Usage:    "Delete blockchain data",
   159  		Category: "MISCELLANEOUS COMMANDS",
   160  
   161  		Subcommands: []cli.Command{
   162  			{
   163  				Name:      "txtracer",
   164  				Usage:     "Delete transaction traces",
   165  				ArgsUsage: "[<blockFrom> <blockTo>]",
   166  				Action:    utils.MigrateFlags(deleteTxTracer),
   167  				Flags: []cli.Flag{
   168  					DataDirFlag,
   169  				},
   170  				Description: `
   171      client delete txtracer
   172  
   173  Optional first and second arguments control the first and
   174  last block to delete transaction traces from. If the file ends with .gz, the output will
   175  be gzipped
   176  `,
   177  			},
   178  		},
   179  	}
   180  	checkCommand = cli.Command{
   181  		Name:     "check",
   182  		Usage:    "Check blockchain",
   183  		Category: "MISCELLANEOUS COMMANDS",
   184  
   185  		Subcommands: []cli.Command{
   186  			{
   187  				Name:   "evm",
   188  				Usage:  "Check EVM storage",
   189  				Action: utils.MigrateFlags(checkEvm),
   190  				Flags: []cli.Flag{
   191  					DataDirFlag,
   192  				},
   193  				Description: `
   194      u2u check evm
   195  
   196  Checks EVM storage roots and code hashes
   197  `,
   198  			},
   199  		},
   200  	}
   201  )