Skip to content

Commit

Permalink
Merge pull request #28 from bgd-labs/feat/script-to-change-owner-guar…
Browse files Browse the repository at this point in the history
…dians

feat: add script to change owner and guardian on adi / gov contracts
  • Loading branch information
sendra authored Aug 8, 2024
2 parents bfaf9d4 + 3692b76 commit 884db49
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 18 deletions.
1 change: 0 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
[submodule "lib/aave-helpers"]
path = lib/aave-helpers
url = https://github.com/bgd-labs/aave-helpers
branch = fix/e2e-fix-forwarder-diff-zksync
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -270,3 +270,6 @@ deploy-ccc-shuffle-payload:

deploy-zksync-path-payload:
$(call deploy_fn,payloads/adapters/zksync/Network_Deployments,ethereum)

update-owners-and-guardians:
$(call deploy_fn,helpers/Update_Ownership,zksync)
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata="none"
solc = "0.8.19"
ffi = true

[profile.default.zksync]
[profile.zksync.zksync]
fallback_oz = true
mode = "3"
zksolc="1.4.1"
Expand Down
2 changes: 1 addition & 1 deletion lib/aave-helpers
Submodule aave-helpers updated 46 files
+2 −0 .env.example
+7 −0 .github/workflows/merge-main.yml
+1 −0 .gitignore
+0 −1 .gitmodules
+17 −0 foundry.toml
+1 −1 lib/aave-address-book
+1 −1 lib/forge-std
+1 −1 lib/solidity-utils
+6 −1 scripts/AaveV2ConfigEngine.s.sol
+1 −3 scripts/DeployBridges.s.sol
+1 −1 scripts/FreezingStewards.s.sol
+1 −1 scripts/RiskStewards.s.sol
+5 −1 scripts/V2RateStrategyFactory.s.sol
+1 −1 scripts/VotingScripts.s.sol
+1 −138 src/ChainIds.sol
+207 −0 src/CollectorUtils.sol
+1 −1 src/CommonTestBase.sol
+1 −1 src/GovHelpers.sol
+85 −2 src/GovV3Helpers.sol
+1 −1 src/ProtocolV2TestBase.sol
+1 −1 src/ProtocolV3TestBase.sol
+1 −160 src/ScriptUtils.sol
+0 −15 src/adi/BaseADIPayloadUpdate.sol
+0 −27 src/adi/BaseAdaptersUpdate.sol
+0 −48 src/adi/BaseCCCUpdate.sol
+0 −47 src/adi/BaseForwarderAdaptersUpdate.sol
+0 −48 src/adi/BaseReceiverAdaptersUpdate.sol
+0 −48 src/adi/SimpleAddForwarderAdapter.sol
+0 −160 src/adi/SimpleOneToManyAdapterUpdate.sol
+0 −86 src/adi/SimpleReceiverAdapterUpdate.sol
+0 −13 src/adi/interfaces/IBaseAdaptersUpdate.sol
+0 −35 src/adi/interfaces/IBaseForwarderAdaptersUpdate.sol
+0 −34 src/adi/interfaces/IBaseReceiverAdaptersUpdate.sol
+0 −682 src/adi/test/ADITestBase.sol
+1 −1 src/bridges/arbitrum/AaveArbEthERC20Bridge.sol
+1 −1 src/bridges/optimism/AaveOpEthERC20Bridge.sol
+1 −1 src/bridges/polygon/AavePolEthERC20Bridge.sol
+1 −1 src/bridges/polygon/AavePolEthPlasmaBridge.sol
+2 −0 src/interfaces/IChainlinkAggregator.sol
+15 −0 src/v3-config-engine/AaveV3PayloadZkSync.sol
+199 −0 tests/CollectorUtils.t.sol
+0 −158 tests/adi/SimpleOneToManyAdapterUpdatePayloadTest.t.sol
+0 −109 tests/adi/mocks/AdapterMock.sol
+0 −31 tests/adi/mocks/AdaptersByteCode.sol
+481 −0 zksync/src/ProtocolV3TestBase.sol
+421 −0 zksync/src/SnapshotHelpersV3.sol
2 changes: 1 addition & 1 deletion remappings.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
solidity-utils/=lib/aave-delivery-infrastructure/lib/solidity-utils/src/
solidity-utils/=lib/aave-helpers/lib/solidity-utils/src/
forge-std/=lib/aave-helpers/lib/forge-std/src/
openzeppelin-contracts/=lib/aave-delivery-infrastructure/lib/openzeppelin-contracts/
aave-helpers/=lib/aave-helpers/src/
Expand Down
2 changes: 1 addition & 1 deletion scripts/InitialDeployments.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ contract Zksync is BaseInitialDeployment {
// }

function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.ZK_SYNC;
return ChainIds.ZKSYNC;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,6 @@ contract Zksync is DeployGranularGuardian {
}

function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.ZK_SYNC;
return ChainIds.ZKSYNC;
}
}
10 changes: 5 additions & 5 deletions scripts/adapters/DeployZkSyncAdapter.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import '../BaseDeployerScript.sol';

abstract contract DeployZkSyncAdapter is BaseDeployerScript, BaseZkSyncAdapter {
function _execute(Addresses memory addresses) internal virtual override {
if (TRANSACTION_NETWORK() == ChainIds.ZK_SYNC) {
if (TRANSACTION_NETWORK() == ChainIds.ZKSYNC) {
addresses.zksyncAdapter = _deployWithoutCreate2(
BaseAdapterArgs({
crossChainController: addresses.crossChainController,
Expand All @@ -31,7 +31,7 @@ contract Ethereum is DeployZkSyncAdapter {
}

function REFUND_ADDRESS() internal view override returns (address) {
Addresses memory remoteAddresses = _getAddresses(ChainIds.ZK_SYNC);
Addresses memory remoteAddresses = _getAddresses(ChainIds.ZKSYNC);
return remoteAddresses.crossChainController;
}

Expand All @@ -46,7 +46,7 @@ contract Ethereum is DeployZkSyncAdapter {

contract Zksync is DeployZkSyncAdapter {
function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.ZK_SYNC;
return ChainIds.ZKSYNC;
}

function REMOTE_CCC_BY_NETWORK() internal view override returns (RemoteCCC[] memory) {
Expand All @@ -68,7 +68,7 @@ contract Ethereum_testnet is DeployZkSyncAdapter {
}

function REFUND_ADDRESS() internal view override returns (address) {
Addresses memory remoteAddresses = _getAddresses(TestNetChainIds.ZK_SYNC_SEPOLIA);
Addresses memory remoteAddresses = _getAddresses(TestNetChainIds.ZKSYNC_SEPOLIA);
return remoteAddresses.crossChainController;
}

Expand All @@ -87,7 +87,7 @@ contract Ethereum_testnet is DeployZkSyncAdapter {

contract Zksync_testnet is DeployZkSyncAdapter {
function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return TestNetChainIds.ZK_SYNC_SEPOLIA;
return TestNetChainIds.ZKSYNC_SEPOLIA;
}

function REMOTE_CCC_BY_NETWORK() internal view override returns (RemoteCCC[] memory) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/ccc/DeployCCC.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ contract Celo is BaseCCCNetworkDeployment {

contract Zksync is BaseCCCNetworkDeployment {
function TRANSACTION_NETWORK() internal pure override returns (uint256) {
return ChainIds.ZK_SYNC;
return ChainIds.ZKSYNC;
}
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/ccc/Set_CCF_Sender_Adapters.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ contract Ethereum is BaseCCFSenderAdapters {
zkevm: _getAddresses(ChainIds.POLYGON_ZK_EVM),
scroll: _getAddresses(ChainIds.SCROLL),
celo: _getAddresses(ChainIds.CELO),
zksync: _getAddresses(ChainIds.ZK_SYNC)
zksync: _getAddresses(ChainIds.ZKSYNC)
});

// polygon path
Expand Down
2 changes: 1 addition & 1 deletion scripts/ccc/Set_CCR_Confirmations.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ contract Celo is BaseSetCCRConfirmations {

contract Zksync is BaseSetCCRConfirmations {
function TRANSACTION_NETWORK() internal pure virtual override returns (uint256) {
return ChainIds.ZK_SYNC;
return ChainIds.ZKSYNC;
}

function getConfirmationsByChainIds()
Expand Down
2 changes: 1 addition & 1 deletion scripts/ccc/Set_CCR_Receivers_Adapters.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ contract Celo is BaseSetCCRAdapters {

contract Zksync is BaseSetCCRAdapters {
function TRANSACTION_NETWORK() internal pure virtual override returns (uint256) {
return ChainIds.ZK_SYNC;
return ChainIds.ZKSYNC;
}

function getChainIds() public pure virtual override returns (uint256[] memory) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/helpers/Deploy_Mock_destination.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ contract Scroll is BaseMockDestination {

contract Zksync is BaseMockDestination {
function TRANSACTION_NETWORK() internal pure virtual override returns (uint256) {
return ChainIds.ZK_SYNC;
return ChainIds.ZKSYNC;
}
}

Expand Down
31 changes: 31 additions & 0 deletions scripts/helpers/Update_Ownership.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

// This Scripts change the ownership of the V3 contracts from Deployer to the correct addresses. For most of the cases
// ownership will be changed to executor lvl1, and guardian to the aave safes.

import {ZkSyncScript} from 'solidity-utils/contracts/utils/ScriptUtils.sol';
import {OwnableWithGuardian} from 'solidity-utils/contracts/access-control/OwnableWithGuardian.sol';
import {GovernanceV3ZkSync} from 'aave-address-book/AaveAddressBook.sol';

contract ZkSync is ZkSyncScript {
function run() external {
vm.startBroadcast();
OwnableWithGuardian(address(GovernanceV3ZkSync.PAYLOADS_CONTROLLER)).transferOwnership(
GovernanceV3ZkSync.EXECUTOR_LVL_1
);
OwnableWithGuardian(address(GovernanceV3ZkSync.PAYLOADS_CONTROLLER)).updateGuardian(
GovernanceV3ZkSync.GOVERNANCE_GUARDIAN
);

OwnableWithGuardian(GovernanceV3ZkSync.CROSS_CHAIN_CONTROLLER).updateGuardian(
GovernanceV3ZkSync.GRANULAR_GUARDIAN
);

OwnableWithGuardian(GovernanceV3ZkSync.CROSS_CHAIN_CONTROLLER).transferOwnership(
GovernanceV3ZkSync.EXECUTOR_LVL_1
);

vm.stopBroadcast();
}
}
2 changes: 1 addition & 1 deletion scripts/payloads/adapters/zksync/Network_Deployments.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ contract Ethereum is Base_Deploy_Add_ZkSync_Path_Payload {
}

function DESTINATION_CHAIN_ID() internal pure override returns (uint256) {
return ChainIds.ZK_SYNC;
return ChainIds.ZKSYNC;
}
}

0 comments on commit 884db49

Please sign in to comment.