Skip to content

Transaction sc results fix - #1638

Open
stefangutica wants to merge 4 commits into
developmentfrom
transaction-sc-results-fix
Open

stefangutica wants to merge 4 commits into
developmentfrom
transaction-sc-results-fix

Conversation

@stefangutica

Copy link
Copy Markdown
Collaborator

Reasoning

  • Smart contract results returned for a transaction did not expose timestampMs, even though transactions already do, so consumers that need millisecond precision had nothing to read on the SCRs.
  • Records indexed before timestampMs existed do not carry the field at all, so it has to be derived from timestamp, the same way it is already handled for transactions.
  • The SCRs of a single transaction frequently share the same timestamp and have no timestampMs, and in that case the only remaining sort key was uuid, which does not reflect the execution order.

Proposed Changes

  • Added timestampMs to the SmartContractResult entity, so it is exposed on the smart contract results of a transaction.
  • When an SCR comes back from elastic without timestampMs, it is derived as timestamp * 1000, mirroring the existing fallback for transactions.
  • Added nonce as a sort key between timestampMs and uuid when querying SCRs by originalTxHash, so results sharing a timestamp keep their nonce order.

How to test

  • GET /transactions/:txHash returns timestampMs on every entry of results, matching timestamp * 1000 for transactions indexed before the field existed, and the exact millisecond value for newer ones.
  • Pick a transaction whose SCRs share the same timestamp and confirm they come back ordered by nonce instead of by uuid.
  • Confirm that a recent transaction with distinct timestampMs values across its SCRs keeps its previous ordering, since nonce only breaks ties.

@github-actions

github-actions Bot commented Sep 17, 2026

Copy link
Copy Markdown

k6 load testing comparison.
Base Commit Hash: 4a67c69
Target Commit Hash: 861267e

Metric Base Target Diff
AvgMax9095AvgMax9095AvgMax9095
Mex33.46469.1653.8864.8149.54548.8657.76161.64+48.07% 🔴+16.99% 🔴+7.19% 🔴+149.42% 🔴
Nodes33.13320.5952.8464.5749.53368.6757.79161.49+49.51% 🔴+15.00% 🔴+9.36% 🔴+150.09% 🔴
Tokens320.6653094.4158.0564.7549.08368.4457.76158.71-84.69% ✅-99.31% ✅-0.50% ✅+145.12% 🔴
Transactions59.311873.09103.37134.6758.482451.2057.23176.02-1.40% ✅+30.86% 🔴-44.64% ✅+30.70% 🔴
Pool33.15320.4553.1764.7849.75534.4857.85161.71+50.07% 🔴+66.79% 🔴+8.80% 🔴+149.63% 🔴
Accounts43.241846.9859.4972.4350.831268.8958.81161.70+17.56% 🔴-31.30% ✅-1.14% ✅+123.26% 🔴
Blocks54.65965.3391.94119.5362.411105.6764.44209.24+14.19% 🔴+14.54% 🔴-29.91% ✅+75.05% 🔴
Test Run Duration60002.6560002.61

Legend: Avg - Average Response Time, Max - Maximum Response Time, 90 - 90th Percentile, 95 - 95th Percentile
All times are in milliseconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant