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

Add get-recent-prioritization-fees command to cli #805

Merged

Conversation

sakridge
Copy link

@sakridge sakridge commented Apr 15, 2024

Problem

No method to get recent prioritization fees in the CLI

Summary of Changes

Add a command

Fixes #

@codecov-commenter
Copy link

codecov-commenter commented Apr 15, 2024

Codecov Report

Attention: Patch coverage is 13.55932% with 51 lines in your changes are missing coverage. Please review.

Project coverage is 81.9%. Comparing base (e7452b7) to head (afeee2a).
Report is 14 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master     #805     +/-   ##
=========================================
- Coverage    82.0%    81.9%   -0.1%     
=========================================
  Files         859      859             
  Lines      232906   232965     +59     
=========================================
- Hits       191079   191028     -51     
- Misses      41827    41937    +110     

@sakridge sakridge force-pushed the get-recent-prioritization-fee-cli branch 2 times, most recently from 0887bd8 to d6b652b Compare April 19, 2024 08:44
@sakridge sakridge marked this pull request as ready for review April 19, 2024 08:45
Copy link

@tao-stones tao-stones left a comment

Choose a reason for hiding this comment

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

We might need to reconsider how we present RPC call results to the user

cli/src/cluster_query.rs Outdated Show resolved Hide resolved
cli/src/cluster_query.rs Outdated Show resolved Hide resolved
@sakridge sakridge force-pushed the get-recent-prioritization-fee-cli branch from d6b652b to 9ad59fb Compare April 22, 2024 01:33
@sakridge sakridge requested a review from tao-stones April 22, 2024 01:34
@sakridge sakridge force-pushed the get-recent-prioritization-fee-cli branch from 9ad59fb to b0e3eaa Compare April 22, 2024 02:54
cli/src/cluster_query.rs Outdated Show resolved Hide resolved
cli/src/cluster_query.rs Outdated Show resolved Hide resolved
cli/src/cluster_query.rs Outdated Show resolved Hide resolved
@sakridge sakridge force-pushed the get-recent-prioritization-fee-cli branch from b0e3eaa to d4ad745 Compare April 22, 2024 15:55
@sakridge sakridge force-pushed the get-recent-prioritization-fee-cli branch 2 times, most recently from 87cb300 to 1754296 Compare April 22, 2024 17:05
tao-stones
tao-stones previously approved these changes Apr 22, 2024
Copy link

@tao-stones tao-stones left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link

@CriesofCarrots CriesofCarrots left a comment

Choose a reason for hiding this comment

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

I haven't looked at the math here yet, but building a String to return with if verbose cases doesn't feel great to me, since we already have solana-cli-output handling for regular, quiet, and verbose displays. Can you please put the data in a display struct instead? That will also provide JSON output support by default, which I'm sure people are going to want for this subcommand.

@sakridge sakridge force-pushed the get-recent-prioritization-fee-cli branch 2 times, most recently from c7c7b11 to e2e3caa Compare April 24, 2024 17:16
@sakridge
Copy link
Author

I haven't looked at the math here yet, but building a String to return with if verbose cases doesn't feel great to me, since we already have solana-cli-output handling for regular, quiet, and verbose displays. Can you please put the data in a display struct instead? That will also provide JSON output support by default, which I'm sure people are going to want for this subcommand.

Ok, it should support JSON now with cli-output, please check my work.

@sakridge sakridge force-pushed the get-recent-prioritization-fee-cli branch from e2e3caa to 72b0480 Compare April 24, 2024 17:40
tao-stones
tao-stones previously approved these changes Apr 25, 2024
Copy link

@tao-stones tao-stones left a comment

Choose a reason for hiding this comment

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

lgtm, pending @CriesofCarrots

cli/src/cluster_query.rs Outdated Show resolved Hide resolved
cli/src/cluster_query.rs Show resolved Hide resolved
cli/src/cluster_query.rs Outdated Show resolved Hide resolved
Comment on lines +1089 to +1095
.unwrap_or(fees.len() as u64)
.min(fees.len() as u64)
.max(1) as usize;

Choose a reason for hiding this comment

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

this can all be enforced with clap, which hands the user nice guidance instead of doing things silently behind their back

Copy link
Author

Choose a reason for hiding this comment

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

I have to parse again in an .validator() right? kind of annoying to do, but not perf sensitive and gives better feedback. It's just for the 0 case.

Choose a reason for hiding this comment

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

I have to parse again in an .validator() right?

Yeah. And it is kind of annoying 😅 Honestly, if someone is foolish enough to pass --limit-num-slots 0, I'm okay with just returning empty/default data. But Trent may feel differently

Copy link

@CriesofCarrots CriesofCarrots left a comment

Choose a reason for hiding this comment

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

Math/logic looks good. Just a couple more suggestions on using cli-output, plus Trent's clap suggestions.

cli-output/src/cli_output.rs Outdated Show resolved Hide resolved
cli-output/src/cli_output.rs Outdated Show resolved Hide resolved
writeln!(f, "{:<11} {}", self.slot, self.prioritization_fee)?;
Ok(())

Choose a reason for hiding this comment

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

Suggested change
writeln!(f, "{:<11} {}", self.slot, self.prioritization_fee)?;
Ok(())
writeln!(f, "{:<11} {}", self.slot, self.prioritization_fee)

nit: just a little more concise

Copy link
Author

Choose a reason for hiding this comment

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

changed

Copy link

@CriesofCarrots CriesofCarrots Apr 25, 2024

Choose a reason for hiding this comment

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

I don't see this change (nit)

cli/src/cluster_query.rs Outdated Show resolved Hide resolved
@sakridge sakridge force-pushed the get-recent-prioritization-fee-cli branch 2 times, most recently from 098c727 to 1993ff0 Compare April 25, 2024 18:27
@CriesofCarrots CriesofCarrots dismissed their stale review April 25, 2024 21:42

changes have been made

@sakridge sakridge force-pushed the get-recent-prioritization-fee-cli branch from 1993ff0 to d7903dd Compare April 26, 2024 01:46
@sakridge sakridge force-pushed the get-recent-prioritization-fee-cli branch from d7903dd to afeee2a Compare April 26, 2024 01:47
Copy link

@CriesofCarrots CriesofCarrots left a comment

Choose a reason for hiding this comment

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

Wfm, but happy to restamp if you add the clap validator

@sakridge sakridge merged commit e2f361e into anza-xyz:master Apr 30, 2024
38 checks passed
@sakridge sakridge deleted the get-recent-prioritization-fee-cli branch April 30, 2024 15:56
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.

5 participants