Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCIP 1.5.1 #20

Merged
merged 29 commits into from
Jan 2, 2025
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a9d7e86
feat: setup deps
DhairyaSethi Dec 5, 2024
40a499e
feat: migrate GHO token pools to v1.5.1
DhairyaSethi Dec 5, 2024
f2409aa
fix: ci
DhairyaSethi Dec 5, 2024
fefa18b
feat: certora formal verification
DhairyaSethi Dec 5, 2024
7af5b30
chore: rm whitespace, ref comment
DhairyaSethi Dec 6, 2024
b23faa7
doc: rm unneeded remanant
DhairyaSethi Dec 6, 2024
ff1a97a
feat: upd currentBridged on liquidity transfers
DhairyaSethi Dec 11, 2024
33c0bec
fix: certora add invariant to withdraw, provide, and transfer liq
DhairyaSethi Dec 11, 2024
5f84e6e
feat: add transferLiquidity on burnMintTokenPool
DhairyaSethi Dec 11, 2024
8fea66b
doc: upd transferLiquidity for burnMint
DhairyaSethi Dec 11, 2024
e8521f3
feat: rm token decimal check in constructor
DhairyaSethi Dec 19, 2024
92c9582
feat: setCurrentBridgedAmount, revert bridgeAmount changes on {transf…
DhairyaSethi Dec 19, 2024
d0d0270
chore: fix doc
DhairyaSethi Dec 19, 2024
3667707
feat: mintAndTransferLiquidity
DhairyaSethi Dec 19, 2024
1881f20
chore: reorder imports to minmize diff
DhairyaSethi Dec 19, 2024
a2e92d0
feat: `directMint` & `directBurn` to migrate facilitators
DhairyaSethi Dec 23, 2024
f393191
chore: expand on test scenario
DhairyaSethi Dec 23, 2024
7a2e44a
chore: move revert to base test such that it can be inherited
DhairyaSethi Dec 23, 2024
2708501
test: use setter over vm.store
DhairyaSethi Dec 23, 2024
8a716bd
test: revert `InsufficientLiquidity` on `transferLiquidity`
DhairyaSethi Dec 23, 2024
ae55d15
test: rm unneeded mockCall
DhairyaSethi Dec 23, 2024
4fb7885
test: migrateLiquidity on remote pool
DhairyaSethi Dec 23, 2024
4e0e90f
doc: update comments
DhairyaSethi Dec 23, 2024
5cff384
chore: cleanup test
DhairyaSethi Dec 23, 2024
f06ecdb
new: introduce __gap on UpgradeableTokenPool
DhairyaSethi Dec 23, 2024
a3ff6f5
doc: update doc & diffs for storage gap
DhairyaSethi Dec 23, 2024
ca12f63
chore: upd directMint test
DhairyaSethi Dec 24, 2024
59c3763
doc: upd diff and doc for __gap
DhairyaSethi Dec 30, 2024
dcb63a7
doc: fix base diff doc
DhairyaSethi Jan 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 67 additions & 9 deletions contracts/src/v0.8/ccip/test/pools/GHO/GhoTokenPoolRemote.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {stdError} from "forge-std/Test.sol";
import {UpgradeableTokenPool} from "../../../pools/GHO/UpgradeableTokenPool.sol";
import {EVM2EVMOnRamp} from "../../../onRamp/EVM2EVMOnRamp.sol";
import {EVM2EVMOffRamp} from "../../../offRamp/EVM2EVMOffRamp.sol";
import {BurnMintTokenPool} from "../../../pools/BurnMintTokenPool.sol";
import {UpgradeableBurnMintTokenPool} from "../../../pools/GHO/UpgradeableBurnMintTokenPool.sol";
import {RateLimiter} from "../../../libraries/RateLimiter.sol";
import {Pool} from "../../../libraries/Pool.sol";
import {MockUpgradeable} from "../../mocks/MockUpgradeable.sol";
Expand Down Expand Up @@ -500,12 +500,10 @@ contract GhoTokenPoolRemote_setRateLimitAdmin is GhoTokenPoolRemoteSetup {
}

contract GhoTokenPoolRemote_directMint is GhoTokenPoolRemoteSetup {
miguelmtzinf marked this conversation as resolved.
Show resolved Hide resolved
function testDirectMintAdminSuccess(uint256 amount) public {
function testFuzzDirectMintSuccess(uint256 amount) public {
amount = bound(amount, 1, type(uint128).max); // current pool capacity
// function expected to match bucket level of old facilitator which burns
// provided tokens to reduce its capacity

address oldFacilitator = makeAddr("oldFacilitator");
DhairyaSethi marked this conversation as resolved.
Show resolved Hide resolved
assertEq(s_burnMintERC677.balanceOf(oldFacilitator), 0);

changePrank(AAVE_DAO);
vm.expectEmit(address(s_burnMintERC677));
Expand All @@ -514,13 +512,11 @@ contract GhoTokenPoolRemote_directMint is GhoTokenPoolRemoteSetup {

assertEq(s_burnMintERC677.balanceOf(oldFacilitator), amount);
assertEq(s_burnMintERC677.balanceOf(address(s_pool)), 0);

assertEq(GhoToken(address(s_burnMintERC677)).getFacilitator(address(s_pool)).bucketLevel, amount);
}

// Reverts

function testDirectMintAdminReverts() public {
function testDirectMintReverts() public {
vm.startPrank(STRANGER);

vm.expectRevert(OnlyCallableByOwner.selector);
Expand All @@ -542,10 +538,72 @@ contract GhoTokenPoolRemote_directBurn is GhoTokenPoolRemoteSetup {
assertEq(GhoToken(address(s_burnMintERC677)).getFacilitator(address(s_pool)).bucketLevel, 0);
}

function testDirectBurnAdminReverts() public {
function testDirectBurnReverts() public {
vm.startPrank(STRANGER);

vm.expectRevert(OnlyCallableByOwner.selector);
s_pool.directBurn(13e7);
}
}

contract GhoTokenPoolRemote_migrateLiquidity is GhoTokenPoolRemoteSetup {
UpgradeableBurnMintTokenPool internal s_oldBurnMintTokenPool;

function setUp() public override {
super.setUp();

s_oldBurnMintTokenPool = UpgradeableBurnMintTokenPool(
_deployUpgradeableBurnMintTokenPool(
address(s_burnMintERC677),
address(s_mockRMN),
address(s_sourceRouter),
AAVE_DAO,
PROXY_ADMIN
)
);

changePrank(AAVE_DAO);
GhoToken(address(s_burnMintERC677)).addFacilitator(
address(s_oldBurnMintTokenPool),
"OldTokenPool",
uint128(INITIAL_BRIDGE_LIMIT)
);

// mock existing supply offRamped by old token pool (not using `directMint` for clarity)
// which is circulating on remote chain
changePrank(address(s_oldBurnMintTokenPool));
s_burnMintERC677.mint(makeAddr("users"), INITIAL_BRIDGE_LIMIT);
}

function testFuzzMigrateFacilitator(uint256 amount) public {
amount = bound(amount, 1, INITIAL_BRIDGE_LIMIT); // old pool bucket level
changePrank(AAVE_DAO);

assertEq(
GhoToken(address(s_burnMintERC677)).getFacilitator(address(s_oldBurnMintTokenPool)).bucketLevel,
INITIAL_BRIDGE_LIMIT
);
assertEq(GhoToken(address(s_burnMintERC677)).getFacilitator(address(s_pool)).bucketLevel, 0);

// note: these two operations should be done atomically such that there no unbacked tokens
// in circulation at any point
// 1. mint tokens to old pool
vm.expectEmit(address(s_burnMintERC677));
emit Transfer(address(0), address(s_oldBurnMintTokenPool), amount);
s_pool.directMint(address(s_oldBurnMintTokenPool), amount);

// 2. burn tokens from old pool
vm.expectEmit(address(s_burnMintERC677));
emit Transfer(address(s_oldBurnMintTokenPool), address(0), amount);
s_oldBurnMintTokenPool.directBurn(amount);

assertEq(s_burnMintERC677.balanceOf(address(s_oldBurnMintTokenPool)), 0);
assertEq(s_burnMintERC677.balanceOf(address(s_pool)), 0);

assertEq(
GhoToken(address(s_burnMintERC677)).getFacilitator(address(s_oldBurnMintTokenPool)).bucketLevel,
INITIAL_BRIDGE_LIMIT - amount
);
assertEq(GhoToken(address(s_burnMintERC677)).getFacilitator(address(s_pool)).bucketLevel, amount);
}
}
Loading