Skip to content

Commit

Permalink
Revert "Add Debug Msgs for Failing Tests"
Browse files Browse the repository at this point in the history
This reverts commit b6ed3de.
  • Loading branch information
joelsmith-2019 committed Oct 24, 2024
1 parent 3f35492 commit 656db45
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 98 deletions.
66 changes: 0 additions & 66 deletions sdk/js/src/token_bridge/__tests__/aptos-integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,35 +196,24 @@ describe("Aptos SDK tests", () => {
).toEqual(10_000_000);
});
test("Transfer native ERC-20 from Ethereum to Aptos", async () => {
console.log('eth-aptos', 'starting test');

// setup ethereum
const provider = new ethers.providers.JsonRpcProvider(ETH_NODE_URL);
const sender = new ethers.Wallet(ETH_PRIVATE_KEY6, provider);
const ethTokenBridge = CONTRACTS.DEVNET.ethereum.token_bridge;
const ethCoreBridge = CONTRACTS.DEVNET.ethereum.core;

console.log('eth-aptos', 1);

// attest from eth
const attestReceipt = await attestFromEth(
ethTokenBridge,
sender,
TEST_ERC20
);

console.log('eth-aptos', 2);

// get signed attest vaa
let sequence = parseSequenceFromLogEth(attestReceipt, ethCoreBridge);
expect(sequence).toBeTruthy();

console.log('eth-aptos', 3);

await provider.send("anvil_mine", ["0x40"]); // 64 blocks should get the above block to `finalized`

console.log('eth-aptos', 4);

const { vaaBytes: attestVAA } = await getSignedVAAWithRetry(
WORMHOLE_RPC_HOSTS,
CHAIN_ID_ETH,
Expand All @@ -236,36 +225,23 @@ describe("Aptos SDK tests", () => {
);
expect(attestVAA).toBeTruthy();

console.log('eth-aptos', 5);

// setup aptos
const client = new AptosClient(APTOS_NODE_URL);
const recipient = new AptosAccount();
const faucet = new FaucetClient(APTOS_NODE_URL, APTOS_FAUCET_URL);
await faucet.fundAccount(recipient.address(), 100_000_000);

console.log('eth-aptos', 6);

const aptosTokenBridge = CONTRACTS.DEVNET.aptos.token_bridge;
const createWrappedCoinTypePayload = createWrappedTypeOnAptos(
aptosTokenBridge,
attestVAA
);

console.log('eth-aptos', 7);

try {
const tx = await generateSignAndSubmitEntryFunction(
client,
recipient,
createWrappedCoinTypePayload
);

console.log('eth-aptos', 8);

await client.waitForTransaction(tx.hash);

console.log('eth-aptos', 9);
} catch (e) {
// only throw if token has not been attested but this call fails
if (
Expand All @@ -282,22 +258,13 @@ describe("Aptos SDK tests", () => {
aptosTokenBridge,
attestVAA
);

console.log('eth-aptos', 10);

try {
const tx = await generateSignAndSubmitEntryFunction(
client,
recipient,
createWrappedCoinPayload
);

console.log('eth-aptos', 11);

await client.waitForTransaction(tx.hash);

console.log('eth-aptos', 12);

} catch (e) {
// only throw if token has not been attested but this call fails
if (
Expand All @@ -317,9 +284,6 @@ describe("Aptos SDK tests", () => {
CHAIN_ID_ETH,
TEST_ERC20
);

console.log('eth-aptos', 13);

if (!aptosWrappedType) {
throw new Error("Failed to create wrapped coin on Aptos");
}
Expand All @@ -337,15 +301,10 @@ describe("Aptos SDK tests", () => {
await getIsWrappedAssetAptos(client, aptosTokenBridge, aptosWrappedType)
);

console.log('eth-aptos', 14);

// transfer from eth
const balanceBeforeTransferEth = await getBalanceEth(TEST_ERC20, sender);
const amount = parseUnits("1", 18);
await approveEth(ethTokenBridge, TEST_ERC20, sender, amount);

console.log('eth-aptos', 15);

const transferReceipt = await transferFromEth(
ethTokenBridge,
sender,
Expand All @@ -355,16 +314,11 @@ describe("Aptos SDK tests", () => {
tryNativeToUint8Array(recipient.address().hex(), CHAIN_ID_APTOS)
);

console.log('eth-aptos', 16);

// get signed transfer vaa
sequence = parseSequenceFromLogEth(transferReceipt, ethCoreBridge);
expect(sequence).toBeTruthy();

await provider.send("anvil_mine", ["0x40"]); // 64 blocks should get the above block to `finalized`

console.log('eth-aptos', 17);

const { vaaBytes: transferVAA } = await getSignedVAAWithRetry(
WORMHOLE_RPC_HOSTS,
CHAIN_ID_ETH,
Expand All @@ -376,47 +330,29 @@ describe("Aptos SDK tests", () => {
);
expect(transferVAA).toBeTruthy();

console.log('eth-aptos', 18);

// register token on aptos
const script = registerCoin(aptosTokenBridge, CHAIN_ID_ETH, TEST_ERC20);
await generateSignAndSubmitScript(client, recipient, script);

console.log('eth-aptos', 19);

// redeem on aptos
const balanceBeforeTransferAptos = ethers.BigNumber.from(
await getBalanceAptos(client, aptosWrappedType, recipient.address())
);

console.log('eth-aptos', 20);

const redeemPayload = await redeemOnAptos(
client,
aptosTokenBridge,
transferVAA
);

console.log('eth-aptos', 21);

const tx = await generateSignAndSubmitEntryFunction(
client,
recipient,
redeemPayload
);

console.log('eth-aptos', 22);

await client.waitForTransaction(tx.hash);

console.log('eth-aptos', 23);

expect(
await getIsTransferCompletedAptos(client, aptosTokenBridge, transferVAA)
).toBe(true);

console.log('eth-aptos', 24);

// check balances
const balanceAfterTransferAptos = ethers.BigNumber.from(
await getBalanceAptos(client, aptosWrappedType, recipient.address())
Expand All @@ -428,8 +364,6 @@ describe("Aptos SDK tests", () => {
expect(
balanceBeforeTransferEth.sub(balanceAfterTransferEth).toString()
).toEqual(amount.toString());

console.log('eth-aptos', 25);
});
test("Transfer native token with payload from Aptos to Ethereum", async () => {
const APTOS_TOKEN_BRIDGE = CONTRACTS.DEVNET.aptos.token_bridge;
Expand Down
32 changes: 0 additions & 32 deletions sdk/js/src/token_bridge/__tests__/terra2-integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,47 +169,27 @@ describe("Terra Integration Tests", () => {
});

test("Attest and transfer token from Ethereum to Terra2", async () => {
console.log('eth-terra2', 'starting test');

// Attest
const attestReceipt = await attestFromEth(
CONTRACTS.DEVNET.ethereum.token_bridge,
signer,
TEST_ERC20
);

console.log('eth-terra2', 1);

await provider.send("anvil_mine", ["0x40"]); // 64 blocks should get the above block to `finalized`

console.log('eth-terra2', 2);

const attestSignedVaa = await ethParseLogAndGetSignedVaa(attestReceipt);

console.log('eth-terra2', 3);

const createWrappedMsg = await createWrappedOnTerra(
CONTRACTS.DEVNET.terra2.token_bridge,
terraWalletAddress,
attestSignedVaa
);

console.log('eth-terra2', 4);

await terraBroadcastAndWaitForExecution([createWrappedMsg], terraWallet);

console.log('eth-terra2', 5);

// Transfer
await approveEth(
CONTRACTS.DEVNET.ethereum.token_bridge,
TEST_ERC20,
signer,
ethTransferAmount
);

console.log('eth-terra2', 6);

const transferReceipt = await transferFromEth(
CONTRACTS.DEVNET.ethereum.token_bridge,
signer,
Expand All @@ -218,25 +198,13 @@ describe("Terra Integration Tests", () => {
CHAIN_ID_TERRA2,
tryNativeToUint8Array(terraWalletAddress, CHAIN_ID_TERRA2)
);

console.log('eth-terra2', 7);

await provider.send("anvil_mine", ["0x40"]); // 64 blocks should get the above block to `finalized`

console.log('eth-terra2', 8);

const transferSignedVaa = await ethParseLogAndGetSignedVaa(transferReceipt);

console.log('eth-terra2', 9);

const redeemMsg = await redeemOnTerra(
CONTRACTS.DEVNET.terra2.token_bridge,
terraWalletAddress,
transferSignedVaa
);

console.log('eth-terra2', 10);

expect(
await getIsTransferCompletedTerra2(
CONTRACTS.DEVNET.terra2.token_bridge,
Expand Down

0 comments on commit 656db45

Please sign in to comment.