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

cli: Warn on sizes above 10MB during solana rent #922

Merged
merged 2 commits into from
Apr 22, 2024

Conversation

kubanemil
Copy link

Problem

The CLI command $ solana rent <DATA_LENGTH_OR_MONIKER> calculates the rent even if DATA_LENGTH is greater than 10 MB - which is the maximum size for a single account. The CLI tool should give a warning to avoid misleading the user.

Summary of Changes

Added the check for it.

@mergify mergify bot requested a review from a team April 19, 2024 17:06
Copy link

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

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

Can we make this a warning instead, as the description states?

cli/src/cluster_query.rs Outdated Show resolved Hide resolved
Copy link

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution! Just a couple of extra suggestions to make this as useful as possible.

@@ -2181,6 +2181,9 @@ pub fn process_calculate_rent(
data_length: usize,
use_lamports_unit: bool,
) -> ProcessResult {
if data_length > 10_000_000 {

Choose a reason for hiding this comment

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

Can you use

pub const MAX_PERMITTED_DATA_LENGTH: u64 = 10 * 1024 * 1024;
instead of this value?

cli/src/cluster_query.rs Outdated Show resolved Hide resolved
@kubanemil kubanemil requested a review from joncinque April 20, 2024 03:42
@joncinque joncinque added the CI Pull Request is ready to enter CI label Apr 22, 2024
@anza-team anza-team removed the CI Pull Request is ready to enter CI label Apr 22, 2024
@codecov-commenter
Copy link

Codecov Report

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

Project coverage is 81.9%. Comparing base (6aacbf3) to head (608e9b6).
Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master     #922     +/-   ##
=========================================
- Coverage    81.9%    81.9%   -0.1%     
=========================================
  Files         853      853             
  Lines      231812   231814      +2     
=========================================
  Hits       189867   189867             
- Misses      41945    41947      +2     

Copy link

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

@joncinque joncinque changed the title Putting a Limit on Size when calculating a rent cli: Warn on sizes above 10MB during solana rent Apr 22, 2024
@joncinque joncinque merged commit 06dc262 into anza-xyz:master Apr 22, 2024
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants