Skip to content

Commit

Permalink
Revert Changes to shared folders, will be in Chainlink repo
Browse files Browse the repository at this point in the history
  • Loading branch information
jhweintraub committed Sep 26, 2024
1 parent 0688f98 commit 90ee01d
Show file tree
Hide file tree
Showing 12 changed files with 655 additions and 1,080 deletions.
77 changes: 25 additions & 52 deletions contracts/gas-snapshots/shared.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -7,60 +7,33 @@ AuthorizedCallers_applyAuthorizedCallerUpdates:test_SkipRemove_Success() (gas: 3
AuthorizedCallers_applyAuthorizedCallerUpdates:test_ZeroAddressNotAllowed_Revert() (gas: 64473)
AuthorizedCallers_constructor:test_ZeroAddressNotAllowed_Revert() (gas: 64473)
AuthorizedCallers_constructor:test_constructor_Success() (gas: 720513)
BurnMintERC20_approve:testApproveSuccess() (gas: 55477)
BurnMintERC20_approve:testInvalidAddressReverts() (gas: 10663)
BurnMintERC20_burn:testBasicBurnSuccess() (gas: 173886)
BurnMintERC20_burn:testBurnFromZeroAddressReverts() (gas: 47201)
BurnMintERC20_burn:testExceedsBalanceReverts() (gas: 21819)
BurnMintERC20_burn:testSenderNotBurnerReverts() (gas: 16739)
BurnMintERC20_burnFrom:testBurnFromSuccess() (gas: 57957)
BurnMintERC20_burnFrom:testExceedsBalanceReverts() (gas: 35916)
BurnMintERC20_burnFrom:testInsufficientAllowanceReverts() (gas: 21914)
BurnMintERC20_burnFrom:testSenderNotBurnerReverts() (gas: 16739)
BurnMintERC20_burnFromAlias:testBurnFromSuccess() (gas: 57932)
BurnMintERC20_burnFromAlias:testExceedsBalanceReverts() (gas: 35880)
BurnMintERC20_burnFromAlias:testInsufficientAllowanceReverts() (gas: 21869)
BurnMintERC20_burnFromAlias:testSenderNotBurnerReverts() (gas: 16694)
BurnMintERC20_constructor:testConstructorSuccess() (gas: 1600593)
BurnMintERC20_decreaseApproval:testDecreaseApprovalSuccess() (gas: 31123)
BurnMintERC20_grantMintAndBurnRoles:testGrantMintAndBurnRolesSuccess() (gas: 121170)
BurnMintERC20_grantRole:testGrantBurnAccessSuccess() (gas: 53407)
BurnMintERC20_grantRole:testGrantManySuccess() (gas: 944594)
BurnMintERC20_grantRole:testGrantMintAccessSuccess() (gas: 94200)
BurnMintERC20_increaseApproval:testIncreaseApprovalSuccess() (gas: 44121)
BurnMintERC20_mint:testBasicMintSuccess() (gas: 149743)
BurnMintERC20_mint:testMaxSupplyExceededReverts() (gas: 50429)
BurnMintERC20_mint:testSenderNotMinterReverts() (gas: 14596)
BurnMintERC20_supportsInterface:testConstructorSuccess() (gas: 11123)
BurnMintERC20_transfer:testInvalidAddressReverts() (gas: 10661)
BurnMintERC20_transfer:testTransferSuccess() (gas: 42277)
BurnMintERC677_approve:testApproveSuccess() (gas: 55477)
BurnMintERC677_approve:testApproveSuccess() (gas: 55512)
BurnMintERC677_approve:testInvalidAddressReverts() (gas: 10663)
BurnMintERC677_burn:testBasicBurnSuccess() (gas: 173904)
BurnMintERC677_burn:testBurnFromZeroAddressReverts() (gas: 47223)
BurnMintERC677_burn:testBasicBurnSuccess() (gas: 173939)
BurnMintERC677_burn:testBurnFromZeroAddressReverts() (gas: 47201)
BurnMintERC677_burn:testExceedsBalanceReverts() (gas: 21841)
BurnMintERC677_burn:testSenderNotBurnerReverts() (gas: 13424)
BurnMintERC677_burnFrom:testBurnFromSuccess() (gas: 57957)
BurnMintERC677_burnFrom:testExceedsBalanceReverts() (gas: 35916)
BurnMintERC677_burnFrom:testInsufficientAllowanceReverts() (gas: 21914)
BurnMintERC677_burnFrom:testSenderNotBurnerReverts() (gas: 13424)
BurnMintERC677_burnFromAlias:testBurnFromSuccess() (gas: 57932)
BurnMintERC677_burn:testSenderNotBurnerReverts() (gas: 13359)
BurnMintERC677_burnFrom:testBurnFromSuccess() (gas: 57923)
BurnMintERC677_burnFrom:testExceedsBalanceReverts() (gas: 35864)
BurnMintERC677_burnFrom:testInsufficientAllowanceReverts() (gas: 21849)
BurnMintERC677_burnFrom:testSenderNotBurnerReverts() (gas: 13359)
BurnMintERC677_burnFromAlias:testBurnFromSuccess() (gas: 57949)
BurnMintERC677_burnFromAlias:testExceedsBalanceReverts() (gas: 35880)
BurnMintERC677_burnFromAlias:testInsufficientAllowanceReverts() (gas: 21869)
BurnMintERC677_burnFromAlias:testSenderNotBurnerReverts() (gas: 13379)
BurnMintERC677_constructor:testConstructorSuccess() (gas: 1763863)
BurnMintERC677_decreaseApproval:testDecreaseApprovalSuccess() (gas: 31088)
BurnMintERC677_grantMintAndBurnRoles:testGrantMintAndBurnRolesSuccess() (gas: 121214)
BurnMintERC677_grantRole:testGrantBurnAccessSuccess() (gas: 53477)
BurnMintERC677_grantRole:testGrantManySuccess() (gas: 937980)
BurnMintERC677_grantRole:testGrantMintAccessSuccess() (gas: 94200)
BurnMintERC677_increaseApproval:testIncreaseApprovalSuccess() (gas: 44121)
BurnMintERC677_mint:testBasicMintSuccess() (gas: 149677)
BurnMintERC677_mint:testMaxSupplyExceededReverts() (gas: 50297)
BurnMintERC677_constructor:testConstructorSuccess() (gas: 1672809)
BurnMintERC677_decreaseApproval:testDecreaseApprovalSuccess() (gas: 31069)
BurnMintERC677_grantMintAndBurnRoles:testGrantMintAndBurnRolesSuccess() (gas: 121324)
BurnMintERC677_grantRole:testGrantBurnAccessSuccess() (gas: 53460)
BurnMintERC677_grantRole:testGrantManySuccess() (gas: 937759)
BurnMintERC677_grantRole:testGrantMintAccessSuccess() (gas: 94340)
BurnMintERC677_increaseApproval:testIncreaseApprovalSuccess() (gas: 44076)
BurnMintERC677_mint:testBasicMintSuccess() (gas: 149699)
BurnMintERC677_mint:testMaxSupplyExceededReverts() (gas: 50385)
BurnMintERC677_mint:testSenderNotMinterReverts() (gas: 11195)
BurnMintERC677_supportsInterface:testConstructorSuccess() (gas: 12610)
BurnMintERC677_transfer:testInvalidAddressReverts() (gas: 10661)
BurnMintERC677_transfer:testTransferSuccess() (gas: 42277)
BurnMintERC677_supportsInterface:testConstructorSuccess() (gas: 12476)
BurnMintERC677_transfer:testInvalidAddressReverts() (gas: 10639)
BurnMintERC677_transfer:testTransferSuccess() (gas: 42299)
CallWithExactGas__callWithExactGas:test_CallWithExactGasReceiverErrorSuccess() (gas: 67209)
CallWithExactGas__callWithExactGas:test_CallWithExactGasSafeReturnDataExactGas() (gas: 18324)
CallWithExactGas__callWithExactGas:test_NoContractReverts() (gas: 11559)
Expand Down Expand Up @@ -101,11 +74,11 @@ EnumerableMapAddresses_set:testSetSuccess() (gas: 94685)
EnumerableMapAddresses_tryGet:testBytes32TryGetSuccess() (gas: 94622)
EnumerableMapAddresses_tryGet:testBytesTryGetSuccess() (gas: 96279)
EnumerableMapAddresses_tryGet:testTryGetSuccess() (gas: 94893)
OpStackBurnMintERC677_constructor:testConstructorSuccess() (gas: 1829158)
OpStackBurnMintERC677_interfaceCompatibility:testBurnCompatibility() (gas: 298741)
OpStackBurnMintERC677_interfaceCompatibility:testMintCompatibility() (gas: 138155)
OpStackBurnMintERC677_constructor:testConstructorSuccess() (gas: 1743649)
OpStackBurnMintERC677_interfaceCompatibility:testBurnCompatibility() (gas: 298649)
OpStackBurnMintERC677_interfaceCompatibility:testMintCompatibility() (gas: 137957)
OpStackBurnMintERC677_interfaceCompatibility:testStaticFunctionsCompatibility() (gas: 13781)
OpStackBurnMintERC677_supportsInterface:testConstructorSuccess() (gas: 12814)
OpStackBurnMintERC677_supportsInterface:testConstructorSuccess() (gas: 12752)
SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_EmptySubset_Reverts() (gas: 5460)
SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_EmptySuperset_Reverts() (gas: 4661)
SortedSetValidationUtil_CheckIsValidUniqueSubsetTest:test__checkIsValidUniqueSubset_HasDuplicates_Reverts() (gas: 8265)
Expand Down
14 changes: 14 additions & 0 deletions contracts/src/v0.8/ccip/interfaces/IRegistryModuleOwnerCustom.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.19;

interface IRegistryModuleOwnerCustom {
/// @notice Registers the admin of the token using the `getCCIPAdmin` method.
/// @param token The token to register the admin for.
/// @dev The caller must be the admin returned by the `getCCIPAdmin` method.
function registerAdminViaGetCCIPAdmin(address token) external;

/// @notice Registers the admin of the token using the `owner` method.
/// @param token The token to register the admin for.
/// @dev The caller must be the admin returned by the `owner` method.
function registerAdminViaOwner(address token) external;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ pragma solidity 0.8.24;
import {BurnMintERC677} from "../../../shared/token/ERC677/BurnMintERC677.sol";
import {IGetCCIPAdmin} from "../../interfaces/IGetCCIPAdmin.sol";

contract BurnMintERC677Helper is BurnMintERC677 {
contract BurnMintERC677Helper is BurnMintERC677, IGetCCIPAdmin {
constructor(string memory name, string memory symbol) BurnMintERC677(name, symbol, 18, 0) {}

// Gives one full token to any given address.
function drip(address to) external {
_mint(to, 1e18);
}

function getCCIPAdmin() external view override returns (address) {
return owner();
}
}
85 changes: 62 additions & 23 deletions contracts/src/v0.8/ccip/test/legacy/TokenPoolAndProxy.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pragma solidity ^0.8.0;
import {IPoolV1} from "../../interfaces/IPool.sol";
import {IPoolPriorTo1_5} from "../../interfaces/IPoolPriorTo1_5.sol";

import {BurnMintERC20} from "../../../shared/token/ERC20/BurnMintERC20.sol";
import {BurnMintERC677} from "../../../shared/token/ERC677/BurnMintERC677.sol";
import {Router} from "../../Router.sol";
import {Client} from "../../libraries/Client.sol";
Expand Down Expand Up @@ -113,9 +112,9 @@ contract TokenPoolAndProxyMigration is EVM2EVMOnRampSetup {
s_newPool.setPreviousPool(IPoolPriorTo1_5(address(0)));

// The new pool is now active, but is has not been given permissions to burn/mint yet
vm.expectRevert(abi.encodeWithSelector(BurnMintERC20.SenderNotBurner.selector, address(s_newPool)));
vm.expectRevert(abi.encodeWithSelector(BurnMintERC677.SenderNotBurner.selector, address(s_newPool)));
_ccipSend1_5();
vm.expectRevert(abi.encodeWithSelector(BurnMintERC20.SenderNotMinter.selector, address(s_newPool)));
vm.expectRevert(abi.encodeWithSelector(BurnMintERC677.SenderNotMinter.selector, address(s_newPool)));
_fakeReleaseOrMintFromOffRamp1_5();

// When we do give burn/mint, the new pool is fully active
Expand Down Expand Up @@ -177,9 +176,9 @@ contract TokenPoolAndProxyMigration is EVM2EVMOnRampSetup {
s_newPool.setPreviousPool(IPoolPriorTo1_5(address(0)));

// The new pool is now active, but is has not been given permissions to burn/mint yet
vm.expectRevert(abi.encodeWithSelector(BurnMintERC20.SenderNotBurner.selector, address(s_newPool)));
vm.expectRevert(abi.encodeWithSelector(BurnMintERC677.SenderNotBurner.selector, address(s_newPool)));
_ccipSend1_5();
vm.expectRevert(abi.encodeWithSelector(BurnMintERC20.SenderNotMinter.selector, address(s_newPool)));
vm.expectRevert(abi.encodeWithSelector(BurnMintERC677.SenderNotMinter.selector, address(s_newPool)));
_fakeReleaseOrMintFromOffRamp1_5();

// When we do give burn/mint, the new pool is fully active
Expand Down Expand Up @@ -362,8 +361,12 @@ contract TokenPoolAndProxy is EVM2EVMOnRampSetup {
}

function test_lockOrBurn_burnWithFromMint_Success() public {
s_pool =
new BurnWithFromMintTokenPoolAndProxy(s_token, new address[](0), address(s_mockRMN), address(s_sourceRouter));
s_pool = new BurnWithFromMintTokenPoolAndProxy(
s_token,
new address[](0),
address(s_mockRMN),
address(s_sourceRouter)
);
_configurePool();
_deployOldPool();
_assertLockOrBurnCorrect();
Expand All @@ -375,8 +378,13 @@ contract TokenPoolAndProxy is EVM2EVMOnRampSetup {
}

function test_lockOrBurn_lockRelease_Success() public {
s_pool =
new LockReleaseTokenPoolAndProxy(s_token, new address[](0), address(s_mockRMN), false, address(s_sourceRouter));
s_pool = new LockReleaseTokenPoolAndProxy(
s_token,
new address[](0),
address(s_mockRMN),
false,
address(s_sourceRouter)
);
_configurePool();
_deployOldPool();
_assertLockOrBurnCorrect();
Expand All @@ -392,11 +400,17 @@ contract TokenPoolAndProxy is EVM2EVMOnRampSetup {
s_token.grantMintAndBurnRoles(address(s_legacyPool));

TokenPool1_2.RampUpdate[] memory onRampUpdates = new TokenPool1_2.RampUpdate[](1);
onRampUpdates[0] =
TokenPool1_2.RampUpdate({ramp: address(s_pool), allowed: true, rateLimiterConfig: _getInboundRateLimiterConfig()});
onRampUpdates[0] = TokenPool1_2.RampUpdate({
ramp: address(s_pool),
allowed: true,
rateLimiterConfig: _getInboundRateLimiterConfig()
});
TokenPool1_2.RampUpdate[] memory offRampUpdates = new TokenPool1_2.RampUpdate[](1);
offRampUpdates[0] =
TokenPool1_2.RampUpdate({ramp: address(s_pool), allowed: true, rateLimiterConfig: _getInboundRateLimiterConfig()});
offRampUpdates[0] = TokenPool1_2.RampUpdate({
ramp: address(s_pool),
allowed: true,
rateLimiterConfig: _getInboundRateLimiterConfig()
});
BurnMintTokenPool1_2(address(s_legacyPool)).applyRampUpdates(onRampUpdates, offRampUpdates);
}

Expand Down Expand Up @@ -507,8 +521,13 @@ contract TokenPoolAndProxy is EVM2EVMOnRampSetup {
}

function test_setPreviousPool_Success() public {
LockReleaseTokenPoolAndProxy pool =
new LockReleaseTokenPoolAndProxy(s_token, new address[](0), address(s_mockRMN), true, address(s_sourceRouter));
LockReleaseTokenPoolAndProxy pool = new LockReleaseTokenPoolAndProxy(
s_token,
new address[](0),
address(s_mockRMN),
true,
address(s_sourceRouter)
);

assertEq(pool.getPreviousPool(), address(0));

Expand Down Expand Up @@ -540,13 +559,23 @@ contract LockReleaseTokenPoolAndProxySetup is RouterSetup {
RouterSetup.setUp();
s_token = new BurnMintERC677("LINK", "LNK", 18, 0);
deal(address(s_token), OWNER, type(uint256).max);
s_lockReleaseTokenPoolAndProxy =
new LockReleaseTokenPoolAndProxy(s_token, new address[](0), address(s_mockRMN), true, address(s_sourceRouter));
s_lockReleaseTokenPoolAndProxy = new LockReleaseTokenPoolAndProxy(
s_token,
new address[](0),
address(s_mockRMN),
true,
address(s_sourceRouter)
);

s_allowedList.push(USER_1);
s_allowedList.push(DUMMY_CONTRACT_ADDRESS);
s_lockReleaseTokenPoolAndProxyWithAllowList =
new LockReleaseTokenPoolAndProxy(s_token, s_allowedList, address(s_mockRMN), true, address(s_sourceRouter));
s_lockReleaseTokenPoolAndProxyWithAllowList = new LockReleaseTokenPoolAndProxy(
s_token,
s_allowedList,
address(s_mockRMN),
true,
address(s_sourceRouter)
);

TokenPool.ChainUpdate[] memory chainUpdate = new TokenPool.ChainUpdate[](1);
chainUpdate[0] = TokenPool.ChainUpdate({
Expand Down Expand Up @@ -589,8 +618,13 @@ contract LockReleaseTokenPoolPoolAndProxy_canAcceptLiquidity is LockReleaseToken
function test_CanAcceptLiquidity_Success() public {
assertEq(true, s_lockReleaseTokenPoolAndProxy.canAcceptLiquidity());

s_lockReleaseTokenPoolAndProxy =
new LockReleaseTokenPoolAndProxy(s_token, new address[](0), address(s_mockRMN), false, address(s_sourceRouter));
s_lockReleaseTokenPoolAndProxy = new LockReleaseTokenPoolAndProxy(
s_token,
new address[](0),
address(s_mockRMN),
false,
address(s_sourceRouter)
);
assertEq(false, s_lockReleaseTokenPoolAndProxy.canAcceptLiquidity());
}
}
Expand Down Expand Up @@ -622,8 +656,13 @@ contract LockReleaseTokenPoolPoolAndProxy_provideLiquidity is LockReleaseTokenPo
}

function test_LiquidityNotAccepted_Revert() public {
s_lockReleaseTokenPoolAndProxy =
new LockReleaseTokenPoolAndProxy(s_token, new address[](0), address(s_mockRMN), false, address(s_sourceRouter));
s_lockReleaseTokenPoolAndProxy = new LockReleaseTokenPoolAndProxy(
s_token,
new address[](0),
address(s_mockRMN),
false,
address(s_sourceRouter)
);

vm.expectRevert(LockReleaseTokenPoolAndProxy.LiquidityNotAccepted.selector);
s_lockReleaseTokenPoolAndProxy.provideLiquidity(1);
Expand Down
Loading

0 comments on commit 90ee01d

Please sign in to comment.