Open hats-bug-reporter[bot] opened 7 months ago
This should be invalid. Time is passed in milliseconds
in ink
based projects, so i think current implementation is correct.
Correct me if i am wrong.
Yes, ink! has a timestamp measured in milliseconds, so this is not an issue
Github username: -- Twitter username: -- Submission hash (on-chain): 0xf752eebd9deed4e95e7e9fbfa39c9419222aa4015e225d2173aedc0e9f74632c Severity: medium
Description: Description\
GAS_ORACLE_MAX_AGE
is used as duration for fetching the base fee.The issue here is, the
GAS_ORACLE_MAX_AGE
is calculate in milliseconds an the timestamp of the Aleph zero and EVM is in seconds.The gas oracle duration is intened to be
1 days
i.e 24 hours but the current implementation above calculates it as24000 hours
. This is absolutely incorrect.GAS_ORACLE_MAX_AGE
is used inget_base_fee()
which is used to query a gas price oracle and returns the current base_fee charged per cross chain transfer denominated in AZERO.Now, see this line of code,
This line of code will not be executed till the timestamp + 24000 hours is reached, however it should be 24 hours to pass the condition to get the default gas price. With current implementation, it will take more than 2.5 years to pass this condition in order to get the default gas price.
POC The gas price oracle duration to fetch is price is expected to be 24 hours, However the current implementation sets it to 24000 hours which makes the use of
GAS_ORACLE_MAX_AGE
in most contract after more than 2.5 years. This is not expected behaviour as the user would get the stale price which would only be updated after 2.5 years.Recommendation to fix\