Skip to content

Commit

Permalink
solana: Add check to ensure outboxItem bitmap is set
Browse files Browse the repository at this point in the history
  • Loading branch information
nvsriram committed Oct 17, 2024
1 parent e647fdb commit 85a4bb5
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions solana/tests/anchor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ const w = new Wormhole("Devnet", [SolanaPlatform], {
chains: { Solana: { contracts: { coreBridge: CORE_BRIDGE_ADDRESS } } },
});

const nttTransceiver = anchor.workspace
.NttTransceiver as anchor.Program<NttTransceiverIdlType>;
const nttTransceivers = {
wormhole: anchor.workspace
.NttTransceiver as anchor.Program<NttTransceiverIdlType>,
};

const remoteXcvr: ChainAddress = {
chain: "Ethereum",
Expand Down Expand Up @@ -202,7 +204,9 @@ describe("example-native-token-transfers", () => {
ntt: {
token: tokenAddress,
manager: NTT_ADDRESS,
transceiver: { wormhole: nttTransceiver.programId.toBase58() },
transceiver: {
wormhole: nttTransceivers["wormhole"].programId.toBase58(),
},
},
});
} catch (e) {
Expand Down Expand Up @@ -303,9 +307,17 @@ describe("example-native-token-transfers", () => {
);
await signSendWait(ctx, xferTxs, signer);

// assert that released bitmap has transceiver bits set
const outboxItemInfo = await ntt.program.account.outboxItem.fetch(
outboxItem.publicKey
);
expect(outboxItemInfo.released.map.bitLength()).toBe(
Object.keys(nttTransceivers).length
);

const wormholeMessage = derivePda(
["message", outboxItem.publicKey.toBytes()],
nttTransceiver.programId
nttTransceivers["wormhole"].programId
);

const unsignedVaa = await coreBridge.parsePostMessageAccount(
Expand Down

0 comments on commit 85a4bb5

Please sign in to comment.