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

feat: anchor upgrade with additional solana args #2998

Merged
merged 4 commits into from
Jun 3, 2024

Conversation

tiamo
Copy link
Contributor

@tiamo tiamo commented May 31, 2024

Use anchor upgrade with additional solana arguments, for example:

anchor upgrade ... -- --max-sign-attempts 1000 --with-compute-unit-price 1000000

Copy link

vercel bot commented May 31, 2024

@tiamo is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

@dhruvja
Copy link

dhruvja commented May 31, 2024

can we have this for other commands like idl init and deploy too?

@tiamo
Copy link
Contributor Author

tiamo commented May 31, 2024

can we have this for other commands like idl init and deploy too?

The deploy command already has this, idl init does not need this, as I see

@acheroncrypto acheroncrypto added cli enhancement New feature or request labels May 31, 2024
Copy link
Collaborator

@acheroncrypto acheroncrypto left a comment

Choose a reason for hiding this comment

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

Thanks, but are you using this command only to upgrade your program?

anchor/cli/src/lib.rs

Lines 269 to 271 in 5601702

/// Deploys, initializes an IDL, and migrates all in one command.
/// Upgrades a single program. The configured wallet must be the upgrade
/// authority.

Not sure what happened but this command basically only does the deployment part, and doesn't seem upgrade the IDL and run the migration script:

anchor/cli/src/lib.rs

Lines 3697 to 3727 in 5601702

fn upgrade(
cfg_override: &ConfigOverride,
program_id: Pubkey,
program_filepath: String,
) -> Result<()> {
let path: PathBuf = program_filepath.parse().unwrap();
let program_filepath = path.canonicalize()?.display().to_string();
with_workspace(cfg_override, |cfg| {
let url = cluster_url(cfg, &cfg.test_validator);
let exit = std::process::Command::new("solana")
.arg("program")
.arg("deploy")
.arg("--url")
.arg(url)
.arg("--keypair")
.arg(&cfg.provider.wallet.to_string())
.arg("--program-id")
.arg(strip_workspace_prefix(program_id.to_string()))
.arg(strip_workspace_prefix(program_filepath))
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.output()
.expect("Must deploy");
if !exit.status.success() {
println!("There was a problem deploying: {exit:?}.");
std::process::exit(exit.status.code().unwrap_or(1));
}
Ok(())
})
}

So running regular anchor deploy would achieve the same thing currently.

That being said, I don't see a problem getting this in. Could you note this feature in the CHANGELOG?

@tiamo
Copy link
Contributor Author

tiamo commented Jun 1, 2024

@acheroncrypto Thanks! It makes sense to use the deploy command for upgrade. The CHANGELOG has been updated.

@tiamo tiamo requested a review from acheroncrypto June 1, 2024 07:39
Copy link
Collaborator

@acheroncrypto acheroncrypto left a comment

Choose a reason for hiding this comment

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

There is a small formatting error in CI: https://github.com/coral-xyz/anchor/actions/runs/9328631270/job/25707143836?pr=2998

Could you run cargo fmt?

@acheroncrypto
Copy link
Collaborator

@tiamo tiamo requested a review from acheroncrypto June 3, 2024 07:44
Copy link
Collaborator

@acheroncrypto acheroncrypto left a comment

Choose a reason for hiding this comment

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

Thank you!

@acheroncrypto acheroncrypto merged commit 801b32a into coral-xyz:master Jun 3, 2024
48 of 49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants