Skip to content

Commit

Permalink
fix stale comments
Browse files Browse the repository at this point in the history
  • Loading branch information
RensR committed Aug 7, 2024
1 parent bb285ca commit 4bfe63b
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 22 deletions.
18 changes: 9 additions & 9 deletions contracts/gas-snapshots/ccip.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ AggregateTokenLimiter_setRateLimiterConfig:test_TokenLimitAdmin_Success() (gas:
BurnFromMintTokenPool_lockOrBurn:test_ChainNotAllowed_Revert() (gas: 28761)
BurnFromMintTokenPool_lockOrBurn:test_PoolBurnRevertNotHealthy_Revert() (gas: 55115)
BurnFromMintTokenPool_lockOrBurn:test_PoolBurn_Success() (gas: 243491)
BurnFromMintTokenPool_lockOrBurn:test_Setup_Success() (gas: 23951)
BurnFromMintTokenPool_lockOrBurn:test_Setup_Success() (gas: 23947)
BurnMintTokenPool_lockOrBurn:test_ChainNotAllowed_Revert() (gas: 27522)
BurnMintTokenPool_lockOrBurn:test_PoolBurnRevertNotHealthy_Revert() (gas: 55115)
BurnMintTokenPool_lockOrBurn:test_PoolBurn_Success() (gas: 241381)
Expand All @@ -33,7 +33,7 @@ BurnMintTokenPool_releaseOrMint:test_PoolMint_Success() (gas: 136256)
BurnWithFromMintTokenPool_lockOrBurn:test_ChainNotAllowed_Revert() (gas: 28761)
BurnWithFromMintTokenPool_lockOrBurn:test_PoolBurnRevertNotHealthy_Revert() (gas: 55115)
BurnWithFromMintTokenPool_lockOrBurn:test_PoolBurn_Success() (gas: 243517)
BurnWithFromMintTokenPool_lockOrBurn:test_Setup_Success() (gas: 24304)
BurnWithFromMintTokenPool_lockOrBurn:test_Setup_Success() (gas: 23951)
CCIPClientExample_sanity:test_ImmutableExamples_Success() (gas: 2132877)
CCIPConfigSetup:test_getCapabilityConfiguration_Success() (gas: 9517)
CCIPConfig_ConfigStateMachine:test__computeConfigDigest_Success() (gas: 70831)
Expand Down Expand Up @@ -488,8 +488,8 @@ EtherSenderReceiverTest_validatedMessage:test_validatedMessage_tokenOverwrittenT
EtherSenderReceiverTest_validatedMessage:test_validatedMessage_validMessage_extraArgs() (gas: 26292)
LockReleaseTokenPoolAndProxy_setRebalancer:test_SetRebalancer_Revert() (gas: 10992)
LockReleaseTokenPoolAndProxy_setRebalancer:test_SetRebalancer_Success() (gas: 18058)
LockReleaseTokenPoolPoolAndProxy_canAcceptLiquidity:test_CanAcceptLiquidity_Success() (gas: 3390790)
LockReleaseTokenPoolPoolAndProxy_provideLiquidity:test_LiquidityNotAccepted_Revert() (gas: 3387189)
LockReleaseTokenPoolPoolAndProxy_canAcceptLiquidity:test_CanAcceptLiquidity_Success() (gas: 3414255)
LockReleaseTokenPoolPoolAndProxy_provideLiquidity:test_LiquidityNotAccepted_Revert() (gas: 3410654)
LockReleaseTokenPoolPoolAndProxy_provideLiquidity:test_Unauthorized_Revert() (gas: 11380)
LockReleaseTokenPoolPoolAndProxy_supportsInterface:test_SupportsInterface_Success() (gas: 9977)
LockReleaseTokenPoolPoolAndProxy_withdrawalLiquidity:test_InsufficientLiquidity_Revert() (gas: 60043)
Expand Down Expand Up @@ -821,7 +821,7 @@ RateLimiter_consume:test_TokenRateLimitReached_Revert() (gas: 24706)
RateLimiter_currentTokenBucketState:test_CurrentTokenBucketState_Success() (gas: 38647)
RateLimiter_currentTokenBucketState:test_Refill_Success() (gas: 46384)
RateLimiter_setTokenBucketConfig:test_SetRateLimiterConfig_Success() (gas: 38017)
RegistryModuleOwnerCustom_constructor:test_constructor_Revert() (gas: 36031)
RegistryModuleOwnerCustom_constructor:test_constructor_Revert() (gas: 36028)
RegistryModuleOwnerCustom_registerAdminViaGetCCIPAdmin:test_registerAdminViaGetCCIPAdmin_Revert() (gas: 19637)
RegistryModuleOwnerCustom_registerAdminViaGetCCIPAdmin:test_registerAdminViaGetCCIPAdmin_Success() (gas: 129918)
RegistryModuleOwnerCustom_registerAdminViaOwner:test_registerAdminViaOwner_Revert() (gas: 19451)
Expand Down Expand Up @@ -886,10 +886,10 @@ TokenAdminRegistry_setPool:test_setPool_Success() (gas: 35943)
TokenAdminRegistry_setPool:test_setPool_ZeroAddressRemovesPool_Success() (gas: 30617)
TokenAdminRegistry_transferAdminRole:test_transferAdminRole_OnlyAdministrator_Revert() (gas: 18043)
TokenAdminRegistry_transferAdminRole:test_transferAdminRole_Success() (gas: 49390)
TokenPoolAndProxy:test_lockOrBurn_burnMint_Success() (gas: 6139245)
TokenPoolAndProxy:test_lockOrBurn_lockRelease_Success() (gas: 6406966)
TokenPoolAndProxyMigration:test_tokenPoolMigration_Success_1_2() (gas: 6984900)
TokenPoolAndProxyMigration:test_tokenPoolMigration_Success_1_4() (gas: 7168991)
TokenPoolAndProxy:test_lockOrBurn_burnMint_Success() (gas: 6167133)
TokenPoolAndProxy:test_lockOrBurn_lockRelease_Success() (gas: 6420939)
TokenPoolAndProxyMigration:test_tokenPoolMigration_Success_1_2() (gas: 6998879)
TokenPoolAndProxyMigration:test_tokenPoolMigration_Success_1_4() (gas: 7182970)
TokenPoolWithAllowList_applyAllowListUpdates:test_AllowListNotEnabled_Revert() (gas: 2209837)
TokenPoolWithAllowList_applyAllowListUpdates:test_OnlyOwner_Revert() (gas: 12089)
TokenPoolWithAllowList_applyAllowListUpdates:test_SetAllowListSkipsZero_Success() (gas: 23324)
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/libraries/Pool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ library Pool {
bytes originalSender; // The original sender of the tx on the source chain
uint64 remoteChainSelector; // ─╮ The chain ID of the source chain
address receiver; // ───────────╯ The recipient of the tokens on the destination chain. This is *NOT* the address to
// send the tokens to, but the address that will receive the tokens via the offRamp.
// send the tokens to, but the address that will receive the tokens via a transferFrom in the offRamp.
uint256 amount; // The amount of tokens to release or mint, denominated in the source token's decimals
address localToken; // The address on this chain of the token to release or mint
/// @dev WARNING: sourcePoolAddress should be checked prior to any processing of funds. Make sure it matches the
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/offRamp/EVM2EVMMultiOffRamp.sol
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ contract EVM2EVMMultiOffRamp is ITypeAndVersion, MultiOCR3Base {
revert InvalidDataLength(Pool.CCIP_POOL_V1_RET_BYTES, returnData.length);
}
uint256 localAmount = abi.decode(returnData, (uint256));
// Since token pools send the tokens to the msg.sender, which is this offRamp, we need to
// Since token pools approve the tokens to the msg.sender, which is this offRamp, we need to
// transfer them to the final receiver. We use the _callWithExactGasSafeReturnData function because
// the token contracts are not considered trusted.
(success, returnData,) = CallWithExactGas._callWithExactGasSafeReturnData(
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/offRamp/EVM2EVMOffRamp.sol
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ contract EVM2EVMOffRamp is IAny2EVMOffRamp, AggregateRateLimiter, ITypeAndVersio
revert InvalidDataLength(Pool.CCIP_POOL_V1_RET_BYTES, returnData.length);
}
uint256 localAmount = abi.decode(returnData, (uint256));
// Since token pools send the tokens to the msg.sender, which is this offRamp, we need to
// Since token pools approve the tokens to the msg.sender, which is this offRamp, we need to
// transfer them to the final receiver. We use the _callWithExactGasSafeReturnData function because
// the token contracts are not considered trusted.
(success, returnData,) = CallWithExactGas._callWithExactGasSafeReturnData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ abstract contract BurnMintTokenPoolAbstract is TokenPool {
{
_validateReleaseOrMint(releaseOrMintIn);

// Mint to the offRamp, which forwards it to the recipient
// Mint to the this contract and approve the msg.sender to send it to the recipient
IBurnMintERC20(address(i_token)).mint(address(this), releaseOrMintIn.amount);
IBurnMintERC20(address(i_token)).approve(msg.sender, releaseOrMintIn.amount);

Expand Down
5 changes: 3 additions & 2 deletions contracts/src/v0.8/ccip/pools/BurnMintTokenPoolAndProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ contract BurnMintTokenPoolAndProxy is ITypeAndVersion, LegacyPoolWrapper {
_validateReleaseOrMint(releaseOrMintIn);

if (!_hasLegacyPool()) {
// Mint to the offRamp, which forwards it to the recipient
IBurnMintERC20(address(i_token)).mint(msg.sender, releaseOrMintIn.amount);
// Mint to the this contract and approve the msg.sender to send it to the recipient
IBurnMintERC20(address(i_token)).mint(address(this), releaseOrMintIn.amount);
IBurnMintERC20(address(i_token)).approve(msg.sender, releaseOrMintIn.amount);
} else {
_releaseOrMintLegacy(releaseOrMintIn);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ contract LockReleaseTokenPoolAndProxy is LegacyPoolWrapper, ILiquidityContainer,
_validateReleaseOrMint(releaseOrMintIn);

if (!_hasLegacyPool()) {
// Release to the offRamp, which forwards it to the recipient
getToken().safeTransfer(msg.sender, releaseOrMintIn.amount);
getToken().approve(msg.sender, releaseOrMintIn.amount);
} else {
_releaseOrMintLegacy(releaseOrMintIn);
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/pools/USDC/USDCTokenPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ contract USDCTokenPool is TokenPool, ITypeAndVersion {
// replaceDepositForBurn, the tokens cannot be maliciously re-routed to another address.
uint64 nonce = i_tokenMessenger.depositForBurnWithCaller(
// We set the domain.allowedCaller as the receiver of the funds, as this is the token pool. Since 1.5 the
// token pools receiver the funds to hop them through the offRamps.
// token pools receiver the funds are transferred by the offRamp through a transferFrom.
lockOrBurnIn.amount,
domain.domainIdentifier,
domain.allowedCaller,
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/test/arm/RMN.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ contract RMN_permaBlessing is RMNSetup {
}

contract RMN_getRecordedCurseRelatedOps is RMNSetup {
function test_OpsPostDeployment() public {
function test_OpsPostDeployment() public view {
// The constructor call includes a setConfig, so that's the only thing we should expect to find.
assertEq(s_rmn.getRecordedCurseRelatedOpsCount(), 1);
RMN.RecordedCurseRelatedOp[] memory recordedCurseRelatedOps = s_rmn.getRecordedCurseRelatedOps(0, type(uint256).max);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ contract ReentrantMaliciousTokenPool is TokenPool {

function releaseOrMint(Pool.ReleaseOrMintInV1 calldata releaseOrMintIn)
external
pure
override
returns (Pool.ReleaseOrMintOutV1 memory)
{
i_token.approve(msg.sender, releaseOrMintIn.amount);
return Pool.ReleaseOrMintOutV1({destinationAmount: releaseOrMintIn.amount});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ contract BurnMintMultiTokenPool is MultiTokenPool {
{
_validateReleaseOrMint(releaseOrMintIn);

// Mint to the offRamp, which forwards it to the recipient
IBurnMintERC20(releaseOrMintIn.localToken).mint(msg.sender, releaseOrMintIn.amount);
// Mint to the this contract and approve the msg.sender to send it to the recipient
IBurnMintERC20(releaseOrMintIn.localToken).mint(address(this), releaseOrMintIn.amount);
IBurnMintERC20(releaseOrMintIn.localToken).approve(msg.sender, releaseOrMintIn.amount);

emit Minted(msg.sender, releaseOrMintIn.receiver, releaseOrMintIn.amount);

Expand Down
6 changes: 6 additions & 0 deletions contracts/src/v0.8/ccip/test/legacy/TokenPoolAndProxy.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,9 @@ contract TokenPoolAndProxy is EVM2EVMOnRampSetup {
// releaseOrMint, assert normal path is taken
deal(address(s_token), address(s_pool), amount);

vm.expectEmit(address(s_token));
emit IERC20.Approval(address(s_pool), address(s_fakeOffRamp), amount);

s_pool.releaseOrMint(
Pool.ReleaseOrMintInV1({
receiver: OWNER,
Expand All @@ -468,6 +471,9 @@ contract TokenPoolAndProxy is EVM2EVMOnRampSetup {
})
);

// Transfer the tokens like the offRamp would
s_token.transferFrom(address(s_pool), OWNER, amount);

// set legacy pool

vm.startPrank(OWNER);
Expand Down

0 comments on commit 4bfe63b

Please sign in to comment.