-
Notifications
You must be signed in to change notification settings - Fork 410
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: deploy pzEth staging #5079
Draft
ltyu
wants to merge
12
commits into
main
Choose a base branch
from
ltyu/deploy-pzEth-staging
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+138
−87
Draft
Changes from 3 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
2b36963
Split safes and tokens to separate environments (staging and prod). A…
ltyu 0f9578a
Revert "Split safes and tokens to separate environments (staging and …
ltyu 4a37858
Move staging safes
ltyu a17a882
Merge branch 'main' into ltyu/deploy-pzEth-staging
ltyu a7bbd52
Revert "Move staging safes"
ltyu e8ea443
Add getRenzoEZETHWarpConfigGenerator
ltyu f46f2df
Move functions around in attempt to reduce diffs
ltyu 5ef2b24
Move functions around in attempt to reduce diffs
ltyu 93caee9
Revert "Move functions around in attempt to reduce diffs"
ltyu 6c28235
Revert "Move functions around in attempt to reduce diffs"
ltyu 31187ae
Export chainsToDeploy
ltyu 5ed5086
Add Staging config generator
ltyu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,15 +10,14 @@ import { assert, symmetricDifference } from '@hyperlane-xyz/utils'; | |
|
||
import { getEnvironmentConfig } from '../../../../../scripts/core-utils.js'; | ||
import { getRegistry as getMainnet3Registry } from '../../chains.js'; | ||
import { safes } from '../../owners.js'; | ||
|
||
import { | ||
ezEthSafes, | ||
ezEthValidators, | ||
getRenzoHook, | ||
} from './getRenzoEZETHWarpConfig.js'; | ||
|
||
const lockbox = '0xbC5511354C4A9a50DE928F56DB01DD327c4e56d5'; | ||
const xERC20 = '0x9cb41CD74D01ae4b4f640EC40f7A60cA1bCF83E7'; | ||
const lockboxChain = 'ethereum'; | ||
// over the default 100k to account for xerc20 gas + ISM overhead over the default ISM https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/49f41d9759fd515bfd89e6e22e799c41b27b4119/typescript/sdk/src/router/GasRouterDeployer.ts#L14 | ||
const warpRouteOverheadGas = 200_000; | ||
|
@@ -31,26 +30,140 @@ const pzEthValidators = { | |
swell: ezEthValidators.swell, | ||
}; | ||
|
||
const pzEthSafes: Record<string, string> = { | ||
ethereum: ezEthSafes.ethereum, | ||
zircuit: ezEthSafes.zircuit, | ||
swell: ezEthSafes.swell, | ||
}; | ||
export const getRenzoPZETHWarpConfig = async (): Promise< | ||
ChainMap<HypTokenRouterConfig> | ||
> => { | ||
const lockbox = '0xbC5511354C4A9a50DE928F56DB01DD327c4e56d5'; | ||
const xERC20 = '0x9cb41CD74D01ae4b4f640EC40f7A60cA1bCF83E7'; | ||
|
||
const pzEthSafes: Record<string, string> = { | ||
ethereum: ezEthSafes.ethereum, | ||
zircuit: ezEthSafes.zircuit, | ||
swell: ezEthSafes.swell, | ||
}; | ||
|
||
const existingProxyAdmins: ChainMap<{ address: string; owner: string }> = { | ||
ethereum: { | ||
address: '0x4f4671Ce69c9af15e33eB7Cf6D1358d1B39Af3bF', | ||
owner: '0xD1e6626310fD54Eceb5b9a51dA2eC329D6D4B68A', | ||
}, | ||
zircuit: { | ||
address: '0x8b789B4A56675240c9f0985B467752b870c75711', | ||
owner: '0x8410927C286A38883BC23721e640F31D3E3E79F8', | ||
}, | ||
}; | ||
|
||
const existingProxyAdmins: ChainMap<{ address: string; owner: string }> = { | ||
ethereum: { | ||
address: '0x4f4671Ce69c9af15e33eB7Cf6D1358d1B39Af3bF', | ||
owner: '0xD1e6626310fD54Eceb5b9a51dA2eC329D6D4B68A', | ||
}, | ||
zircuit: { | ||
address: '0x8b789B4A56675240c9f0985B467752b870c75711', | ||
owner: '0x8410927C286A38883BC23721e640F31D3E3E79F8', | ||
}, | ||
const config = getEnvironmentConfig('mainnet3'); | ||
const multiProvider = await config.getMultiProvider(); | ||
const registry = await getMainnet3Registry(); | ||
|
||
const validatorDiff = symmetricDifference( | ||
new Set(chainsToDeploy), | ||
new Set(Object.keys(pzEthValidators)), | ||
); | ||
const safeDiff = symmetricDifference( | ||
new Set(chainsToDeploy), | ||
new Set(Object.keys(pzEthSafes)), | ||
); | ||
if (validatorDiff.size > 0) { | ||
throw new Error( | ||
`chainsToDeploy !== validatorConfig, diff is ${Array.from( | ||
validatorDiff, | ||
).join(', ')}`, | ||
); | ||
} | ||
if (safeDiff.size > 0) { | ||
throw new Error( | ||
`chainsToDeploy !== safeDiff, diff is ${Array.from(safeDiff).join(', ')}`, | ||
); | ||
} | ||
|
||
const tokenConfig = Object.fromEntries<HypTokenRouterConfig>( | ||
await Promise.all( | ||
chainsToDeploy.map( | ||
async (chain): Promise<[string, HypTokenRouterConfig]> => { | ||
const addresses = await registry.getChainAddresses(chain); | ||
assert(addresses, 'No addresses in Registry'); | ||
const { mailbox } = addresses; | ||
|
||
const mailboxContract = Mailbox__factory.connect( | ||
mailbox, | ||
multiProvider.getProvider(chain), | ||
); | ||
const defaultHook = await mailboxContract.defaultHook(); | ||
const ret: [string, HypTokenRouterConfig] = [ | ||
chain, | ||
{ | ||
isNft: false, | ||
type: | ||
chain === lockboxChain | ||
? TokenType.XERC20Lockbox | ||
: TokenType.XERC20, | ||
token: chain === lockboxChain ? lockbox : xERC20, | ||
owner: pzEthSafes[chain], | ||
gas: warpRouteOverheadGas, | ||
mailbox, | ||
interchainSecurityModule: { | ||
type: IsmType.AGGREGATION, | ||
threshold: 2, | ||
modules: [ | ||
{ | ||
type: IsmType.ROUTING, | ||
owner: pzEthSafes[chain], | ||
domains: buildAggregationIsmConfigs( | ||
chain, | ||
chainsToDeploy, | ||
pzEthValidators, | ||
), | ||
}, | ||
{ | ||
type: IsmType.FALLBACK_ROUTING, | ||
domains: {}, | ||
owner: pzEthSafes[chain], | ||
}, | ||
], | ||
}, | ||
hook: getRenzoHook(defaultHook, chain), | ||
proxyAdmin: existingProxyAdmins[chain], | ||
}, | ||
]; | ||
|
||
return ret; | ||
}, | ||
), | ||
), | ||
); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this changing so much? |
||
|
||
return tokenConfig; | ||
}; | ||
|
||
export const getRenzoPZETHWarpConfig = async (): Promise< | ||
export const getRenzoPZETHWarpConfigStaging = async (): Promise< | ||
ChainMap<HypTokenRouterConfig> | ||
> => { | ||
const lockbox = '0xbC5511354C4A9a50DE928F56DB01DD327c4e56d5'; // TODO | ||
const xERC20 = '0x9cb41CD74D01ae4b4f640EC40f7A60cA1bCF83E7'; // TODO | ||
|
||
// TODO DEPLOY REAL ONES | ||
const stagingSafes = { | ||
ethereum: '0xA9421c6F339eC414b7e77449986bE9C2Ae430C25', | ||
bsc: '0xA9421c6F339eC414b7e77449986bE9C2Ae430C25', | ||
arbitrum: '0xA9421c6F339eC414b7e77449986bE9C2Ae430C25', | ||
optimism: '0xA9421c6F339eC414b7e77449986bE9C2Ae430C25', | ||
blast: '0xA9421c6F339eC414b7e77449986bE9C2Ae430C25', | ||
linea: '0xA9421c6F339eC414b7e77449986bE9C2Ae430C25', | ||
base: '0xA9421c6F339eC414b7e77449986bE9C2Ae430C25', | ||
mode: '0xf40b75fb85C3bEc70D75A1B45ef08FC48Db61115', | ||
swell: '0xf40b75fb85C3bEc70D75A1B45ef08FC48Db61115', | ||
fraxtal: '0xf40b75fb85C3bEc70D75A1B45ef08FC48Db61115', | ||
zircuit: '0xf40b75fb85C3bEc70D75A1B45ef08FC48Db61115', | ||
}; | ||
ltyu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const pzEthSafes: Record<string, string> = { | ||
ethereum: stagingSafes.ethereum, | ||
zircuit: stagingSafes.zircuit, | ||
swell: stagingSafes.swell, | ||
}; | ||
|
||
const config = getEnvironmentConfig('mainnet3'); | ||
const multiProvider = await config.getMultiProvider(); | ||
const registry = await getMainnet3Registry(); | ||
|
@@ -122,7 +235,6 @@ export const getRenzoPZETHWarpConfig = async (): Promise< | |
], | ||
}, | ||
hook: getRenzoHook(defaultHook, chain), | ||
proxyAdmin: existingProxyAdmins[chain], | ||
}, | ||
]; | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this removed?