DeFiFoundry
50,000 USDC
View results
Submission Details
Severity: low
Invalid

Chain-Specific Timestamp Validation Issues

[MEDIUM-4] Chain-Specific Timestamp Validation Issues

Location

Price feed validation logic

Description

Fixed timestamp windows for Chainlink price feed validation may not be appropriate across different chains due to varying block times.

Impact

  • Stale prices might be accepted on faster chains

  • Valid prices might be rejected on slower chains

  • Cross-chain deployment issues

Proof of Concept

contract ChainSpecificTest is Test {
PerpetualVault public vault;
function testChainSpecificIssues() public {
// Test on different chain configurations
vm.chainId(1); // Ethereum Mainnet
assertTrue(vault.isPriceValid(), "Should be valid on Ethereum");
vm.chainId(43114); // Avalanche
assertFalse(vault.isPriceValid(), "Should be invalid on Avalanche");
}
}

Recommendation

Implement chain-specific configurations:

contract PerpetualVault {
struct ChainConfig {
uint256 maxPriceAge;
uint256 minBlockTime;
uint256 maxBlockTime;
}
mapping(uint256 => ChainConfig) public chainConfigs;
function setChainConfig(
uint256 chainId,
uint256 maxPriceAge,
uint256 minBlockTime,
uint256 maxBlockTime
) external onlyOwner {
chainConfigs[chainId] = ChainConfig(maxPriceAge, minBlockTime, maxBlockTime);
}
function _validatePriceAge(uint256 timestamp) internal view {
ChainConfig memory config = chainConfigs[block.chainid];
require(
block.timestamp - timestamp <= config.maxPriceAge,
"Price too old for this chain"
);
}
}
Updates

Lead Judging Commences

n0kto Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational or Gas

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.