Oracle will become invalid much faster than intended on non-mainnet chains
The NFT floor price oracle uses a fixed number of blocks (1800) to decide if a price is still valid, assuming 12-second blocks. On chains with faster block times, prices expire much sooner than the intended six hours, so the oracle may reject valid prices.
Submitted by Trust
NFTFloorOracle is in charge of answering price queries for ERC721 assets. EXPIRATION_PERIOD constant is the max amount of blocks allowed to have passed for the reading to be considered up to date:
uint256 diffBlock = currentBlock - priceInfo.updatedAt;
if (diffBlock <= config.expirationPeriod) {
validPriceList[validNum] = priceInfo.twap;
validNum++;
}
We can see it is set to 1800, which is intended to be 6 hours with 12 second block time assumption:
//expirationPeriod at least the interval of client to feed data(currently 6h=21600s/12=1800 in mainnet)
//we do not accept price lags behind to much
uint128 constant EXPIRATION_PERIOD = 1800;
The issue is that different blockchains have wildly different block times. BSC has one every 3 seconds, while Avalanche has a new block every 1 sec. Also the block product rate may be subject to future changes. Therefore, readings may be considered stale much faster than intended on non-mainnet chains.
The correct EVM compatible way to check it is using the block.timestamp variable. Make sure the difference between current and previous timestamp is under 6 * 3600 seconds.
Paraspace docs show they are clearly intending to deploy in multiple chains so it’s very relevant.
Impact
Oracle will become invalid much faster than intended on non-mainnet chains.
Recommended Mitigation Steps
Use block.timestamp to measure passage of time.
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
The contract measures time in block counts instead of using the block timestamp, so the expiration period is wrong on chains with different block times.
What the attacker needed
Deployment on a chain with block time not 12 seconds
The fix
The contract should use block.timestamp to measure the passage of time instead of counting blocks.
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 oracle checks whether a price is fresh by counting how many blocks have passed since it was last updated. It assumes each block takes 12 seconds, so 1800 blocks equals six hours. But other blockchains produce blocks faster, so the same 1800 blocks pass in much less time, making the price expire too early.
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.