Skip to content

Commit

Permalink
update prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-gray committed Feb 29, 2024
1 parent 38a379c commit 488cc49
Showing 1 changed file with 33 additions and 29 deletions.
62 changes: 33 additions & 29 deletions wormchain/contracts/tools/__tests__/test_ntt_accountant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ if (process.env.INIT_SIGNERS_KEYS_CSV === "undefined") {
* f. Ensure an transceiver registration to another transceiver with a known hub is saved
* g. Ensure a duplicate registration is rejected
* 3. Transfer VAAs
* a. Ensure a token can be sent from its hub endpoint
* a. Ensure a token can be sent from its hub transceiver
* b. Ensure a token decimal shift works as expected
* c. Ensure a token can be sent back to its hub transceiver
* d. Ensure a token can be sent between non-hub transceivers
Expand Down Expand Up @@ -526,7 +526,7 @@ describe("NTT Global Accountant Tests", () => {
});
});
describe("3. Transfer VAAs", () => {
test("a. Ensure a token can be sent from its hub endpoint", async () => {
test("a. Ensure a token can be sent from its hub transceiver", async () => {
const vaa = makeVAA(
HUB_CHAIN,
HUB_TRANSCEIVER,
Expand Down Expand Up @@ -768,14 +768,14 @@ describe("NTT Global Accountant Tests", () => {
const vaa = makeVAA(
HUB_CHAIN,
ETH_WALLET_EMITTER,
"c83e3d2e000000000000000000000000bb807f76cda53b1b4256e1b6f33bb46be36508e3000000000000000000000000002a68f967bfa230780a385175d0c86ae4048d309612"
"9c23bd3b000000000000000000000000bb807f76cda53b1b4256e1b6f33bb46be36508e3000000000000000000000000002a68f967bfa230780a385175d0c86ae4048d309612"
);
const result = await submitVAA(vaa);
expect(result.code).toEqual(0);
const response = await cosmWasmClient.queryContractSmart(
NTT_GA_ADDRESS,
{
all_endpoint_hubs: {},
all_transceiver_hubs: {},
}
);
const hub = response.hubs.find(
Expand All @@ -791,14 +791,14 @@ describe("NTT Global Accountant Tests", () => {
const vaa = makeVAA(
SPOKE_CHAIN_A,
BSC_WALLET_EMITTER,
`d0d292f1${chainToHex(HUB_CHAIN)}${ETH_WALLET_EMITTER}`
`18fc67c2${chainToHex(HUB_CHAIN)}${ETH_WALLET_EMITTER}`
);
const result = await submitVAA(vaa);
expect(result.code).toEqual(0);
const response = await cosmWasmClient.queryContractSmart(
NTT_GA_ADDRESS,
{
all_endpoint_peers: {},
all_transceiver_peers: {},
}
);
const peer = response.peers.find(
Expand All @@ -814,14 +814,14 @@ describe("NTT Global Accountant Tests", () => {
const vaa = makeVAA(
SPOKE_CHAIN_B,
ETH_WALLET_EMITTER,
`d0d292f1${chainToHex(HUB_CHAIN)}${ETH_WALLET_EMITTER}`
`18fc67c2${chainToHex(HUB_CHAIN)}${ETH_WALLET_EMITTER}`
);
const result = await submitVAA(vaa);
expect(result.code).toEqual(0);
const response = await cosmWasmClient.queryContractSmart(
NTT_GA_ADDRESS,
{
all_endpoint_peers: {},
all_transceiver_peers: {},
}
);
const peer = response.peers.find(
Expand All @@ -840,14 +840,14 @@ describe("NTT Global Accountant Tests", () => {
const vaa = makeVAA(
HUB_CHAIN,
ETH_WALLET_EMITTER,
`d0d292f1${chainToHex(SPOKE_CHAIN_A)}${BSC_WALLET_EMITTER}`
`18fc67c2${chainToHex(SPOKE_CHAIN_A)}${BSC_WALLET_EMITTER}`
);
const result = await submitVAA(vaa);
expect(result.code).toEqual(0);
const response = await cosmWasmClient.queryContractSmart(
NTT_GA_ADDRESS,
{
all_endpoint_peers: {},
all_transceiver_peers: {},
}
);
const peer = response.peers.find(
Expand All @@ -863,14 +863,14 @@ describe("NTT Global Accountant Tests", () => {
const vaa = makeVAA(
HUB_CHAIN,
ETH_WALLET_EMITTER,
`d0d292f1${chainToHex(SPOKE_CHAIN_B)}${ETH_WALLET_EMITTER}`
`18fc67c2${chainToHex(SPOKE_CHAIN_B)}${ETH_WALLET_EMITTER}`
);
const result = await submitVAA(vaa);
expect(result.code).toEqual(0);
const response = await cosmWasmClient.queryContractSmart(
NTT_GA_ADDRESS,
{
all_endpoint_peers: {},
all_transceiver_peers: {},
}
);
const peer = response.peers.find(
Expand All @@ -889,14 +889,14 @@ describe("NTT Global Accountant Tests", () => {
const vaa = makeVAA(
SPOKE_CHAIN_A,
BSC_WALLET_EMITTER,
`d0d292f1${chainToHex(SPOKE_CHAIN_B)}${ETH_WALLET_EMITTER}`
`18fc67c2${chainToHex(SPOKE_CHAIN_B)}${ETH_WALLET_EMITTER}`
);
const result = await submitVAA(vaa);
expect(result.code).toEqual(0);
const response = await cosmWasmClient.queryContractSmart(
NTT_GA_ADDRESS,
{
all_endpoint_peers: {},
all_transceiver_peers: {},
}
);
const peer = response.peers.find(
Expand All @@ -912,14 +912,14 @@ describe("NTT Global Accountant Tests", () => {
const vaa = makeVAA(
SPOKE_CHAIN_B,
ETH_WALLET_EMITTER,
`d0d292f1${chainToHex(SPOKE_CHAIN_A)}${BSC_WALLET_EMITTER}`
`18fc67c2${chainToHex(SPOKE_CHAIN_A)}${BSC_WALLET_EMITTER}`
);
const result = await submitVAA(vaa);
expect(result.code).toEqual(0);
const response = await cosmWasmClient.queryContractSmart(
NTT_GA_ADDRESS,
{
all_endpoint_peers: {},
all_transceiver_peers: {},
}
);
const peer = response.peers.find(
Expand All @@ -933,7 +933,7 @@ describe("NTT Global Accountant Tests", () => {
}
}
});
test("a. Ensure a token can be sent from its hub endpoint", async () => {
test("a. Ensure a token can be sent from its hub transceiver", async () => {
const beforeMetrics = await fetchGlobalAccountantMetrics();
const beforeEthBalance = await fetchGlobalAccountantBalance(
HUB_CHAIN,
Expand Down Expand Up @@ -968,7 +968,8 @@ describe("NTT Global Accountant Tests", () => {
sequence,
{
transport: NodeHttpTransport(),
}
},
30000
);
await sleep(500); // avoid socket hang up
const afterMetrics = await fetchGlobalAccountantMetrics();
Expand Down Expand Up @@ -1085,7 +1086,7 @@ describe("NTT Global Accountant Tests", () => {
).rejects.toThrow();
}
});
test("c. Ensure a token can be sent back to its hub endpoint", async () => {
test("c. Ensure a token can be sent back to its hub transceiver", async () => {
const beforeMetrics = await fetchGlobalAccountantMetrics();
const beforeEthBalance = await fetchGlobalAccountantBalance(
HUB_CHAIN,
Expand Down Expand Up @@ -1120,7 +1121,8 @@ describe("NTT Global Accountant Tests", () => {
sequence,
{
transport: NodeHttpTransport(),
}
},
30000
);
await sleep(500); // avoid socket hang up
const afterMetrics = await fetchGlobalAccountantMetrics();
Expand Down Expand Up @@ -1162,7 +1164,7 @@ describe("NTT Global Accountant Tests", () => {
);
expect(afterBscBalance).toBeLessThan(beforeBscBalance.valueOf());
});
test("d. Ensure a token can be sent between non-hub endpoints", async () => {
test("d. Ensure a token can be sent between non-hub transceivers", async () => {
const beforeMetrics = await fetchGlobalAccountantMetrics();
const beforeBscBalance = await fetchGlobalAccountantBalance(
SPOKE_CHAIN_A,
Expand Down Expand Up @@ -1197,7 +1199,8 @@ describe("NTT Global Accountant Tests", () => {
sequence,
{
transport: NodeHttpTransport(),
}
},
30000
);
await sleep(500); // avoid socket hang up
const afterMetrics = await fetchGlobalAccountantMetrics();
Expand Down Expand Up @@ -1241,7 +1244,7 @@ describe("NTT Global Accountant Tests", () => {
beforePolygonBalance.valueOf()
);
});
test("e. Ensure a token sent from a source endpoint without a known hub is rejected", async () => {
test("e. Ensure a token sent from a source transceiver without a known hub is rejected", async () => {
const beforeMetrics = await fetchGlobalAccountantMetrics();
const core = ethers_contracts.Implementation__factory.connect(
CONTRACTS.DEVNET.ethereum.core,
Expand Down Expand Up @@ -1283,13 +1286,13 @@ describe("NTT Global Accountant Tests", () => {
)
).rejects.toThrow();
});
test("f. Ensure a token sent from a source chain without a known endpoint is rejected", async () => {
test("f. Ensure a token sent from a source chain without a known transceiver is rejected", async () => {
{
// init the locking hub
const vaa = makeVAA(
HUB_CHAIN,
BSC_WALLET_EMITTER,
"c83e3d2e000000000000000000000000bb807f76cda53b1b4256e1b6f33bb46be36508e3000000000000000000000000002a68f967bfa230780a385175d0c86ae4048d309612"
"9c23bd3b000000000000000000000000bb807f76cda53b1b4256e1b6f33bb46be36508e3000000000000000000000000002a68f967bfa230780a385175d0c86ae4048d309612"
);
const result = await submitVAA(vaa);
expect(result.code).toEqual(0);
Expand Down Expand Up @@ -1335,13 +1338,13 @@ describe("NTT Global Accountant Tests", () => {
)
).rejects.toThrow();
});
test("g. Ensure a token sent from a source chain without a matching endpoint is rejected", async () => {
test("g. Ensure a token sent from a source chain without a matching transceiver is rejected", async () => {
{
// set faux spoke registration to hub but not vice-versa
const vaa = makeVAA(
FAUX_SPOKE_CHAIN_A,
ETH_WALLET_EMITTER,
`d0d292f1${chainToHex(HUB_CHAIN)}${BSC_WALLET_EMITTER}`
`18fc67c2${chainToHex(HUB_CHAIN)}${BSC_WALLET_EMITTER}`
);
const result = await submitVAA(vaa);
expect(result.code).toEqual(0);
Expand Down Expand Up @@ -1387,7 +1390,7 @@ describe("NTT Global Accountant Tests", () => {
)
).rejects.toThrow();
});
test("h. Ensure a token sent to a destination chain without a known endpoint is rejected", async () => {
test("h. Ensure a token sent to a destination chain without a known transceiver is rejected", async () => {
const beforeMetrics = await fetchGlobalAccountantMetrics();
const core = ethers_contracts.Implementation__factory.connect(
CONTRACTS.DEVNET.ethereum.core,
Expand Down Expand Up @@ -1536,7 +1539,8 @@ describe("NTT Global Accountant Tests", () => {
sequence,
{
transport: NodeHttpTransport(),
}
},
30000
);
await sleep(500); // avoid socket hang up
const afterMetrics = await fetchGlobalAccountantMetrics();
Expand Down

0 comments on commit 488cc49

Please sign in to comment.