Skip to content

Commit b2a3015

Browse files
committed
removed argument
1 parent d0d6b19 commit b2a3015

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

target_chains/ethereum/contracts/forge-test/utils/PythTestUtils.t.sol

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -376,13 +376,10 @@ contract PythUtilsTest is Test, WormholeTestUtils, PythTestUtils, IPythEvents {
376376
int64 price2,
377377
int32 expo2,
378378
int32 targetExpo,
379-
380-
int64 expectedPrice,
381-
int32 expectedExpo
382-
) internal {
383-
(int64 price, int32 expo) = PythUtils.deriveCrossRate(price1, expo1, price2, expo2, targetExpo);
379+
int64 expectedPrice
380+
) internal {
381+
int64 price = PythUtils.deriveCrossRate(price1, expo1, price2, expo2, targetExpo);
384382
assertEq(price, expectedPrice);
385-
assertEq(expo, expectedExpo);
386383
}
387384

388385
function assertCrossRateReverts(
@@ -449,9 +446,9 @@ contract PythUtilsTest is Test, WormholeTestUtils, PythTestUtils, IPythEvents {
449446
function testCombinePrices() public {
450447

451448
// Basic Tests
452-
assertCrossRateEquals(500, -8, 500, -8, -5, 100000, -5);
453-
assertCrossRateEquals(10_000, -8, 100, -2, -5, 10, -5);
454-
assertCrossRateEquals(10_000, -2, 100, -8, -4, 1_000_000_000_000, -4);
449+
assertCrossRateEquals(500, -8, 500, -8, -5, 100000);
450+
assertCrossRateEquals(10_000, -8, 100, -2, -5, 10);
451+
assertCrossRateEquals(10_000, -2, 100, -8, -4, 1_000_000_000_000);
455452

456453
// Negative Price Tests
457454
assertCrossRateReverts(-100, -2, 100, -2, -5, PythErrors.NegativeInputPrice.selector);
@@ -467,13 +464,13 @@ contract PythUtilsTest is Test, WormholeTestUtils, PythTestUtils, IPythEvents {
467464
assertCrossRateReverts(100, -2, 100, -2, 1, PythErrors.InvalidTargetExpo.selector);
468465

469466
// Different Exponent Tests
470-
assertCrossRateEquals(10_000, -2, 100, -4, -4, 100_000_000, -4);
471-
assertCrossRateEquals(10_000, -2, 10_000, -1, -2, 10, -2);
472-
assertCrossRateEquals(10_000, -10, 10_000, -2, 0, 0, 0); // It will truncate to 0
467+
assertCrossRateEquals(10_000, -2, 100, -4, -4, 100_000_000);
468+
assertCrossRateEquals(10_000, -2, 10_000, -1, -2, 10);
469+
assertCrossRateEquals(10_000, -10, 10_000, -2, 0, 0); // It will truncate to 0
473470

474471
// Exponent Edge Tests
475-
assertCrossRateEquals(10_000, 0, 100, 0, 0, 100, 0);
476-
assertCrossRateEquals(10_000, 0, 100, 0, -255, 100, -255);
472+
assertCrossRateEquals(10_000, 0, 100, 0, 0, 100);
473+
assertCrossRateEquals(10_000, 0, 100, 0, -255, 100);
477474
// assertCrossRateEquals(10_000, 0, 100, -255, -255, 100, -255);
478475
// assertCrossRateEquals(10_000, -255, 100, 0, 0, 100, 0);
479476

target_chains/ethereum/sdk/solidity/PythUtils.sol

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ library PythUtils {
5353
/// @param expo2 The exponent of the second price
5454
/// @param targetExpo The target exponent of the cross-rate
5555
/// @return crossRate The cross-rate (a/c)
56-
/// @return expo The exponent of the cross-rate
5756
/// @dev This function will revert if either price is negative or if the exponents are invalid.
5857
/// @dev This function will also revert if the cross-rate is greater than int64.max
5958
/// @notice This function doesn't return the combined confidence interval.
@@ -63,7 +62,7 @@ library PythUtils {
6362
int64 price2,
6463
int32 expo2,
6564
int32 targetExpo
66-
) public pure returns (int64 crossRate, int32 expo) {
65+
) public pure returns (int64 crossRate) {
6766
// Check if the input prices are negative
6867
if (price1 < 0 || price2 < 0) {
6968
revert PythErrors.NegativeInputPrice();
@@ -103,6 +102,6 @@ library PythUtils {
103102
revert();
104103
}
105104

106-
return (int64(uint64(combined)), targetExpo);
105+
return int64(uint64(combined));
107106
}
108107
}

0 commit comments

Comments
 (0)