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(proposal_cli): FI-1571: Do not write the args.hex file from proposal-cli #2460

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions rs/cross-chain/proposal-cli/src/candid/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ impl UpgradeArgs {
&self.encoded_upgrade_args
}

pub fn upgrade_args_hex(&self) -> String {
hex::encode(&self.encoded_upgrade_args)
}

pub fn args_sha256_hex(&self) -> String {
self.args_sha256.to_string()
}
Expand Down
4 changes: 2 additions & 2 deletions rs/cross-chain/proposal-cli/src/candid/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn should_encode_default_upgrade_args() {
let upgrade_args = encode_upgrade_args(&path, canister.default_upgrade_args());

assert_eq!(
upgrade_args.upgrade_args_hex(),
hex::encode(upgrade_args.upgrade_args_bin()),
expected,
"failed to encode default upgrade args for: {:?}",
canister
Expand All @@ -29,7 +29,7 @@ fn should_encode_non_empty_ledger_upgrade_args() {

let upgrade_args = encode_upgrade_args(&path, "(variant {Upgrade})");

assert_matches!(upgrade_args.upgrade_args_hex(), _string);
assert!(hex::encode(upgrade_args.upgrade_args_bin()).starts_with("4449444c"));
}

#[test]
Expand Down
9 changes: 0 additions & 9 deletions rs/cross-chain/proposal-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,6 @@ fn write_to_disk<P: Into<ProposalTemplate>>(
bin_args_file_path.display()
);

let hex_args_file_path = output_dir.join("args.hex");
let mut args_file = fs::File::create(&hex_args_file_path)
.unwrap_or_else(|_| panic!("failed to create {:?}", hex_args_file_path));
proposal.write_hex_args(&mut args_file);
println!(
"Hexadecimal upgrade args written to '{}'",
hex_args_file_path.display()
);

let artifact = output_dir.join(proposal.target_canister().artifact_file_name());
ic_repo.copy_file(&proposal.target_canister().artifact(), &artifact);
println!("Artifact written to '{}'", artifact.display());
Expand Down
10 changes: 0 additions & 10 deletions rs/cross-chain/proposal-cli/src/proposal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,6 @@ impl ProposalTemplate {
.expect("failed to write binary args");
}

pub fn write_hex_args<W: Write>(&self, writer: &mut W) {
let hex_args = match self {
ProposalTemplate::Upgrade(template) => template.upgrade_args.upgrade_args_hex(),
ProposalTemplate::Install(template) => template.install_args.upgrade_args_hex(),
};
writer
.write_all(hex_args.as_bytes())
.expect("failed to write hex args");
}

pub fn args_sha256_hex(&self) -> String {
match self {
ProposalTemplate::Upgrade(template) => template.upgrade_args.args_sha256_hex(),
Expand Down