1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
#[cfg(feature = "template")]
use structopt::clap::arg_enum;
use structopt::StructOpt;
#[cfg(feature = "runtime-benchmarks")]
use frame_benchmarking_cli::BenchmarkCmd;
use sc_cli::*;
#[cfg(feature = "try-runtime")]
use try_runtime_cli::TryRuntimeCmd;
use drml_rpc::EthRpcConfig;
#[derive(Debug, StructOpt)]
pub struct Cli {
#[structopt(subcommand)]
pub subcommand: Option<Subcommand>,
#[allow(missing_docs)]
#[structopt(flatten)]
pub run: Run,
}
#[allow(missing_docs)]
#[derive(Debug, StructOpt)]
pub struct Run {
#[allow(missing_docs)]
#[structopt(flatten)]
pub base: RunCmd,
#[structopt(long = "force-pangolin")]
pub force_pangolin: bool,
#[structopt(long = "disable-authority-discovery")]
pub authority_discovery_disabled: bool,
#[allow(missing_docs)]
#[structopt(flatten)]
pub dvm_args: DvmArgs,
}
#[derive(Debug, StructOpt)]
pub enum Subcommand {
BuildSpec(BuildSpecCmd),
CheckBlock(CheckBlockCmd),
ExportBlocks(ExportBlocksCmd),
ExportState(ExportStateCmd),
ImportBlocks(ImportBlocksCmd),
PurgeChain(PurgeChainCmd),
Revert(RevertCmd),
Key(KeySubcommand),
Verify(VerifyCmd),
Vanity(VanityCmd),
Sign(SignCmd),
#[cfg(feature = "runtime-benchmarks")]
#[structopt(name = "benchmark", about = "Benchmark runtime pallets.")]
Benchmark(BenchmarkCmd),
#[cfg(feature = "try-runtime")]
TryRuntime(TryRuntimeCmd),
}
#[derive(Debug, StructOpt)]
pub struct DvmArgs {
#[structopt(long, require_delimiter = true)]
pub ethapi_debug_targets: Vec<String>,
#[structopt(long, default_value = "10")]
pub ethapi_max_permits: u32,
#[structopt(long, default_value = "500")]
pub ethapi_trace_max_count: u32,
#[structopt(long, default_value = "300")]
pub ethapi_trace_cache_duration: u64,
#[structopt(long, default_value = "3000")]
pub eth_log_block_cache: usize,
#[structopt(long, default_value = "10000")]
pub max_past_logs: u32,
#[structopt(long, default_value = "2048")]
pub fee_history_limit: u64,
#[cfg(feature = "template")]
#[structopt(long = "sealing", default_value)]
pub sealing: Sealing,
#[cfg(feature = "template")]
#[structopt(long = "enable-dev-signer")]
pub enable_dev_signer: bool,
}
impl DvmArgs {
pub fn build_eth_rpc_config(&self) -> EthRpcConfig {
EthRpcConfig {
ethapi_debug_targets: self.ethapi_debug_targets.clone(),
ethapi_max_permits: self.ethapi_max_permits,
ethapi_trace_max_count: self.ethapi_trace_max_count,
ethapi_trace_cache_duration: self.ethapi_trace_cache_duration,
eth_log_block_cache: self.eth_log_block_cache,
max_past_logs: self.max_past_logs,
fee_history_limit: self.fee_history_limit,
}
}
}
#[cfg(feature = "template")]
arg_enum! {
#[derive(Debug, Copy, Clone, StructOpt)]
pub enum Sealing {
Manual,
Instant,
}
}
#[cfg(feature = "template")]
impl Sealing {
pub fn is_manual(&self) -> bool {
match self {
Self::Manual => true,
Self::Instant => false,
}
}
}
#[cfg(feature = "template")]
impl Default for Sealing {
fn default() -> Sealing {
Sealing::Manual
}
}