Skip to content

Commit

Permalink
Disallow block pinning in the test template for linked pools
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiTimesChi committed Nov 8, 2023
1 parent 3e7a5b6 commit fb6b11c
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@ pragma solidity 0.8.17;
import {LinkedPoolConfigIntegrationTest} from "./LinkedPoolConfigIntegration.sol";

contract LinkedPoolConfigUSDCArbTestFork is LinkedPoolConfigIntegrationTest {
// Don't pin to a specific block number
uint256 public constant ARB_BLOCK_NUMBER = 0;

/// @notice Test swaps worth 10_000 USDC
uint256 public constant SWAP_VALUE = 10_000;

/// @notice Used pools have accurate quoting functions, so should have no delta
uint256 public constant MAX_PERCENT_DELTA = 0;

constructor()
LinkedPoolConfigIntegrationTest("arbitrum", ARB_BLOCK_NUMBER, "CCTP.USDC", SWAP_VALUE, MAX_PERCENT_DELTA)
{}
constructor() LinkedPoolConfigIntegrationTest("arbitrum", "CCTP.USDC", SWAP_VALUE, MAX_PERCENT_DELTA) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@ pragma solidity 0.8.17;
import {LinkedPoolConfigIntegrationTest} from "./LinkedPoolConfigIntegration.sol";

contract LinkedPoolConfigUSDCAvaxTestFork is LinkedPoolConfigIntegrationTest {
// Don't pin to a specific block number
uint256 public constant AVAX_BLOCK_NUMBER = 0;

/// @notice Test swaps worth 10_000 USDC
uint256 public constant SWAP_VALUE = 10_000;

/// @notice Used pools have accurate quoting functions, so should have no delta
uint256 public constant MAX_PERCENT_DELTA = 0;

constructor()
LinkedPoolConfigIntegrationTest("avalanche", AVAX_BLOCK_NUMBER, "CCTP.USDC", SWAP_VALUE, MAX_PERCENT_DELTA)
{}
constructor() LinkedPoolConfigIntegrationTest("avalanche", "CCTP.USDC", SWAP_VALUE, MAX_PERCENT_DELTA) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@ pragma solidity 0.8.17;
import {LinkedPoolConfigIntegrationTest} from "./LinkedPoolConfigIntegration.sol";

contract LinkedPoolConfigUSDCBaseTestFork is LinkedPoolConfigIntegrationTest {
// Don't pin to a specific block number
uint256 public constant BASE_BLOCK_NUMBER = 0;

/// @notice Test swaps worth 10_000 USDC
uint256 public constant SWAP_VALUE = 10_000;

/// @notice Used pools have accurate quoting functions, so should have no delta
uint256 public constant MAX_PERCENT_DELTA = 0;

constructor()
LinkedPoolConfigIntegrationTest("base", BASE_BLOCK_NUMBER, "CCTP.USDC", SWAP_VALUE, MAX_PERCENT_DELTA)
{}
constructor() LinkedPoolConfigIntegrationTest("base", "CCTP.USDC", SWAP_VALUE, MAX_PERCENT_DELTA) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@ pragma solidity 0.8.17;
import {LinkedPoolConfigIntegrationTest} from "./LinkedPoolConfigIntegration.sol";

contract LinkedPoolConfigUSDCEthTestFork is LinkedPoolConfigIntegrationTest {
// Don't pin to a specific block number
uint256 public constant ETH_BLOCK_NUMBER = 0;

/// @notice Test swaps worth 10_000 USDC
uint256 public constant SWAP_VALUE = 10_000;

/// @notice Used pools have accurate quoting functions, so should have no delta
uint256 public constant MAX_PERCENT_DELTA = 0;

constructor()
LinkedPoolConfigIntegrationTest("mainnet", ETH_BLOCK_NUMBER, "CCTP.USDC", SWAP_VALUE, MAX_PERCENT_DELTA)
{}
constructor() LinkedPoolConfigIntegrationTest("mainnet", "CCTP.USDC", SWAP_VALUE, MAX_PERCENT_DELTA) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ import {LinkedPoolConfigIntegrationTest} from "./LinkedPoolConfigIntegration.sol
import {ISynth} from "../../interfaces/ISynth.sol";

contract LinkedPoolConfigUSDCOptTestFork is LinkedPoolConfigIntegrationTest {
// Don't pin to a specific block number
uint256 public constant OPT_BLOCK_NUMBER = 0;

/// @notice Test swaps worth 10_000 USDC
uint256 public constant SWAP_VALUE = 10_000;

Expand All @@ -17,9 +14,7 @@ contract LinkedPoolConfigUSDCOptTestFork is LinkedPoolConfigIntegrationTest {
/// @notice Optimism sUSD
address public constant SUSD = 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9;

constructor()
LinkedPoolConfigIntegrationTest("optimism", OPT_BLOCK_NUMBER, "CCTP.USDC", SWAP_VALUE, MAX_PERCENT_DELTA)
{}
constructor() LinkedPoolConfigIntegrationTest("optimism", "CCTP.USDC", SWAP_VALUE, MAX_PERCENT_DELTA) {}

/// @dev sUSD requires special logic for deal cheatcode to work, as the balances are stored externally
function setBalance(address token, uint256 amount) internal virtual override {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ import {LinkedPoolConfigIntegrationTest} from "./LinkedPoolConfigIntegration.sol
import {ISynth} from "../../interfaces/ISynth.sol";

contract LinkedPoolConfigNUSDOptTestFork is LinkedPoolConfigIntegrationTest {
// Don't pin to a specific block number
uint256 public constant OPT_BLOCK_NUMBER = 0;

/// @notice Test swaps worth 10_000 USDC
uint256 public constant SWAP_VALUE = 10_000;

Expand All @@ -17,9 +14,7 @@ contract LinkedPoolConfigNUSDOptTestFork is LinkedPoolConfigIntegrationTest {
/// @notice Optimism sUSD
address public constant SUSD = 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9;

constructor()
LinkedPoolConfigIntegrationTest("optimism", OPT_BLOCK_NUMBER, "nUSD", SWAP_VALUE, MAX_PERCENT_DELTA)
{}
constructor() LinkedPoolConfigIntegrationTest("optimism", "nUSD", SWAP_VALUE, MAX_PERCENT_DELTA) {}

/// @dev sUSD requires special logic for deal cheatcode to work, as the balances are stored externally
function setBalance(address token, uint256 amount) internal virtual override {
Expand Down
5 changes: 3 additions & 2 deletions test/router/linkedPool/LinkedPoolConfigIntegration.sol
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,14 @@ abstract contract LinkedPoolConfigIntegrationTest is IntegrationUtils {

address public user;

/// @dev We don't pin the LinkedPool config tests to a specific block number because we want to be able to run them
/// against the current state of the chain to test the latest configuration against the current liquidity composition.
constructor(
string memory chainName_,
uint256 forkBlockNumber,
string memory bridgeSymbol_,
uint256 swapValue_,
uint256 maxPercentDelta_
) IntegrationUtils(chainName_, linkedPoolAlias = string.concat("LinkedPool.", bridgeSymbol_), forkBlockNumber) {
) IntegrationUtils(chainName_, linkedPoolAlias = string.concat("LinkedPool.", bridgeSymbol_), 0) {
user = makeAddr("User");
swapValue = swapValue_;
maxPercentDelta = maxPercentDelta_;
Expand Down

0 comments on commit fb6b11c

Please sign in to comment.