Skip to content

Commit

Permalink
fix accountant ci check
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-gray committed Feb 28, 2024
1 parent b6140ba commit 123e03d
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 15 deletions.
20 changes: 15 additions & 5 deletions wormchain/contracts/tools/__tests__/test_accountant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,13 +511,23 @@ describe("Global Accountant Tests", () => {
throw new Error("Expected metrics change did not occur");
}
// the transfer should fail, because there's an insufficient source balance
await expect(
fetchGlobalAccountantTransferStatus(
if (VAA_SIGNERS.length > 1) {
const transferStatus = await fetchGlobalAccountantTransferStatus(
CHAIN_ID_BSC,
getEmitterAddressEth(CONTRACTS.DEVNET.bsc.core),
getEmitterAddressEth(CONTRACTS.DEVNET.bsc.token_bridge),
sequence
)
).rejects.toThrow();
);
expect(Object.keys(transferStatus)).toContain("pending");
expect(Object.keys(transferStatus)).not.toContain("committed");
} else {
await expect(
fetchGlobalAccountantTransferStatus(
CHAIN_ID_BSC,
getEmitterAddressEth(CONTRACTS.DEVNET.bsc.token_bridge),
sequence
)
).rejects.toThrow();
}
}
console.log("success!");
});
Expand Down
46 changes: 36 additions & 10 deletions wormchain/contracts/tools/__tests__/test_ntt_accountant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,11 @@ let client: any;
let signer: string;
let ethProvider: ethers.providers.WebSocketProvider;
let ethSigner: ethers.Wallet;
let fauxEthProvider: ethers.providers.WebSocketProvider;
let fauxEthSigner: ethers.Wallet;
let bscProvider: ethers.providers.WebSocketProvider;
let bscSigner: ethers.Wallet;
let fauxBscProvider: ethers.providers.WebSocketProvider;
let fauxBscSigner: ethers.Wallet;
let cosmWasmClient: CosmWasmClient;

Expand All @@ -158,17 +160,21 @@ beforeAll(async () => {
// create a signer for Eth
ethProvider = new ethers.providers.WebSocketProvider(ETH_NODE_URL);
ethSigner = new ethers.Wallet(ETH_WALLET.private, ethProvider);
fauxEthSigner = new ethers.Wallet(BSC_WALLET.private, ethProvider);
fauxEthProvider = new ethers.providers.WebSocketProvider(ETH_NODE_URL);
fauxEthSigner = new ethers.Wallet(BSC_WALLET.private, fauxEthProvider);
// create a signer for BSC
bscProvider = new ethers.providers.WebSocketProvider(BSC_NODE_URL);
bscSigner = new ethers.Wallet(BSC_WALLET.private, bscProvider);
fauxBscSigner = new ethers.Wallet(ETH_WALLET.private, bscProvider);
fauxBscProvider = new ethers.providers.WebSocketProvider(BSC_NODE_URL);
fauxBscSigner = new ethers.Wallet(ETH_WALLET.private, fauxBscProvider);
cosmWasmClient = await CosmWasmClient.connect(TENDERMINT_URL);
});

afterAll(async () => {
await ethProvider.destroy();
await fauxEthProvider.destroy();
await bscProvider.destroy();
await fauxBscProvider.destroy();
cosmWasmClient.disconnect();
});

Expand Down Expand Up @@ -1068,13 +1074,23 @@ describe("Global Accountant Tests", () => {
throw new Error("Expected metrics change did not occur");
}
// the transfer should fail, because there's an insufficient source balance
await expect(
fetchGlobalAccountantTransferStatus(
if (VAA_SIGNERS.length > 1) {
const transferStatus = await fetchGlobalAccountantTransferStatus(
SPOKE_CHAIN_A,
BSC_WALLET_EMITTER,
sequence
)
).rejects.toThrow();
);
expect(Object.keys(transferStatus)).toContain("pending");
expect(Object.keys(transferStatus)).not.toContain("committed");
} else {
await expect(
fetchGlobalAccountantTransferStatus(
SPOKE_CHAIN_A,
BSC_WALLET_EMITTER,
sequence
)
).rejects.toThrow();
}
});
test("c. Ensure a token can be sent back to its hub endpoint", async () => {
const beforeMetrics = await fetchGlobalAccountantMetrics();
Expand Down Expand Up @@ -1457,13 +1473,23 @@ describe("Global Accountant Tests", () => {
throw new Error("Expected metrics change did not occur");
}
// the transfer should fail, because there's an insufficient source balance
await expect(
fetchGlobalAccountantTransferStatus(
if (VAA_SIGNERS.length > 1) {
const transferStatus = await fetchGlobalAccountantTransferStatus(
SPOKE_CHAIN_A,
BSC_WALLET_EMITTER,
sequence
)
).rejects.toThrow();
);
expect(Object.keys(transferStatus)).toContain("pending");
expect(Object.keys(transferStatus)).not.toContain("committed");
} else {
await expect(
fetchGlobalAccountantTransferStatus(
SPOKE_CHAIN_A,
BSC_WALLET_EMITTER,
sequence
)
).rejects.toThrow();
}
});
test("k. Relayed message gets accounted", async () => {
const beforeMetrics = await fetchGlobalAccountantMetrics();
Expand Down

0 comments on commit 123e03d

Please sign in to comment.