-
Notifications
You must be signed in to change notification settings - Fork 87
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 block_transaction_size_limit
to ConsensusParameters
#821
Conversation
…onsensus_parameter
#[cfg(feature = "test-helpers")] | ||
/// Constructor for the `ConsensusParameters` with Standard values. | ||
pub fn standard_v2() -> Self { | ||
ConsensusParametersV2::standard().into() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just use only standard
=)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in a1ddd07
@@ -273,6 +332,63 @@ impl From<ConsensusParametersV1> for ConsensusParameters { | |||
} | |||
} | |||
|
|||
/// A collection of parameters for convenience |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to mention what is the difference between V1 and V2 here=) You can check how we do it for GasCosts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update in 65087ba
…or and use V2 by default
Co-authored-by: Green Baneling <XgreenX9999@gmail.com>
…meter' into 2133_block_size_consensus_parameter
Self::V1(params) => params | ||
.block_gas_limit | ||
.checked_div(self.fee_params().gas_per_byte()) | ||
.unwrap_or(Self::DEFAULT_BLOCK_TRANSACTION_SIZE_LIMIT), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After thinking a little bit more about it, I think we need to return u64::MAX
for backward compatibility reasons. Because in the past it was not limited
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in 7b8c998
pub gas_costs: GasCosts, | ||
pub base_asset_id: AssetId, | ||
pub block_gas_limit: u64, | ||
pub block_transaction_size_limit: u64, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not related to this PR only, but in general I think we should strive to have as much documentation as possible, including individual fields of structs.
For example in this case it is not 100% clear if block_transaction_size_limit
refers to the number of transactions in a block, or the number of bytes in a transaction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we could enforce this with missing_docs
lint, but it'll cause a swarm of warnings.
Also, I see an indication that it is already on our radar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, a test which asserts SettingBlockTransactionSizeLimitNotSupported
is thrown would be nice :)
…imit for legacy (V1) consensus parameters
Test added in d07fbc3 |
Checked the code again, LGTM. |
Partial implementation of #2133. ## Linked Issues/PRs (FuelLabs/fuel-vm#821) ## Description It adds handling for the updated data struct `ConsensusParameters` (new field: `block_transaction_size_limit`). No additional logic around this new parameter is implemented in this PR, it's just a stub for further work. The new parameter is exposed via GraphQL, example: Request snippet: ```graphql consensusParameters(version: 0) { blockGasLimit blockTransactionSizeLimit } ``` Response snippet: ```json "consensusParameters": { "blockGasLimit": "30000000", "blockTransactionSizeLimit": "129024" } ``` ## Checklist - [ ] Breaking changes are clearly marked as such in the PR description and changelog - [ ] New behavior is reflected in tests - [ ] [The specification](https://github.com/FuelLabs/fuel-specs/) matches the implemented behavior (link update PR if changes are needed) ### Before requesting review - [ ] I have reviewed the code myself - [ ] I have created follow-up issues caused by this PR and linked them here ### After merging, notify other teams [Add or remove entries as needed] - [ ] [Rust SDK](https://github.com/FuelLabs/fuels-rs/) - [ ] [Sway compiler](https://github.com/FuelLabs/sway/) - [ ] [Platform documentation](https://github.com/FuelLabs/devrel-requests/issues/new?assignees=&labels=new+request&projects=&template=NEW-REQUEST.yml&title=%5BRequest%5D%3A+) (for out-of-organization contributors, the person merging the PR will do this) - [ ] Someone else? --------- Co-authored-by: green <xgreenx9999@gmail.com> Co-authored-by: Hannes Karppila <2204863+Dentosal@users.noreply.github.com>
Partial implementation of FuelLabs/fuel-core#2133.
This PR adds a new version (
V2
) of theConsensusParameters
which includes theblock_transaction_size_limit
parameter.Linked Issues/PRs
FuelLabs/fuel-core#2188
Checklist
Before requesting review
After merging, notify other teams
[Add or remove entries as needed]