1// Copyright 2020 The go-ethereum Authors
2// This file is part of the go-ethereum library.
3//
4// The go-ethereum library is free software: you can redistribute it and/or modify
5// it under the terms of the GNU Lesser General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// The go-ethereum library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU Lesser General Public License for more details.
13//
14// You should have received a copy of the GNU Lesser General Public License
15// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
16
17package t8ntool
18
19import (
20	"fmt"
21	"strings"
22
23	"github.com/ethereum/go-ethereum/core/vm"
24	"github.com/ethereum/go-ethereum/tests"
25	"gopkg.in/urfave/cli.v1"
26)
27
28var (
29	TraceFlag = cli.BoolFlag{
30		Name:  "trace",
31		Usage: "Output full trace logs to files <txhash>.jsonl",
32	}
33	TraceDisableMemoryFlag = cli.BoolTFlag{
34		Name:  "trace.nomemory",
35		Usage: "Disable full memory dump in traces (deprecated)",
36	}
37	TraceEnableMemoryFlag = cli.BoolFlag{
38		Name:  "trace.memory",
39		Usage: "Enable full memory dump in traces",
40	}
41	TraceDisableStackFlag = cli.BoolFlag{
42		Name:  "trace.nostack",
43		Usage: "Disable stack output in traces",
44	}
45	TraceDisableReturnDataFlag = cli.BoolTFlag{
46		Name:  "trace.noreturndata",
47		Usage: "Disable return data output in traces (deprecated)",
48	}
49	TraceEnableReturnDataFlag = cli.BoolFlag{
50		Name:  "trace.returndata",
51		Usage: "Enable return data output in traces",
52	}
53	OutputBasedir = cli.StringFlag{
54		Name:  "output.basedir",
55		Usage: "Specifies where output files are placed. Will be created if it does not exist.",
56		Value: "",
57	}
58	OutputBodyFlag = cli.StringFlag{
59		Name:  "output.body",
60		Usage: "If set, the RLP of the transactions (block body) will be written to this file.",
61		Value: "",
62	}
63	OutputAllocFlag = cli.StringFlag{
64		Name: "output.alloc",
65		Usage: "Determines where to put the `alloc` of the post-state.\n" +
66			"\t`stdout` - into the stdout output\n" +
67			"\t`stderr` - into the stderr output\n" +
68			"\t<file> - into the file <file> ",
69		Value: "alloc.json",
70	}
71	OutputResultFlag = cli.StringFlag{
72		Name: "output.result",
73		Usage: "Determines where to put the `result` (stateroot, txroot etc) of the post-state.\n" +
74			"\t`stdout` - into the stdout output\n" +
75			"\t`stderr` - into the stderr output\n" +
76			"\t<file> - into the file <file> ",
77		Value: "result.json",
78	}
79	OutputBlockFlag = cli.StringFlag{
80		Name: "output.block",
81		Usage: "Determines where to put the `block` after building.\n" +
82			"\t`stdout` - into the stdout output\n" +
83			"\t`stderr` - into the stderr output\n" +
84			"\t<file> - into the file <file> ",
85		Value: "block.json",
86	}
87	InputAllocFlag = cli.StringFlag{
88		Name:  "input.alloc",
89		Usage: "`stdin` or file name of where to find the prestate alloc to use.",
90		Value: "alloc.json",
91	}
92	InputEnvFlag = cli.StringFlag{
93		Name:  "input.env",
94		Usage: "`stdin` or file name of where to find the prestate env to use.",
95		Value: "env.json",
96	}
97	InputTxsFlag = cli.StringFlag{
98		Name: "input.txs",
99		Usage: "`stdin` or file name of where to find the transactions to apply. " +
100			"If the file extension is '.rlp', then the data is interpreted as an RLP list of signed transactions." +
101			"The '.rlp' format is identical to the output.body format.",
102		Value: "txs.json",
103	}
104	InputHeaderFlag = cli.StringFlag{
105		Name:  "input.header",
106		Usage: "`stdin` or file name of where to find the block header to use.",
107		Value: "header.json",
108	}
109	InputOmmersFlag = cli.StringFlag{
110		Name:  "input.ommers",
111		Usage: "`stdin` or file name of where to find the list of ommer header RLPs to use.",
112	}
113	InputTxsRlpFlag = cli.StringFlag{
114		Name:  "input.txs",
115		Usage: "`stdin` or file name of where to find the transactions list in RLP form.",
116		Value: "txs.rlp",
117	}
118	SealCliqueFlag = cli.StringFlag{
119		Name:  "seal.clique",
120		Usage: "Seal block with Clique. `stdin` or file name of where to find the Clique sealing data.",
121	}
122	SealEthashFlag = cli.BoolFlag{
123		Name:  "seal.ethash",
124		Usage: "Seal block with ethash.",
125	}
126	SealEthashDirFlag = cli.StringFlag{
127		Name:  "seal.ethash.dir",
128		Usage: "Path to ethash DAG. If none exists, a new DAG will be generated.",
129	}
130	SealEthashModeFlag = cli.StringFlag{
131		Name:  "seal.ethash.mode",
132		Usage: "Defines the type and amount of PoW verification an ethash engine makes.",
133		Value: "normal",
134	}
135	RewardFlag = cli.Int64Flag{
136		Name:  "state.reward",
137		Usage: "Mining reward. Set to -1 to disable",
138		Value: 0,
139	}
140	ChainIDFlag = cli.Int64Flag{
141		Name:  "state.chainid",
142		Usage: "ChainID to use",
143		Value: 1,
144	}
145	ForknameFlag = cli.StringFlag{
146		Name: "state.fork",
147		Usage: fmt.Sprintf("Name of ruleset to use."+
148			"\n\tAvailable forknames:"+
149			"\n\t    %v"+
150			"\n\tAvailable extra eips:"+
151			"\n\t    %v"+
152			"\n\tSyntax <forkname>(+ExtraEip)",
153			strings.Join(tests.AvailableForks(), "\n\t    "),
154			strings.Join(vm.ActivateableEips(), ", ")),
155		Value: "Istanbul",
156	}
157	VerbosityFlag = cli.IntFlag{
158		Name:  "verbosity",
159		Usage: "sets the verbosity level",
160		Value: 3,
161	}
162)
163