diff --git a/docker-compose.yml b/docker-compose.yml index 7a2b834a..720a55ca 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -81,7 +81,7 @@ services: restart: always environment: DATABASE_URL: mongodb://mongo1:30001/sygmaprotocol-explorer-indexer?replicaSet=my-replica-set&authSource=admin&retryWrites=true&w=majority - SHARED_CONFIG_URL: https://ipfs.io/ipfs/QmW9RhxFFotHtvsU2PMVYU2NNZigeCpbg1ywDCZ3vX675b + SHARED_CONFIG_URL: https://ipfs.io/ipfs/bafkreiasnla2ya55of6nwm3swjstip4q2ixfa3t6tvixyibclfovxnerte RPC_URL_CONFIG: '[{"id": 1, "endpoint": "http://evm1:8545"}, {"id": 2, "endpoint": "http://evm2:8545"}, {"id": 3, "endpoint": "ws://substrate-pallet:9944"}]' RETRY_COUNT: '1' BACKOFF: '100' diff --git a/src/indexer/utils/evm/index.ts b/src/indexer/utils/evm/index.ts index 93bc2efc..44468677 100644 --- a/src/indexer/utils/evm/index.ts +++ b/src/indexer/utils/evm/index.ts @@ -393,6 +393,9 @@ export async function saveFailedHandlerExecutionLogs( executionRepository: ExecutionRepository, ): Promise { let transfer = await transferRepository.findTransfer(error.depositNonce, Number(error.domainId), toDomainId) + if (transfer?.status == TransferStatus.executed) { + return + } if (!transfer) { transfer = await transferRepository.insertFailedTransfer(error, toDomainId) } else { diff --git a/src/indexer/utils/substrate/index.ts b/src/indexer/utils/substrate/index.ts index 9f41f727..8b97caca 100644 --- a/src/indexer/utils/substrate/index.ts +++ b/src/indexer/utils/substrate/index.ts @@ -74,6 +74,9 @@ export async function saveFailedHandlerExecution( const numDepositNonce = Number(depositNonce.replace(/,/g, "")) let transfer = await transferRepository.findTransfer(numDepositNonce, Number(originDomainId), toDomainId) + if (transfer?.status == TransferStatus.executed) { + return + } // there is no transfer yet, but a proposal execution exists if (!transfer) { transfer = await transferRepository.insertFailedTransfer( diff --git a/tests/e2e/domainAndResourceRoute.spec.ts b/tests/e2e/domainAndResourceRoute.spec.ts index 222b2999..9f8af6cc 100644 --- a/tests/e2e/domainAndResourceRoute.spec.ts +++ b/tests/e2e/domainAndResourceRoute.spec.ts @@ -28,7 +28,7 @@ describe("Get all transfers for a specific resource between source and destinati before(async () => { let transfers = 0 let isProcessing = false - while (transfers !== 35 || isProcessing) { + while (transfers !== 31 || isProcessing) { const res: { data: Array } = await axios.get("http://localhost:8000/api/transfers?page=1&limit=100") transfers = res.data.length @@ -75,7 +75,7 @@ describe("Get all transfers for a specific resource between source and destinati fromDomainId: 1, toDomainId: 2, destination: "0x8e0a907331554af72563bd8d43051c2e64be5d35", - amount: "2296080355773541392", + amount: "2935717020161974584", status: "executed", accountId: "0x5C1F5961696BaD2e73f73417f07EF55C62a2dC5b", message: "", @@ -90,22 +90,22 @@ describe("Get all transfers for a specific resource between source and destinati id: transfers[0].fee.id, transferId: transfers[0].id, decimals: 18, - amount: "1000000000000000", + amount: "100000000000000", tokenAddress: "0x0000000000000000000000000000000000000000", tokenSymbol: "eth", }, deposit: { - txHash: "0x7b7c2be6b60c25a1be9f506fdd75e1aab76d3016f0bc708715405f2e6718c6df", - blockNumber: "591", + txHash: "0x12327002087fe09d30a4bd45e97e55549d92dbf05d254788591dc2b6bca4ef0f", + blockNumber: "130", depositData: - "0x0000000000000000000000000000000000000000000000001fdd50eb1da26c1000000000000000000000000000000000000000000000000000000000000000148e0a907331554af72563bd8d43051c2e64be5d35000000000000000000000000000000000000000000000000000000000000000c6d657461646174612e75726c", + "0x00000000000000000000000000000000000000000000000028bdc31363d2a13800000000000000000000000000000000000000000000000000000000000000148e0a907331554af72563bd8d43051c2e64be5d35000000000000000000000000000000000000000000000000000000000000000c6d657461646174612e75726c", handlerResponse: "0x6d657461646174612e746573746d657461646174612e75726c", - timestamp: "2023-07-17T08:31:22.000Z", + timestamp: "2024-11-14T08:17:11.000Z", }, execution: { - txHash: "0x3de2201e548a8332aaa50147a2fb02e2b6669184f042b4dbcf23b4f5d40edcfb", - blockNumber: "598", - timestamp: "2023-07-17T08:31:35.000Z", + txHash: "0x43c02a7cee493621c550e059489db14500b5a388185d61deeb7d9a7f52959e8d", + blockNumber: "138", + timestamp: "2024-11-14T08:17:31.000Z", }, account: { addressStatus: "" }, }, @@ -124,11 +124,11 @@ describe("Get all transfers for a specific resource between source and destinati expect(transfers).to.be.deep.equal([ { id: transfers[0].id, - depositNonce: 29, + depositNonce: 28, resourceID: "0x0000000000000000000000000000000000000000000000000000000000000500", fromDomainId: 1, toDomainId: 2, - destination: "0xb1387b365ae7294ea13bad9db83436e671dd16ba", + destination: "0xa2451c8553371e754f5e93a440adcca1c0dcf395", amount: "", status: "executed", accountId: "0x5C1F5961696BaD2e73f73417f07EF55C62a2dC5b", @@ -141,7 +141,7 @@ describe("Get all transfers for a specific resource between source and destinati toDomain: { name: "evm2", lastIndexedBlock: transfers[0].toDomain.lastIndexedBlock, id: 2 }, fromDomain: { name: "Ethereum 1", lastIndexedBlock: transfers[0].fromDomain.lastIndexedBlock, id: 1 }, fee: { - amount: "1000000000000000", + amount: "100000000000000", id: transfers[0].fee.id, decimals: 18, tokenAddress: "0x0000000000000000000000000000000000000000", @@ -149,17 +149,17 @@ describe("Get all transfers for a specific resource between source and destinati transferId: transfers[0].id, }, deposit: { - txHash: "0x18fa527a4773789a5ba487dae5bc3d00cc04dc50509b6f67e438efdb60e75c67", - blockNumber: "623", + txHash: "0x2b355542a454d8faedccc75c8741ef0d2f531ea4cd8ed53544734ff681377699", + blockNumber: "155", depositData: - "0x0000000000000000000000000000000000000000000000000000000000030d400004ea287d1514b1387b365ae7294ea13bad9db83436e671dd16ba145c1f5961696bad2e73f73417f07ef55c62a2dc5b47ed248f568cc8f9fe4371a1d1fab88a62af595f8efb9aeff6f0e043b7ea33b10000000000000000000000005c1f5961696bad2e73f73417f07ef55c62a2dc5b", + "0x00000000000000000000000000000000000000000000000000000000000927c00004ea287d1514a2451c8553371e754f5e93a440adcca1c0dcf395145c1f5961696bad2e73f73417f07ef55c62a2dc5b35353436383833363939383137363233353732000000000000000000000000000000000000000000000000005c1f5961696bad2e73f73417f07ef55c62a2dc5b", handlerResponse: "0x", - timestamp: "2023-07-17T08:32:27.000Z", + timestamp: "2024-11-14T08:18:03.000Z", }, execution: { - txHash: "0xcc7c318cfd71745c27111772f21dec553f53277c9dc218fe07b54f897560c0cb", - blockNumber: "631", - timestamp: "2023-07-17T08:32:42.000Z", + txHash: "0x508195d23128b60c20a577eca7ace567e6ec68f636bad42ddb554b7d96644dd3", + blockNumber: "162", + timestamp: "2024-11-14T08:18:20.000Z", }, account: { addressStatus: "" }, }, @@ -173,7 +173,7 @@ describe("Get all transfers for a specific resource between source and destinati const transfers = res.data as Array expect(res.status).to.be.deep.equal(200) - expect(transfers.length).to.be.deep.equal(3) + expect(transfers.length).to.be.deep.equal(1) for (const transfer of transfers) { expect(transfer.resourceID).to.be.deep.equal(ERC20LRTEST_RESOURCE_ID) diff --git a/tests/e2e/domainRoute.spec.ts b/tests/e2e/domainRoute.spec.ts index ec2a1e8e..8ebc315e 100644 --- a/tests/e2e/domainRoute.spec.ts +++ b/tests/e2e/domainRoute.spec.ts @@ -23,7 +23,7 @@ describe("Get all transfers with a specific domain as source or destination", fu before(async () => { let transfers = 0 let isProcessing = false - while (transfers !== 35 || isProcessing) { + while (transfers !== 31 || isProcessing) { const res: { data: Array } = await axios.get("http://localhost:8000/api/transfers?page=1&limit=100") transfers = res.data.length @@ -42,7 +42,7 @@ describe("Get all transfers with a specific domain as source or destination", fu const transfers = res.data as Array expect(res.status).to.be.deep.equal(200) - expect(transfers.length).to.be.deep.equal(32) + expect(transfers.length).to.be.deep.equal(30) for (const transfer of transfers) { expect(transfer.fromDomainId).to.be.deep.equal(parseInt(DOMAIN_1)) @@ -54,7 +54,7 @@ describe("Get all transfers with a specific domain as source or destination", fu const transfers = res.data as Array expect(res.status).to.be.deep.equal(200) - expect(transfers.length).to.be.deep.equal(32) + expect(transfers.length).to.be.deep.equal(30) for (const transfer of transfers) { expect(transfer.fromDomainId).to.be.deep.equal(parseInt(DOMAIN_1)) @@ -76,7 +76,7 @@ describe("Get all transfers with a specific domain as source or destination", fu const transfers = res.data as Array expect(res.status).to.be.deep.equal(200) - expect(transfers.length).to.be.deep.equal(3) + expect(transfers.length).to.be.deep.equal(1) for (const transfer of transfers) { expect(transfer.toDomainId).to.be.deep.equal(parseInt(DOMAIN_1)) @@ -88,7 +88,7 @@ describe("Get all transfers with a specific domain as source or destination", fu const transfers = res.data as Array expect(res.status).to.be.deep.equal(200) - expect(transfers.length).to.be.deep.equal(30) + expect(transfers.length).to.be.deep.equal(29) for (const transfer of transfers) { expect(transfer.toDomainId).to.be.deep.equal(parseInt(DOMAIN_2)) @@ -100,7 +100,7 @@ describe("Get all transfers with a specific domain as source or destination", fu const transfers = res.data as Array expect(res.status).to.be.deep.equal(200) - expect(transfers.length).to.be.deep.equal(3) + expect(transfers.length).to.be.deep.equal(1) for (const transfer of transfers) { expect(transfer.fromDomainId).to.be.deep.equal(parseInt(DOMAIN_3)) diff --git a/tests/e2e/indexing.spec.ts b/tests/e2e/indexing.spec.ts index 54bfb231..9c378cd4 100644 --- a/tests/e2e/indexing.spec.ts +++ b/tests/e2e/indexing.spec.ts @@ -8,23 +8,23 @@ import { Transfer, Resource, Fee, Deposit, Execution, Domain } from "@prisma/cli import { DomainTypes } from "../../src/indexer/config" import { DepositType } from "../../src/indexer/services/evmIndexer/evmTypes" -const NUMBER_OF_TRANSFERS = 35 -const NUMBER_OF_SUBSTRATE_DEPOSITS = 3 -const NUMBER_OF_FUNGIBLE_DEPOSITS = 32 +const NUMBER_OF_TRANSFERS = 31 +const NUMBER_OF_SUBSTRATE_DEPOSITS = 1 +const NUMBER_OF_FUNGIBLE_DEPOSITS = 29 const NUMBER_OF_PERMISSIONLESS_DEPOSITS = 1 -const NUMBER_OF_PERMISSIONED_DEPOSITS = 1 const NUMBER_OF_NFT_DEPOSITS = 1 const DOMAIN_1 = 1 const DOMAIN_3 = 3 -const FUNGIBLE_EVM_DEPOSIT_TXHASH = "0x1e33c8969f943ce9e12b56937b97109a3d394b0b0eb9cc77cda0127c89b5961b" -const NONFUNGIBLE_EVM_DEPOSIT_TXHASH = "0x7b7c2be6b60c25a1be9f506fdd75e1aab76d3016f0bc708715405f2e6718c6df" -const PERMISSIONLESS_GENERIC_EVM_DEPOSIT_TXHASH = "0x18fa527a4773789a5ba487dae5bc3d00cc04dc50509b6f67e438efdb60e75c67" -const PERMISSIONED_GENERIC_EVM_DEPOSIT_TXHASH = "0x44b9ac0bbd9052b8468aae63620ee9babff498ace3092babca2994097344b516" -const FUNGIBLE_SUBSTRATE_TO_EVM_DEPOSIT_TXHASH = "356-1" -const FUNGIBLE_EVM_TO_SUBSTRATE_DEPOSIT = "0xdae4f76d4cb634ca175996bb85d76e82f476cc91f71332bdba967f066d9efc16" +const FUNGIBLE_EVM_DEPOSIT_TXHASH = "0x0a4fb75c91ca774d1b2faeed14a0d9c8f261dba64fc8adfe070c0b9f78a07492" +const NONFUNGIBLE_EVM_DEPOSIT_TXHASH = "0x12327002087fe09d30a4bd45e97e55549d92dbf05d254788591dc2b6bca4ef0f" +const FUNGIBLE_SUBSTRATE_TO_EVM_DEPOSIT_TXHASH = "279-1" + +const PERMISSIONLESS_GENERIC_EVM_DEPOSIT_TXHASH = "0x2b355542a454d8faedccc75c8741ef0d2f531ea4cd8ed53544734ff681377699" + +const FUNGIBLE_EVM_TO_SUBSTRATE_DEPOSIT_TXHASH = "0x967b320daebffcba435b6bf9ba493963471f6ca9d12c84c9f156bda6862934e0" type TransferResponse = Transfer & { resource: Resource toDomain: Domain @@ -37,13 +37,12 @@ describe("Indexer e2e tests", function () { let substrateDeposits = 0 let fungibleDeposits = 0 let permissionlessDeposits = 0 - let permissionedDeposits = 0 let nftDeposits = 0 before(async () => { let transfers = 0 let isProcessing = false - while (transfers !== 35 || isProcessing) { + while (transfers !== NUMBER_OF_TRANSFERS || isProcessing) { const res: { data: Array } = await axios.get("http://localhost:8000/api/transfers?page=1&limit=100") transfers = res.data.length @@ -78,10 +77,6 @@ describe("Indexer e2e tests", function () { permissionlessDeposits++ break } - case DepositType.PERMISSIONED_GENERIC: { - permissionedDeposits++ - break - } } } @@ -89,7 +84,6 @@ describe("Indexer e2e tests", function () { expect(substrateDeposits).to.be.eq(NUMBER_OF_SUBSTRATE_DEPOSITS) expect(fungibleDeposits).to.be.eq(NUMBER_OF_FUNGIBLE_DEPOSITS) expect(permissionlessDeposits).to.be.eq(NUMBER_OF_PERMISSIONLESS_DEPOSITS) - expect(permissionedDeposits).to.be.eq(NUMBER_OF_PERMISSIONED_DEPOSITS) expect(nftDeposits).to.be.eq(NUMBER_OF_NFT_DEPOSITS) transfers.map(transfer => { @@ -120,22 +114,22 @@ describe("Indexer e2e tests", function () { { id: transfer[0].id, message: "", - depositNonce: 30, - resourceID: "0x0000000000000000000000000000000000000000000000000000000000000300", + depositNonce: 1, + resourceID: "0x0000000000000000000000000000000000000000000000000000000000000000", fromDomainId: 1, toDomainId: 2, accountId: "0x5C1F5961696BaD2e73f73417f07EF55C62a2dC5b", - destination: "0x8e0a907331554af72563bd8d43051c2e64be5d35", + destination: "0x5c1f5961696bad2e73f73417f07ef55c62a2dc5b", amount: "0.0000000000000001", status: "executed", resource: { type: "fungible", - id: "0x0000000000000000000000000000000000000000000000000000000000000300", + id: "0x0000000000000000000000000000000000000000000000000000000000000000", }, toDomain: { name: "evm2", lastIndexedBlock: transfer[0].toDomain.lastIndexedBlock, id: 2 }, fromDomain: { name: "Ethereum 1", lastIndexedBlock: transfer[0].fromDomain.lastIndexedBlock, id: 1 }, fee: { - amount: "1000000000000000", + amount: "100000000000000", id: transfer[0].fee.id, decimals: 18, tokenAddress: "0x0000000000000000000000000000000000000000", @@ -143,17 +137,17 @@ describe("Indexer e2e tests", function () { transferId: transfer[0].id, }, deposit: { - txHash: "0x1e33c8969f943ce9e12b56937b97109a3d394b0b0eb9cc77cda0127c89b5961b", - blockNumber: "628", + txHash: "0x0a4fb75c91ca774d1b2faeed14a0d9c8f261dba64fc8adfe070c0b9f78a07492", + blockNumber: "115", depositData: - "0x000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000148e0a907331554af72563bd8d43051c2e64be5d350102", - handlerResponse: "0x", - timestamp: "2023-07-17T08:32:37.000Z", + "0x000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000145c1f5961696bad2e73f73417f07ef55c62a2dc5b", + handlerResponse: "0x0000000000000000000000000000000000000000000000000000000000000064", + timestamp: "2024-11-14T08:16:41.000Z", }, execution: { - txHash: "0xb8de40d5d0f5eb8ac4d2a54858bcd4946c85dfcb4353710df1cb73cc6b030c10", - blockNumber: "643", - timestamp: "2023-07-17T08:33:06.000Z", + txHash: "0x8be14ce560b614606e2fad63c6bd58f80a7bc2ae344114eed094ec5296178888", + blockNumber: "123", + timestamp: "2024-11-14T08:17:00.000Z", }, account: { addressStatus: "", @@ -178,7 +172,7 @@ describe("Indexer e2e tests", function () { toDomainId: 2, accountId: "0x5C1F5961696BaD2e73f73417f07EF55C62a2dC5b", destination: "0x8e0a907331554af72563bd8d43051c2e64be5d35", - amount: "2296080355773541392", + amount: "2935717020161974584", status: "executed", resource: { type: "nonfungible", @@ -187,7 +181,7 @@ describe("Indexer e2e tests", function () { toDomain: { name: "evm2", lastIndexedBlock: transfer[0].toDomain.lastIndexedBlock, id: 2 }, fromDomain: { name: "Ethereum 1", lastIndexedBlock: transfer[0].fromDomain.lastIndexedBlock, id: 1 }, fee: { - amount: "1000000000000000", + amount: "100000000000000", id: transfer[0].fee.id, decimals: 18, tokenAddress: "0x0000000000000000000000000000000000000000", @@ -195,17 +189,17 @@ describe("Indexer e2e tests", function () { transferId: transfer[0].id, }, deposit: { - txHash: "0x7b7c2be6b60c25a1be9f506fdd75e1aab76d3016f0bc708715405f2e6718c6df", - blockNumber: "591", + txHash: "0x12327002087fe09d30a4bd45e97e55549d92dbf05d254788591dc2b6bca4ef0f", + blockNumber: "130", depositData: - "0x0000000000000000000000000000000000000000000000001fdd50eb1da26c1000000000000000000000000000000000000000000000000000000000000000148e0a907331554af72563bd8d43051c2e64be5d35000000000000000000000000000000000000000000000000000000000000000c6d657461646174612e75726c", + "0x00000000000000000000000000000000000000000000000028bdc31363d2a13800000000000000000000000000000000000000000000000000000000000000148e0a907331554af72563bd8d43051c2e64be5d35000000000000000000000000000000000000000000000000000000000000000c6d657461646174612e75726c", handlerResponse: "0x6d657461646174612e746573746d657461646174612e75726c", - timestamp: "2023-07-17T08:31:22.000Z", + timestamp: "2024-11-14T08:17:11.000Z", }, execution: { - txHash: "0x3de2201e548a8332aaa50147a2fb02e2b6669184f042b4dbcf23b4f5d40edcfb", - blockNumber: "598", - timestamp: "2023-07-17T08:31:35.000Z", + txHash: "0x43c02a7cee493621c550e059489db14500b5a388185d61deeb7d9a7f52959e8d", + blockNumber: "138", + timestamp: "2024-11-14T08:17:31.000Z", }, account: { addressStatus: "", @@ -223,13 +217,13 @@ describe("Indexer e2e tests", function () { expect(transfer).to.be.deep.equal([ { id: transfer[0].id, - depositNonce: 29, + depositNonce: 28, resourceID: "0x0000000000000000000000000000000000000000000000000000000000000500", fromDomainId: 1, message: "", toDomainId: 2, accountId: "0x5C1F5961696BaD2e73f73417f07EF55C62a2dC5b", - destination: "0xb1387b365ae7294ea13bad9db83436e671dd16ba", + destination: "0xa2451c8553371e754f5e93a440adcca1c0dcf395", amount: "", status: "executed", resource: { @@ -239,7 +233,7 @@ describe("Indexer e2e tests", function () { toDomain: { name: "evm2", lastIndexedBlock: transfer[0].toDomain.lastIndexedBlock, id: 2 }, fromDomain: { name: "Ethereum 1", lastIndexedBlock: transfer[0].fromDomain.lastIndexedBlock, id: 1 }, fee: { - amount: "1000000000000000", + amount: "100000000000000", id: transfer[0].fee.id, decimals: 18, tokenAddress: "0x0000000000000000000000000000000000000000", @@ -247,69 +241,17 @@ describe("Indexer e2e tests", function () { transferId: transfer[0].id, }, deposit: { - txHash: "0x18fa527a4773789a5ba487dae5bc3d00cc04dc50509b6f67e438efdb60e75c67", - blockNumber: "623", + txHash: "0x2b355542a454d8faedccc75c8741ef0d2f531ea4cd8ed53544734ff681377699", + blockNumber: "155", depositData: - "0x0000000000000000000000000000000000000000000000000000000000030d400004ea287d1514b1387b365ae7294ea13bad9db83436e671dd16ba145c1f5961696bad2e73f73417f07ef55c62a2dc5b47ed248f568cc8f9fe4371a1d1fab88a62af595f8efb9aeff6f0e043b7ea33b10000000000000000000000005c1f5961696bad2e73f73417f07ef55c62a2dc5b", + "0x00000000000000000000000000000000000000000000000000000000000927c00004ea287d1514a2451c8553371e754f5e93a440adcca1c0dcf395145c1f5961696bad2e73f73417f07ef55c62a2dc5b35353436383833363939383137363233353732000000000000000000000000000000000000000000000000005c1f5961696bad2e73f73417f07ef55c62a2dc5b", handlerResponse: "0x", - timestamp: "2023-07-17T08:32:27.000Z", + timestamp: "2024-11-14T08:18:03.000Z", }, execution: { - txHash: "0xcc7c318cfd71745c27111772f21dec553f53277c9dc218fe07b54f897560c0cb", - blockNumber: "631", - timestamp: "2023-07-17T08:32:42.000Z", - }, - account: { - addressStatus: "", - }, - usdValue: null, - }, - ]) - }) - - it("should succesfully fetch evm permissioned generic transfer", async () => { - const res = await axios.get(`http://localhost:8000/api/transfers/txHash/${PERMISSIONED_GENERIC_EVM_DEPOSIT_TXHASH}?domainID=${DOMAIN_1}`) - const transfer = res.data as TransferResponse[] - - expect(res.status).to.be.deep.equal(200) - expect(transfer).to.be.deep.equal([ - { - id: transfer[0].id, - depositNonce: 3, - resourceID: "0x0000000000000000000000000000000000000000000000000000000000000100", - fromDomainId: 1, - toDomainId: 2, - accountId: "0x5C1F5961696BaD2e73f73417f07EF55C62a2dC5b", - destination: "", - message: "", - amount: "", - status: "executed", - resource: { - type: "permissionedGeneric", - id: "0x0000000000000000000000000000000000000000000000000000000000000100", - }, - toDomain: { name: "evm2", lastIndexedBlock: transfer[0].toDomain.lastIndexedBlock, id: 2 }, - fromDomain: { name: "Ethereum 1", lastIndexedBlock: transfer[0].fromDomain.lastIndexedBlock, id: 1 }, - fee: { - id: transfer[0].fee.id, - amount: "1000000000000000", - decimals: 18, - tokenAddress: "0x0000000000000000000000000000000000000000", - tokenSymbol: "eth", - transferId: transfer[0].id, - }, - deposit: { - txHash: "0x44b9ac0bbd9052b8468aae63620ee9babff498ace3092babca2994097344b516", - blockNumber: "598", - depositData: - "0x000000000000000000000000000000000000000000000000000000000000002030bb0f28498d8bc6272403413a967b2098aa4d7c7422d4ff2ff2c6c2bdc44af3", - handlerResponse: "0x", - timestamp: "2023-07-17T08:31:36.000Z", - }, - execution: { - txHash: "0xf031174a3a2b3ae7064f2ca083fa35b1b48b7723ae45ce1f925c9c09a3ba3077", - blockNumber: "603", - timestamp: "2023-07-17T08:31:45.000Z", + txHash: "0x508195d23128b60c20a577eca7ace567e6ec68f636bad42ddb554b7d96644dd3", + blockNumber: "162", + timestamp: "2024-11-14T08:18:20.000Z", }, account: { addressStatus: "", @@ -327,7 +269,7 @@ describe("Indexer e2e tests", function () { expect(transfer).to.be.deep.equal([ { id: transfer[0].id, - depositNonce: 2, + depositNonce: 0, resourceID: "0x0000000000000000000000000000000000000000000000000000000000000300", fromDomainId: 3, message: "", @@ -344,24 +286,25 @@ describe("Indexer e2e tests", function () { fromDomain: { name: "Substrate", lastIndexedBlock: transfer[0].fromDomain.lastIndexedBlock, id: 3 }, fee: { id: transfer[0].fee.id, - amount: "50", - decimals: 0, - tokenAddress: "{}", - tokenSymbol: "PHA", + amount: "0", + decimals: 6, + tokenAddress: + '{"Concrete":{"parents":"1","interior":{"X3":[{"Parachain":"2,005"},{"GeneralKey":{"length":"5","data":"0x7379676d61000000000000000000000000000000000000000000000000000000"}},{"GeneralKey":{"length":"4","data":"0x7573646300000000000000000000000000000000000000000000000000000000"}}]}}}', + tokenSymbol: "USDC", transferId: transfer[0].id, }, deposit: { - txHash: "356-1", - blockNumber: "356", + txHash: "279-1", + blockNumber: "279", depositData: "0x00000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000000145c1f5961696bad2e73f73417f07ef55c62a2dc5b", handlerResponse: "", - timestamp: "2023-07-17T08:29:12.000Z", + timestamp: "2024-11-14T08:19:48.001Z", }, execution: { - txHash: "0xe5648eb14c885ddf52226aea17440ec3126bfff778c70e0a366dc9666301ff35", - blockNumber: "548", - timestamp: "2023-07-17T08:29:55.000Z", + txHash: "0x9b10747083d576b05caa28edbecd5937080b77ae27da3485b29376e168e4076d", + blockNumber: "218", + timestamp: "2024-11-14T08:20:10.000Z", }, account: { addressStatus: "", @@ -372,14 +315,14 @@ describe("Indexer e2e tests", function () { }) it("should succesfully fetch evm to substrate fungible transfer", async () => { - const res = await axios.get(`http://localhost:8000/api/transfers/txHash/${FUNGIBLE_EVM_TO_SUBSTRATE_DEPOSIT}?domainID=${DOMAIN_1}`) + const res = await axios.get(`http://localhost:8000/api/transfers/txHash/${FUNGIBLE_EVM_TO_SUBSTRATE_DEPOSIT_TXHASH}?domainID=${DOMAIN_1}`) const transfer = res.data as TransferResponse[] expect(res.status).to.be.deep.equal(200) expect(transfer).to.be.deep.equal([ { id: transfer[0].id, - depositNonce: 2, + depositNonce: 1, resourceID: "0x0000000000000000000000000000000000000000000000000000000000000300", fromDomainId: 1, message: "", @@ -395,7 +338,7 @@ describe("Indexer e2e tests", function () { toDomain: { name: "Substrate", lastIndexedBlock: transfer[0].toDomain.lastIndexedBlock, id: 3 }, fromDomain: { name: "Ethereum 1", lastIndexedBlock: transfer[0].fromDomain.lastIndexedBlock, id: 1 }, fee: { - amount: "1000000000000000", + amount: "100000000000000", id: transfer[0].fee.id, decimals: 18, tokenAddress: "0x0000000000000000000000000000000000000000", @@ -403,17 +346,17 @@ describe("Indexer e2e tests", function () { transferId: transfer[0].id, }, deposit: { - txHash: "0xdae4f76d4cb634ca175996bb85d76e82f476cc91f71332bdba967f066d9efc16", - blockNumber: "516", + txHash: "0x967b320daebffcba435b6bf9ba493963471f6ca9d12c84c9f156bda6862934e0", + blockNumber: "195", depositData: "0x00000000000000000000000000000000000000000000000000005af3107a4000000000000000000000000000000000000000000000000000000000000000002400010100d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d", - handlerResponse: "0x", - timestamp: "2023-07-17T08:28:51.000Z", + handlerResponse: "0x00000000000000000000000000000000000000000000000000005af3107a4000", + timestamp: "2024-11-14T08:19:23.000Z", }, execution: { - txHash: "355-1", - blockNumber: "355", - timestamp: "2023-07-17T08:29:06.001Z", + txHash: "278-1", + blockNumber: "278", + timestamp: "2024-11-14T08:19:42.000Z", }, account: { addressStatus: "", diff --git a/tests/e2e/resourceRoute.spec.ts b/tests/e2e/resourceRoute.spec.ts index a59c69d3..08e46b00 100644 --- a/tests/e2e/resourceRoute.spec.ts +++ b/tests/e2e/resourceRoute.spec.ts @@ -16,22 +16,20 @@ type TransferResponse = Transfer & { } const NUMBER_OF_ERC20TST_TRANSFERS = 26 -const NUMBER_OF_ERC20LRTEST_TRANSFERS = 6 +const NUMBER_OF_ERC20LRTEST_TRANSFERS = 3 const NUMBER_OF_ERC721TST_TRANSFERS = 1 const NUMBER_OF_PERMISSIONLESS_TRANSFERS = 1 -const NUMBER_OF_PERMISSIONED_TRANSFERS = 1 const ERC20TST_RESOURCE_ID = "0x0000000000000000000000000000000000000000000000000000000000000000" const ERC20LRTEST_RESOURCE_ID = "0x0000000000000000000000000000000000000000000000000000000000000300" const ERC721TST_RESOURCE_ID = "0x0000000000000000000000000000000000000000000000000000000000000200" const PERMISSIONLESS_GENERIC_RESOURCE_ID = "0x0000000000000000000000000000000000000000000000000000000000000500" -const PERMISSIONED_GENERIC_RESOURCE_ID = "0x0000000000000000000000000000000000000000000000000000000000000100" describe("Get all transfers for a specific resource", function () { before(async () => { let transfers = 0 let isProcessing = false - while (transfers !== 35 || isProcessing) { + while (transfers !== 31 || isProcessing) { const res: { data: Array } = await axios.get("http://localhost:8000/api/transfers?page=1&limit=100") transfers = res.data.length @@ -84,7 +82,7 @@ describe("Get all transfers for a specific resource", function () { fromDomainId: 1, toDomainId: 2, destination: "0x8e0a907331554af72563bd8d43051c2e64be5d35", - amount: "2296080355773541392", + amount: "2935717020161974584", status: "executed", accountId: "0x5C1F5961696BaD2e73f73417f07EF55C62a2dC5b", message: "", @@ -96,7 +94,7 @@ describe("Get all transfers for a specific resource", function () { toDomain: { name: "evm2", lastIndexedBlock: transfers[0].toDomain.lastIndexedBlock, id: 2 }, fromDomain: { name: "Ethereum 1", lastIndexedBlock: transfers[0].fromDomain.lastIndexedBlock, id: 1 }, fee: { - amount: "1000000000000000", + amount: "100000000000000", id: transfers[0].fee.id, decimals: 18, tokenAddress: "0x0000000000000000000000000000000000000000", @@ -104,17 +102,17 @@ describe("Get all transfers for a specific resource", function () { transferId: transfers[0].id, }, deposit: { - txHash: "0x7b7c2be6b60c25a1be9f506fdd75e1aab76d3016f0bc708715405f2e6718c6df", - blockNumber: "591", + txHash: "0x12327002087fe09d30a4bd45e97e55549d92dbf05d254788591dc2b6bca4ef0f", + blockNumber: "130", depositData: - "0x0000000000000000000000000000000000000000000000001fdd50eb1da26c1000000000000000000000000000000000000000000000000000000000000000148e0a907331554af72563bd8d43051c2e64be5d35000000000000000000000000000000000000000000000000000000000000000c6d657461646174612e75726c", + "0x00000000000000000000000000000000000000000000000028bdc31363d2a13800000000000000000000000000000000000000000000000000000000000000148e0a907331554af72563bd8d43051c2e64be5d35000000000000000000000000000000000000000000000000000000000000000c6d657461646174612e75726c", handlerResponse: "0x6d657461646174612e746573746d657461646174612e75726c", - timestamp: "2023-07-17T08:31:22.000Z", + timestamp: "2024-11-14T08:17:11.000Z", }, execution: { - txHash: "0x3de2201e548a8332aaa50147a2fb02e2b6669184f042b4dbcf23b4f5d40edcfb", - blockNumber: "598", - timestamp: "2023-07-17T08:31:35.000Z", + txHash: "0x43c02a7cee493621c550e059489db14500b5a388185d61deeb7d9a7f52959e8d", + blockNumber: "138", + timestamp: "2024-11-14T08:17:31.000Z", }, account: { addressStatus: "" }, }, @@ -131,11 +129,11 @@ describe("Get all transfers for a specific resource", function () { expect(transfers).to.be.deep.equal([ { id: transfers[0].id, - depositNonce: 29, + depositNonce: 28, resourceID: "0x0000000000000000000000000000000000000000000000000000000000000500", fromDomainId: 1, toDomainId: 2, - destination: "0xb1387b365ae7294ea13bad9db83436e671dd16ba", + destination: "0xa2451c8553371e754f5e93a440adcca1c0dcf395", amount: "", status: "executed", accountId: "0x5C1F5961696BaD2e73f73417f07EF55C62a2dC5b", @@ -148,7 +146,7 @@ describe("Get all transfers for a specific resource", function () { toDomain: { name: "evm2", lastIndexedBlock: transfers[0].toDomain.lastIndexedBlock, id: 2 }, fromDomain: { name: "Ethereum 1", lastIndexedBlock: transfers[0].fromDomain.lastIndexedBlock, id: 1 }, fee: { - amount: "1000000000000000", + amount: "100000000000000", id: transfers[0].fee.id, decimals: 18, tokenAddress: "0x0000000000000000000000000000000000000000", @@ -156,69 +154,17 @@ describe("Get all transfers for a specific resource", function () { transferId: transfers[0].id, }, deposit: { - txHash: "0x18fa527a4773789a5ba487dae5bc3d00cc04dc50509b6f67e438efdb60e75c67", - blockNumber: "623", + txHash: "0x2b355542a454d8faedccc75c8741ef0d2f531ea4cd8ed53544734ff681377699", + blockNumber: "155", depositData: - "0x0000000000000000000000000000000000000000000000000000000000030d400004ea287d1514b1387b365ae7294ea13bad9db83436e671dd16ba145c1f5961696bad2e73f73417f07ef55c62a2dc5b47ed248f568cc8f9fe4371a1d1fab88a62af595f8efb9aeff6f0e043b7ea33b10000000000000000000000005c1f5961696bad2e73f73417f07ef55c62a2dc5b", + "0x00000000000000000000000000000000000000000000000000000000000927c00004ea287d1514a2451c8553371e754f5e93a440adcca1c0dcf395145c1f5961696bad2e73f73417f07ef55c62a2dc5b35353436383833363939383137363233353732000000000000000000000000000000000000000000000000005c1f5961696bad2e73f73417f07ef55c62a2dc5b", handlerResponse: "0x", - timestamp: "2023-07-17T08:32:27.000Z", + timestamp: "2024-11-14T08:18:03.000Z", }, execution: { - txHash: "0xcc7c318cfd71745c27111772f21dec553f53277c9dc218fe07b54f897560c0cb", - blockNumber: "631", - timestamp: "2023-07-17T08:32:42.000Z", - }, - account: { addressStatus: "" }, - }, - ]) - }) - - it("Should successfully fetch all permissioned generic transfers", async () => { - const res = await axios.get(`http://localhost:8000/api/resources/${PERMISSIONED_GENERIC_RESOURCE_ID}/transfers?page=1&limit=100`) - const transfers = res.data as Array - - expect(res.status).to.be.deep.equal(200) - expect(transfers.length).to.be.deep.equal(NUMBER_OF_PERMISSIONED_TRANSFERS) - - expect(transfers).to.be.deep.equal([ - { - id: transfers[0].id, - depositNonce: 3, - resourceID: "0x0000000000000000000000000000000000000000000000000000000000000100", - fromDomainId: 1, - toDomainId: 2, - destination: "", - amount: "", - status: "executed", - accountId: "0x5C1F5961696BaD2e73f73417f07EF55C62a2dC5b", - message: "", - usdValue: null, - resource: { - type: "permissionedGeneric", - id: "0x0000000000000000000000000000000000000000000000000000000000000100", - }, - toDomain: { name: "evm2", lastIndexedBlock: transfers[0].toDomain.lastIndexedBlock, id: 2 }, - fromDomain: { name: "Ethereum 1", lastIndexedBlock: transfers[0].fromDomain.lastIndexedBlock, id: 1 }, - fee: { - amount: "1000000000000000", - id: transfers[0].fee.id, - decimals: 18, - tokenAddress: "0x0000000000000000000000000000000000000000", - tokenSymbol: "eth", - transferId: transfers[0].id, - }, - deposit: { - txHash: "0x44b9ac0bbd9052b8468aae63620ee9babff498ace3092babca2994097344b516", - blockNumber: "598", - depositData: - "0x000000000000000000000000000000000000000000000000000000000000002030bb0f28498d8bc6272403413a967b2098aa4d7c7422d4ff2ff2c6c2bdc44af3", - handlerResponse: "0x", - timestamp: "2023-07-17T08:31:36.000Z", - }, - execution: { - txHash: "0xf031174a3a2b3ae7064f2ca083fa35b1b48b7723ae45ce1f925c9c09a3ba3077", - blockNumber: "603", - timestamp: "2023-07-17T08:31:45.000Z", + txHash: "0x508195d23128b60c20a577eca7ace567e6ec68f636bad42ddb554b7d96644dd3", + blockNumber: "162", + timestamp: "2024-11-14T08:18:20.000Z", }, account: { addressStatus: "" }, }, diff --git a/tests/e2e/sourceToDestDomainRoute.spec.ts b/tests/e2e/sourceToDestDomainRoute.spec.ts index 30338ee2..3d6d3e42 100644 --- a/tests/e2e/sourceToDestDomainRoute.spec.ts +++ b/tests/e2e/sourceToDestDomainRoute.spec.ts @@ -23,7 +23,7 @@ describe("Get all transfers from a source domain to a destination domain", funct before(async () => { let transfers = 0 let isProcessing = false - while (transfers !== 35 || isProcessing) { + while (transfers !== 31 || isProcessing) { const res: { data: Array } = await axios.get("http://localhost:8000/api/transfers?page=1&limit=100") transfers = res.data.length @@ -41,7 +41,7 @@ describe("Get all transfers from a source domain to a destination domain", funct const res = await axios.get(`http://localhost:8000/api/domains/source/${DOMAIN_1}/destination/${DOMAIN_2}/transfers?page=1&limit=100`) const transfers = res.data as Array - expect(transfers.length).to.be.deep.equal(30) + expect(transfers.length).to.be.deep.equal(29) for (const transfer of transfers) { expect(transfer.fromDomainId).to.be.deep.equal(parseInt(DOMAIN_1)) @@ -53,7 +53,7 @@ describe("Get all transfers from a source domain to a destination domain", funct const res = await axios.get(`http://localhost:8000/api/domains/source/${DOMAIN_1}/destination/${DOMAIN_3}/transfers?page=1&limit=100`) const transfers = res.data as Array - expect(transfers.length).to.be.deep.equal(2) + expect(transfers.length).to.be.deep.equal(1) for (const transfer of transfers) { expect(transfer.fromDomainId).to.be.deep.equal(parseInt(DOMAIN_1)) @@ -65,7 +65,7 @@ describe("Get all transfers from a source domain to a destination domain", funct const res = await axios.get(`http://localhost:8000/api/domains/source/${DOMAIN_3}/destination/${DOMAIN_1}/transfers`) const transfers = res.data as Array - expect(transfers.length).to.be.deep.equal(3) + expect(transfers.length).to.be.deep.equal(1) for (const transfer of transfers) { expect(transfer.fromDomainId).to.be.deep.equal(parseInt(DOMAIN_3))