Skip to content

Commit

Permalink
Merge branch 'main' into upgrade-enum
Browse files Browse the repository at this point in the history
  • Loading branch information
Larkooo authored Feb 3, 2025
2 parents 46f028d + d250797 commit 6d5ec11
Show file tree
Hide file tree
Showing 32 changed files with 697 additions and 563 deletions.
163 changes: 61 additions & 102 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 24 additions & 5 deletions bin/katana/src/cli/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,39 @@ use anyhow::Result;
use clap::Args;
use katana_chain_spec::rollup::file::ChainConfigDir;
use katana_primitives::chain::ChainId;
use starknet::core::utils::parse_cairo_short_string;

#[derive(Debug, Args)]
pub struct ConfigArgs {
/// The chain id.
#[arg(value_parser = ChainId::parse)]
chain: ChainId,
chain: Option<ChainId>,
}

impl ConfigArgs {
pub fn execute(self) -> Result<()> {
let cs = ChainConfigDir::open(&self.chain)?;
let path = cs.config_path();
let config = std::fs::read_to_string(&path)?;
println!("File: {}\n\n{config}", path.display());
match self.chain {
Some(chain) => {
let cs = ChainConfigDir::open(&chain)?;
let path = cs.config_path();
let config = std::fs::read_to_string(&path)?;
println!("File: {}\n\n{config}", path.display());
}

None => {
let chains = katana_chain_spec::rollup::file::list()?;
for chain in chains {
// TODO:
// We can't just assume that the id is a valid (and readable) ascii string
// as we don' yet handle that elegently in the `ChainId` type itself. The ids
// returned by `list` will be of the `ChainId::Id` variant and thus
// will display in hex form. But for now, it's fine to assume that because we
// only limit valid ASCII string in the `katana init` flow.
let name = parse_cairo_short_string(&chain.id())?;
println!("{name}");
}
}
}
Ok(())
}
}
2 changes: 1 addition & 1 deletion crates/katana/cairo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ cairo-lang-starknet = "2.7.0"
cairo-lang-starknet-classes = "2.7.0"
cairo-lang-utils = "2.7.0"
cairo-vm = "1.0.1"
starknet_api = { git = "https://github.com/dojoengine/sequencer", rev = "802c5dc" }
starknet_api = { git = "https://github.com/dojoengine/sequencer", rev = "adae779" }

[features]
# Some types that we used from cairo-vm implements the `Arbitrary` trait,
Expand Down
Loading

0 comments on commit 6d5ec11

Please sign in to comment.