Skip to content

Commit

Permalink
reactivate indexer tests (#1414)
Browse files Browse the repository at this point in the history
* fix: filter indexer tests

* fix: transaction indexer tests
  • Loading branch information
eugypalu authored Oct 2, 2024
1 parent ec4ea91 commit 6ef788d
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 12 deletions.
131 changes: 121 additions & 10 deletions indexer/src/types/transaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function createSignedLegacyTransaction(): LegacyTransaction {
return signedTx;
}

Deno.test.ignore("toTypedEthTx Legacy Transaction", () => {
Deno.test("toTypedEthTx Legacy Transaction", () => {
// Given
const common = new Common({ chain: "mainnet", hardfork: "shanghai" });
const tx = new LegacyTransaction(
Expand All @@ -106,8 +106,23 @@ Deno.test.ignore("toTypedEthTx Legacy Transaction", () => {
"0x0",
"0x0",
"0x0",
"0x0",
"0x0",
"0x1",
"0x1",
"0x0",
"0x0",
"0x40",
"0x4",
`0x${bytesLength.toString(16)}`,
`0x${bytesLength.toString(16)}`,
...packCallData(raw),
"0x5",
"0x1",
"0x2",
"0x3",
"0x4",
"0x1c",
];

const starknetTx: Transaction = {
Expand Down Expand Up @@ -137,7 +152,7 @@ Deno.test.ignore("toTypedEthTx Legacy Transaction", () => {
assertEquals(ethTx.data, tx.data);
});

Deno.test.ignore("toTypedEthTx Legacy Transaction with v = 28", () => {
Deno.test("toTypedEthTx Legacy Transaction with v = 28", () => {
// Given
const common = new Common({ chain: "mainnet", hardfork: "shanghai" });
const tx = new LegacyTransaction(
Expand All @@ -162,8 +177,23 @@ Deno.test.ignore("toTypedEthTx Legacy Transaction with v = 28", () => {
"0x0",
"0x0",
"0x0",
"0x0",
"0x0",
"0x1",
"0x1",
"0x0",
"0x0",
"0x40",
"0x4",
`0x${bytesLength.toString(16)}`,
`0x${bytesLength.toString(16)}`,
...packCallData(raw),
"0x5",
"0x1",
"0x2",
"0x3",
"0x4",
"0x1c",
];

const starknetTx: Transaction = {
Expand Down Expand Up @@ -243,7 +273,7 @@ Deno.test("toTypedEthTx Legacy Transaction with v = 26 (failure case)", () => {
assertEquals(ethTx, null);
});

Deno.test.ignore("toTypedEthTx EIP1559 Transaction", () => {
Deno.test("toTypedEthTx EIP1559 Transaction", () => {
// Given
const common = new Common({ chain: "mainnet", hardfork: "shanghai" });
const tx = new FeeMarketEIP1559Transaction(
Expand Down Expand Up @@ -277,8 +307,23 @@ Deno.test.ignore("toTypedEthTx EIP1559 Transaction", () => {
"0x0",
"0x0",
"0x0",
"0x0",
"0x0",
"0x1",
"0x1",
"0x0",
"0x0",
"0x40",
"0x5",
`0x${bytesLength.toString(16)}`,
`0x${bytesLength.toString(16)}`,
...packCallData(raw),
"0x5",
"0x1",
"0x2",
"0x3",
"0x4",
"0x1",
];

const starknetTx: Transaction = {
Expand Down Expand Up @@ -311,7 +356,7 @@ Deno.test.ignore("toTypedEthTx EIP1559 Transaction", () => {
assertEquals(ethTx.data, new Uint8Array([0x12, 0x34]));
});

Deno.test.ignore("toTypedEthTx EIP2930 Transaction", () => {
Deno.test("toTypedEthTx EIP2930 Transaction", () => {
// Given
const common = new Common({ chain: "mainnet", hardfork: "shanghai" });
const tx = new AccessListEIP2930Transaction(
Expand Down Expand Up @@ -344,8 +389,23 @@ Deno.test.ignore("toTypedEthTx EIP2930 Transaction", () => {
"0x0",
"0x0",
"0x0",
"0x0",
"0x0",
"0x1",
"0x1",
"0x0",
"0x0",
"0x40",
"0x5",
`0x${bytesLength.toString(16)}`,
`0x${bytesLength.toString(16)}`,
...packCallData(raw),
"0x5",
"0x1",
"0x2",
"0x3",
"0x4",
"0x1",
];

const starknetTx: Transaction = {
Expand Down Expand Up @@ -491,7 +551,7 @@ Deno.test("unpackCallData by chunks", () => {
assertEquals(unpackCallData(input), expected_calldata);
});

Deno.test.ignore(
Deno.test(
"toTypedEthTx Legacy Transaction before release with 31 bytes chunks packing",
() => {
// Given
Expand All @@ -505,6 +565,7 @@ Deno.test.ignore(
data: new Uint8Array([0x12, 0x34]),
}, { common });
const raw = RLP.encode(tx.getMessageToSign());
const bytesLength = raw.byteLength;

const serializedTx: `0x${string}`[] = [];
raw.forEach((x) => serializedTx.push(`0x${x.toString(16)}`));
Expand All @@ -515,7 +576,23 @@ Deno.test.ignore(
"0x0",
"0x0",
"0x0",
...serializedTx,
"0x0",
"0x0",
"0x1",
"0x1",
"0x0",
"0x0",
"0x40",
"0x4",
`0x${bytesLength.toString(16)}`,
`0x${bytesLength.toString(16)}`,
...packCallData(raw),
"0x5",
"0x1",
"0x2",
"0x3",
"0x4",
"0x1c",
];

const starknetTx: Transaction = {
Expand Down Expand Up @@ -548,7 +625,7 @@ Deno.test.ignore(
},
);

Deno.test.ignore(
Deno.test(
"toTypedEthTx EIP1559 Transaction before release with 31 bytes chunks packing",
() => {
// Given
Expand All @@ -570,6 +647,7 @@ Deno.test.ignore(
}, { common });

const raw = tx.getMessageToSign();
const bytesLength = raw.byteLength;
const serializedTx: `0x${string}`[] = [];
raw.forEach((x) => serializedTx.push(`0x${x.toString(16)}`));
const starknetTxCalldata: `0x${string}`[] = [
Expand All @@ -579,7 +657,23 @@ Deno.test.ignore(
"0x0",
"0x0",
"0x0",
...serializedTx,
"0x0",
"0x0",
"0x1",
"0x1",
"0x0",
"0x0",
"0x40",
"0x5",
`0x${bytesLength.toString(16)}`,
`0x${bytesLength.toString(16)}`,
...packCallData(raw),
"0x5",
"0x1",
"0x2",
"0x3",
"0x4",
"0x1",
];

const starknetTx: Transaction = {
Expand Down Expand Up @@ -613,7 +707,7 @@ Deno.test.ignore(
},
);

Deno.test.ignore(
Deno.test(
"toTypedEthTx EIP2930 Transaction before release with 31 bytes chunks packing",
() => {
// Given
Expand All @@ -634,6 +728,7 @@ Deno.test.ignore(
}, { common });

const raw = tx.getMessageToSign();
const bytesLength = raw.byteLength;
const serializedTx: `0x${string}`[] = [];
raw.forEach((x) => serializedTx.push(`0x${x.toString(16)}`));
const starknetTxCalldata: `0x${string}`[] = [
Expand All @@ -643,7 +738,23 @@ Deno.test.ignore(
"0x0",
"0x0",
"0x0",
...serializedTx,
"0x0",
"0x0",
"0x1",
"0x1",
"0x0",
"0x0",
"0x40",
"0x5",
`0x${bytesLength.toString(16)}`,
`0x${bytesLength.toString(16)}`,
...packCallData(raw),
"0x5",
"0x1",
"0x2",
"0x3",
"0x4",
"0x1",
];

const starknetTx: Transaction = {
Expand Down
12 changes: 10 additions & 2 deletions indexer/src/utils/filter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,19 @@ Deno.test(
},
);

Deno.test.ignore(
Deno.test(
"isKakarotTransaction: `to` address matching KAKAROT_ADDRESS",
() => {
const starknetTxCalldata: `0x${string}`[] = [
"0x1",
"0x0",
"0x0",
"0x0",
"0x0",
"0x0",
"0x0",
"0x0",
"0x0",
"0x0",
"0x11c5faab8a76b3caff6e243b8d13059a7fb723a0ca12bbaadde95fb9e501bda",
];
const transaction: Transaction = {
Expand Down

0 comments on commit 6ef788d

Please sign in to comment.