Skip to content

Commit

Permalink
test: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
petarTxFusion committed Dec 5, 2024
1 parent cd3911b commit aadcc6d
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 30 deletions.
5 changes: 5 additions & 0 deletions packages/api/test/address.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,7 @@ describe("AddressController (e2e)", () => {
createdInBlockNumber: 10,
creatorAddress: "0x91d0a23f34e535e44Df8Ba84c53a0945cf0eEB60",
creatorTxHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e15",
isEvmLike: null,
totalTransactions: 4,
type: "contract",
})
Expand Down Expand Up @@ -849,6 +850,7 @@ describe("AddressController (e2e)", () => {
createdInBlockNumber: 10,
creatorAddress: "0x91d0a23f34e535e44Df8Ba84c53a0945cf0eEB60",
creatorTxHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e15",
isEvmLike: null,
totalTransactions: 4,
type: "contract",
})
Expand Down Expand Up @@ -908,6 +910,7 @@ describe("AddressController (e2e)", () => {
createdInBlockNumber: 10,
creatorAddress: "0x91d0a23f34e535e44Df8Ba84c53a0945cf0eEB60",
creatorTxHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e15",
isEvmLike: null,
totalTransactions: 4,
type: "contract",
})
Expand Down Expand Up @@ -967,6 +970,7 @@ describe("AddressController (e2e)", () => {
createdInBlockNumber: 10,
creatorAddress: "0x91d0a23f34e535e44Df8Ba84c53a0945cf0eEB60",
creatorTxHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e15",
isEvmLike: null,
totalTransactions: 4,
type: "contract",
})
Expand All @@ -987,6 +991,7 @@ describe("AddressController (e2e)", () => {
createdInBlockNumber: 10,
creatorAddress: "0x91d0a23f34e535e44Df8Ba84c53a0945cf0eEB60",
creatorTxHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e15",
isEvmLike: null,
totalTransactions: 0,
type: "contract",
})
Expand Down
23 changes: 23 additions & 0 deletions packages/api/test/transaction.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ describe("TransactionController (e2e)", () => {
maxFeePerGas: "3009",
maxPriorityFeePerGas: "4009",
hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e19",
isEvmLike: null,
isL1BatchSealed: false,
isL1Originated: true,
l1BatchNumber: 9,
Expand Down Expand Up @@ -296,6 +297,7 @@ describe("TransactionController (e2e)", () => {
maxFeePerGas: "3008",
maxPriorityFeePerGas: "4008",
hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e18",
isEvmLike: null,
isL1BatchSealed: true,
isL1Originated: true,
l1BatchNumber: 8,
Expand Down Expand Up @@ -324,6 +326,7 @@ describe("TransactionController (e2e)", () => {
maxFeePerGas: "3007",
maxPriorityFeePerGas: "4007",
hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e17",
isEvmLike: null,
isL1BatchSealed: true,
isL1Originated: true,
l1BatchNumber: 7,
Expand Down Expand Up @@ -352,6 +355,7 @@ describe("TransactionController (e2e)", () => {
maxFeePerGas: "3006",
maxPriorityFeePerGas: "4006",
hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e16",
isEvmLike: null,
isL1BatchSealed: true,
isL1Originated: true,
l1BatchNumber: 6,
Expand Down Expand Up @@ -380,6 +384,7 @@ describe("TransactionController (e2e)", () => {
maxFeePerGas: "3005",
maxPriorityFeePerGas: "4005",
hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e15",
isEvmLike: null,
isL1BatchSealed: true,
isL1Originated: true,
l1BatchNumber: 5,
Expand Down Expand Up @@ -408,6 +413,7 @@ describe("TransactionController (e2e)", () => {
maxFeePerGas: "3004",
maxPriorityFeePerGas: "4004",
hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e14",
isEvmLike: null,
isL1BatchSealed: true,
isL1Originated: true,
l1BatchNumber: 4,
Expand Down Expand Up @@ -436,6 +442,7 @@ describe("TransactionController (e2e)", () => {
maxFeePerGas: "3003",
maxPriorityFeePerGas: "4003",
hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e13",
isEvmLike: null,
isL1BatchSealed: true,
isL1Originated: true,
l1BatchNumber: 3,
Expand Down Expand Up @@ -464,6 +471,7 @@ describe("TransactionController (e2e)", () => {
maxFeePerGas: "3002",
maxPriorityFeePerGas: "4002",
hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e12",
isEvmLike: null,
isL1BatchSealed: false,
isL1Originated: true,
l1BatchNumber: 1,
Expand Down Expand Up @@ -492,6 +500,7 @@ describe("TransactionController (e2e)", () => {
maxFeePerGas: "3001",
maxPriorityFeePerGas: "4001",
hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e11",
isEvmLike: null,
isL1BatchSealed: false,
isL1Originated: true,
l1BatchNumber: 1,
Expand Down Expand Up @@ -520,6 +529,7 @@ describe("TransactionController (e2e)", () => {
maxFeePerGas: "3000",
maxPriorityFeePerGas: "4000",
hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10",
isEvmLike: null,
isL1BatchSealed: false,
isL1Originated: true,
l1BatchNumber: 1,
Expand Down Expand Up @@ -558,6 +568,7 @@ describe("TransactionController (e2e)", () => {
maxFeePerGas: "3008",
maxPriorityFeePerGas: "4008",
hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e18",
isEvmLike: null,
isL1BatchSealed: true,
isL1Originated: true,
l1BatchNumber: 8,
Expand Down Expand Up @@ -586,6 +597,7 @@ describe("TransactionController (e2e)", () => {
maxFeePerGas: "3007",
maxPriorityFeePerGas: "4007",
hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e17",
isEvmLike: null,
isL1BatchSealed: true,
isL1Originated: true,
l1BatchNumber: 7,
Expand Down Expand Up @@ -614,6 +626,7 @@ describe("TransactionController (e2e)", () => {
maxFeePerGas: "3006",
maxPriorityFeePerGas: "4006",
hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e16",
isEvmLike: null,
isL1BatchSealed: true,
isL1Originated: true,
l1BatchNumber: 6,
Expand Down Expand Up @@ -698,6 +711,7 @@ describe("TransactionController (e2e)", () => {
maxFeePerGas: "3001",
maxPriorityFeePerGas: "4001",
hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e11",
isEvmLike: null,
isL1BatchSealed: false,
isL1Originated: true,
l1BatchNumber: 1,
Expand Down Expand Up @@ -751,6 +765,7 @@ describe("TransactionController (e2e)", () => {
maxFeePerGas: "3001",
maxPriorityFeePerGas: "4001",
hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e11",
isEvmLike: null,
isL1BatchSealed: false,
isL1Originated: true,
l1BatchNumber: 1,
Expand Down Expand Up @@ -804,6 +819,7 @@ describe("TransactionController (e2e)", () => {
maxFeePerGas: "3007",
maxPriorityFeePerGas: "4007",
hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e17",
isEvmLike: null,
isL1BatchSealed: true,
isL1Originated: true,
l1BatchNumber: 7,
Expand Down Expand Up @@ -922,6 +938,7 @@ describe("TransactionController (e2e)", () => {
maxFeePerGas: "3008",
maxPriorityFeePerGas: "4008",
hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e18",
isEvmLike: null,
isL1BatchSealed: true,
isL1Originated: true,
l1BatchNumber: 8,
Expand Down Expand Up @@ -959,6 +976,7 @@ describe("TransactionController (e2e)", () => {
maxFeePerGas: "3005",
maxPriorityFeePerGas: "4005",
hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e15",
isEvmLike: null,
isL1BatchSealed: true,
isL1Originated: true,
l1BatchNumber: 5,
Expand Down Expand Up @@ -996,6 +1014,7 @@ describe("TransactionController (e2e)", () => {
maxFeePerGas: "3003",
maxPriorityFeePerGas: "4003",
hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e13",
isEvmLike: null,
isL1BatchSealed: true,
isL1Originated: true,
l1BatchNumber: 3,
Expand Down Expand Up @@ -1033,6 +1052,7 @@ describe("TransactionController (e2e)", () => {
maxFeePerGas: "3000",
maxPriorityFeePerGas: "4000",
hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10",
isEvmLike: null,
isL1BatchSealed: true,
isL1Originated: true,
l1BatchNumber: 1,
Expand Down Expand Up @@ -1070,6 +1090,7 @@ describe("TransactionController (e2e)", () => {
maxFeePerGas: "3009",
maxPriorityFeePerGas: "4009",
hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e19",
isEvmLike: null,
isL1BatchSealed: true,
isL1Originated: true,
l1BatchNumber: 9,
Expand Down Expand Up @@ -1107,6 +1128,7 @@ describe("TransactionController (e2e)", () => {
maxFeePerGas: "3000",
maxPriorityFeePerGas: "4000",
hash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10",
isEvmLike: null,
isL1BatchSealed: true,
isL1Originated: true,
l1BatchNumber: 1,
Expand Down Expand Up @@ -1425,6 +1447,7 @@ describe("TransactionController (e2e)", () => {
},
tokenAddress: "0x000000000000000000000000000000000000800A",
transactionHash: "0x8a008b8dbbc18035e56370abb820e736b705d68d6ac12b203603db8d9ea87e10",
isEvmLike: null,
type: "deposit",
tokenType: "BASETOKEN",
isInternal: false,
Expand Down
1 change: 1 addition & 0 deletions packages/app/tests/components/transactions/Table.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const transaction: TransactionListItem = {
gasPerPubdata: "800",
maxFeePerGas: "7000",
maxPriorityFeePerGas: "8000",
isEvmLike: true,
error: null,
revertReason: null,
};
Expand Down
1 change: 1 addition & 0 deletions packages/app/tests/composables/useTransactions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const transaction: TransactionListItem = {
gasPerPubdata: "800",
maxFeePerGas: "7000",
maxPriorityFeePerGas: "8000",
isEvmLike: true,
error: null,
revertReason: null,
};
Expand Down
4 changes: 0 additions & 4 deletions packages/data-fetcher/src/transaction/transaction.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export interface TransactionInfo extends types.TransactionResponse {
error?: string;
revertReason?: string;
isEvmLike?: boolean;
isToEvmLike?: boolean;
}

export interface TransactionData extends LogsData {
Expand Down Expand Up @@ -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;

Expand Down
26 changes: 0 additions & 26 deletions packages/worker/src/transaction/transaction.processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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<void> {
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({
Expand Down

0 comments on commit aadcc6d

Please sign in to comment.