Skip to content

Commit

Permalink
Fix after self-review.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreibancioiu committed Oct 8, 2024
1 parent d13f4c6 commit 0ac07f1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 63 deletions.
2 changes: 1 addition & 1 deletion src/testdata/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Testdata

## Files `transactions_N.mainnet.json`
## Files `transactions.mainnet.json`

Transactions were sampled from the mainnet BigQuery dataset:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,66 +37,4 @@ describe("test smart contract transactions outcome parser on devnet", () => {
assert.equal(parsedGivenTransactionOnNetwork.returnCode, "execution failed");
assert.lengthOf(parsedGivenTransactionOnNetwork.contracts, 0);
});

it("should parse outcome of relayed V3 inner transactions (1)", async () => {
const transactionHash = "c798e8c03d93aa4e3425f63fe020572304305e2017b1053c9f4e56f2c46bafd7";
const transactionOnNetwork = await networkProvider.getTransaction(transactionHash);
const outcomes = transactionsConverter.transactionOnNetworkToOutcomesOfInnerTransactions(transactionOnNetwork);

const parsed = parser.parseExecute({ transactionOutcome: outcomes[0] });
assert.deepEqual(parsed.values, [Buffer.from([1])]);
assert.equal(parsed.returnCode, "ok");
assert.equal(parsed.returnMessage, "ok");
});

// Will work upon the fix on Node's side (so that SCRs have as "originalTxHash" the inner transaction itself).
it.skip("should parse outcome of relayed V3 inner transactions (2)", async () => {
const transactionHash = "eaf80014f1b413191ac6a04a81c3751c5563aff246021f4f7c4ba9723fa3b536";
const transactionOnNetwork = await networkProvider.getTransaction(transactionHash);
const outcomes = transactionsConverter.transactionOnNetworkToOutcomesOfInnerTransactions(transactionOnNetwork);

let parsed = parser.parseExecute({ transactionOutcome: outcomes[0] });
assert.deepEqual(parsed.values, [Buffer.from([42]), Buffer.from([43]), Buffer.from([44])]);
assert.equal(parsed.returnCode, "ok");
assert.equal(parsed.returnMessage, "ok");

parsed = parser.parseExecute({ transactionOutcome: outcomes[1] });
assert.deepEqual(parsed.values, []);
assert.equal(parsed.returnCode, "");
assert.equal(parsed.returnMessage, "");
});

it("should parse outcome of relayed V3 inner transactions (3)", async () => {
const transactionHash = "d241307c92c66cfe8ce723656d8b2c47a4a4f9e457eec305155debba6c92ca1b";
const transactionOnNetwork = await networkProvider.getTransaction(transactionHash);
const outcomes = transactionsConverter.transactionOnNetworkToOutcomesOfInnerTransactions(transactionOnNetwork);

let parsed = parser.parseExecute({ transactionOutcome: outcomes[0] });
assert.deepEqual(parsed.values, [Buffer.from([42]), Buffer.from([43]), Buffer.from([44])]);
assert.equal(parsed.returnCode, "ok");
assert.equal(parsed.returnMessage, "ok");

// Signal error is not recoverable (for the moment).
parsed = parser.parseExecute({ transactionOutcome: outcomes[1] });
assert.deepEqual(parsed.values, []);
assert.equal(parsed.returnCode, "");
assert.equal(parsed.returnMessage, "");
});

it("should parse outcome of relayed V3 inner transactions (4)", async () => {
const transactionHash = "4bb3bc0f069fe4cf6a19750db026cca0968b224a59a2bfe6eee834c19d73cb80";
const transactionOnNetwork = await networkProvider.getTransaction(transactionHash);
const outcomes = transactionsConverter.transactionOnNetworkToOutcomesOfInnerTransactions(transactionOnNetwork);

let parsed = parser.parseExecute({ transactionOutcome: outcomes[0] });
assert.deepEqual(parsed.values, [Buffer.from([42]), Buffer.from([43]), Buffer.from([44])]);
assert.equal(parsed.returnCode, "ok");
assert.equal(parsed.returnMessage, "ok");

// Signal error is not recoverable (for the moment).
parsed = parser.parseExecute({ transactionOutcome: outcomes[1] });
assert.deepEqual(parsed.values, [Buffer.from([42]), Buffer.from([43]), Buffer.from([44])]);
assert.equal(parsed.returnCode, "ok");
assert.equal(parsed.returnMessage, "ok");
});
});

0 comments on commit 0ac07f1

Please sign in to comment.