Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

log signature after successful feature activation #33488

Merged
merged 2 commits into from
Oct 6, 2023

Conversation

apfitzge
Copy link
Contributor

@apfitzge apfitzge commented Oct 2, 2023

Problem

When activating a feature the transaction Signature is not logged in the final result.
It is only logged temporarily in the progress bar during during transaction finalization.
If it activates quickly, The user misses the signature and has to find it manually.

Summary of Changes

Return the signature in the ProcessResult which is used to print final results.

Fixes #

@apfitzge
Copy link
Contributor Author

apfitzge commented Oct 2, 2023

Example of recent feature activation on testnet:
image

That trailing blank line is because the previous result was returning "".to_string().
With this change, the blank line would be filled with Signature: ...

@codecov
Copy link

codecov bot commented Oct 2, 2023

Codecov Report

Merging #33488 (3a59417) into master (660e41a) will increase coverage by 0.0%.
Report is 36 commits behind head on master.
The diff coverage is 0.0%.

@@           Coverage Diff           @@
##           master   #33488   +/-   ##
=======================================
  Coverage    81.7%    81.7%           
=======================================
  Files         802      802           
  Lines      217786   217786           
=======================================
+ Hits       178082   178093   +11     
+ Misses      39704    39693   -11     

@apfitzge apfitzge marked this pull request as ready for review October 2, 2023 19:53
@apfitzge apfitzge requested a review from brooksprumo October 4, 2023 16:09
Copy link
Contributor

@brooksprumo brooksprumo left a comment

Choose a reason for hiding this comment

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

Looks good to me. I'm going to add @CriesofCarrots as a reviewer to ensure someone that knows the whole CLI stuffs take a look for correctness/consistency/UX.

Comment on lines 960 to 961
let signature = rpc_client.send_and_confirm_transaction_with_spinner(&transaction)?;
Ok(format!("Signature: {signature}"))
Copy link
Contributor

Choose a reason for hiding this comment

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

There are actually a couple options here that would be more consistent with other parts of solana-cli, and automatically support --output json:

Suggested change
let signature = rpc_client.send_and_confirm_transaction_with_spinner(&transaction)?;
Ok(format!("Signature: {signature}"))
let signature = rpc_client.send_and_confirm_transaction_with_spinner(&transaction)?;
let signature = CliSignature {
signature: signature.to_string(),
};
Ok(config.output_format.formatted_string(&signature))

This is also an option, and is cool because it adds nice parsing for instruction errors, but will need to be rewritten in the near future when we start using a bpf program for feature gate activations:

Suggested change
let signature = rpc_client.send_and_confirm_transaction_with_spinner(&transaction)?;
Ok(format!("Signature: {signature}"))
let result = rpc_client.send_and_confirm_transaction_with_spinner(&transaction);
log_instruction_custom_error::<SystemError>(result, config)

(PS. I've never tried putting two suggestions in one comment before. Hopefully it Just Works ™️ )

@apfitzge apfitzge merged commit 973df82 into solana-labs:master Oct 6, 2023
@apfitzge apfitzge deleted the feature_activiation_signature branch October 6, 2023 16:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants