Skip to content

Commit c1fd9f0

Browse files
authored
feat(bin): restructure init command with explicit rollup/sovereign modes (#280)
Refactor `katana init` command to use explicit subcommands for rollup and sovereign chain modes. Now running `katana init` requires you to select the mode as a subcommand: `katana init rollup` or `katana init sovereign`. One of the reason why we made this change is because the CLI argument configurations will always require you to provide the arguments instead of falling back to prompting. The expected behaviour when you literally just run `katana init` is for it to prompt the arguments like so: <img width="411" height="51" alt="Screenshot 2025-09-23 at 10 03 49 AM" src="https://github.com/user-attachments/assets/e910a787-e412-4c61-b519-ea574d689382" /> But due to how the CLI arguments is being configured, we instead get an error for not providing the arguments using flags: <img width="1030" height="149" alt="Screenshot 2025-09-23 at 10 04 05 AM" src="https://github.com/user-attachments/assets/d5ab9ab6-ecb3-43f7-bd80-e4b9b646edfc" /> This is mainly because of the `#[arg(required_unless_present = "sovereign")]` tag we're using that forces us to provide the options if `--sovereign` is not present. https://github.com/dojoengine/katana/blob/d584d4224f75f3648d55d1e4cec773ed638967ff/bin/katana/src/cli/init/mod.rs#L44-L48 Afaik it doesn't seem to be possible to 'fix' this using `clap` derive macro. Even if it does, I believe separating the mode into separate commands feels like a better UX. ## Comparison with current behaviour - Current: `katana init --id my-chain --settlement-chain sepolia ...` - New: `katana init rollup --id my-chain --settlement-chain sepolia ...`
1 parent 291c572 commit c1fd9f0

File tree

5 files changed

+320
-150
lines changed

5 files changed

+320
-150
lines changed

bin/katana/src/cli/init/deployment.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ pub async fn deploy_settlement_contract(
234234
// FINAL CHECKS
235235
// -----------------------------------------------------------------------
236236

237-
check_program_info(chain_id, deployed_appchain_contract, account.provider()).await?;
237+
check_program_info(chain_id, deployed_appchain_contract.into(), account.provider()).await?;
238238

239239
Ok(DeploymentOutcome {
240240
block_number: deployment_block,
@@ -262,10 +262,10 @@ pub async fn deploy_settlement_contract(
262262
/// * Layout bridge program hash
263263
pub async fn check_program_info(
264264
chain_id: Felt,
265-
appchain_address: Felt,
265+
appchain_address: ContractAddress,
266266
provider: &SettlementChainProvider,
267267
) -> Result<(), ContractInitError> {
268-
let appchain = AppchainContractReader::new(appchain_address, provider);
268+
let appchain = AppchainContractReader::new(appchain_address.into(), provider);
269269

270270
// Compute the chain's config hash
271271
let config_hash = compute_config_hash(

0 commit comments

Comments
 (0)