Skip to content
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

Add scripts for etherscan ISM verification #4962

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions solidity/verify-chain.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CHAIN=$1

KEYS="staticAggregationHookFactory domainRoutingIsmFactory staticAggregationIsmFactory staticMerkleRootMultisigIsmFactory staticMessageIdMultisigIsmFactory"

for KEY in $KEYS; do
ADDRESS=$(cat ~/.hyperlane/chains/$CHAIN/addresses.yaml | yq -r ".$KEY")
echo "Verifying $KEY at $ADDRESS"
./verify-factory.sh $CHAIN $ADDRESS
done
40 changes: 40 additions & 0 deletions solidity/verify-factory.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
CHAIN=$1
ADDRESS=$2

RPC_URL=$(cat ~/.hyperlane/chains/$CHAIN/metadata.yaml | yq '.rpcUrls[0].http')
API_KEY=$(gcloud secrets versions access latest --secret "explorer-api-keys" | jq -r ".$CHAIN")

IMPLEMENTATION=$(cast call $ADDRESS "implementation()(address)" --rpc-url $RPC_URL)
ISM_TYPE=$(cast call $IMPLEMENTATION --rpc-url $RPC_URL "moduleType()(uint8)")

# enum Types {
# 0 UNUSED,
# 1 ROUTING,
# 2 AGGREGATION,
# 3 LEGACY_MULTISIG,
# 4 MERKLE_ROOT_MULTISIG,
# 5 MESSAGE_ID_MULTISIG,
# 6 NULL, // used with relayer carrying no metadata
# 7 CCIP_READ,
# 8 ARB_L2_TO_L1,
# 9 WEIGHTED_MERKLE_ROOT_MULTISIG,
# 10 WEIGHTED_MESSAGE_ID_MULTISIG,
# 11 OP_L2_TO_L1
# }

if [ $? -ne 0 ]; then
CONTRACT_NAME="StaticAggregationHook"
elif [ $ISM_TYPE -eq 1 ]; then
CONTRACT_NAME="DomainRoutingIsm"
elif [ $ISM_TYPE -eq 2 ]; then
CONTRACT_NAME="StaticAggregationIsm"
elif [ $ISM_TYPE -eq 4 ]; then
CONTRACT_NAME="StaticMerkleRootMultisigIsm"
elif [ $ISM_TYPE -eq 5 ]; then
CONTRACT_NAME="StaticMessageIdMultisigIsm"
fi

forge verify-contract $IMPLEMENTATION $CONTRACT_NAME \
--rpc-url $RPC_URL \
--verifier-api-key $API_KEY \
--watch
Loading