-
Notifications
You must be signed in to change notification settings - Fork 0
feat: re add verification script #80
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
2f10afe
feat: add verification scripts for proxy and implementation contracts
gfournierPro 0ba9d73
feat: refactor verification targets to use reusable functions for pro…
gfournierPro 27cf969
Merge branch 'main' into feature/re-add-verification-script
gfournierPro c36f051
feat: change folder from scripts/ to tools/
gfournierPro bec88aa
feat: simplify address extraction logic in get_config_address.sh
gfournierPro 9cc00a4
feat: update constructor argument handling in verification scripts
gfournierPro 2829f2d
feat: streamline implementation verification process in verification.mk
gfournierPro e6d06b1
feat: replace bash scripts with Solidity implementation for configura…
gfournierPro 7158c40
feat: remove commented-out code for lzChainId in GetConfigInfo script
gfournierPro 0410d89
feat: remove outdated comments and documentation from verification.mk
gfournierPro 29d5af6
fix: forge fmt
gfournierPro c25f1c7
feat: update GetConfigInfo script to use config field names and impro…
gfournierPro 61a0c49
fix: forge fmt
gfournierPro 013ce86
feat: remove unused import of ConfigLib from GetConfigInfo script
gfournierPro e1d927e
fix: update GetConfigInfo script to retrieve rlcAddress instead of rl…
gfournierPro ec8391b
refactor: simplify GetConfigInfo script by removing chain parameter a…
gfournierPro 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| MAKEFLAGS += --no-print-directory | ||
|
|
||
| include report.mk | ||
| include tools/report.mk tools/verification.mk | ||
| -include .env | ||
|
|
||
|
|
||
|
|
||
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,48 @@ | ||
| // SPDX-FileCopyrightText: 2025 IEXEC BLOCKCHAIN TECH <[email protected]> | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| pragma solidity ^0.8.22; | ||
|
|
||
| import {Script} from "forge-std/Script.sol"; | ||
| import {console} from "forge-std/console.sol"; | ||
| import {stdJson} from "forge-std/StdJson.sol"; | ||
| import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol"; | ||
|
|
||
| /** | ||
| * @title GetConfigInfo | ||
| * @dev Script to extract configuration information and proxy implementation addresses. | ||
| * Replaces bash scripts with type-safe Solidity implementation. | ||
| * | ||
| * Usage examples: | ||
| * - Get config field: forge script script/GetConfigInfo.s.sol --sig "getConfigField(string,string)" "sepolia" "rlcCrosschainTokenAddress" | ||
| * - Get implementation: forge script script/GetConfigInfo.s.sol --sig "getImplementationAddress(string,string)" "sepolia" "rlcCrosschainTokenAddress" | ||
| */ | ||
| contract GetConfigInfo is Script { | ||
| using stdJson for string; | ||
| /** | ||
| * @dev Get a configuration field value for a specific chain | ||
| * @param field The field name to retrieve | ||
| */ | ||
|
|
||
| function getConfigField(string calldata field) external view { | ||
| string memory config = vm.readFile("config/config.json"); | ||
| address value = config.readAddress(field); | ||
| console.log(value); | ||
| } | ||
|
|
||
| /** | ||
| * @dev Get the implementation address of a proxy contract | ||
| * @param proxyField The config field containing the proxy address | ||
| */ | ||
| function getImplementationAddress(string calldata proxyField) external view { | ||
| string memory config = vm.readFile("config/config.json"); | ||
| address proxyAddress = config.readAddress(proxyField); | ||
| if (proxyAddress == address(0)) { | ||
| console.log("Error: Proxy address is zero for field '%s'", proxyField); | ||
| revert("Zero proxy address"); | ||
| } | ||
| // Get implementation address using OpenZeppelin's Upgrades library | ||
| address impl = Upgrades.getImplementationAddress(proxyAddress); | ||
| console.log(impl); | ||
| } | ||
| } | ||
File renamed without changes.
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,127 @@ | ||||||
|
|
||||||
| # ======================================================================== | ||||||
| # SMART CONTRACT VERIFICATION | ||||||
| # ======================================================================== | ||||||
| # Chain IDs for supported networks | ||||||
| SEPOLIA_CHAIN_ID := 11155111 | ||||||
| ARBITRUM_SEPOLIA_CHAIN_ID := 421614 | ||||||
|
|
||||||
| # ======================================================================== | ||||||
| # VERIFICATION FUNCTIONS | ||||||
| # ======================================================================== | ||||||
|
|
||||||
| # Verify ERC1967 proxy contracts | ||||||
| # Parameters: CONTRACT_NAME, NETWORK, CONFIG_KEY, CHAIN_ID, DISPLAY_NAME | ||||||
| define verify-proxy | ||||||
| @echo "Verifying $(1) Proxy on $(5)..." | ||||||
| forge verify-contract \ | ||||||
| --chain-id $(4) \ | ||||||
| --watch \ | ||||||
| --etherscan-api-key $(ETHERSCAN_API_KEY) \ | ||||||
| $$(forge script script/GetConfigInfo.s.sol --sig "getConfigField(string)" ".chains.$(2).$(3)" 2>/dev/null | grep "0x" | tail -n1) \ | ||||||
| lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy | ||||||
| @echo "Proxy verification completed for $(1) on $(5)" | ||||||
| endef | ||||||
|
|
||||||
| # Verify implementation contracts with optional constructor arguments | ||||||
| # Parameters: CONTRACT_NAME, NETWORK, CONFIG_KEY, CHAIN_ID, DISPLAY_NAME, CONTRACT_PATH, RPC_URL, CONSTRUCTOR_ARGS | ||||||
| define verify-impl | ||||||
| @echo "Verifying $(1) Implementation on $(5)..." | ||||||
| @proxy_address=$$(forge script script/GetConfigInfo.s.sol --sig "getConfigField(string)" ".chains.$(2).$(3)" 2>/dev/null | grep "0x" | tail -n1); \ | ||||||
| impl_address=$$(forge script script/GetConfigInfo.s.sol --sig "getImplementationAddress(string)" ".chains.$(2).$(3)" --rpc-url $(7) 2>/dev/null | grep "0x" | tail -n1); \ | ||||||
| echo "Proxy address: $$proxy_address"; \ | ||||||
| echo "Implementation address: $$impl_address"; \ | ||||||
| forge verify-contract \ | ||||||
| --chain-id $(4) \ | ||||||
| --watch \ | ||||||
| $(8) \ | ||||||
| --etherscan-api-key $(ETHERSCAN_API_KEY) \ | ||||||
| $$impl_address \ | ||||||
| $(6); \ | ||||||
| echo "Implementation verification completed for $(1) on $(5)"; \ | ||||||
| echo "" | ||||||
| endef | ||||||
|
|
||||||
| # ======================================================================== | ||||||
| # SEPOLIA NETWORK VERIFICATION | ||||||
| # ======================================================================== | ||||||
|
|
||||||
| # Proxy Verifications - Sepolia | ||||||
| # ----------------------------- | ||||||
| verify-rlc-liquidity-unifier-proxy-sepolia: | ||||||
| $(call verify-proxy,RLCLiquidityUnifier,sepolia,rlcLiquidityUnifierAddress,$(SEPOLIA_CHAIN_ID),Sepolia Etherscan) | ||||||
|
|
||||||
| verify-layerzero-bridge-proxy-sepolia: | ||||||
| $(call verify-proxy,IexecLayerZeroBridge,sepolia,iexecLayerZeroBridgeAddress,$(SEPOLIA_CHAIN_ID),Sepolia Etherscan) | ||||||
|
|
||||||
| # Implementation Verifications - Sepolia | ||||||
| # -------------------------------------- | ||||||
| verify-rlc-liquidity-unifier-impl-sepolia: | ||||||
| @rlc_address=$$(forge script script/GetConfigInfo.s.sol --sig "getConfigField(string)" ".chains.sepolia.rlcAddress" 2>/dev/null | grep "0x" | tail -n1); \ | ||||||
| constructor_args=$$(cast abi-encode "constructor(address)" $$rlc_address); \ | ||||||
| $(MAKE) _verify-rlc-liquidity-unifier-impl-sepolia CONSTRUCTOR_ARGS="--constructor-args $$constructor_args" | ||||||
|
|
||||||
| _verify-rlc-liquidity-unifier-impl-sepolia: | ||||||
| $(call verify-impl,RLCLiquidityUnifier,sepolia,rlcLiquidityUnifierAddress,$(SEPOLIA_CHAIN_ID),Sepolia Etherscan,src/RLCLiquidityUnifier.sol:RLCLiquidityUnifier,$(SEPOLIA_RPC_URL),$(CONSTRUCTOR_ARGS)) | ||||||
|
|
||||||
| verify-layerzero-bridge-impl-sepolia: | ||||||
| @echo "Building constructor arguments for IexecLayerZeroBridge..." | ||||||
| @rlc_liquidity_unifier_address=$$(forge script script/GetConfigInfo.s.sol --sig "getConfigField(string)" ".chains.sepolia.rlcLiquidityUnifierAddress" 2>/dev/null | grep "0x" | tail -n1); \ | ||||||
| lz_endpoint_address=$$(forge script script/GetConfigInfo.s.sol --sig "getConfigField(string)" ".chains.sepolia.lzEndpointAddress" 2>/dev/null | grep "0x" | tail -n1); \ | ||||||
| constructor_args=$$(cast abi-encode "constructor(bool,address,address)" true $$rlc_liquidity_unifier_address $$lz_endpoint_address); \ | ||||||
| $(MAKE) _verify-layerzero-bridge-impl-sepolia CONSTRUCTOR_ARGS="--constructor-args $$constructor_args" | ||||||
|
|
||||||
| _verify-layerzero-bridge-impl-sepolia: | ||||||
| $(call verify-impl,IexecLayerZeroBridge,sepolia,iexecLayerZeroBridgeAddress,$(SEPOLIA_CHAIN_ID),Sepolia Etherscan,src/bridges/layerZero/IexecLayerZeroBridge.sol:IexecLayerZeroBridge,$(SEPOLIA_RPC_URL),$(CONSTRUCTOR_ARGS)) | ||||||
|
|
||||||
| # ======================================================================== | ||||||
| # ARBITRUM SEPOLIA NETWORK VERIFICATION | ||||||
| # ======================================================================== | ||||||
|
|
||||||
| # Proxy Verifications - Arbitrum Sepolia | ||||||
| # --------------------------------------- | ||||||
| verify-rlc-crosschain-token-proxy-arbitrum-sepolia: | ||||||
| $(call verify-proxy,RLCCrosschainToken,arbitrum_sepolia,rlcCrosschainTokenAddress,$(ARBITRUM_SEPOLIA_CHAIN_ID),Arbitrum Sepolia) | ||||||
|
|
||||||
| verify-layerzero-bridge-proxy-arbitrum-sepolia: | ||||||
| $(call verify-proxy,IexecLayerZeroBridge,arbitrum_sepolia,iexecLayerZeroBridgeAddress,$(ARBITRUM_SEPOLIA_CHAIN_ID),Arbitrum Sepolia) | ||||||
|
|
||||||
| # Implementation Verifications - Arbitrum Sepolia | ||||||
| # ------------------------------------------------ | ||||||
| verify-rlc-crosschain-token-impl-arbitrum-sepolia: | ||||||
| $(call verify-impl,RLCCrosschainToken,arbitrum_sepolia,rlcCrosschainTokenAddress,$(ARBITRUM_SEPOLIA_CHAIN_ID),Arbitrum Sepolia,src/RLCCrosschainToken.sol:RLCCrosschainToken,$(ARBITRUM_SEPOLIA_RPC_URL),) | ||||||
|
|
||||||
| verify-layerzero-bridge-impl-arbitrum-sepolia: | ||||||
| @echo "Building constructor arguments for IexecLayerZeroBridge..." | ||||||
| @rlc_crosschain_token_address=$$(forge script script/GetConfigInfo.s.sol --sig "getConfigField(string)" ".chains.arbitrum_sepolia.rlcCrosschainTokenAddress" 2>/dev/null | grep "0x" | tail -n1); \ | ||||||
| lz_endpoint_address=$$(forge script script/GetConfigInfo.s.sol --sig "getConfigField(string)" ".chains.arbitrum_sepolia.lzEndpointAddress" 2>/dev/null | grep "0x" | tail -n1); \ | ||||||
| constructor_args=$$(cast abi-encode "constructor(bool,address,address)" false $$rlc_crosschain_token_address $$lz_endpoint_address); \ | ||||||
| $(MAKE) _verify-layerzero-bridge-impl-arbitrum-sepolia CONSTRUCTOR_ARGS="--constructor-args $$constructor_args" | ||||||
|
|
||||||
| _verify-layerzero-bridge-impl-arbitrum-sepolia: | ||||||
| $(call verify-impl,IexecLayerZeroBridge,arbitrum_sepolia,iexecLayerZeroBridgeAddress,$(ARBITRUM_SEPOLIA_CHAIN_ID),Arbitrum Sepolia,src/bridges/layerZero/IexecLayerZeroBridge.sol:IexecLayerZeroBridge,$(ARBITRUM_SEPOLIA_RPC_URL),$(CONSTRUCTOR_ARGS)) | ||||||
|
|
||||||
| # ======================================================================== | ||||||
| # PROXY AND IMPLEMENTATION VERIFICATION | ||||||
gfournierPro marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| # ======================================================================== | ||||||
| verify-proxies-sepolia: verify-rlc-liquidity-unifier-proxy-sepolia verify-layerzero-bridge-proxy-sepolia | ||||||
| verify-proxies-arbitrum-sepolia: verify-rlc-crosschain-token-proxy-arbitrum-sepolia verify-layerzero-bridge-proxy-arbitrum-sepolia | ||||||
| verify-proxies-testnets: verify-proxies-sepolia verify-proxies-arbitrum-sepolia | ||||||
|
|
||||||
| verify-implementations-sepolia: verify-rlc-liquidity-unifier-impl-sepolia verify-layerzero-bridge-impl-sepolia | ||||||
| verify-implementations-arbitrum-sepolia: verify-rlc-crosschain-token-impl-arbitrum-sepolia verify-layerzero-bridge-impl-arbitrum-sepolia | ||||||
| verify-implementations-testnets: verify-implementations-sepolia verify-implementations-arbitrum-sepolia | ||||||
|
|
||||||
|
|
||||||
| # ======================================================================== | ||||||
| # COMPLETION TARGETS | ||||||
|
||||||
| # COMPLETION TARGETS | |
| # COMPLETION TARGETS |
gfournierPro marked this conversation as resolved.
Show resolved
Hide resolved
gfournierPro marked this conversation as resolved.
Show resolved
Hide resolved
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.
Uh oh!
There was an error while loading. Please reload this page.