-
Notifications
You must be signed in to change notification settings - Fork 0
feat: added calldata executor and bridge receiver #7
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
Open
tHeMaskedMan981
wants to merge
7
commits into
main
Choose a base branch
from
feat/dst-payload
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.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ccca148
feat: added calldata executor and bridge receiver
tHeMaskedMan981 968594f
feat: bungee receiver cleanup
tHeMaskedMan981 52f737a
Merge branch 'main' into feat/dst-payload
tHeMaskedMan981 e754e97
fix: comments
tHeMaskedMan981 b7ec9c3
Merge branch 'feat/dst-payload' of github.com:SocketDotTech/poc-openr…
tHeMaskedMan981 b11369e
fix: added quoteId check to avoid double spends
tHeMaskedMan981 c926823
feat: added BungeeReceiver and CallDataExecutor
tHeMaskedMan981 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 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,9 @@ docs/ | |
|
|
||
| # Dotenv file | ||
| .env | ||
| .env.op | ||
|
|
||
| dist/ | ||
|
|
||
| node_modules | ||
|
|
||
|
|
||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| /** | ||
| * Checks that BungeeReceiver and CalldataExecutor are deployed on the current network. | ||
| * Addresses are derived from CREATE3 salts via CreateX (guarded salt + factory deployer). | ||
| * | ||
| * Usage: | ||
| * npx hardhat run scripts/deploy/checkReceiverDeployment.ts --network <network> | ||
| * | ||
| * Optional env vars: | ||
| * OWNER_ADDRESS — if set, assert BungeeReceiver owner() matches this address | ||
| */ | ||
|
|
||
| import hre from 'hardhat'; | ||
| import { ethers } from 'hardhat'; | ||
| import { Contract } from 'ethers'; | ||
| import { | ||
| BUNGEE_RECEIVER_CREATE3_SALT, | ||
| CALLDATA_EXECUTOR_CREATE3_SALT, | ||
| CREATE_X_FACTORY, | ||
| Create3ABI, | ||
| computeFinalAddress, | ||
| getBungeeReceiverDeploymentStatus, | ||
| getCalldataExecutorDeploymentStatus, | ||
| } from './create3'; | ||
|
|
||
| async function main() { | ||
| const networkName = hre.network.name; | ||
| const { chainId } = await ethers.provider.getNetwork(); | ||
|
|
||
| const create3Factory = new Contract( | ||
| CREATE_X_FACTORY, | ||
| Create3ABI, | ||
| ethers.provider, | ||
| ); | ||
|
|
||
| // Do not use computeCreate3Address(rawSalt, eoa): CreateX uses guarded salt + factory deployer. | ||
| const receiverAddress = await computeFinalAddress( | ||
| BUNGEE_RECEIVER_CREATE3_SALT, | ||
| create3Factory, | ||
| ); | ||
| const executorAddress = await computeFinalAddress( | ||
| CALLDATA_EXECUTOR_CREATE3_SALT, | ||
| create3Factory, | ||
| ); | ||
|
|
||
| let hasError = false; | ||
|
|
||
| // ── Check CalldataExecutor ─────────────────────────────────────────────────── | ||
|
|
||
| const executorStatus = await getCalldataExecutorDeploymentStatus({ | ||
| provider: ethers.provider, | ||
| address: executorAddress, | ||
| }); | ||
|
|
||
| if (!executorStatus.deployed) { | ||
| console.error( | ||
| `CalldataExecutor NOT deployed on ${networkName} (chainId=${chainId}) at ${executorAddress}`, | ||
| ); | ||
| hasError = true; | ||
| } else { | ||
| if ( | ||
| executorStatus.bungeeReceiver?.toLowerCase() !== | ||
| receiverAddress.toLowerCase() | ||
| ) { | ||
| console.error( | ||
| `CalldataExecutor BUNGEE_RECEIVER mismatch on ${networkName} (chainId=${chainId}): ` + | ||
| `executor=${executorAddress}, expected receiver=${receiverAddress}, got ${executorStatus.bungeeReceiver}`, | ||
| ); | ||
| hasError = true; | ||
| } else { | ||
| console.log( | ||
| `CalldataExecutor deployed on ${networkName} (chainId=${chainId}) at ${executorAddress}, BUNGEE_RECEIVER=${executorStatus.bungeeReceiver}`, | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| // ── Check BungeeReceiver ───────────────────────────────────────────────────── | ||
|
|
||
| const receiverStatus = await getBungeeReceiverDeploymentStatus({ | ||
| provider: ethers.provider, | ||
| address: receiverAddress, | ||
| }); | ||
|
|
||
| if (!receiverStatus.deployed) { | ||
| console.error( | ||
| `BungeeReceiver NOT deployed on ${networkName} (chainId=${chainId}) at ${receiverAddress}`, | ||
| ); | ||
| hasError = true; | ||
| } else { | ||
| const expectedOwner = process.env.OWNER_ADDRESS?.trim(); | ||
| if ( | ||
| expectedOwner && | ||
| receiverStatus.owner?.toLowerCase() !== expectedOwner.toLowerCase() | ||
| ) { | ||
| console.error( | ||
| `BungeeReceiver owner mismatch on ${networkName} (chainId=${chainId}): expected ${expectedOwner}, got ${receiverStatus.owner}`, | ||
| ); | ||
| hasError = true; | ||
| } else { | ||
| console.log( | ||
| `BungeeReceiver deployed on ${networkName} (chainId=${chainId}) at ${receiverAddress}, owner=${receiverStatus.owner}`, | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| if (hasError) { | ||
| process.exit(1); | ||
| } | ||
| } | ||
|
|
||
| main().catch((err) => { | ||
| console.error(err); | ||
| process.exit(1); | ||
| }); |
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
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.
Strengthen
getBungeeReceiverDeploymentStatuscontract identity check.Current logic marks deployment as valid if
owner()responds. That can false-positive on unrelated Ownable contracts. This should also probe BungeeReceiver-specific view(s), e.g.CALLDATA_EXECUTOR()and/orSOLVER_SIGNER().Suggested direction
export async function getBungeeReceiverDeploymentStatus(params: { provider: Provider; address: string; -}): Promise<{ address: string; deployed: boolean; owner?: string }> { +}): Promise<{ address: string; deployed: boolean; owner?: string; calldataExecutor?: string }> { @@ try { const contract = new Contract( address, - ['function owner() view returns (address)'], + [ + 'function owner() view returns (address)', + 'function CALLDATA_EXECUTOR() view returns (address)', + ], provider, ); const owner = (await contract.owner()) as string; - return { address, deployed: true, owner }; + const calldataExecutor = (await contract.CALLDATA_EXECUTOR()) as string; + return { address, deployed: true, owner, calldataExecutor }; } catch { return { address, deployed: false }; } }As per coding guidelines, “Check for resource leaks, race conditions, and unhandled edge cases. Flag over-engineering and premature abstractions.”
📝 Committable suggestion
🤖 Prompt for AI Agents