Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduced by-name deployment and declare-deploy command #2331

Open
wants to merge 39 commits into
base: master
Choose a base branch
from

Conversation

integraledelebesgue
Copy link
Member

@integraledelebesgue integraledelebesgue commented Jul 24, 2024

Closes #2279

Introduced changes

  • sncast deploy now allows to deploy a contract by its name instead of class hash;
    --contract-name and --class-hash arguments are mutually exclusive
  • Added a new command - declare-deploy, used to quickly combine declaration with deployment
  • Command handlers build contract artifacts:
    • declare, declare-deploy - always
    • deploy - when depolying by name

Checklist

  • Linked relevant issue
  • Updated relevant documentation
  • Added relevant tests
  • Performed self-review of the code
  • Added changes to CHANGELOG.md

@integraledelebesgue integraledelebesgue linked an issue Jul 24, 2024 that may be closed by this pull request
@integraledelebesgue integraledelebesgue marked this pull request as ready for review July 29, 2024 08:59
@integraledelebesgue integraledelebesgue requested review from Arcticae and removed request for Arcticae July 29, 2024 09:00
@Arcticae Arcticae requested a review from cptartur July 30, 2024 14:38
docs/src/starknet/deploy.md Outdated Show resolved Hide resolved
crates/sncast/src/starknet_commands/deploy.rs Outdated Show resolved Hide resolved
crates/sncast/src/starknet_commands/deploy.rs Outdated Show resolved Hide resolved
crates/sncast/src/starknet_commands/declare.rs Outdated Show resolved Hide resolved
crates/sncast/src/helpers/scarb_utils.rs Outdated Show resolved Hide resolved
crates/sncast/src/helpers/scarb_utils.rs Outdated Show resolved Hide resolved
crates/sncast/src/helpers/scarb_utils.rs Outdated Show resolved Hide resolved
crates/sncast/src/starknet_commands/declare.rs Outdated Show resolved Hide resolved
crates/sncast/src/starknet_commands/deploy.rs Outdated Show resolved Hide resolved
crates/sncast/tests/e2e/deploy.rs Outdated Show resolved Hide resolved
docs/src/appendix/sncast/deploy.md Show resolved Hide resolved
Comment on lines 225 to 240
let deploy: DeployResolved = if deploy.class_hash.is_some() {
deploy.try_into().unwrap()
} else {
let contract =
deploy.build_artifacts_and_get_compiled_contract(cli.json, &cli.profile)?;
let class_hash = contract.sierra_class_hash;

if !contract.is_declared(&provider).await? {
bail!("Contract with class hash {:x} is not declared", class_hash);
}

deploy.resolved_with_class_hash(class_hash)
};

deploy.validate()?;

Copy link
Member

Choose a reason for hiding this comment

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

So now we will explicitly fail if user tries to deploy contract that wasn't declared? What was the previous behavior. This might be worth including in a changelog if this behavior changed.

Copy link
Collaborator

@franciszekjob franciszekjob Dec 20, 2024

Choose a reason for hiding this comment

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

No, the behavior remains the same, e.g. running

sncast -a my_account deploy --class-hash 0x123 --fee-token strk --url http://127.0.0.1:5050

will produce

Error: An error occurred in the called contract = ContractErrorData { revert_error: "Class with hash 0x123 is not declared" }

which is same as current behavior.

crates/sncast/src/main.rs Show resolved Hide resolved
crates/sncast/src/starknet_commands/declare_deploy.rs Outdated Show resolved Hide resolved
crates/sncast/src/starknet_commands/deploy.rs Outdated Show resolved Hide resolved
crates/sncast/tests/e2e/declare_deploy.rs Show resolved Hide resolved
docs/src/starknet/declare-deploy.md Outdated Show resolved Hide resolved
docs/src/starknet/declare-deploy.md Outdated Show resolved Hide resolved
docs/src/starknet/declare-deploy.md Outdated Show resolved Hide resolved
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.

Deploy contract by name
6 participants