Skip to content

Commit 76d1356

Browse files
evgenikoclaude
andcommitted
fix: guard sendGreeting against Solana, handle aborted status, document msgValue
- Reject sendGreeting/quoteGreeting with CHAIN_ID_SOLANA (must use WithMsgValue variants to include lamports for rent) - Handle 'aborted' executor status in sendToSolanaOnChainQuote.ts - Document SOLANA_MSG_VALUE_LAMPORTS adjustment guidance Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 582c77d commit 76d1356

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

e2e/sendToSolanaOnChainQuote.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ const CHAIN_ID_SOLANA = 1;
4242
const QUOTER_ADDRESS = process.env.QUOTER_ADDRESS
4343
|| '0x5241c9276698439fef2780dbab76fec90b633fbd';
4444

45-
// Solana-specific: msgValue in LAMPORTS for rent, priority fees
45+
// Solana-specific: msgValue in LAMPORTS for rent + priority fees on the Solana side.
46+
// This is forwarded by the Executor when calling receive_greeting. Adjust upward
47+
// if delivery fails with insufficient funds for account creation.
4648
const SOLANA_MSG_VALUE_LAMPORTS = 15_000_000n; // ~0.015 SOL
4749

4850
// Gas limit for Solana execution (compute units)
@@ -145,8 +147,8 @@ async function main() {
145147
console.log('\nSUCCESS! Message delivered to Solana!');
146148
console.log(` Solana TX: ${relay.txs[0].txHash}`);
147149
console.log(` https://explorer.solana.com/tx/${relay.txs[0].txHash}?cluster=devnet`);
148-
} else if (relay?.status === 'error') {
149-
console.log(`\nRelay failed: ${relay.failureCause || relay.error || 'unknown'}`);
150+
} else if (relay?.status === 'error' || relay?.status === 'aborted') {
151+
console.log(`\nRelay failed: ${relay.failureCause || relay.error || relay.status}`);
150152
} else if (relay?.status === 'underpaid') {
151153
console.log('\nRelay underpaid. Try increasing GAS_LIMIT or SOLANA_MSG_VALUE_LAMPORTS.');
152154
} else {

src/HelloWormholeOnChainQuote.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ contract HelloWormholeOnChainQuote is ExecutorSendReceiveQuoteOnChain, AccessCon
137137
view
138138
returns (uint256 totalCost)
139139
{
140+
require(targetChain != CHAIN_ID_SOLANA, "Use quoteGreetingWithMsgValue for Solana");
140141
return _quoteGreeting(targetChain, gasLimit, 0, quoterAddress);
141142
}
142143

@@ -191,6 +192,7 @@ contract HelloWormholeOnChainQuote is ExecutorSendReceiveQuoteOnChain, AccessCon
191192
uint256 totalCost,
192193
address quoterAddress
193194
) external payable returns (uint64 sequence) {
195+
require(targetChain != CHAIN_ID_SOLANA, "Use sendGreetingWithMsgValue for Solana");
194196
sequence = _sendGreeting(greeting, targetChain, gasLimit, 0, totalCost, quoterAddress);
195197
}
196198

0 commit comments

Comments
 (0)