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

feat: V1.5 pre bera fix SUP-9039 #646

Merged
merged 18 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ build-sizes: ## Builds the project and shows sizes

.PHONY: test-vvv
test-vvv: ## Runs tests with verbose output
forge test --match-test test_crossChainRebalance_updateSuperformData_allErrors --evm-version cancun -vvv
forge test --match-test test_lzConfig --evm-version cancun -vv


.PHONY: ftest
ftest: ## Runs tests with cancun evm version
Expand All @@ -141,7 +142,7 @@ coverage-t: ## Runs coverage for a specific contract

.PHONY: smoke-test
smoke-test: ## Runs smoke tests
forge test --match-contract SmokeTest -vvv
forge test --match-test test_deBridgeValidators -vvv

.PHONY: invariant
invariant: ## Runs invariant tests
Expand Down Expand Up @@ -177,3 +178,4 @@ help: ## Prints this help
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| sort \
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

147 changes: 131 additions & 16 deletions script/forge-scripts/Abstract.Deploy.Single.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ abstract contract AbstractDeploySingle is BatchScript {
address public lzV2Endpoint = 0x1a44076050125825900e736c501f859c50fE728c;
address public lzV2Endpoint_TESTNET = 0x6EDCE65403992e310A62460808c4b910D972f10f;
address public constant CHAINLINK_lzOracle = 0x150A58e9E6BF69ccEb1DBA5ae97C166DC8792539;
mapping(uint64 => mapping(uint64 => uint64)) public CONFIRMATIONS;

address[] public lzEndpoints = [
0x66A71Dcef29A0fFBDBE3c6a460a3B5BC225Cd675,
Expand Down Expand Up @@ -329,7 +330,7 @@ abstract contract AbstractDeploySingle is BatchScript {
uint64 public constant BLAST = 81_457;
uint64 public constant BARTIO = 80_084;

uint256[] public manualNonces = [20, 20, 20, 20, 19, 19, 18, 7, 1, 0, 0];
uint256[] public manualNonces = [21, 21, 21, 21, 20, 20, 19, 8, 2, 0, 0];
uint64[] public chainIds = [1, 56, 43_114, 137, 42_161, 10, 8453, 250, 59_144, 81_457, 80_084];
string[] public chainNames = [
"Ethereum",
Expand Down Expand Up @@ -612,6 +613,9 @@ abstract contract AbstractDeploySingle is BatchScript {
/// @dev 5.1- deploy Layerzero Implementation
vars.lzImplementation = address(new LayerzeroV2Implementation{ salt: salt }(vars.superRegistryC));
contracts[vars.chainId][bytes32(bytes("LayerzeroImplementation"))] = vars.lzImplementation;
LayerzeroV2Implementation(vars.lzImplementation).setDelegate(
env == 0 || env == 2 ? PROTOCOL_ADMINS[trueIndex] : PROTOCOL_ADMINS_STAGING[trueIndex]
);
if (vars.chainId != BARTIO) {
LayerzeroV2Implementation(payable(vars.lzImplementation)).setLzEndpoint(lzV2Endpoint);
} else {
Expand Down Expand Up @@ -1612,12 +1616,13 @@ abstract contract AbstractDeploySingle is BatchScript {
);

AxelarImplementation(payable(vars.axelarImplementation)).setReceiver(
vars.dstAxelarChainId, vars.dstAxelarImplementation
vars.dstAxelarChainId, address(0xDEAD)
);
}
SuperRegistry(payable(vars.superRegistry)).setRequiredMessagingQuorum(vars.dstChainId, 1);

vars.superRegistryC.batchSetAddress(ids, newAddresses, chainIdsSetAddresses);
vars.superRegistryC.setVaultLimitPerDestination(vars.dstChainId, 5);
} else {
bytes memory txn = abi.encodeWithSelector(
LayerzeroV2Implementation.setPeer.selector,
Expand Down Expand Up @@ -1701,9 +1706,7 @@ abstract contract AbstractDeploySingle is BatchScript {
}

if (DEPLOY_AXELAR) {
txn = abi.encodeWithSelector(
AxelarImplementation.setReceiver.selector, vars.dstAxelarChainId, vars.dstAxelarImplementation
);
txn = abi.encodeWithSelector(AxelarImplementation.setReceiver.selector, vars.dstAxelarChainId, 0xDEAD);
addToBatch(vars.axelarImplementation, 0, txn);

txn = abi.encodeWithSelector(
Expand Down Expand Up @@ -1959,17 +1962,17 @@ abstract contract AbstractDeploySingle is BatchScript {
priceFeeds[FANTOM][BARTIO] = 0x11DdD3d147E5b83D01cee7070027092397d63658;

/// LINEA
priceFeeds[LINEA][LINEA] = 0x3c6Cd9Cc7c7a4c2Cf5a82734CD249D7D593354dA;
priceFeeds[LINEA][OP] = 0x3c6Cd9Cc7c7a4c2Cf5a82734CD249D7D593354dA;
priceFeeds[LINEA][POLY] = 0x9ce4473B42a639d010eD741df3CA829E6e480803;
priceFeeds[LINEA][AVAX] = 0xD86d65fb17B5E0ee7152da12b4A4D31Bf5f4fDe9;
priceFeeds[LINEA][BSC] = 0x09E929D57969D8B996a62ee176Df214D87565bDE;
priceFeeds[LINEA][ETH] = 0x3c6Cd9Cc7c7a4c2Cf5a82734CD249D7D593354dA;
priceFeeds[LINEA][BASE] = 0x3c6Cd9Cc7c7a4c2Cf5a82734CD249D7D593354dA;
priceFeeds[LINEA][ARBI] = 0x3c6Cd9Cc7c7a4c2Cf5a82734CD249D7D593354dA;
priceFeeds[LINEA][FANTOM] = 0xA40819f13aece3D0C8375522bF44DCC30290f655;
priceFeeds[LINEA][BLAST] = 0x3c6Cd9Cc7c7a4c2Cf5a82734CD249D7D593354dA;
priceFeeds[LINEA][BARTIO] = 0x3c6Cd9Cc7c7a4c2Cf5a82734CD249D7D593354dA;
priceFeeds[LINEA][LINEA] = 0x22C942d2DE7673435Cc0D10278c8D5e0d8284c65;
priceFeeds[LINEA][OP] = 0x22C942d2DE7673435Cc0D10278c8D5e0d8284c65;
priceFeeds[LINEA][POLY] = 0x2AFFD07522147fba37Da08f938cA22Eaa02CEF25;
priceFeeds[LINEA][AVAX] = 0xEcD363e4ffe9D0004451648DA2b45E1158c00bF8;
priceFeeds[LINEA][BSC] = 0x7464Cc4f3100Cd2e2169d7918030025C8d3E114C;
priceFeeds[LINEA][ETH] = 0x22C942d2DE7673435Cc0D10278c8D5e0d8284c65;
priceFeeds[LINEA][BASE] = 0x22C942d2DE7673435Cc0D10278c8D5e0d8284c65;
priceFeeds[LINEA][ARBI] = 0x22C942d2DE7673435Cc0D10278c8D5e0d8284c65;
priceFeeds[LINEA][FANTOM] = 0x5CC126760258e319548fc8740d7656B08550BF54;
priceFeeds[LINEA][BLAST] = 0x22C942d2DE7673435Cc0D10278c8D5e0d8284c65;
priceFeeds[LINEA][BARTIO] = 0x22C942d2DE7673435Cc0D10278c8D5e0d8284c65;

/// BLAST
priceFeeds[BLAST][LINEA] = 0x4AB67C7e24d94bd70502c44051274195215d8071;
Expand All @@ -1996,6 +1999,118 @@ abstract contract AbstractDeploySingle is BatchScript {
priceFeeds[BARTIO][FANTOM] = address(0);
priceFeeds[BARTIO][LINEA] = 0x42324DA2cB327D9DDE198d10A7A68870d761C390;
priceFeeds[BARTIO][BLAST] = 0x42324DA2cB327D9DDE198d10A7A68870d761C390;

mapping(uint64 => mapping(uint64 => uint64)) storage confirmations = CONFIRMATIONS;

/// ETH
confirmations[ETH][BSC] = 20;
confirmations[ETH][AVAX] = 12;
confirmations[ETH][POLY] = 512;
confirmations[ETH][OP] = 20;
confirmations[ETH][ARBI] = 20;
confirmations[ETH][BASE] = 10;
confirmations[ETH][FANTOM] = 5;
confirmations[ETH][LINEA] = 20;
confirmations[ETH][BLAST] = 20;

/// BSC
confirmations[BSC][ETH] = 20;
confirmations[BSC][AVAX] = 20;
confirmations[BSC][POLY] = 20;
confirmations[BSC][OP] = 20;
confirmations[BSC][ARBI] = 20;
confirmations[BSC][BASE] = 20;
confirmations[BSC][FANTOM] = 20;
confirmations[BSC][LINEA] = 20;
confirmations[BSC][BLAST] = 20;

/// AVAX
confirmations[AVAX][ETH] = 12;
confirmations[AVAX][BSC] = 12;
confirmations[AVAX][POLY] = 12;
confirmations[AVAX][OP] = 12;
confirmations[AVAX][ARBI] = 12;
confirmations[AVAX][BASE] = 12;
confirmations[AVAX][FANTOM] = 12;
confirmations[AVAX][LINEA] = 12;
confirmations[AVAX][BLAST] = 12;

/// POLYGON
confirmations[POLY][AVAX] = 512;
confirmations[POLY][BSC] = 512;
confirmations[POLY][ETH] = 512;
confirmations[POLY][OP] = 512;
confirmations[POLY][ARBI] = 512;
confirmations[POLY][BASE] = 512;
confirmations[POLY][FANTOM] = 512;
confirmations[POLY][LINEA] = 512;
confirmations[POLY][BLAST] = 512;

/// OPTIMISM
confirmations[OP][POLY] = 20;
confirmations[OP][AVAX] = 20;
confirmations[OP][BSC] = 20;
confirmations[OP][ETH] = 20;
confirmations[OP][ARBI] = 20;
confirmations[OP][BASE] = 20;
confirmations[OP][FANTOM] = 20;
confirmations[OP][LINEA] = 20;
confirmations[OP][BLAST] = 20;

/// ARBITRUM
confirmations[ARBI][OP] = 20;
confirmations[ARBI][POLY] = 20;
confirmations[ARBI][AVAX] = 20;
confirmations[ARBI][BSC] = 20;
confirmations[ARBI][ETH] = 20;
confirmations[ARBI][BASE] = 20;
confirmations[ARBI][FANTOM] = 20;
confirmations[ARBI][LINEA] = 20;
confirmations[ARBI][BLAST] = 20;

/// BASE
confirmations[BASE][OP] = 10;
confirmations[BASE][POLY] = 10;
confirmations[BASE][AVAX] = 10;
confirmations[BASE][BSC] = 10;
confirmations[BASE][ETH] = 10;
confirmations[BASE][ARBI] = 10;
confirmations[BASE][FANTOM] = 10;
confirmations[BASE][LINEA] = 10;
confirmations[BASE][BLAST] = 10;

/// FANTOM
confirmations[FANTOM][OP] = 5;
confirmations[FANTOM][POLY] = 5;
confirmations[FANTOM][AVAX] = 5;
confirmations[FANTOM][BSC] = 5;
confirmations[FANTOM][ETH] = 5;
confirmations[FANTOM][BASE] = 5;
confirmations[FANTOM][ARBI] = 5;
confirmations[FANTOM][LINEA] = 5;
confirmations[FANTOM][BLAST] = 5;

/// LINEA
confirmations[LINEA][OP] = 10;
confirmations[LINEA][POLY] = 10;
confirmations[LINEA][AVAX] = 10;
confirmations[LINEA][BSC] = 10;
confirmations[LINEA][ETH] = 10;
confirmations[LINEA][BASE] = 10;
confirmations[LINEA][ARBI] = 10;
confirmations[LINEA][FANTOM] = 10;
confirmations[LINEA][BLAST] = 10;

/// BLAST
confirmations[BLAST][LINEA] = 15;
confirmations[BLAST][OP] = 15;
confirmations[BLAST][POLY] = 15;
confirmations[BLAST][AVAX] = 15;
confirmations[BLAST][BSC] = 15;
confirmations[BLAST][ETH] = 15;
confirmations[BLAST][BASE] = 15;
confirmations[BLAST][ARBI] = 15;
confirmations[BLAST][FANTOM] = 15;
}

/// @dev use this function for full deployments
Expand Down
11 changes: 11 additions & 0 deletions script/forge-scripts/EnvironmentUtils.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ abstract contract EnvironmentUtils is AbstractDeploySingle {
function _setEnvironment(uint256 env, bool useNewSalt) internal {
/// Production
if (env == 0) {
DEPLOY_AXELAR = true;
DEPLOY_7540 = false;
TARGET_CHAINS.push(ETH);
TARGET_CHAINS.push(BSC);
TARGET_CHAINS.push(AVAX);
Expand Down Expand Up @@ -65,6 +67,9 @@ abstract contract EnvironmentUtils is AbstractDeploySingle {
WORMHOLE_VAA_RELAYER = 0x1A86b5c1467331A3A52572663FDBf037A9e29719;
// Staging
} else if (env == 1) {
DEPLOY_AXELAR = true;
DEPLOY_7540 = true;

TARGET_CHAINS.push(BSC);
TARGET_CHAINS.push(ARBI);
TARGET_CHAINS.push(OP);
Expand Down Expand Up @@ -97,6 +102,9 @@ abstract contract EnvironmentUtils is AbstractDeploySingle {

// Tenderly
} else if (env == 2) {
DEPLOY_AXELAR = true;
DEPLOY_7540 = true;

TARGET_CHAINS.push(ETH);
TARGET_CHAINS.push(OP);
TARGET_CHAINS.push(ARBI);
Expand All @@ -123,6 +131,9 @@ abstract contract EnvironmentUtils is AbstractDeploySingle {

salt = "Tenderly";
} else if (env == 3) {
DEPLOY_AXELAR = false;
DEPLOY_7540 = false;

salt = "Testnet";

PAYMENT_ADMIN = 0xD911673eAF0D3e15fe662D58De15511c5509bAbB;
Expand Down
Loading
Loading