From aadcc6d53ea748b6c8fa02aa7cb4500b9b576a60 Mon Sep 17 00:00:00 2001 From: petarTxFusion Date: Thu, 5 Dec 2024 14:32:28 +0100 Subject: [PATCH] test: fix tests --- packages/api/test/address.e2e-spec.ts | 5 ++++ packages/api/test/transaction.e2e-spec.ts | 23 ++++++++++++++++ .../components/transactions/Table.spec.ts | 1 + .../tests/composables/useTransactions.spec.ts | 1 + .../src/transaction/transaction.service.ts | 4 --- .../src/transaction/transaction.processor.ts | 26 ------------------- 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/packages/api/test/address.e2e-spec.ts b/packages/api/test/address.e2e-spec.ts index 7ffa7f550..151875c0e 100644 --- a/packages/api/test/address.e2e-spec.ts +++ b/packages/api/test/address.e2e-spec.ts @@ -790,6 +790,7 @@ describe("AddressController (e2e)", () => { createdInBlockNumber: 10, creatorAddress: "0x91d0a23f34e535e44Df8Ba84c53a0945cf0eEB60", creatorTxHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e15", + isEvmLike: null, totalTransactions: 4, type: "contract", }) @@ -849,6 +850,7 @@ describe("AddressController (e2e)", () => { createdInBlockNumber: 10, creatorAddress: "0x91d0a23f34e535e44Df8Ba84c53a0945cf0eEB60", creatorTxHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e15", + isEvmLike: null, totalTransactions: 4, type: "contract", }) @@ -908,6 +910,7 @@ describe("AddressController (e2e)", () => { createdInBlockNumber: 10, creatorAddress: "0x91d0a23f34e535e44Df8Ba84c53a0945cf0eEB60", creatorTxHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e15", + isEvmLike: null, totalTransactions: 4, type: "contract", }) @@ -967,6 +970,7 @@ describe("AddressController (e2e)", () => { createdInBlockNumber: 10, creatorAddress: "0x91d0a23f34e535e44Df8Ba84c53a0945cf0eEB60", creatorTxHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e15", + isEvmLike: null, totalTransactions: 4, type: "contract", }) @@ -987,6 +991,7 @@ describe("AddressController (e2e)", () => { createdInBlockNumber: 10, creatorAddress: "0x91d0a23f34e535e44Df8Ba84c53a0945cf0eEB60", creatorTxHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e15", + isEvmLike: null, totalTransactions: 0, type: "contract", }) diff --git a/packages/api/test/transaction.e2e-spec.ts b/packages/api/test/transaction.e2e-spec.ts index 305933ed7..837faaaf5 100644 --- a/packages/api/test/transaction.e2e-spec.ts +++ b/packages/api/test/transaction.e2e-spec.ts @@ -268,6 +268,7 @@ describe("TransactionController (e2e)", () => { maxFeePerGas: "3009", maxPriorityFeePerGas: "4009", hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e19", + isEvmLike: null, isL1BatchSealed: false, isL1Originated: true, l1BatchNumber: 9, @@ -296,6 +297,7 @@ describe("TransactionController (e2e)", () => { maxFeePerGas: "3008", maxPriorityFeePerGas: "4008", hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e18", + isEvmLike: null, isL1BatchSealed: true, isL1Originated: true, l1BatchNumber: 8, @@ -324,6 +326,7 @@ describe("TransactionController (e2e)", () => { maxFeePerGas: "3007", maxPriorityFeePerGas: "4007", hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e17", + isEvmLike: null, isL1BatchSealed: true, isL1Originated: true, l1BatchNumber: 7, @@ -352,6 +355,7 @@ describe("TransactionController (e2e)", () => { maxFeePerGas: "3006", maxPriorityFeePerGas: "4006", hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e16", + isEvmLike: null, isL1BatchSealed: true, isL1Originated: true, l1BatchNumber: 6, @@ -380,6 +384,7 @@ describe("TransactionController (e2e)", () => { maxFeePerGas: "3005", maxPriorityFeePerGas: "4005", hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e15", + isEvmLike: null, isL1BatchSealed: true, isL1Originated: true, l1BatchNumber: 5, @@ -408,6 +413,7 @@ describe("TransactionController (e2e)", () => { maxFeePerGas: "3004", maxPriorityFeePerGas: "4004", hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e14", + isEvmLike: null, isL1BatchSealed: true, isL1Originated: true, l1BatchNumber: 4, @@ -436,6 +442,7 @@ describe("TransactionController (e2e)", () => { maxFeePerGas: "3003", maxPriorityFeePerGas: "4003", hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e13", + isEvmLike: null, isL1BatchSealed: true, isL1Originated: true, l1BatchNumber: 3, @@ -464,6 +471,7 @@ describe("TransactionController (e2e)", () => { maxFeePerGas: "3002", maxPriorityFeePerGas: "4002", hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e12", + isEvmLike: null, isL1BatchSealed: false, isL1Originated: true, l1BatchNumber: 1, @@ -492,6 +500,7 @@ describe("TransactionController (e2e)", () => { maxFeePerGas: "3001", maxPriorityFeePerGas: "4001", hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e11", + isEvmLike: null, isL1BatchSealed: false, isL1Originated: true, l1BatchNumber: 1, @@ -520,6 +529,7 @@ describe("TransactionController (e2e)", () => { maxFeePerGas: "3000", maxPriorityFeePerGas: "4000", hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10", + isEvmLike: null, isL1BatchSealed: false, isL1Originated: true, l1BatchNumber: 1, @@ -558,6 +568,7 @@ describe("TransactionController (e2e)", () => { maxFeePerGas: "3008", maxPriorityFeePerGas: "4008", hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e18", + isEvmLike: null, isL1BatchSealed: true, isL1Originated: true, l1BatchNumber: 8, @@ -586,6 +597,7 @@ describe("TransactionController (e2e)", () => { maxFeePerGas: "3007", maxPriorityFeePerGas: "4007", hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e17", + isEvmLike: null, isL1BatchSealed: true, isL1Originated: true, l1BatchNumber: 7, @@ -614,6 +626,7 @@ describe("TransactionController (e2e)", () => { maxFeePerGas: "3006", maxPriorityFeePerGas: "4006", hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e16", + isEvmLike: null, isL1BatchSealed: true, isL1Originated: true, l1BatchNumber: 6, @@ -698,6 +711,7 @@ describe("TransactionController (e2e)", () => { maxFeePerGas: "3001", maxPriorityFeePerGas: "4001", hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e11", + isEvmLike: null, isL1BatchSealed: false, isL1Originated: true, l1BatchNumber: 1, @@ -751,6 +765,7 @@ describe("TransactionController (e2e)", () => { maxFeePerGas: "3001", maxPriorityFeePerGas: "4001", hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e11", + isEvmLike: null, isL1BatchSealed: false, isL1Originated: true, l1BatchNumber: 1, @@ -804,6 +819,7 @@ describe("TransactionController (e2e)", () => { maxFeePerGas: "3007", maxPriorityFeePerGas: "4007", hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e17", + isEvmLike: null, isL1BatchSealed: true, isL1Originated: true, l1BatchNumber: 7, @@ -922,6 +938,7 @@ describe("TransactionController (e2e)", () => { maxFeePerGas: "3008", maxPriorityFeePerGas: "4008", hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e18", + isEvmLike: null, isL1BatchSealed: true, isL1Originated: true, l1BatchNumber: 8, @@ -959,6 +976,7 @@ describe("TransactionController (e2e)", () => { maxFeePerGas: "3005", maxPriorityFeePerGas: "4005", hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e15", + isEvmLike: null, isL1BatchSealed: true, isL1Originated: true, l1BatchNumber: 5, @@ -996,6 +1014,7 @@ describe("TransactionController (e2e)", () => { maxFeePerGas: "3003", maxPriorityFeePerGas: "4003", hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e13", + isEvmLike: null, isL1BatchSealed: true, isL1Originated: true, l1BatchNumber: 3, @@ -1033,6 +1052,7 @@ describe("TransactionController (e2e)", () => { maxFeePerGas: "3000", maxPriorityFeePerGas: "4000", hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10", + isEvmLike: null, isL1BatchSealed: true, isL1Originated: true, l1BatchNumber: 1, @@ -1070,6 +1090,7 @@ describe("TransactionController (e2e)", () => { maxFeePerGas: "3009", maxPriorityFeePerGas: "4009", hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e19", + isEvmLike: null, isL1BatchSealed: true, isL1Originated: true, l1BatchNumber: 9, @@ -1107,6 +1128,7 @@ describe("TransactionController (e2e)", () => { maxFeePerGas: "3000", maxPriorityFeePerGas: "4000", hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10", + isEvmLike: null, isL1BatchSealed: true, isL1Originated: true, l1BatchNumber: 1, @@ -1425,6 +1447,7 @@ describe("TransactionController (e2e)", () => { }, tokenAddress: "0x000000000000000000000000000000000000800A", transactionHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10", + isEvmLike: null, type: "deposit", tokenType: "BASETOKEN", isInternal: false, diff --git a/packages/app/tests/components/transactions/Table.spec.ts b/packages/app/tests/components/transactions/Table.spec.ts index 0c8febfa7..0fc964295 100644 --- a/packages/app/tests/components/transactions/Table.spec.ts +++ b/packages/app/tests/components/transactions/Table.spec.ts @@ -71,6 +71,7 @@ const transaction: TransactionListItem = { gasPerPubdata: "800", maxFeePerGas: "7000", maxPriorityFeePerGas: "8000", + isEvmLike: true, error: null, revertReason: null, }; diff --git a/packages/app/tests/composables/useTransactions.spec.ts b/packages/app/tests/composables/useTransactions.spec.ts index 2924a9c3f..2ffa3df7e 100644 --- a/packages/app/tests/composables/useTransactions.spec.ts +++ b/packages/app/tests/composables/useTransactions.spec.ts @@ -33,6 +33,7 @@ const transaction: TransactionListItem = { gasPerPubdata: "800", maxFeePerGas: "7000", maxPriorityFeePerGas: "8000", + isEvmLike: true, error: null, revertReason: null, }; diff --git a/packages/data-fetcher/src/transaction/transaction.service.ts b/packages/data-fetcher/src/transaction/transaction.service.ts index d1a6340b8..33d70063d 100644 --- a/packages/data-fetcher/src/transaction/transaction.service.ts +++ b/packages/data-fetcher/src/transaction/transaction.service.ts @@ -14,7 +14,6 @@ export interface TransactionInfo extends types.TransactionResponse { error?: string; revertReason?: string; isEvmLike?: boolean; - isToEvmLike?: boolean; } export interface TransactionData extends LogsData { @@ -82,15 +81,12 @@ export class TransactionService { ); const isEvmLike = transactionInfo.to === null; - const isToEvmLike = - isEvmLike && logsData.contractAddresses?.length > 0 ? logsData.contractAddresses[0].isEvmLike : false; const toAddress = isEvmLike && logsData.contractAddresses?.length > 0 ? logsData.contractAddresses[0].address : transactionInfo.to; const updatedTransactionInfo = { ...transactionInfo, isEvmLike, - isToEvmLike: isToEvmLike, to: toAddress, } as unknown as TransactionInfo; diff --git a/packages/worker/src/transaction/transaction.processor.ts b/packages/worker/src/transaction/transaction.processor.ts index d95eac758..88bbef89f 100644 --- a/packages/worker/src/transaction/transaction.processor.ts +++ b/packages/worker/src/transaction/transaction.processor.ts @@ -11,7 +11,6 @@ import { } from "../repositories"; import { TRANSACTION_PROCESSING_DURATION_METRIC_NAME } from "../metrics"; import { TransactionData } from "../dataFetcher/types"; -import { getAddress } from "ethers"; @Injectable() export class TransactionProcessor { @@ -30,44 +29,19 @@ export class TransactionProcessor { this.logger = new Logger(TransactionProcessor.name); } - public async test() { - const tx = await this.transactionRepository.findOneBy({ - hash: "0x3071841b9fb9ca6f329a7fa3d79970a36126e70d12d2210c7f47102bf81374d6", - }); - const pls = await this.addressRepository.findOneBy({ address: "0xafb5167116e6b833889018916594ac8040dbc05f" }); - const addresses = await this.addressRepository.find({}); - const jedan = addresses[13]; - this.logger.debug({ - pls: pls, - }); - } - public async add(blockNumber: number, transactionData: TransactionData): Promise { const stopTransactionProcessingMeasuring = this.transactionProcessingDurationMetric.startTimer(); - let isToEvmLike = false; - if (transactionData.transaction.data.length > 2) { - let a = null; - while (a === null) { - a = await this.addressRepository.findOneBy({ address: transactionData.transaction.to }); - } - isToEvmLike = a?.isEvmLike ?? false; - this.logger.debug({ - molimTe: a, - }); - } this.logger.debug({ message: "Saving transactions data to the DB", blockNumber: blockNumber, transactionHash: transactionData.transaction.hash, - transactionData: transactionData, }); await this.transactionRepository.add({ ...transactionData.transaction, transactionIndex: transactionData.transaction.index, isEvmLike: transactionData.transaction.isEvmLike, - isToEvmLike: isToEvmLike, }); this.logger.debug({