Skip to content

Deploy network arc testnet#1645

Draft
0xDEnYO wants to merge 21 commits intomainfrom
deploy-network-arc-testnet
Draft

Deploy network arc testnet#1645
0xDEnYO wants to merge 21 commits intomainfrom
deploy-network-arc-testnet

Conversation

@0xDEnYO
Copy link
Copy Markdown
Contributor

@0xDEnYO 0xDEnYO commented Mar 5, 2026

Which Jira task belongs to this PR?

https://lifi.atlassian.net/browse/EX-308

Why did I implement it this way?

Checklist before requesting a review

Checklist for reviewer (DO NOT DEPLOY and contracts BEFORE CHECKING THIS!!!)

  • I have checked that any arbitrary calls to external contracts are validated and or restricted
  • I have checked that any privileged calls (i.e. storage modifications) are validated and or restricted
  • I have ensured that any new contracts have had AT A MINIMUM 1 preliminary audit conducted on by <company/auditor>

@lifi-action-bot lifi-action-bot marked this pull request as draft March 5, 2026 10:15
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 5, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds support for a new network arctestnet (chainId 5042002): configuration, deployments, periphery whitelist entries, PolymerCCTPFacet chain mapping and version bump, foundry/rpc settings, helper/type updates for optional async cast sending, and minor deployment script/facet adjustments.

Changes

Cohort / File(s) Summary
Network & Periphery Configs
config/networks.json, config/permit2Proxy.json, config/whitelist.json, config/polymercctp.json
Add arctestnet entries: network metadata (RPC, explorer, chainId 5042002), Permit2 and CCTP addresses, and PERIPHERY contract mappings with selector→signature entries.
Arctestnet Deployments
deployments/arctestnet.json, deployments/arctestnet.diamond.json
New deployment manifests mapping contracts, facets, and periphery addresses for the Arctestnet diamond and components.
Foundry / RPC config
foundry.toml
Add arctestnet RPC endpoint and Blockscout/ArcScan verification settings (chain 5042002).
Type & Target State
script/common/types.ts, script/deploy/_targetState.json
Add optional castSendAsync?: boolean to INetwork and insert arctestnet.production.LiFiDiamond facet-version mappings.
Deployment scripts & helpers
script/deploy/deployAllContracts.sh, script/deploy/facets/UpdateDiamondLoupeFacet.s.sol, script/helperFunctions.sh, script/universalCast.sh
Add getCastSendAsync() helper; make universal cast support network-specific async vs confirmations and add a short delay for async success; run UpdateDiamondLoupeFacet during Stage 3; refactor cutData encoding/logging timing.
Facet code & tests
src/Facets/PolymerCCTPFacet.sol, test/solidity/Facets/PolymerCCTPFacet.t.sol
Bump PolymerCCTPFacet to 2.0.1, add chainId 5042002 → domainId 26 mapping, and extend unit test mapping array accordingly.
Other deployment updates
deployments/optimism.diamond.staging.json, deployments/optimism.staging.json
Add new PolymerCCTPFacet facet entry (version 2.0.1) and update staging manifest address to the new facet instance.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

NewNetwork

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description includes the Jira task link but lacks implementation details, reasoning, and most checklist items are unchecked. The 'Why did I implement it this way?' section is empty, providing insufficient context for reviewers. Complete the 'Why did I implement it this way?' section with implementation rationale and mark checklist items as completed or explain why they don't apply to this configuration-only PR.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Deploy network arc testnet' directly describes the main change: adding Arc Testnet (chainId 5042002) network configuration across multiple config and deployment files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch deploy-network-arc-testnet

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
script/deploy/_targetState.json (1)

2225-2251: Alphabetical ordering inconsistency.

Per coding guidelines, network entries should be ordered with mainnet first, then all other networks alphabetically. The arctestnet entry is placed at the end (after jovay), but it should come after arbitrum (around line 95-147).

Additionally, note that DexManagerFacet and WhitelistManagerFacet are not included in this configuration, unlike most other production network entries. If this is intentional for the testnet, no action needed; otherwise, consider adding them for consistency.

📝 Suggested fix for ordering

Move the arctestnet block to appear after arbitrum and before avalanche to maintain alphabetical ordering.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@script/deploy/_targetState.json` around lines 2225 - 2251, Move the
"arctestnet" network block so it appears immediately after "arbitrum" (i.e.,
maintain mainnet first then other networks alphabetically) and ensure its
production LiFiDiamond entry matches the typical facet set; if you want
consistency add the missing "DexManagerFacet" and "WhitelistManagerFacet" keys
to the "LiFiDiamond" object (or explicitly confirm they are intentionally
omitted) so the configuration for "arctestnet" aligns with other production
network entries.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@script/tasks/updateERC20Proxy.sh`:
- Line 30: The call to universalCast in updateERC20Proxy.sh hardcodes the
environment as "production" which ignores the ENVIRONMENT variable and can route
privileged transactions incorrectly; update the universalCast invocation (the
line using universalCast "send" "$NETWORK" "production" "$ERC20PROXY"
"setAuthorizedCaller(address,bool)" "$EXECUTOR true" "false") to use the
ENVIRONMENT variable (e.g. "$ENVIRONMENT") instead of the literal "production"
so the script respects the passed environment for staging/testnet runs.

---

Nitpick comments:
In `@script/deploy/_targetState.json`:
- Around line 2225-2251: Move the "arctestnet" network block so it appears
immediately after "arbitrum" (i.e., maintain mainnet first then other networks
alphabetically) and ensure its production LiFiDiamond entry matches the typical
facet set; if you want consistency add the missing "DexManagerFacet" and
"WhitelistManagerFacet" keys to the "LiFiDiamond" object (or explicitly confirm
they are intentionally omitted) so the configuration for "arctestnet" aligns
with other production network entries.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 81642ef3-fb55-465b-8880-8b1a65cff618

📥 Commits

Reviewing files that changed from the base of the PR and between c00e856 and 64dd968.

📒 Files selected for processing (12)
  • config/networks.json
  • config/permit2Proxy.json
  • config/whitelist.json
  • deployments/arctestnet.json
  • foundry.toml
  • script/common/types.ts
  • script/deploy/_targetState.json
  • script/deploy/deployAllContracts.sh
  • script/deploy/facets/UpdateDiamondLoupeFacet.s.sol
  • script/helperFunctions.sh
  • script/tasks/updateERC20Proxy.sh
  • script/universalCast.sh

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
script/deploy/deployAllContracts.sh (1)

187-198: ⚠️ Potential issue | 🟡 Minor

Missing error check for DiamondLoupeFacet update.

The first diamondUpdateFacet call for UpdateDiamondLoupeFacet (line 192) lacks error checking. If this step fails, the script proceeds to update core facets anyway, potentially leaving the diamond in an inconsistent state.

Consider adding a checkFailure call after line 192:

Proposed fix
     echo "[info] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> now adding DiamondLoupeFacet to diamond contract"
     diamondUpdateFacet "$NETWORK" "$ENVIRONMENT" "$DIAMOND_CONTRACT_NAME" "UpdateDiamondLoupeFacet" false
+    checkFailure $? "update DiamondLoupeFacet in $DIAMOND_CONTRACT_NAME on network $NETWORK"

     # update diamond with core facets
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@script/deploy/deployAllContracts.sh` around lines 187 - 198, The script calls
diamondUpdateFacet "$NETWORK" "$ENVIRONMENT" "$DIAMOND_CONTRACT_NAME"
"UpdateDiamondLoupeFacet" without checking for failure, so if that step fails
the script continues and may leave the diamond inconsistent; after the
diamondUpdateFacet call for "UpdateDiamondLoupeFacet" add a call to checkFailure
(or the existing failure handler used elsewhere) to abort or handle errors
before proceeding to the next diamondUpdateFacet for "UpdateCoreFacets",
ensuring the check references the same DIAMOND_CONTRACT_NAME/NETWORK/ENVIRONMENT
context.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@script/deploy/deployAllContracts.sh`:
- Around line 187-198: The script calls diamondUpdateFacet "$NETWORK"
"$ENVIRONMENT" "$DIAMOND_CONTRACT_NAME" "UpdateDiamondLoupeFacet" without
checking for failure, so if that step fails the script continues and may leave
the diamond inconsistent; after the diamondUpdateFacet call for
"UpdateDiamondLoupeFacet" add a call to checkFailure (or the existing failure
handler used elsewhere) to abort or handle errors before proceeding to the next
diamondUpdateFacet for "UpdateCoreFacets", ensuring the check references the
same DIAMOND_CONTRACT_NAME/NETWORK/ENVIRONMENT context.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1c99b6fd-0bc3-403b-9b56-f57b571d166a

📥 Commits

Reviewing files that changed from the base of the PR and between 64dd968 and e956e5d.

📒 Files selected for processing (10)
  • config/networks.json
  • config/permit2Proxy.json
  • config/whitelist.json
  • deployments/arctestnet.diamond.json
  • deployments/arctestnet.json
  • foundry.toml
  • script/deploy/_targetState.json
  • script/deploy/deployAllContracts.sh
  • script/helperFunctions.sh
  • script/tasks/diamondUpdatePeriphery.sh
✅ Files skipped from review due to trivial changes (1)
  • script/tasks/diamondUpdatePeriphery.sh
🚧 Files skipped from review as they are similar to previous changes (4)
  • config/permit2Proxy.json
  • foundry.toml
  • config/networks.json
  • script/helperFunctions.sh

@0xDEnYO
Copy link
Copy Markdown
Contributor Author

0xDEnYO commented Mar 16, 2026

My tendency is to not/never merge this PR for the following reasons:

  • we do not have GasZip available there
  • it's not a mainnet and we usually do not support testnets
  • this is an exception for a client request and will be replaced by mainnet once available

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@script/deploy/deployAllContracts.sh`:
- Around line 187-193: The diamondUpdateFacet call for "UpdateDiamondLoupeFacet"
is not being checked, allowing Stage 3 to appear successful on partial updates;
modify the script where diamondUpdateFacet "$NETWORK" "$ENVIRONMENT"
"$DIAMOND_CONTRACT_NAME" "UpdateDiamondLoupeFacet" false is invoked to
immediately verify its exit status (e.g., check $? or use set -e around the
call) and on failure log an error and exit non‑zero so the deployment fails
fast; ensure this mirrors the handling used for the UpdateCoreFacets step so the
facet update is treated as a critical invariant.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 9e81f999-018b-441c-a72f-89bf9fb10fc4

📥 Commits

Reviewing files that changed from the base of the PR and between e956e5d and 93cee3c.

📒 Files selected for processing (11)
  • config/networks.json
  • config/permit2Proxy.json
  • config/polymercctp.json
  • config/whitelist.json
  • deployments/arctestnet.diamond.json
  • deployments/arctestnet.json
  • foundry.toml
  • script/common/types.ts
  • script/deploy/_targetState.json
  • script/deploy/deployAllContracts.sh
  • script/helperFunctions.sh
✅ Files skipped from review due to trivial changes (7)
  • config/permit2Proxy.json
  • foundry.toml
  • deployments/arctestnet.diamond.json
  • script/deploy/_targetState.json
  • deployments/arctestnet.json
  • config/networks.json
  • config/whitelist.json

Comment on lines +187 to +193
# add DiamondLoupeFacet to diamond
# this one facet is done separately because in many networks we had problems deploying it as part of the core facets update
echo ""
echo ""
echo "[info] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> now adding DiamondLoupeFacet to diamond contract"
diamondUpdateFacet "$NETWORK" "$ENVIRONMENT" "$DIAMOND_CONTRACT_NAME" "UpdateDiamondLoupeFacet" false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Fail fast if UpdateDiamondLoupeFacet fails.

On Line 192, the new diamondUpdateFacet call is not checked. If it fails but UpdateCoreFacets succeeds, Stage 3 can still appear successful with a partial facet update.

Suggested fix
     echo "[info] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> now adding DiamondLoupeFacet to diamond contract"
     diamondUpdateFacet "$NETWORK" "$ENVIRONMENT" "$DIAMOND_CONTRACT_NAME" "UpdateDiamondLoupeFacet" false
+    checkFailure $? "add DiamondLoupeFacet to $DIAMOND_CONTRACT_NAME on network $NETWORK"
+    echo "[info] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< DiamondLoupeFacet update completed"

As per coding guidelines .cursor/rules/002-architecture.mdc, selector/facet update steps are critical invariants and should be explicitly cross-checked.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@script/deploy/deployAllContracts.sh` around lines 187 - 193, The
diamondUpdateFacet call for "UpdateDiamondLoupeFacet" is not being checked,
allowing Stage 3 to appear successful on partial updates; modify the script
where diamondUpdateFacet "$NETWORK" "$ENVIRONMENT" "$DIAMOND_CONTRACT_NAME"
"UpdateDiamondLoupeFacet" false is invoked to immediately verify its exit status
(e.g., check $? or use set -e around the call) and on failure log an error and
exit non‑zero so the deployment fails fast; ensure this mirrors the handling
used for the UpdateCoreFacets step so the facet update is treated as a critical
invariant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants