Skip to content

Conversation

cptartur
Copy link
Member

@cptartur cptartur commented Oct 3, 2025

@cptartur cptartur marked this pull request as ready for review October 3, 2025 10:54
@cptartur cptartur requested a review from a team as a code owner October 3, 2025 10:54
@cptartur cptartur requested review from ddoktorski and franciszekjob and removed request for a team October 3, 2025 10:54
@cptartur cptartur force-pushed the spr/master/82e786a7 branch 2 times, most recently from ac92c0d to 48c85d9 Compare October 3, 2025 14:23
@cptartur cptartur force-pushed the spr/master/94945a36 branch from 899b363 to a9c96f6 Compare October 3, 2025 14:23
@cptartur cptartur force-pushed the spr/master/82e786a7 branch from 48c85d9 to 859e21b Compare October 6, 2025 11:43
@cptartur cptartur force-pushed the spr/master/94945a36 branch from a9c96f6 to 41b8753 Compare October 6, 2025 11:43
@cptartur cptartur requested a review from franciszekjob October 6, 2025 11:46
@cptartur cptartur force-pushed the spr/master/94945a36 branch from 41b8753 to 39b967c Compare October 6, 2025 13:14
@cptartur cptartur force-pushed the spr/master/82e786a7 branch 2 times, most recently from 28cef8c to b764071 Compare October 6, 2025 13:29
Copy link
Contributor

@franciszekjob franciszekjob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wdyt about mentioning this in sncast 101?

@cptartur cptartur force-pushed the spr/master/82e786a7 branch from b764071 to 96a6140 Compare October 6, 2025 14:47
@cptartur cptartur force-pushed the spr/master/94945a36 branch from 39b967c to 0b18bd5 Compare October 6, 2025 14:47
@cptartur cptartur force-pushed the spr/master/82e786a7 branch from 96a6140 to 24199f7 Compare October 7, 2025 12:52
@cptartur cptartur force-pushed the spr/master/94945a36 branch from 0b18bd5 to 04e89a1 Compare October 7, 2025 12:52
@cptartur cptartur requested a review from franciszekjob October 7, 2025 12:52
commit-id:82e786a7

# Conflicts:
#	crates/sncast/src/main.rs
@cptartur cptartur force-pushed the spr/master/94945a36 branch from 04e89a1 to 5ea3fa5 Compare October 7, 2025 14:39
@cptartur cptartur force-pushed the spr/master/82e786a7 branch from 24199f7 to aaa6e8d Compare October 7, 2025 14:39
@cptartur cptartur linked an issue Oct 7, 2025 that may be closed by this pull request
Comment on lines +122 to +126
To see deployment details, visit:
contract: [..]
class: [..]
declare transaction: [..]
deploy transaction: [..]
Copy link
Contributor

@franciszekjob franciszekjob Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm a bit too picky, but after deployment details we have link to declare transaction. Maybe it can be moved above/separated?

Comment on lines +17 to +18
Deploy(StandardDeployResponse),
DeployWithDeclare(DeployResponseWithDeclare),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
Deploy(StandardDeployResponse),
DeployWithDeclare(DeployResponseWithDeclare),
Standard(StandardDeployResponse),
WithDeclare(DeployResponseWithDeclare),

}
}
} else {
unreachable!("One of class_hash or contract_name must be provided");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
unreachable!("One of class_hash or contract_name must be provided");
unreachable!("One of `--class-hash` or `--contract-name` must be provided");

Comment on lines +20 to +31
#[derive(Args, Debug, Clone)]
#[group(required = true, multiple = false)]
pub struct ContractIdentifier {
/// Class hash of contract to deploy
#[arg(short = 'g', long)]
pub class_hash: Option<Felt>,

/// Contract name
#[arg(long, conflicts_with = "class_hash")]
pub contract_name: Option<String>,
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Usage of id and group seems suitable here:

Suggested change
#[derive(Args, Debug, Clone)]
#[group(required = true, multiple = false)]
pub struct ContractIdentifier {
/// Class hash of contract to deploy
#[arg(short = 'g', long)]
pub class_hash: Option<Felt>,
/// Contract name
#[arg(long, conflicts_with = "class_hash")]
pub contract_name: Option<String>,
}
#[derive(Args, Debug, Clone)]
#[group(id = "contract_identifier", required = true, multiple = false)]
pub struct ContractIdentifier {
/// Class hash of contract to deploy
#[arg(short = 'g', long, group = "contract_identifier")]
pub class_hash: Option<Felt>,
/// Contract name
#[arg(long, group = "contract_identifier")]
pub contract_name: Option<String>,
}

(class_hash, None)
} else if let Some(contract_name) = identifier.contract_name {
let manifest_path = assert_manifest_path_exists()?;
let package_metadata = get_package_metadata(&manifest_path, &None)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this feature work for workspaces?

WaitForTx {
wait: true,
wait_params: wait_config.wait_params,
show_ui_outputs: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if someone passes the --wait flag?

}

#[tokio::test]
async fn test_deploy_with_declare_nonexistent_contract() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the rationale behind this test given that its name refers to nonexistent_contract, but the asserted error is Invalid transaction nonce?

> The contract might wait for a few seconds before executing the deployment.
> 📝 **Note**
> If fee arguments are provided to the method, they will be shared between declare and deploy transactions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might suggest that the provided fee will will try to cover both transactions, which is not the case. I think it should be rephrased to clarify that the same fee arguments are used separately for each transaction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement declare-deploy command in cast
3 participants