22
33Cross-chain messaging with Wormhole Executor, demonstrating both ** off-chain** and ** on-chain** quote methods.
44
5+ This repo covers two use cases:
6+ - ** EVM ↔ EVM** — both off-chain and on-chain quotes, Sepolia ↔ Base Sepolia
7+ - ** EVM ↔ Solana** — off-chain quotes only (see [ Cross-VM section] ( #cross-vm-evm--solana ) )
8+
59> ** License:** Code provided "AS IS", without warranties. Audit before mainnet deployment.
610
711## Contracts
@@ -26,6 +30,9 @@ function quoteGreeting(uint16 targetChain, uint128 gasLimit, address quoterAddre
2630function sendGreeting(..., address quoterAddress) external payable;
2731```
2832
33+ > ** Note:** On-chain quotes currently support EVM destination chains only.
34+ > For EVM → Solana, use ` HelloWormhole ` (off-chain signed quotes) instead.
35+
2936## Deployed Contracts (Testnet)
3037
3138| Chain | HelloWormhole (Off-chain) | HelloWormholeOnChainQuote |
@@ -139,6 +146,77 @@ npx tsx testOnChainQuote.ts # On-chain quote E2E
139146npx tsx test.ts # Off-chain quote E2E
140147```
141148
149+ ---
150+
151+ ## Cross-VM: EVM ↔ Solana
152+
153+ Uses ` HelloWormhole ` (off-chain quotes) — on-chain quotes do not yet support Solana destinations.
154+
155+ See the [ Solana demo repo] ( https://github.com/wormhole-foundation/demo-hello-executor-solana ) for the Solana-side implementation.
156+
157+ ### Peer Registration
158+
159+ For EVM ↔ Solana, peer registration on the EVM side requires ** two separate addresses** because the Executor uses ` peers[chainId] ` as a routing address (must be an executable program), while incoming VAAs carry the ** emitter PDA** as their source:
160+
161+ ``` solidity
162+ // 1. Program ID → executor routing (must be an executable account on Solana)
163+ hello.setPeer(CHAIN_ID_SOLANA, solanaProgramIdBytes32);
164+
165+ // 2. Emitter PDA → VAA verification (PDA(["emitter"], programId))
166+ hello.setVaaEmitter(CHAIN_ID_SOLANA, solanaEmitterPdaBytes32);
167+ ```
168+
169+ Run ` script/SetupSolanaPeer.s.sol ` to register both in one step. For EVM↔EVM, only ` setPeer() ` is needed.
170+
171+ Derive both Solana addresses from your program ID:
172+ ``` typescript
173+ const programId = new PublicKey (" 7eiTqf1b1dNwpzn27qEr4eGSWnuon2fJTbnTuWcFifZG" );
174+ const [emitterPda] = PublicKey .findProgramAddressSync ([Buffer .from (" emitter" )], programId );
175+
176+ const programIdBytes32 = ' 0x' + Buffer .from (programId .toBytes ()).toString (' hex' );
177+ const emitterPdaBytes32 = ' 0x' + Buffer .from (emitterPda .toBytes ()).toString (' hex' );
178+ ```
179+
180+ ### Sending to Solana
181+
182+ Use ` sendGreetingWithMsgValue ` with ` msgValue ` in ** lamports** to cover rent and fees on Solana:
183+
184+ ``` solidity
185+ // msgValue covers rent + fees on Solana (~0.015 SOL = 15_000_000 lamports)
186+ sequence = sendGreetingWithMsgValue(
187+ greeting,
188+ 1, // Wormhole chain ID for Solana
189+ 500000, // compute units (not gas)
190+ 15_000_000, // msgValue in lamports
191+ totalCost,
192+ signedQuote
193+ );
194+ ```
195+
196+ > ** Message size limit:** The Solana receiver enforces a ** 512-byte** max on greeting messages.
197+ > Messages longer than 512 bytes will revert on Sepolia with ` PayloadTooLargeForSolana ` .
198+
199+ ### Deployment
200+
201+ ``` bash
202+ # Deploy HelloWormhole (cross-VM variant)
203+ forge script script/HelloWormhole.s.sol --rpc-url $SEPOLIA_RPC_URL --broadcast --verify
204+
205+ # Register Solana as a peer (both program ID and emitter PDA)
206+ forge script script/SetupSolanaPeer.s.sol --rpc-url $SEPOLIA_RPC_URL --broadcast
207+ ```
208+
209+ ### E2E Testing
210+
211+ ``` bash
212+ cd e2e
213+ cp .env.example .env # Fill in HELLO_WORMHOLE_SEPOLIA_CROSSVM and Solana peer addresses
214+ npx tsx sendToSolana.ts # EVM → Solana
215+ # For Solana → EVM, run sendToSepolia.ts from the Solana demo repo
216+ ```
217+
218+ ---
219+
142220## Key Concepts
143221
144222| Concept | Description |
@@ -152,3 +230,4 @@ npx tsx test.ts # Off-chain quote E2E
152230- [ Wormhole Docs] ( https://wormhole.com/docs )
153231- [ Solidity SDK] ( https://github.com/wormhole-foundation/wormhole-solidity-sdk )
154232- [ Executor Documentation] ( https://wormhole.com/docs/protocol/infrastructure/relayer/#executor )
233+ - [ Solana demo repo] ( https://github.com/wormhole-foundation/demo-hello-executor-solana )
0 commit comments