-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Block producer selects da height to never exceed u64::MAX - 1 transactions from L1 #2189
Changes from 3 commits
ad1d2b1
4c527aa
87efdde
cec811a
f355d25
5b48295
6b5008d
f45d770
ca016df
4a5c9e9
03f4160
7949399
9a91abe
3252f59
7767d32
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -352,8 +352,10 @@ where | |
.consensus_parameters_provider | ||
.consensus_params_at_version(&block_header.consensus_parameters_version)? | ||
.block_gas_limit(); | ||
// We have a hard limit of u16::MAX transactions per block, including the final mint transactions. | ||
// Therefore we choose the `new_da_height` to never include more than u16::MAX - 1 transactions in a block. | ||
let new_da_height = self | ||
.select_new_da_height(gas_limit, previous_da_height) | ||
.select_new_da_height(gas_limit, previous_da_height, u16::MAX - 1) | ||
xgreenx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.await?; | ||
|
||
block_header.application.da_height = new_da_height; | ||
|
@@ -375,9 +377,12 @@ where | |
&self, | ||
gas_limit: u64, | ||
previous_da_height: DaBlockHeight, | ||
transactions_limit: u16, | ||
rafal-ch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
) -> anyhow::Result<DaBlockHeight> { | ||
let mut new_best = previous_da_height; | ||
let mut total_cost: u64 = 0; | ||
let transactions_limit: u64 = transactions_limit as u64; | ||
let mut total_transactions: u64 = 0; | ||
let highest = self | ||
.relayer | ||
.wait_for_at_least_height(&previous_da_height) | ||
|
@@ -404,7 +409,17 @@ where | |
if total_cost > gas_limit { | ||
break; | ||
} else { | ||
new_best = DaBlockHeight(height); | ||
let transactions_number = self | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, I have changed it in 5b48295 and changed all the adapters implementations accordingly |
||
.relayer | ||
.get_transactions_number_for_block(&DaBlockHeight(height)) | ||
.await?; | ||
total_transactions = | ||
total_transactions.saturating_add(transactions_number); | ||
if total_transactions > transactions_limit { | ||
break; | ||
} else { | ||
new_best = DaBlockHeight(height); | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like we can simplify it to be
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, simplified it a bit more in 6b5008d |
||
} | ||
if new_best == previous_da_height { | ||
|
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 need to move this into
unreleased
section because of release=)