diff --git a/.github/workflows/solana.yml b/.github/workflows/solana.yml index 5bafd226e..0bef7c173 100644 --- a/.github/workflows/solana.yml +++ b/.github/workflows/solana.yml @@ -47,10 +47,10 @@ jobs: run: cargo fmt --check --all --manifest-path Cargo.toml - name: Run `cargo check` - run: cargo check --workspace --tests --manifest-path Cargo.toml + run: cargo check --workspace --tests --manifest-path Cargo.toml --features mainnet - name: Run `cargo clippy` - run: cargo clippy --workspace --tests --manifest-path Cargo.toml -- -Dclippy::cast_possible_truncation + run: cargo clippy --workspace --tests --manifest-path Cargo.toml --features mainnet -- -Dclippy::cast_possible_truncation - name: Cache solana tools id: cache-solana @@ -83,7 +83,7 @@ jobs: cargo build-sbf --features "mainnet" cargo test-sbf -p "example-native-token-transfers" --features "mainnet" cargo test-sbf -p "ntt-transceiver" --features "mainnet,testing" - cargo test + cargo test --features "mainnet" check-version: name: Check version diff --git a/cli/src/index.ts b/cli/src/index.ts index d62986ed2..0bce03bc0 100755 --- a/cli/src/index.ts +++ b/cli/src/index.ts @@ -339,7 +339,7 @@ const options = { type: "number", }, payer: { - describe: "Path to the payer json file (Solana)", + describe: "Path to the payer json file (SVM)", type: "string", }, skipChain: { @@ -590,15 +590,15 @@ yargs(hideBin(process.argv)) // type: "string", // }) .option("program-key", { - describe: "Path to program key json (Solana)", + describe: "Path to program key json (SVM)", type: "string", }) .option("payer", { - describe: "Path to payer key json (Solana)", + describe: "Path to payer key json (SVM)", type: "string", }) .option("binary", { - describe: "Path to program binary (.so file -- Solana)", + describe: "Path to program binary (.so file -- SVM)", type: "string", }) .option("token", { @@ -612,7 +612,7 @@ yargs(hideBin(process.argv)) choices: ["locking", "burning"], }) .option("solana-priority-fee", { - describe: "Priority fee for Solana deployment (in microlamports)", + describe: "Priority fee for SVM deployment (in microlamports)", type: "number", default: 50000, }) @@ -823,15 +823,15 @@ yargs(hideBin(process.argv)) .option("path", options.deploymentPath) .option("yes", options.yes) .option("payer", { - describe: "Path to payer key json (Solana)", + describe: "Path to payer key json (SVM)", type: "string", }) .option("program-key", { - describe: "Path to program key json (Solana)", + describe: "Path to program key json (SVM)", type: "string", }) .option("binary", { - describe: "Path to program binary (.so file -- Solana)", + describe: "Path to program binary (.so file -- SVM)", type: "string", }) .option("gas-estimate-multiplier", options.gasEstimateMultiplier) @@ -1201,7 +1201,7 @@ yargs(hideBin(process.argv)) ) .example( "$0 push --payer ", - "Path to the payer json file (Solana), instead of setting SOLANA_PRIVATE_KEY env variable" + "Path to the payer json file (SVM), instead of setting SOLANA_PRIVATE_KEY env variable" ), async (argv) => { const deployments: Config = loadConfig(argv["path"]); @@ -1991,7 +1991,7 @@ yargs(hideBin(process.argv)) } ) .command(createTokenTransferCommand(overrides)) - .command("solana", "Solana commands", (yargs) => { + .command(["solana", "svm"], "svm commands", (yargs) => { yargs .command( "key-base58 ", @@ -2086,11 +2086,11 @@ yargs(hideBin(process.argv)) .option("yes", options.yes) .option("payer", { ...options.payer, demandOption: true }) .example( - "$0 solana create-spl-multisig Sol1234... --token Sol3456... --manager Sol5678... --payer ", + "$0 svm create-spl-multisig Sol1234... --token Sol3456... --manager Sol5678... --payer ", "Create multisig with Sol1234... having independent mint privilege alongside NTT token-authority for undeployed program" ) .example( - "$0 solana create-spl-multisig Sol1234... Sol3456... Sol5678... --payer ", + "$0 svm create-spl-multisig Sol1234... Sol3456... Sol5678... --payer ", "Create multisig with Sol1234..., Sol3456..., and Sol5678... having mint privileges alongside NTT token-authority for deployed program" ), async (argv) => { @@ -2221,6 +2221,107 @@ yargs(hideBin(process.argv)) } } ) + .command( + "build ", + "build the SVM program binary without deploying", + (yargs) => + yargs + .positional("chain", options.chain) + .option("program-key", { + describe: "Path to program key json", + type: "string", + }) + .option("binary", { + describe: "Path to existing program binary (.so file) - if provided, only validates the binary", + type: "string", + }) + .option("ver", options.version) + .option("latest", options.latest) + .option("local", options.local) + .option("path", options.deploymentPath) + .example( + "$0 svm build Solana --latest", + "Build the SVM program binary using the latest version" + ) + .example( + "$0 svm build Solana --ver 1.0.0", + "Build using a specific version" + ) + .example( + "$0 svm build Solana --local --program-key my-program-keypair.json", + "Build from local source with a specific program keypair" + ) + .example( + "$0 svm build Solana --latest --binary target/deploy/example_native_token_transfers.so", + "Validate an existing binary against the latest version" + ), + async (argv) => { + const path = argv["path"]; + const deployments: Config = loadConfig(path); + const chain: Chain = argv["chain"]; + const network = deployments.network as Network; + + // Check that the platform is Solana + const platform = chainToPlatform(chain); + if (platform !== "Solana") { + console.error( + `build command is only supported for Solana chains. Got platform: ${platform}` + ); + process.exit(1); + } + + validateChain(network, chain); + + // Resolve version (--latest, --ver, or --local) + const version = resolveVersion( + argv["latest"], + argv["ver"], + argv["local"], + platform + ); + + // Create worktree if version is specified, otherwise use current directory + const worktree = version ? createWorkTree(platform, version) : "."; + + // Get wormhole core bridge address for verification + const wh = new Wormhole( + network, + [solana.Platform, evm.Platform, sui.Platform], + overrides + ); + const ch = wh.getChain(chain); + const wormhole = ch.config.contracts.coreBridge; + if (!wormhole) { + console.error("Core bridge not found"); + process.exit(1); + } + + const programKeyPath = argv["program-key"]; + const binaryPath = argv["binary"]; + + console.log(`Building SVM program for ${chain} on ${network}...`); + if (version) { + console.log(chalk.blue(`Using version: ${version}`)); + console.log(chalk.blue(`Worktree: ${worktree}`)); + } else { + console.log(chalk.blue(`Using local source`)); + } + + const buildResult = await buildSvm( + worktree, + network, + chain, + wormhole, + version, + programKeyPath, + binaryPath + ); + + console.log(`Program ID: ${buildResult.programId}`); + console.log(`Binary: ${buildResult.binary}`); + console.log(`Keypair: ${buildResult.programKeypairPath}`); + } + ) .demandCommand(); }) .command("manual", "Manual NTT operations", (yargs) => { @@ -2851,7 +2952,7 @@ async function upgradeSolana( throw new Error("Cannot upgrade Solana to local version"); // TODO: this is not hard to enabled } const mint = (await ntt.getConfig()).mint; - await deploySolana( + await deploySvm( pwd, version, await ntt.getMode(), @@ -3098,7 +3199,7 @@ async function deploy( process.exit(1); } const solanaCtx = ch as ChainContext; - return (await deploySolana( + return (await deploySvm( worktree, version, mode, @@ -3322,34 +3423,138 @@ ${simulateArg} \ return { chain: ch.chain, address: universalManager }; } -async function deploySolana( +/** + * Check if the Solana program supports the bridge-address-from-env feature + * @param pwd - Project root directory + * @returns true if the feature exists in Cargo.toml + */ +function hasBridgeAddressFromEnvFeature(pwd: string): boolean { + try { + const cargoTomlPath = `${pwd}/solana/programs/example-native-token-transfers/Cargo.toml`; + if (!fs.existsSync(cargoTomlPath)) { + return false; + } + const cargoToml = fs.readFileSync(cargoTomlPath, 'utf8'); + // Check if bridge-address-from-env feature is defined + return cargoToml.includes('bridge-address-from-env'); + } catch (error) { + return false; + } +} + +/** + * Build the Solana NTT program using anchor build. + * Uses bridge-address-from-env feature if available, otherwise uses network-specific features. + * For legacy builds on non-Solana chains, patches the binary after building. + * @param pwd - Project root directory + * @param network - Network to build for + * @param chain - Target chain (used to determine if patching is needed) + * @param wormhole - Wormhole core bridge address + * @returns Exit code from anchor build + */ +async function runAnchorBuild( pwd: string, - version: string | null, - mode: Ntt.Mode, - ch: ChainContext, - token: string, - payer: string, - initialize: boolean, - managerKeyPath?: string, - binaryPath?: string, - priorityFee?: number -): Promise> { - ensureNttRoot(pwd); + network: Network, + chain: Chain, + wormhole: string, +): Promise { + checkAnchorVersion(pwd); + + const useBridgeFromEnv = hasBridgeAddressFromEnvFeature(pwd); + + let buildArgs: string[]; + let buildEnv: Record; + + if (useBridgeFromEnv) { + // New method: use bridge-address-from-env feature with BRIDGE_ADDRESS env var + console.log(`Building with bridge-address-from-env feature (BRIDGE_ADDRESS=${wormhole})...`); + buildArgs = [ + "anchor", + "build", + "-p", + "example_native_token_transfers", + "--", + "--no-default-features", + "--features", + "bridge-address-from-env" + ]; + buildEnv = { + ...process.env, + BRIDGE_ADDRESS: wormhole + }; + } else { + // Old method: use network-specific feature (mainnet, solana-devnet, tilt-devnet) + const networkFeature = cargoNetworkFeature(network); + console.log(`Building with ${networkFeature} feature (legacy method)...`); + buildArgs = [ + "anchor", + "build", + "-p", + "example_native_token_transfers", + "--", + "--no-default-features", + "--features", + networkFeature + ]; + buildEnv = process.env; + } - checkSolanaVersion(pwd); + const proc = Bun.spawn(buildArgs, { + cwd: `${pwd}/solana`, + env: buildEnv + }); - // TODO: if the binary is provided, we should not check addresses in the source tree. (so we should move around the control flow a bit) - // TODO: factor out some of this into separate functions to help readability of this function (maybe even move to a different file) + await proc.exited; + const exitCode = proc.exitCode ?? 1; - const wormhole = ch.config.contracts.coreBridge; - if (!wormhole) { - console.error("Core bridge not found"); - process.exit(1); + if (exitCode !== 0) { + return exitCode; + } + + // For legacy builds on non-Solana chains, patch the binary + if (!useBridgeFromEnv && chain !== "Solana") { + const binary = `${pwd}/solana/target/deploy/example_native_token_transfers.so`; + + // Get Solana mainnet address for patching + const wh = new Wormhole(network, [solana.Platform], overrides); + const sol = wh.getChain("Solana"); + const solanaAddress = sol.config.contracts.coreBridge; + if (!solanaAddress) { + console.error("Core bridge address not found in Solana config"); + return 1; + } + + console.log(`Patching binary for ${chain}...`); + await patchSolanaBinary(binary, wormhole, solanaAddress); } - // grep example_native_token_transfers = ".*" - // in solana/Anchor.toml - // TODO: what if they rename the program? + return exitCode; +} + +/** + * Build the Solana NTT program binary + * @param pwd - Project root directory + * @param network - Network to build for (affects cargo features) + * @param chain - Target chain (for patching non-Solana chains) + * @param wormhole - Wormhole core bridge address for verification + * @param version - Version string for verification (optional) + * @param programKeyPath - Optional path to program keypair (if not provided, will look for {programId}.json) + * @param binaryPath - Optional path to pre-built binary (if provided, building is skipped) + * @returns Object containing binary path, program ID, and program keypair path + */ +async function buildSvm( + pwd: string, + network: Network, + chain: Chain, + wormhole: string, + version: string | null, + programKeyPath?: string, + binaryPath?: string +): Promise<{ binary: string, programId: string, programKeypairPath: string }> { + ensureNttRoot(pwd); + checkSolanaVersion(pwd); + + // If binary is provided, still need to get program ID const existingProgramId = fs .readFileSync(`${pwd}/solana/Anchor.toml`) .toString() @@ -3361,17 +3566,17 @@ async function deploySolana( process.exit(1); } - let programKeypairPath; - let programKeypair; + let programKeypairPath: string; + let programKeypair: Keypair; - if (managerKeyPath) { - if (!fs.existsSync(managerKeyPath)) { - console.error(`Program keypair not found: ${managerKeyPath}`); + if (programKeyPath) { + if (!fs.existsSync(programKeyPath)) { + console.error(`Program keypair not found: ${programKeyPath}`); process.exit(1); } - programKeypairPath = managerKeyPath; + programKeypairPath = programKeyPath; programKeypair = Keypair.fromSecretKey( - new Uint8Array(JSON.parse(fs.readFileSync(managerKeyPath).toString())) + new Uint8Array(JSON.parse(fs.readFileSync(programKeyPath).toString())) ); } else { const programKeyJson = `${existingProgramId}.json`; @@ -3427,6 +3632,62 @@ async function deploySolana( fs.writeFileSync(libRsPath, newLibRs); } + let binary: string; + + if (binaryPath) { + console.log(`Using provided binary: ${binaryPath}`); + binary = binaryPath; + } else { + // build the program + console.log(`Building SVM program for ${network}...`); + const exitCode = await runAnchorBuild(pwd, network, chain, wormhole); + if (exitCode !== 0) { + process.exit(exitCode); + } + + binary = `${pwd}/solana/target/deploy/example_native_token_transfers.so`; + console.log(`Build complete: ${binary}`); + } + + // Verify the binary contains expected addresses and version + console.log(`Verifying binary...`); + await checkSvmBinary( + binary, + wormhole, + providedProgramId, + version ?? undefined + ); + console.log(`✓ Binary verification passed`); + + return { + binary, + programId: providedProgramId, + programKeypairPath, + }; +} + +async function deploySvm( + pwd: string, + version: string | null, + mode: Ntt.Mode, + ch: ChainContext, + token: string, + payer: string, + initialize: boolean, + managerKeyPath?: string, + binaryPath?: string, + priorityFee?: number +): Promise> { + const wormhole = ch.config.contracts.coreBridge; + if (!wormhole) { + console.error("Core bridge not found"); + process.exit(1); + } + + // Build the Solana program (or use provided binary) + const buildResult = await buildSvm(pwd, ch.network, ch.chain, wormhole, version, managerKeyPath, binaryPath); + const { binary, programId: providedProgramId, programKeypairPath } = buildResult; + // First we check that the provided mint's mint authority is the program's token authority PDA when in burning mode. // This is checked in the program initialiser anyway, but we can save some // time by checking it here and failing early (not to mention better @@ -3508,61 +3769,10 @@ async function deploySolana( } } - let binary: string; - + // Deploy the binary (patching was already done during build for legacy builds on non-Solana chains) const skipDeploy = false; if (!skipDeploy) { - if (binaryPath) { - binary = binaryPath; - } else { - // build the program - // TODO: build with docker - checkAnchorVersion(pwd); - const proc = Bun.spawn( - [ - "anchor", - "build", - "-p", - "example_native_token_transfers", - "--", - "--no-default-features", - "--features", - cargoNetworkFeature(ch.network), - ], - { - cwd: `${pwd}/solana`, - } - ); - - // const _out = await new Response(proc.stdout).text(); - - await proc.exited; - if (proc.exitCode !== 0) { - process.exit(proc.exitCode ?? 1); - } - - binary = `${pwd}/solana/target/deploy/example_native_token_transfers.so`; - } - - const wh = new Wormhole(ch.network, [solana.Platform], overrides); - const sol = wh.getChain("Solana"); - const solanaAddress = sol.config.contracts.coreBridge; - if (!solanaAddress) { - console.error("Core bridge address not found in Solana config"); - process.exit(1); - } - - if (ch.chain !== "Solana") { - await patchSolanaBinary(binary, wormhole, solanaAddress); - } - await checkSolanaBinary( - binary, - wormhole, - providedProgramId, - version ?? undefined - ); - // if buffer.json doesn't exist, create it if (!fs.existsSync(`buffer.json`)) { execSync(`solana-keygen new -o buffer.json --no-bip39-passphrase`); @@ -5015,7 +5225,7 @@ async function patchSolanaBinary( } } -async function checkSolanaBinary( +async function checkSvmBinary( binary: string, wormhole: string, providedProgramId: string, diff --git a/solana/Cargo.lock b/solana/Cargo.lock index 7216c7243..53f7ae413 100644 --- a/solana/Cargo.lock +++ b/solana/Cargo.lock @@ -2521,7 +2521,7 @@ dependencies = [ "wormhole-io", "wormhole-post-message-shim-interface", "wormhole-sdk", - "wormhole-svm-definitions 0.1.0 (git+https://github.com/wormholelabs-xyz/wormhole?branch=svm-shims-fr-env-addr)", + "wormhole-svm-definitions", "wormhole-verify-vaa-shim-interface", ] @@ -2687,7 +2687,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" dependencies = [ - "proc-macro-crate 3.1.0", + "proc-macro-crate 1.3.1", "proc-macro2", "quote", "syn 2.0.109", @@ -5646,7 +5646,7 @@ dependencies = [ "wormhole-io", "wormhole-sdk", "wormhole-solana-utils", - "wormhole-svm-definitions 0.1.0 (git+https://github.com/wormholelabs-xyz/wormhole?branch=svm-shims-fr-env-addr)", + "wormhole-svm-definitions", "wormhole-svm-shim", ] @@ -6440,13 +6440,14 @@ dependencies = [ [[package]] name = "wormhole-anchor-sdk" -version = "0.29.0-alpha.1" -source = "git+https://github.com/wormholelabs-xyz/wormhole-scaffolding?branch=solana/anchor-0.29.0#2b4598732a417dc8bd658dedbdd234839b662321" +version = "1.0.0" +source = "git+https://github.com/wormhole-foundation/wormhole-scaffolding.git?rev=1e5f6d6db2e1d77cca291cd77b5b2e05e97b905e#1e5f6d6db2e1d77cca291cd77b5b2e05e97b905e" dependencies = [ "anchor-lang", "anchor-spl", "cfg-if", "wormhole-io", + "wormhole-svm-definitions", ] [[package]] @@ -6470,7 +6471,7 @@ checksum = "b021a14ea7bcef9517ed9f81d4466c4a663dd90e726c5724707a976fa83ad8f3" [[package]] name = "wormhole-post-message-shim-interface" version = "0.0.0" -source = "git+https://github.com/wormhole-foundation/wormhole?branch=svm/anchor-v0.29.0-shim-interface#63481c6486f8747529f7df692bab8b7fdf85146b" +source = "git+https://github.com/wormhole-foundation/wormhole?rev=325cca4b628f17536f54b079eeb82b41247bfbef#325cca4b628f17536f54b079eeb82b41247bfbef" dependencies = [ "anchor-lang", ] @@ -6501,8 +6502,8 @@ dependencies = [ [[package]] name = "wormhole-svm-definitions" -version = "0.1.0" -source = "git+https://github.com/wormholelabs-xyz/wormhole?branch=svm-shims-fr-env-addr#085a45eefb279b42f17d5b880fce7b96f092290f" +version = "1.0.0" +source = "git+https://github.com/wormhole-foundation/wormhole?rev=325cca4b628f17536f54b079eeb82b41247bfbef#325cca4b628f17536f54b079eeb82b41247bfbef" dependencies = [ "cfg-if", "const-crypto", @@ -6510,32 +6511,22 @@ dependencies = [ "solana-program", ] -[[package]] -name = "wormhole-svm-definitions" -version = "0.1.0" -source = "git+https://github.com/wormhole-foundation/wormhole?branch=svm/anchor-v0.29.0-shim-interface#63481c6486f8747529f7df692bab8b7fdf85146b" -dependencies = [ - "cfg-if", - "sha2-const-stable", - "solana-program", -] - [[package]] name = "wormhole-svm-shim" version = "0.1.0" -source = "git+https://github.com/wormhole-foundation/wormhole?branch=svm/anchor-v0.29.0-shim-interface#63481c6486f8747529f7df692bab8b7fdf85146b" +source = "git+https://github.com/wormhole-foundation/wormhole?rev=325cca4b628f17536f54b079eeb82b41247bfbef#325cca4b628f17536f54b079eeb82b41247bfbef" dependencies = [ "solana-program", - "wormhole-svm-definitions 0.1.0 (git+https://github.com/wormhole-foundation/wormhole?branch=svm/anchor-v0.29.0-shim-interface)", + "wormhole-svm-definitions", ] [[package]] name = "wormhole-verify-vaa-shim-interface" version = "0.0.0" -source = "git+https://github.com/wormhole-foundation/wormhole?branch=svm/anchor-v0.29.0-shim-interface#63481c6486f8747529f7df692bab8b7fdf85146b" +source = "git+https://github.com/wormhole-foundation/wormhole?rev=325cca4b628f17536f54b079eeb82b41247bfbef#325cca4b628f17536f54b079eeb82b41247bfbef" dependencies = [ "anchor-lang", - "wormhole-svm-definitions 0.1.0 (git+https://github.com/wormhole-foundation/wormhole?branch=svm/anchor-v0.29.0-shim-interface)", + "wormhole-svm-definitions", ] [[package]] diff --git a/solana/Cargo.toml b/solana/Cargo.toml index d3397518e..2f9f79325 100644 --- a/solana/Cargo.toml +++ b/solana/Cargo.toml @@ -55,7 +55,7 @@ solana-address-lookup-table-program = "=1.18.26" spl-token = "4.0.0" spl-token-2022 = "3.0.2" -wormhole-anchor-sdk = { git = "https://github.com/wormholelabs-xyz/wormhole-scaffolding", branch = "solana/anchor-0.29.0", default-features = false } +wormhole-anchor-sdk = { git = "https://github.com/wormhole-foundation/wormhole-scaffolding.git", rev = "1e5f6d6db2e1d77cca291cd77b5b2e05e97b905e", default-features = false } wormhole-sdk = { git = "https://github.com/wormhole-foundation/wormhole", rev = "eee4641" } serde_wormhole = { git = "https://github.com/wormhole-foundation/wormhole", rev = "eee4641" } diff --git a/solana/Makefile b/solana/Makefile index dc83dabb3..86a19a56e 100644 --- a/solana/Makefile +++ b/solana/Makefile @@ -21,13 +21,13 @@ cargo-build: # After building, remove the generics from the idl file. This is necessary as of anchor 0.29.0, # because the javascript library does not support generics yet, and just panics anchor-build: - anchor build --arch sbf + anchor build --arch sbf -- --features mainnet for jsonfile in target/idl/*.json; do \ echo "Removing generics from" $$jsonfile; \ ./scripts/patch-idl $$jsonfile; \ done -artifacts-mainnet: +artifacts-mainnet: $(MAKE) _artifacts TARGET_DIR=$@ NETWORK=mainnet artifacts-solana-devnet: diff --git a/solana/programs/example-native-token-transfers/Cargo.toml b/solana/programs/example-native-token-transfers/Cargo.toml index 513f1c8a5..ddb851fbe 100644 --- a/solana/programs/example-native-token-transfers/Cargo.toml +++ b/solana/programs/example-native-token-transfers/Cargo.toml @@ -9,7 +9,7 @@ crate-type = ["cdylib", "lib"] name = "example_native_token_transfers" [features] -default = ["mainnet"] +default = [] no-entrypoint = [] no-idl = [] no-log-ix-name = [] @@ -17,12 +17,15 @@ cpi = ["no-entrypoint"] idl-build = [ "anchor-lang/idl-build", "anchor-spl/idl-build", + "wormhole-anchor-sdk/idl-build", + "wormhole-anchor-sdk/no-custom-discriminator", + "wormhole-anchor-sdk/mainnet", ] # cargo-test-sbf will pass this along test-sbf = [] # networks mainnet = [ "wormhole-anchor-sdk/mainnet" ] -bridge-address-from-env = [ "wormhole-anchor-sdk/bridge-address-from-env" ] +bridge-address-from-env = [ "wormhole-anchor-sdk/from-env" ] solana-devnet = [ "wormhole-anchor-sdk/solana-devnet" ] tilt-devnet = [ "wormhole-anchor-sdk/tilt-devnet" ] tilt-devnet2 = [ "tilt-devnet" ] diff --git a/solana/programs/ntt-quoter/Cargo.toml b/solana/programs/ntt-quoter/Cargo.toml index e804d68be..cbe452911 100644 --- a/solana/programs/ntt-quoter/Cargo.toml +++ b/solana/programs/ntt-quoter/Cargo.toml @@ -8,16 +8,16 @@ crate-type = ["cdylib", "lib"] name = "ntt_quoter" [features] -default = ["mainnet", "no-idl"] +default = ["no-idl"] no-entrypoint = [] no-idl = [] no-log-ix-name = [] cpi = ["no-entrypoint"] -mainnet = [] -solana-devnet = [] -tilt-devnet = [] -tilt-devnet2 = ["tilt-devnet"] +mainnet = ["example-native-token-transfers/mainnet"] +solana-devnet = ["example-native-token-transfers/solana-devnet"] +tilt-devnet = ["example-native-token-transfers/tilt-devnet"] +tilt-devnet2 = ["example-native-token-transfers/tilt-devnet2"] [lints] workspace = true diff --git a/solana/programs/ntt-transceiver/Cargo.toml b/solana/programs/ntt-transceiver/Cargo.toml index 9b0333362..fefbc0fd0 100644 --- a/solana/programs/ntt-transceiver/Cargo.toml +++ b/solana/programs/ntt-transceiver/Cargo.toml @@ -9,7 +9,7 @@ crate-type = ["cdylib", "lib"] name = "ntt_transceiver" [features] -default = ["mainnet"] +default = [] no-entrypoint = ["example-native-token-transfers/no-entrypoint"] no-idl = [] no-log-ix-name = [] @@ -18,7 +18,8 @@ idl-build = [ "anchor-lang/idl-build", "anchor-spl/idl-build", "example-native-token-transfers/idl-build", - "wormhole-anchor-sdk/mainnet" # TODO: is this kosher? builds idl without passing on our feature flags + "wormhole-anchor-sdk/mainnet", + "wormhole-transceiver" ] wormhole-transceiver = ["example-native-token-transfers/cpi"] transceiver-type-from-env = [] @@ -27,11 +28,11 @@ test-sbf = [] # only enable for tests testing = [] # networks -mainnet = [ "wormhole-transceiver", "wormhole-anchor-sdk/mainnet", "example-native-token-transfers/mainnet" ] -bridge-address-from-env = [ "wormhole-anchor-sdk/bridge-address-from-env", "wormhole-svm-definitions/from-env", "example-native-token-transfers/bridge-address-from-env" ] -solana-devnet = [ "wormhole-transceiver", "wormhole-anchor-sdk/solana-devnet", "wormhole-svm-definitions/testnet", "example-native-token-transfers/solana-devnet" ] -tilt-devnet = [ "wormhole-transceiver", "wormhole-anchor-sdk/tilt-devnet", "wormhole-svm-definitions/localnet", "example-native-token-transfers/tilt-devnet" ] -tilt-devnet2 = [ "wormhole-transceiver", "tilt-devnet", "wormhole-svm-definitions/localnet", "example-native-token-transfers/tilt-devnet2" ] +mainnet = [ "wormhole-transceiver", "wormhole-anchor-sdk/mainnet", "wormhole-svm-definitions/solana", "example-native-token-transfers/mainnet" ] +bridge-address-from-env = [ "wormhole-anchor-sdk/from-env", "wormhole-svm-definitions/from-env", "example-native-token-transfers/bridge-address-from-env" ] +solana-devnet = [ "wormhole-transceiver", "wormhole-anchor-sdk/solana-devnet", "wormhole-svm-definitions/solana", "wormhole-svm-definitions/testnet", "example-native-token-transfers/solana-devnet" ] +tilt-devnet = [ "wormhole-transceiver", "wormhole-anchor-sdk/tilt-devnet", "wormhole-svm-definitions/solana", "wormhole-svm-definitions/localnet", "example-native-token-transfers/tilt-devnet" ] +tilt-devnet2 = [ "wormhole-transceiver", "tilt-devnet", "wormhole-svm-definitions/solana", "wormhole-svm-definitions/localnet", "example-native-token-transfers/tilt-devnet2" ] [lints] workspace = true @@ -47,9 +48,9 @@ wormhole-sdk.workspace = true example-native-token-transfers = { path = "../example-native-token-transfers", default-features = false } ntt-messages = { path = "../../modules/ntt-messages", features = ["anchor", "hash"] } -wormhole-post-message-shim-interface = { git = "https://github.com/wormhole-foundation/wormhole", branch = "svm/anchor-v0.29.0-shim-interface", features = ["no-entrypoint", "cpi"] } -wormhole-verify-vaa-shim-interface = { git = "https://github.com/wormhole-foundation/wormhole", branch = "svm/anchor-v0.29.0-shim-interface", features = ["no-entrypoint", "cpi"] } -wormhole-svm-definitions = { git = "https://github.com/wormholelabs-xyz/wormhole", branch = "svm-shims-fr-env-addr" } +wormhole-post-message-shim-interface = { git = "https://github.com/wormhole-foundation/wormhole", rev = "325cca4b628f17536f54b079eeb82b41247bfbef", features = ["no-entrypoint", "cpi"] } +wormhole-verify-vaa-shim-interface = { git = "https://github.com/wormhole-foundation/wormhole", rev = "325cca4b628f17536f54b079eeb82b41247bfbef", features = ["no-entrypoint", "cpi"] } +wormhole-svm-definitions = { git = "https://github.com/wormhole-foundation/wormhole", rev = "325cca4b628f17536f54b079eeb82b41247bfbef" } [dev-dependencies] solana-program-test.workspace = true diff --git a/solana/programs/ntt-transceiver/tests/broadcast.rs b/solana/programs/ntt-transceiver/tests/broadcast.rs index ed0763f48..861a62be7 100644 --- a/solana/programs/ntt-transceiver/tests/broadcast.rs +++ b/solana/programs/ntt-transceiver/tests/broadcast.rs @@ -26,7 +26,7 @@ use test_utils::{ }, }, }; -use wormhole_svm_definitions::{solana::Finality::Finalized, EncodeFinality}; +use wormhole_svm_definitions::{EncodeFinality, Finality::Finalized}; #[tokio::test] async fn test_broadcast_peer() { diff --git a/solana/programs/ntt-transceiver/tests/transfer.rs b/solana/programs/ntt-transceiver/tests/transfer.rs index ded9d5f57..b04def154 100644 --- a/solana/programs/ntt-transceiver/tests/transfer.rs +++ b/solana/programs/ntt-transceiver/tests/transfer.rs @@ -32,7 +32,7 @@ use test_utils::{ }, }, }; -use wormhole_svm_definitions::{solana::Finality::Finalized, EncodeFinality}; +use wormhole_svm_definitions::{EncodeFinality, Finality::Finalized}; #[tokio::test] pub async fn test_transfer_locking() { diff --git a/solana/programs/wormhole-governance/Cargo.toml b/solana/programs/wormhole-governance/Cargo.toml index 15e39d0d6..e0433ea9b 100644 --- a/solana/programs/wormhole-governance/Cargo.toml +++ b/solana/programs/wormhole-governance/Cargo.toml @@ -9,16 +9,19 @@ crate-type = ["cdylib", "lib"] name = "wormhole_governance" [features] -default = ["mainnet"] +default = [] no-entrypoint = [] no-idl = [] no-log-ix-name = [] cpi = ["no-entrypoint"] idl-build = [ "anchor-lang/idl-build", + "wormhole-anchor-sdk/idl-build", + "wormhole-anchor-sdk/no-custom-discriminator", + "wormhole-anchor-sdk/mainnet", ] -bridge-address-from-env = [ "wormhole-anchor-sdk/bridge-address-from-env" ] +bridge-address-from-env = [ "wormhole-anchor-sdk/from-env" ] mainnet = [ "wormhole-anchor-sdk/mainnet" ] solana-devnet = [ "wormhole-anchor-sdk/solana-devnet" ] tilt-devnet = [ "wormhole-anchor-sdk/tilt-devnet" ] diff --git a/solana/tests/cargo/Cargo.toml b/solana/tests/cargo/Cargo.toml index 298e90a2b..a2e2fb5da 100644 --- a/solana/tests/cargo/Cargo.toml +++ b/solana/tests/cargo/Cargo.toml @@ -11,10 +11,10 @@ test-sbf = [] shim = ["ntt-transceiver"] # networks mainnet = [ "wormhole-anchor-sdk/mainnet", "example-native-token-transfers/mainnet", "ntt-transceiver/mainnet" ] -bridge-address-from-env = [ "wormhole-anchor-sdk/bridge-address-from-env", "wormhole-svm-definitions/from-env", "example-native-token-transfers/bridge-address-from-env", "ntt-transceiver/bridge-address-from-env" ] -solana-devnet = [ "wormhole-anchor-sdk/solana-devnet", "wormhole-svm-definitions/testnet", "example-native-token-transfers/solana-devnet", "ntt-transceiver/solana-devnet" ] -tilt-devnet = [ "wormhole-anchor-sdk/tilt-devnet", "wormhole-svm-definitions/localnet", "example-native-token-transfers/tilt-devnet", "ntt-transceiver/tilt-devnet" ] -tilt-devnet2 = [ "tilt-devnet", "wormhole-svm-definitions/localnet", "example-native-token-transfers/tilt-devnet2", "ntt-transceiver/tilt-devnet2" ] +bridge-address-from-env = [ "wormhole-anchor-sdk/from-env", "example-native-token-transfers/bridge-address-from-env", "ntt-transceiver/bridge-address-from-env" ] +solana-devnet = [ "wormhole-anchor-sdk/solana-devnet", "example-native-token-transfers/solana-devnet", "ntt-transceiver/solana-devnet" ] +tilt-devnet = [ "wormhole-anchor-sdk/tilt-devnet", "example-native-token-transfers/tilt-devnet", "ntt-transceiver/tilt-devnet" ] +tilt-devnet2 = [ "tilt-devnet", "example-native-token-transfers/tilt-devnet2", "ntt-transceiver/tilt-devnet2" ] [lints] workspace = true @@ -48,5 +48,6 @@ example-native-token-transfers = { path = "../../programs/example-native-token-t ntt-messages = { path = "../../modules/ntt-messages", features = ["anchor", "hash"] } ntt-transceiver = { path = "../../programs/ntt-transceiver", features = ["testing"], optional = true } wormhole-governance = { path = "../../programs/wormhole-governance", features = ["no-entrypoint"] } -wormhole-svm-definitions = { git = "https://github.com/wormholelabs-xyz/wormhole", branch = "svm-shims-fr-env-addr" } -wormhole-svm-shim = { git = "https://github.com/wormhole-foundation/wormhole", branch = "svm/anchor-v0.29.0-shim-interface" } + +wormhole-svm-definitions = { git = "https://github.com/wormhole-foundation/wormhole", rev = "325cca4b628f17536f54b079eeb82b41247bfbef" } +wormhole-svm-shim = { git = "https://github.com/wormhole-foundation/wormhole", rev = "325cca4b628f17536f54b079eeb82b41247bfbef" }