77
88import { createHash } from "node:crypto" ;
99
10- import NodeWallet from "@coral-xyz/anchor/dist/cjs/nodewallet " ;
10+ import { Wallet } from "@coral-xyz/anchor" ;
1111import type { PythCluster } from "@pythnetwork/client/lib/cluster" ;
1212import { getPythClusterApiUrl } from "@pythnetwork/client/lib/cluster" ;
1313import {
@@ -21,7 +21,7 @@ import {
2121} from "@pythnetwork/xc-admin-common" ;
2222import type { AccountMeta } from "@solana/web3.js" ;
2323import { Keypair , PublicKey } from "@solana/web3.js" ;
24- import SquadsMesh from "@sqds/mesh" ;
24+ import SquadsMeshClass from "@sqds/mesh" ;
2525import Web3 from "web3" ;
2626import yargs from "yargs" ;
2727import { hideBin } from "yargs/helpers" ;
@@ -32,9 +32,16 @@ import {
3232 EvmPriceFeedContract ,
3333 getCodeDigestWithoutAddress ,
3434 EvmWormholeContract ,
35+ EvmLazerContract ,
3536} from "../src/core/contracts/evm" ;
3637import { DefaultStore } from "../src/node/utils/store" ;
3738
39+ function getSquadsMesh ( ) {
40+ // Handle nested default export from @sqds /mesh
41+ return ( SquadsMeshClass as { default ?: typeof SquadsMeshClass } ) . default ??
42+ SquadsMeshClass ;
43+ }
44+
3845const parser = yargs ( hideBin ( process . argv ) )
3946 . usage ( "Usage: $0 --cluster <cluster_id> --proposal <proposal_address>" )
4047 . options ( {
@@ -48,14 +55,21 @@ const parser = yargs(hideBin(process.argv))
4855 demandOption : true ,
4956 desc : "The proposal address to check" ,
5057 } ,
58+ "contract-type" : {
59+ type : "string" ,
60+ demandOption : false ,
61+ desc : "Type of EVM contract to verify (entropy or lazer). Required when checking EvmExecute instructions." ,
62+ choices : [ "entropy" , "lazer" ] ,
63+ } ,
5164 } ) ;
5265
5366async function main ( ) {
5467 const argv = await parser . argv ;
5568 const cluster = argv . cluster as PythCluster ;
56- const squad = SquadsMesh . endpoint (
69+ const mesh = getSquadsMesh ( ) ;
70+ const squad = mesh . endpoint (
5771 getPythClusterApiUrl ( cluster ) ,
58- new NodeWallet ( Keypair . generate ( ) ) , // dummy wallet
72+ new Wallet ( Keypair . generate ( ) ) , // dummy wallet
5973 ) ;
6074 const transaction = await squad . getTransaction ( new PublicKey ( argv . proposal ) ) ;
6175 const instructions = await getProposalInstructions ( squad , transaction ) ;
@@ -148,7 +162,7 @@ async function main() {
148162 if ( instruction . governanceAction instanceof EvmExecute ) {
149163 // Note: it only checks for upgrade entropy contracts right now
150164 console . log (
151- `Verifying EVMExecute on ${ instruction . governanceAction . targetChainId } ` ,
165+ `\nVerifying EVMExecute on ${ instruction . governanceAction . targetChainId } ` ,
152166 ) ;
153167 for ( const chain of Object . values ( DefaultStore . chains ) ) {
154168 if (
@@ -161,9 +175,13 @@ async function main() {
161175 const callAddress = instruction . governanceAction . callAddress ;
162176 const calldata = instruction . governanceAction . calldata ;
163177
164- // TODO: If we add additional EVM contracts using the executor, we need to
165- // add some logic here to identify what kind of contract is at the call address.
166- const contract = new EvmEntropyContract ( chain , callAddress ) ;
178+ // Get contract type from flag, default to "entropy" for backward compatibility
179+ const contractType = argv [ "contract-type" ] ?? "entropy" ;
180+
181+ const contract : EvmEntropyContract | EvmLazerContract =
182+ contractType === "lazer"
183+ ? new EvmLazerContract ( chain , callAddress )
184+ : new EvmEntropyContract ( chain , callAddress ) ;
167185 const owner = await contract . getOwner ( ) ;
168186
169187 if (
0 commit comments