Skip to content

Commit

Permalink
solana: add invalid outbound gateway test
Browse files Browse the repository at this point in the history
  • Loading branch information
gator-boi committed Aug 4, 2023
1 parent 0d71328 commit ddad9e9
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions cross-chain/solana/tests/02__wormholeGateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,35 @@ describe("wormhole-gateway", () => {
await expectIxFail([ix], [commonTokenOwner], "ZeroRecipient");
});

it("cannot send tbtc to gateway (invalid target gateway)", async () => {
// Use common token account.
const sender = commonTokenOwner.publicKey;
const senderToken = getAssociatedTokenAddressSync(
tbtc.getMintPDA(),
sender
);

// Get destination gateway.
const recipientChain = 69; // bad gateway
const recipient = Array.from(Buffer.alloc(32)); // empty buffer
const nonce = 420;

const sendAmount = BigInt(69);
const ix = await wormholeGateway.sendTbtcGatewayIx(
{
senderToken,
sender,
},
{
amount: new anchor.BN(sendAmount.toString()),
recipientChain,
recipient,
nonce,
}
);
await expectIxFail([ix], [commonTokenOwner], "AccountNotInitialized");
});

it("send wrapped tbtc", async () => {
// Use common token account.
const sender = commonTokenOwner.publicKey;
Expand Down

0 comments on commit ddad9e9

Please sign in to comment.