From 251be4f5ae00e8e4f707d66fb4afdf93cbf972c1 Mon Sep 17 00:00:00 2001 From: Ryan Hall Date: Tue, 8 Oct 2024 10:23:26 -0400 Subject: [PATCH] rename stalenessThreshold => tokenStalenessThreshold --- contracts/src/v0.8/ccip/FeeQuoter.sol | 12 ++++++------ .../src/v0.8/ccip/test/feeQuoter/FeeQuoter.t.sol | 10 +++++----- .../v0.8/ccip/test/feeQuoter/FeeQuoterSetup.t.sol | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/contracts/src/v0.8/ccip/FeeQuoter.sol b/contracts/src/v0.8/ccip/FeeQuoter.sol index 2cb54dd2dc..e13f14102c 100644 --- a/contracts/src/v0.8/ccip/FeeQuoter.sol +++ b/contracts/src/v0.8/ccip/FeeQuoter.sol @@ -77,7 +77,7 @@ contract FeeQuoter is AuthorizedCallers, IFeeQuoter, ITypeAndVersion, IReceiver, uint96 maxFeeJuelsPerMsg; // ─╮ Maximum fee that can be charged for a message address linkToken; // ────────╯ LINK token address // The amount of time a token price can be stale before it is considered invalid (gas price staleness is configured per dest chain) - uint32 stalenessThreshold; + uint32 tokenStalenessThreshold; } /// @dev The struct representing the received CCIP feed report from keystone IReceiver.onReport() @@ -205,7 +205,7 @@ contract FeeQuoter is AuthorizedCallers, IFeeQuoter, ITypeAndVersion, IReceiver, /// @dev Subset of tokens which prices tracked by this registry which are fee tokens. EnumerableSet.AddressSet private s_feeTokens; /// @dev The amount of time a token price can be stale before it is considered invalid. - uint32 private immutable i_stalenessThreshold; + uint32 private immutable i_tokenStalenessThreshold; constructor( StaticConfig memory staticConfig, @@ -218,14 +218,14 @@ contract FeeQuoter is AuthorizedCallers, IFeeQuoter, ITypeAndVersion, IReceiver, ) AuthorizedCallers(priceUpdaters) { if ( staticConfig.linkToken == address(0) || staticConfig.maxFeeJuelsPerMsg == 0 - || staticConfig.stalenessThreshold == 0 + || staticConfig.tokenStalenessThreshold == 0 ) { revert InvalidStaticConfig(); } i_linkToken = staticConfig.linkToken; i_maxFeeJuelsPerMsg = staticConfig.maxFeeJuelsPerMsg; - i_stalenessThreshold = staticConfig.stalenessThreshold; + i_tokenStalenessThreshold = staticConfig.tokenStalenessThreshold; _applyFeeTokensUpdates(feeTokens, new address[](0)); _updateTokenPriceFeeds(tokenPriceFeeds); @@ -243,7 +243,7 @@ contract FeeQuoter is AuthorizedCallers, IFeeQuoter, ITypeAndVersion, IReceiver, Internal.TimestampedPackedUint224 memory tokenPrice = s_usdPerToken[token]; // If the token price is not stale, return it - if (block.timestamp - tokenPrice.timestamp < i_stalenessThreshold) { + if (block.timestamp - tokenPrice.timestamp < i_tokenStalenessThreshold) { return tokenPrice; } @@ -1012,7 +1012,7 @@ contract FeeQuoter is AuthorizedCallers, IFeeQuoter, ITypeAndVersion, IReceiver, return StaticConfig({ maxFeeJuelsPerMsg: i_maxFeeJuelsPerMsg, linkToken: i_linkToken, - stalenessThreshold: i_stalenessThreshold + tokenStalenessThreshold: i_tokenStalenessThreshold }); } } diff --git a/contracts/src/v0.8/ccip/test/feeQuoter/FeeQuoter.t.sol b/contracts/src/v0.8/ccip/test/feeQuoter/FeeQuoter.t.sol index c1e652aeec..09750ca6cd 100644 --- a/contracts/src/v0.8/ccip/test/feeQuoter/FeeQuoter.t.sol +++ b/contracts/src/v0.8/ccip/test/feeQuoter/FeeQuoter.t.sol @@ -33,7 +33,7 @@ contract FeeQuoter_constructor is FeeQuoterSetup { FeeQuoter.StaticConfig memory staticConfig = FeeQuoter.StaticConfig({ linkToken: s_sourceTokens[0], maxFeeJuelsPerMsg: MAX_MSG_FEES_JUELS, - stalenessThreshold: uint32(TWELVE_HOURS) + tokenStalenessThreshold: uint32(TWELVE_HOURS) }); s_feeQuoter = new FeeQuoterHelper( staticConfig, @@ -91,7 +91,7 @@ contract FeeQuoter_constructor is FeeQuoterSetup { FeeQuoter.StaticConfig memory staticConfig = FeeQuoter.StaticConfig({ linkToken: s_sourceTokens[0], maxFeeJuelsPerMsg: MAX_MSG_FEES_JUELS, - stalenessThreshold: 0 + tokenStalenessThreshold: 0 }); vm.expectRevert(FeeQuoter.InvalidStaticConfig.selector); @@ -111,7 +111,7 @@ contract FeeQuoter_constructor is FeeQuoterSetup { FeeQuoter.StaticConfig memory staticConfig = FeeQuoter.StaticConfig({ linkToken: address(0), maxFeeJuelsPerMsg: MAX_MSG_FEES_JUELS, - stalenessThreshold: uint32(TWELVE_HOURS) + tokenStalenessThreshold: uint32(TWELVE_HOURS) }); vm.expectRevert(FeeQuoter.InvalidStaticConfig.selector); @@ -131,7 +131,7 @@ contract FeeQuoter_constructor is FeeQuoterSetup { FeeQuoter.StaticConfig memory staticConfig = FeeQuoter.StaticConfig({ linkToken: s_sourceTokens[0], maxFeeJuelsPerMsg: 0, - stalenessThreshold: uint32(TWELVE_HOURS) + tokenStalenessThreshold: uint32(TWELVE_HOURS) }); vm.expectRevert(FeeQuoter.InvalidStaticConfig.selector); @@ -171,7 +171,7 @@ contract FeeQuoter_getTokenPrice is FeeQuoterSetup { uint256 originalTimestampValue = block.timestamp; // Above staleness threshold - vm.warp(originalTimestampValue + s_feeQuoter.getStaticConfig().stalenessThreshold + 1); + vm.warp(originalTimestampValue + s_feeQuoter.getStaticConfig().tokenStalenessThreshold + 1); address sourceToken = _initialiseSingleTokenPriceFeed(); Internal.TimestampedPackedUint224 memory tokenPriceAnswer = s_feeQuoter.getTokenPrice(sourceToken); diff --git a/contracts/src/v0.8/ccip/test/feeQuoter/FeeQuoterSetup.t.sol b/contracts/src/v0.8/ccip/test/feeQuoter/FeeQuoterSetup.t.sol index 712682f58b..50f6f8f2b3 100644 --- a/contracts/src/v0.8/ccip/test/feeQuoter/FeeQuoterSetup.t.sol +++ b/contracts/src/v0.8/ccip/test/feeQuoter/FeeQuoterSetup.t.sol @@ -162,7 +162,7 @@ contract FeeQuoterSetup is TokenSetup { FeeQuoter.StaticConfig({ linkToken: s_sourceTokens[0], maxFeeJuelsPerMsg: MAX_MSG_FEES_JUELS, - stalenessThreshold: uint32(TWELVE_HOURS) + tokenStalenessThreshold: uint32(TWELVE_HOURS) }), priceUpdaters, feeTokens,