reth_optimism_cli/commands/
test_vectors.rs
1use clap::{Parser, Subcommand};
4use op_alloy_consensus::TxDeposit;
5use proptest::test_runner::TestRunner;
6use reth_chainspec::ChainSpec;
7use reth_cli_commands::{
8 compact_types,
9 test_vectors::{
10 compact,
11 compact::{
12 generate_vector, read_vector, GENERATE_VECTORS as ETH_GENERATE_VECTORS,
13 READ_VECTORS as ETH_READ_VECTORS,
14 },
15 tables,
16 },
17};
18use std::sync::Arc;
19
20#[derive(Debug, Parser)]
22pub struct Command {
23 #[command(subcommand)]
24 command: Subcommands,
25}
26
27#[derive(Subcommand, Debug)]
28pub enum Subcommands {
30 Tables {
32 names: Vec<String>,
34 },
35 #[group(multiple = false, required = true)]
38 Compact {
39 #[arg(long)]
41 write: bool,
42
43 #[arg(long)]
45 read: bool,
46 },
47}
48
49impl Command {
50 pub async fn execute(self) -> eyre::Result<()> {
52 match self.command {
53 Subcommands::Tables { names } => {
54 tables::generate_vectors(names)?;
55 }
56 Subcommands::Compact { write, .. } => {
57 compact_types!(
58 regular: [
59 TxDeposit
60 ], identifier: []
61 );
62
63 if write {
64 compact::generate_vectors_with(ETH_GENERATE_VECTORS)?;
65 compact::generate_vectors_with(GENERATE_VECTORS)?;
66 } else {
67 compact::read_vectors_with(ETH_READ_VECTORS)?;
68 compact::read_vectors_with(READ_VECTORS)?;
69 }
70 }
71 }
72 Ok(())
73 }
74 pub const fn chain_spec(&self) -> Option<&Arc<ChainSpec>> {
76 None
77 }
78}