Skip to content
Merged
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
36 changes: 28 additions & 8 deletions contract_manager/scripts/check_proposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { createHash } from "node:crypto";

import NodeWallet from "@coral-xyz/anchor/dist/cjs/nodewallet";
import { Wallet } from "@coral-xyz/anchor";
import type { PythCluster } from "@pythnetwork/client/lib/cluster";
import { getPythClusterApiUrl } from "@pythnetwork/client/lib/cluster";
import {
Expand All @@ -21,7 +21,7 @@ import {
} from "@pythnetwork/xc-admin-common";
import type { AccountMeta } from "@solana/web3.js";
import { Keypair, PublicKey } from "@solana/web3.js";
import SquadsMesh from "@sqds/mesh";
import SquadsMeshClass from "@sqds/mesh";
import Web3 from "web3";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
Expand All @@ -32,9 +32,18 @@ import {
EvmPriceFeedContract,
getCodeDigestWithoutAddress,
EvmWormholeContract,
EvmLazerContract,
} from "../src/core/contracts/evm";
import { DefaultStore } from "../src/node/utils/store";

function getSquadsMesh() {
// Handle nested default export from @sqds/mesh
return (
(SquadsMeshClass as { default?: typeof SquadsMeshClass }).default ??
SquadsMeshClass
);
}

const parser = yargs(hideBin(process.argv))
.usage("Usage: $0 --cluster <cluster_id> --proposal <proposal_address>")
.options({
Expand All @@ -48,14 +57,21 @@ const parser = yargs(hideBin(process.argv))
demandOption: true,
desc: "The proposal address to check",
},
"contract-type": {
type: "string",
demandOption: false,
desc: "Type of EVM contract to verify (entropy or lazer). Required when checking EvmExecute instructions.",
choices: ["entropy", "lazer"],
},
});

async function main() {
const argv = await parser.argv;
const cluster = argv.cluster as PythCluster;
const squad = SquadsMesh.endpoint(
const mesh = getSquadsMesh();
const squad = mesh.endpoint(
getPythClusterApiUrl(cluster),
new NodeWallet(Keypair.generate()), // dummy wallet
new Wallet(Keypair.generate()), // dummy wallet
);
const transaction = await squad.getTransaction(new PublicKey(argv.proposal));
const instructions = await getProposalInstructions(squad, transaction);
Expand Down Expand Up @@ -148,7 +164,7 @@ async function main() {
if (instruction.governanceAction instanceof EvmExecute) {
// Note: it only checks for upgrade entropy contracts right now
console.log(
`Verifying EVMExecute on ${instruction.governanceAction.targetChainId}`,
`\nVerifying EVMExecute on ${instruction.governanceAction.targetChainId}`,
);
for (const chain of Object.values(DefaultStore.chains)) {
if (
Expand All @@ -161,9 +177,13 @@ async function main() {
const callAddress = instruction.governanceAction.callAddress;
const calldata = instruction.governanceAction.calldata;

// TODO: If we add additional EVM contracts using the executor, we need to
// add some logic here to identify what kind of contract is at the call address.
const contract = new EvmEntropyContract(chain, callAddress);
// Get contract type from flag, default to "entropy" for backward compatibility
const contractType = argv["contract-type"] ?? "entropy";

const contract: EvmEntropyContract | EvmLazerContract =
contractType === "lazer"
? new EvmLazerContract(chain, callAddress)
: new EvmEntropyContract(chain, callAddress);
const owner = await contract.getOwner();

if (
Expand Down
6 changes: 5 additions & 1 deletion contract_manager/src/node/utils/governance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ export class WormholeMultisigProposal {
type SquadsMeshInstance = InstanceType<typeof SquadsMeshClass>;

function getSquadsMesh() {
return SquadsMeshClass;
// Handle nested default export from @sqds/mesh
return (
(SquadsMeshClass as { default?: typeof SquadsMeshClass }).default ??
SquadsMeshClass
);
}

export class Vault extends Storable {
Expand Down
4 changes: 2 additions & 2 deletions contract_manager/src/store/chains/EvmChains.json
Original file line number Diff line number Diff line change
Expand Up @@ -1323,9 +1323,9 @@
"type": "EvmChain"
},
{
"id": "itsnotreal2",
"id": "ethereal",
"mainnet": true,
"rpcUrl": "https://rpc.itsnotreal2.lol",
"rpcUrl": "https://rpc.ethereal.trade",
"networkId": 5064014,
"type": "EvmChain"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
"type": "EvmExecutorContract"
},
{
"chain": "itsnotreal2",
"chain": "ethereal",
"address": "0x5744Cbf430D99456a0A8771208b674F27f8EF0Fb",
"type": "EvmExecutorContract"
},
Expand Down
7 changes: 1 addition & 6 deletions contract_manager/src/store/contracts/EvmLazerContracts.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
"address": "0xACeA761c27A909d4D3895128EBe6370FDE2dF481",
"type": "EvmLazerContract"
},
{
"chain": "ethereal_testnet",
"address": "0xACeA761c27A909d4D3895128EBe6370FDE2dF481",
"type": "EvmLazerContract"
},
{
"chain": "ethereal_testnet_v2",
"address": "0x4D4772F06c595F69FB57039599a180536FDE8245",
Expand Down Expand Up @@ -60,7 +55,7 @@
"type": "EvmLazerContract"
},
{
"chain": "itsnotreal2",
"chain": "ethereal",
"address": "0xACeA761c27A909d4D3895128EBe6370FDE2dF481",
"type": "EvmLazerContract"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@
"type": "EvmWormholeContract"
},
{
"chain": "itsnotreal2",
"chain": "ethereal",
"address": "0x35a58BeeE77a2Ad547FcDed7e8CB1c6e19746b13",
"type": "EvmWormholeContract"
},
Expand Down
2 changes: 1 addition & 1 deletion governance/xc_admin/packages/xc_admin_common/src/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export const RECEIVER_CHAINS = {
zero_gravity: 60088,
itsnotreal: 60089, // Deprecated
plasma: 60090,
itsnotreal2: 60091,
ethereal: 60091,
injective_evm: 60092,
orange: 60093,

Expand Down
1 change: 1 addition & 0 deletions lazer/contracts/evm/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ fs_permissions = [{ access = "read-write", path = "."}]
optimizer = true
optimizer_runs = 100000
solc_version = "0.8.23"
evm_version = "paris"
Loading
Loading