Skip to content

Commit f8cf181

Browse files
committed
fix: remove redundant decimals checks from pyth price feed
1 parent dbf6701 commit f8cf181

File tree

2 files changed

+0
-14
lines changed

2 files changed

+0
-14
lines changed

contracts/oracles/updatable/PythPriceFeed.sol

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ interface IPythPriceFeedExceptions {
3030
/// the payload's internal timestamp
3131
error IncorrectExpectedPublishTimestamp();
3232

33-
/// @notice Thrown when the decimals returned by Pyth are outside sane boundaries
34-
error IncorrectPriceDecimals();
35-
3633
/// @notice Thrown when a retrieved price's publish time is too far ahead in the future
3734
error PriceTimestampTooFarAhead();
3835

@@ -112,7 +109,6 @@ contract PythPriceFeed is IUpdatablePriceFeed, IPythPriceFeedExceptions {
112109
if (price == 0) revert IncorrectPriceException();
113110

114111
if (priceData.expo != -8) {
115-
if (priceData.expo > 0 || priceData.expo < -255) revert IncorrectPriceDecimals();
116112
int256 pythDecimals = int256(uint256(10) ** uint32(-priceData.expo));
117113
price = price * DECIMALS / pythDecimals;
118114
}

contracts/test/unit/updatable/PythPriceFeed.unit.t.sol

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,5 @@ contract PythPriceFeedUnitTest is TestHelper, IPythPriceFeedExceptions {
131131
(, price,,,) = pf.latestRoundData();
132132

133133
assertEq(price, 100 * 10 ** 8, "Incorrect price when pyth decimals are 0");
134-
135-
pyth.setPriceData(bytes32(uint256(1)), 100, 0, 2, block.timestamp);
136-
137-
vm.expectRevert(IncorrectPriceDecimals.selector);
138-
pf.latestRoundData();
139-
140-
pyth.setPriceData(bytes32(uint256(1)), 100, 0, -257, block.timestamp);
141-
142-
vm.expectRevert(IncorrectPriceDecimals.selector);
143-
pf.latestRoundData();
144134
}
145135
}

0 commit comments

Comments
 (0)