Skip to content
Business logic Audit finding Beginner

BLOCK_PERIOD is incorrect

A constant defining the assumed Ethereum block period was set to 13 seconds instead of the post-Merge 12 seconds, so the priority queue expiration window was computed as roughly 5.5 hours shorter than intended. Transactions in the priority queue would therefore be treated as expired earlier than the design intended.

Soosh Follow

Originally disclosed on Code4rena

Submitted by Soosh

Config.sol#L47

The BLOCK_PERIOD is set to 13 seconds in Config.sol.

uint256 constant BLOCK_PERIOD = 13 seconds;

Since moving to Proof-of-Stake (PoS) after the Merge, block times on ethereum are fixed at 12 seconds per block (slots). https://ethereum.org/en/developers/docs/consensus-mechanisms/pos/#:~:text=Whereas%20under%20proof%2Dof%2Dwork,block%20proposer%20in%20every%20slot.

Impact

This results in incorrect calculation of PRIORITY_EXPIRATION which is used to determine when a transaction in the Priority Queue should be considered expired.

uint256 constant PRIORITY_EXPIRATION_PERIOD = 3 days;
/// @dev Expiration delta for priority request to be satisfied (in ETH blocks)
uint256 constant PRIORITY_EXPIRATION = PRIORITY_EXPIRATION_PERIOD/BLOCK_PERIOD;

The time difference can be calulated

>>> 3*24*60*60 / 13    # 3 days / 13 sec block period
19938.46153846154
>>> 3*24*60*60 / 12    # 3 days / 12 sec block period
21600.0
>>> 21600 - 19938      # difference in blocks
1662
>>> 1662 * 12 / (60 * 60) # difference in hours
5.54

By using block time of 13 seconds, a transaction in the Priority Queue incorrectly expires 5.5 hours earlier than is expected.

5.5 hours is a significant amount of time difference so I believe this issue to be Medium severity.

Recommended Mitigation Steps

Change the block period to be 12 seconds

uint256 constant BLOCK_PERIOD = 12 seconds;

miladpiri (zkSync) confirmed and commented:

This is a valid medium issue! Thanks!

Alex the Entreprenerd (judge) commented:

The warden has shown how, due to an incorrect configuration, L2Transactions will expire earlier than intended.

The value would normally be rated a Low Severity, however, because the Warden has shown a more specific impact, I agree with Medium Severity.


The original report as published on Code4rena, by Soosh. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely a hard-coded block period constant was not updated after Ethereum moved to proof of stake, where slots are 12 seconds rather than the previously assumed 13.

Impact

Priority queue transactions could expire about 5.5 hours earlier than intended, which the reporter and the project rated as a medium-severity configuration issue.

What the attacker needed

None

The fix

The block period constant should be changed to 12 seconds to match post-Merge Ethereum slot times.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A smart contract can store a fixed number that says how long one block takes. That number is used to turn a time window (three days) into a number of blocks. If the assumed block time is wrong, the window becomes shorter or longer than planned, and here requests waiting in a queue were dropped sooner than they should have been.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by Soosh

View all

7 more disclosed reports, best first.

More from zkSync Era

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.