Repository navigation
feat(oft): deploy OFT proxies via CreateX CREATE3 for cross-chain deterministic addresses - #18
Closed
ocakciomursel-pixel wants to merge 2 commits into
Closed
ocakciomursel-pixel wants to merge 2 commits into
ocakciomursel-pixel wants to merge 2 commits into
Conversation
…erministic addresses
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="packages/bridge-contracts/deploy/deployOFT.ts" line_range="145" />
<code_context>
+ const oftAdapterProxySalt = buildCreateXSalt(root.address, `${envPrefix}-GoodDollarOFTAdapterV1`);
+ // Both proxy addresses are known before deployment, which breaks the MinterBurner <-> adapter init cycle
+ const minterBurnerAddress: string = await createX['computeCreate3Address(bytes32)'](
+ guardCreateXSalt(root.address, minterBurnerProxySalt),
);
- const oftAdapterProxySalt = ethers.BigNumber.from(
</code_context>
<issue_to_address>
**Proxy address prediction reverts**
When the OFT deployment or Celo fork test predicts a proxy address with the one-argument CreateX method, `guardCreateXSalt(...)` has already applied CreateX’s sender guard, and `computeCreate3Address(bytes32)` applies it again, so the salt’s sender prefix no longer matches and prediction reverts before proxy deployment.
Pass the raw proxy salt to `computeCreate3Address(bytes32)` and let CreateX apply its guard once.
Also at `packages/bridge-contracts/test/GoodDollarOFT.e2e.test.ts:459-464`, `packages/bridge-contracts/deploy/deployOFT.ts:147-149`.
</issue_to_address>
### Comment 2
<location path="packages/bridge-contracts/deploy/deployOFT.ts" line_range="152-160" />
<code_context>
- const deployProxyIfMissing = async (name: string, address: string, salt: BigNumber, logic: string, initData: string) => {
+ const deployProxyIfMissing = async (name: string, address: string, salt: string, logic: string, initData: string) => {
if ((await ethers.provider.getCode(address)) !== '0x') {
console.log(`${name} proxy already deployed`, address);
} else {
- const tx = await proxyFactory.deployProxy(salt, logic, initData);
+ const proxyInitCall = proxyInterface.encodeFunctionData('initialize', [logic, initData]);
+ const tx = await createX.deployCreate3AndInit(salt, proxyArtifact.bytecode, proxyInitCall, {
+ constructorAmount: 0,
+ initCallAmount: 0,
+ });
await tx.wait();
console.log(`${name} proxy deployed and initialized`, address, tx.hash);
}
</code_context>
<issue_to_address>
**Concurrent deployments abort one run**
When two `deployOFT` runs for the same network and signer start before either run's proxy transaction is mined, `deployProxyIfMissing` checks for missing code and then submits `deployCreate3AndInit` without handling a competing deployment. When two runs use the same signer and salt, the first transaction deploys the proxy and the second reverts; the losing run exits before deploying the remaining proxy, so its deployment job reports failure despite the proxy now existing.
Serialize deployments for a network, or handle a failed create by rechecking the predicted address and continuing only if the deployed proxy passes the expected initialization and implementation checks.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 2 findings to address first, and the script now deploys and initializes persistent proxies through CreateX at addresses derived from the new salt scheme. If that derivation or initialization is wrong but succeeds, reverting the script will not remove or repair the deployed proxy state; remediation may require an upgrade or a separate deployment.
Blocking findings: packages/bridge-contracts/deploy/deployOFT.ts:145, packages/bridge-contracts/deploy/deployOFT.ts:160
…d clarify post-guard salt
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Replaces GoodProtocol's chain-specific ProxyFactory1967 in deployOFT.ts with the canonical CreateX universal factory (xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed) using deployCreate3AndInit so GoodDollarOFTAdapter and GoodDollarOFTMinterBurner proxy addresses are deterministic and identical across all target chains (Celo, XDC, Ethereum, Fuse, etc.).
Closes #16
Why
Changes
Summary by Sourcery
Deploy OFT proxies with CreateX CREATE3 to provide secure, bytecode-independent addresses that remain identical across target chains.
New Features:
Bug Fixes:
Enhancements:
Deployment:
Documentation:
Tests: