diff --git a/Makefile b/Makefile index 5553da4..3f8ac22 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ BASE_KEY = --private-key ${PRIVATE_KEY} -custom_ethereum := --with-gas-price 30000000000 # 53 gwei +custom_ethereum := --with-gas-price 20000000000 # 53 gwei #custom_polygon := --with-gas-price 190000000000 # 560 gwei #custom_avalanche := --with-gas-price 27000000000 # 27 gwei #custom_metis-testnet := --legacy --verifier-url https://goerli.explorer.metisdevops.link/api/ @@ -280,5 +280,8 @@ deploy-ccc-shuffle-payload: deploy-zksync-path-payload: $(call deploy_fn,payloads/adapters/zksync/Network_Deployments,ethereum) +deploy-linea-path-payload: + $(call deploy_fn,payloads/adapters/ethereum/Network_Deployments,ethereum) + update-owners-and-guardians: $(call deploy_fn,helpers/Update_Ownership,zksync) diff --git a/deployments/linea.json b/deployments/linea.json index 1e9c271..41890f2 100644 --- a/deployments/linea.json +++ b/deployments/linea.json @@ -9,7 +9,7 @@ "crossChainControllerImpl": "0xcb5C27e1EF28949b354904ee8D3088330D806a6f", "emergencyRegistry": "0x0000000000000000000000000000000000000000", "gnosisAdapter": "0x0000000000000000000000000000000000000000", - "granularCCCGuardian": "0x8CAdaAE6cd278c7C8FBaD5d6F55Ca6129A627E10", + "granularCCCGuardian": "0xc1cd6faF6e9138b4e6C21d438f9ebF2bd6F6cA16", "guardian": "0xEAF6183bAb3eFD3bF856Ac5C058431C8592394d6", "hlAdapter": "0x0000000000000000000000000000000000000000", "lineaAdapter": "0xB3332d31ECFC3ef3BF6Cda79833D11d1A53f5cE6", diff --git a/diffs/adi_add_linea_path_to_adiethereum_before_adi_add_linea_path_to_adiethereum_after.md b/diffs/adi_add_linea_path_to_adiethereum_before_adi_add_linea_path_to_adiethereum_after.md new file mode 100644 index 0000000..d665da9 --- /dev/null +++ b/diffs/adi_add_linea_path_to_adiethereum_before_adi_add_linea_path_to_adiethereum_after.md @@ -0,0 +1,14 @@ +## Raw diff + +```json +{ + "forwarderAdaptersByChain": { + "59144": { + "from": "", + "to": { + "0x8097555ffDa4176C93FEf92dF473b9763e467686": "0xB3332d31ECFC3ef3BF6Cda79833D11d1A53f5cE6" + } + } + } +} +``` \ No newline at end of file diff --git a/foundry.toml b/foundry.toml index f9a7acc..8c7600f 100644 --- a/foundry.toml +++ b/foundry.toml @@ -11,7 +11,6 @@ metadata="none" solc = "0.8.20" ffi = true -#evm_version = 'london' [profile.zksync.zksync] fallback_oz = true diff --git a/scripts/access_control/network_scripts/GranularGuardianNetworkDeploys.s.sol b/scripts/access_control/network_scripts/GranularGuardianNetworkDeploys.s.sol index 8d43ca6..22e50f9 100644 --- a/scripts/access_control/network_scripts/GranularGuardianNetworkDeploys.s.sol +++ b/scripts/access_control/network_scripts/GranularGuardianNetworkDeploys.s.sol @@ -231,7 +231,7 @@ contract Linea is DeployGranularGuardian { } function SOLVE_EMERGENCY_GUARDIAN() internal pure override returns (address) { - return 0x0BF186764D8333a938f35e5dD124a7b9b9dccDF9; // dao guardian + return 0x056E4C4E80D1D14a637ccbD0412CDAAEc5B51F4E; // dao governance guardian } function TRANSACTION_NETWORK() internal pure override returns (uint256) { diff --git a/scripts/payloads/adapters/ethereum/Ethereum_Activate_Lina_Bridge_Adapter_Payload.s.sol b/scripts/payloads/adapters/ethereum/Ethereum_Activate_Lina_Bridge_Adapter_Payload.s.sol new file mode 100644 index 0000000..fb3bc7e --- /dev/null +++ b/scripts/payloads/adapters/ethereum/Ethereum_Activate_Lina_Bridge_Adapter_Payload.s.sol @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import '../../../BaseDeployerScript.sol'; +import '../../../../src/templates/SimpleAddForwarderAdapter.sol'; + +abstract contract Ethereum_Activate_Lina_Bridge_Adapter_Payload is BaseDeployerScript { + function _getPayloadByteCode() internal virtual returns (bytes memory); + + function PAYLOAD_SALT() internal pure virtual returns (string memory) { + return 'Add Linea path to a.DI'; + } + + function DESTINATION_CHAIN_ID() internal pure virtual returns (uint256); + + function _deployPayload(AddForwarderAdapterArgs memory args) internal returns (address) { + bytes memory payloadCode = abi.encodePacked(_getPayloadByteCode(), abi.encode(args)); + + return _deployByteCode(payloadCode, PAYLOAD_SALT()); + } + + function _execute(Addresses memory addresses) internal virtual override { + Addresses memory destinationAddresses = _getAddresses(DESTINATION_CHAIN_ID()); + + _deployPayload( + AddForwarderAdapterArgs({ + crossChainController: addresses.crossChainController, + currentChainBridgeAdapter: addresses.lineaAdapter, + destinationChainBridgeAdapter: destinationAddresses.lineaAdapter, + destinationChainId: DESTINATION_CHAIN_ID() + }) + ); + } +} diff --git a/scripts/payloads/adapters/ethereum/Network_Deployments.s.sol b/scripts/payloads/adapters/ethereum/Network_Deployments.s.sol new file mode 100644 index 0000000..dd8fa70 --- /dev/null +++ b/scripts/payloads/adapters/ethereum/Network_Deployments.s.sol @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import './Ethereum_Activate_Lina_Bridge_Adapter_Payload.s.sol'; + +contract Ethereum is Ethereum_Activate_Lina_Bridge_Adapter_Payload { + function TRANSACTION_NETWORK() internal pure override returns (uint256) { + return ChainIds.ETHEREUM; + } + + function _getPayloadByteCode() internal pure override returns (bytes memory) { + return type(SimpleAddForwarderAdapter).creationCode; + } + + function DESTINATION_CHAIN_ID() internal pure override returns (uint256) { + return ChainIds.LINEA; + } +} diff --git a/tests/access_control/GranularGuardianDeployTest.t.sol b/tests/access_control/GranularGuardianDeployTest.t.sol index cc491ab..781ab79 100644 --- a/tests/access_control/GranularGuardianDeployTest.t.sol +++ b/tests/access_control/GranularGuardianDeployTest.t.sol @@ -526,7 +526,7 @@ contract CBaseGGTest is Base, BaseGGTest('base', 15896446) { } } -contract LineaGGTest is Linea, BaseGGTest('linea', 13215719) { +contract LineaGGTest is Linea, BaseGGTest('linea', 13223742) { function CROSS_CHAIN_CONTROLLER() internal view override returns (address) { return _getAddresses(TRANSACTION_NETWORK()).crossChainController; } diff --git a/tests/adi/ADITestBase.sol b/tests/adi/ADITestBase.sol index 2e027c8..e237f83 100644 --- a/tests/adi/ADITestBase.sol +++ b/tests/adi/ADITestBase.sol @@ -19,6 +19,7 @@ import {GovernanceV3Base} from 'aave-address-book/GovernanceV3Base.sol'; import {GovernanceV3Arbitrum} from 'aave-address-book/GovernanceV3Arbitrum.sol'; import {GovernanceV3Gnosis} from 'aave-address-book/GovernanceV3Gnosis.sol'; import {GovernanceV3Scroll} from 'aave-address-book/GovernanceV3Scroll.sol'; +//import {GovernanceV3Linea} from 'aave-address-book/GovernanceV3Linea.sol'; import {IBaseAdapter} from 'aave-address-book/common/IBaseAdapter.sol'; contract ADITestBase is Test { @@ -586,7 +587,7 @@ contract ADITestBase is Test { uint256 chainId ) internal pure returns (uint256[] memory) { if (chainId == ChainIds.MAINNET) { - uint256[] memory chainIds = new uint256[](10); + uint256[] memory chainIds = new uint256[](11); chainIds[0] = ChainIds.MAINNET; chainIds[1] = ChainIds.POLYGON; chainIds[2] = ChainIds.AVALANCHE; @@ -597,6 +598,7 @@ contract ADITestBase is Test { chainIds[7] = ChainIds.METIS; chainIds[8] = ChainIds.BASE; chainIds[9] = ChainIds.SCROLL; + chainIds[10] = ChainIds.LINEA; return chainIds; } else if (chainId == ChainIds.POLYGON) { @@ -672,6 +674,8 @@ contract ADITestBase is Test { return GovernanceV3Gnosis.CROSS_CHAIN_CONTROLLER; } else if (chainId == ChainIds.SCROLL) { return GovernanceV3Scroll.CROSS_CHAIN_CONTROLLER; + } else if (chainId == ChainIds.LINEA) { + return 0x0D3f821e9741C8a8Bcac231162320251Db0cdf52; } revert(); } diff --git a/tests/payloads/ethereum/AddLineaPathTest.t.sol b/tests/payloads/ethereum/AddLineaPathTest.t.sol new file mode 100644 index 0000000..b84ba93 --- /dev/null +++ b/tests/payloads/ethereum/AddLineaPathTest.t.sol @@ -0,0 +1,92 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity ^0.8.0; + +import 'forge-std/console.sol'; +import {ADITestBase} from '../../adi/ADITestBase.sol'; +import {Addresses, Ethereum as PayloadEthereumScript} from '../../../scripts/payloads/adapters/ethereum/Network_Deployments.s.sol'; +import '../../../src/templates/SimpleAddForwarderAdapter.sol'; + +abstract contract BaseAddLineaPathPayloadTest is ADITestBase { + address internal _payload; + address internal _crossChainController; + + string internal NETWORK; + uint256 internal immutable BLOCK_NUMBER; + + constructor(string memory network, uint256 blockNumber) { + NETWORK = network; + BLOCK_NUMBER = blockNumber; + } + + function _getDeployedPayload() internal virtual returns (address); + + function _getPayload() internal virtual returns (address); + + function _getCurrentNetworkAddresses() internal virtual returns (Addresses memory); + + function setUp() public { + vm.createSelectFork(vm.rpcUrl(NETWORK), BLOCK_NUMBER); + + Addresses memory addresses = _getCurrentNetworkAddresses(); + _crossChainController = addresses.crossChainController; + + _payload = _getPayload(); + } + + function test_defaultTest() public { + defaultTest( + string.concat('add_linea_path_to_adi', NETWORK), + _crossChainController, + address(_payload), + false, + vm + ); + } + + function test_samePayloadAddress( + address currentChainAdapter, + address destinationChainAdapter, + address crossChainController, + uint256 destinationChainId + ) public { + SimpleAddForwarderAdapter deployedPayload = SimpleAddForwarderAdapter(_getDeployedPayload()); + SimpleAddForwarderAdapter predictedPayload = SimpleAddForwarderAdapter(_getPayload()); + + assertEq(predictedPayload.DESTINATION_CHAIN_ID(), deployedPayload.DESTINATION_CHAIN_ID()); + assertEq(predictedPayload.CROSS_CHAIN_CONTROLLER(), deployedPayload.CROSS_CHAIN_CONTROLLER()); + assertEq( + predictedPayload.CURRENT_CHAIN_BRIDGE_ADAPTER(), + deployedPayload.CURRENT_CHAIN_BRIDGE_ADAPTER() + ); + assertEq( + predictedPayload.DESTINATION_CHAIN_BRIDGE_ADAPTER(), + deployedPayload.DESTINATION_CHAIN_BRIDGE_ADAPTER() + ); + } +} + +contract EthereumAddLineaPathPayloadTest is + PayloadEthereumScript, + BaseAddLineaPathPayloadTest('ethereum', 21386891) +{ + function _getDeployedPayload() internal pure override returns (address) { + return 0x3C2A076cD5ECbed55D8Fc0A341c14Fc808bA7fF7; + } + + function _getCurrentNetworkAddresses() internal view override returns (Addresses memory) { + return _getAddresses(TRANSACTION_NETWORK()); + } + + function _getPayload() internal override returns (address) { + Addresses memory currentAddresses = _getCurrentNetworkAddresses(); + Addresses memory destinationAddresses = _getAddresses(DESTINATION_CHAIN_ID()); + + AddForwarderAdapterArgs memory args = AddForwarderAdapterArgs({ + crossChainController: currentAddresses.crossChainController, + currentChainBridgeAdapter: 0x8097555ffDa4176C93FEf92dF473b9763e467686, // ethereum -> linea bridge adapter + destinationChainBridgeAdapter: 0xB3332d31ECFC3ef3BF6Cda79833D11d1A53f5cE6, // linea bridge adapter + destinationChainId: DESTINATION_CHAIN_ID() + }); + return _deployPayload(args); + } +}