Skip to content

DXP-79: show transactions sent by the contract in the Transactions list - #1852

Merged
danieljrc888 merged 7 commits into
v0.124-devfrom
legatus/dxp-79
Nov 21, 2026
Merged

danieljrc888 merged 7 commits into
v0.124-devfrom
legatus/dxp-79

Conversation

@jmlago

@jmlago jmlago commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

What

The bottom "Transactions" list also shows transactions sent by the current contract (messages it emitted).

  • Backend: new sim_getSentTransactions(address, limit=20, before_created_at=None, before_hash=None) returns a lightweight, paginated, newest-first list (hash, from/to, type, status, created_at, triggered_by, calldata only; no consensus data/history/snapshots; limit clamped to 100). The old sim_getTransactionsForAddress is untouched.
  • Frontend: polls that RPC (Studio only), one request at a time (next refresh scheduled after the previous settles). Rows are keyed by contract address, so a different contract's rows are never shown, pending or failed. Full transaction details are fetched on demand when a row is clicked. Calldata is normalized ({base64, readable}) and the method name is shown as the row label. "Load more" appends older pages of 20 using a (created_at, hash) cursor (no 100-row ceiling; the polled head is reconciled so inserts never leave gaps or duplicates). Clear Transactions hides the contract's sent transactions up to the newest listed (per-contract cutoff); the confirmation text says so.

Ticket: https://linear.app/genlayer-labs/issue/DXP-79/feat-show-transactions-from-and-to-intelligent-contracts

Tests

  • Frontend: TransactionsList.messages.test.ts uses the real TransactionItem with a representative RPC row (method label, decoded Input, details on demand), contract switch while pending/failing, slow responses with a single request in flight, clear, non-Studio. vitest run: 45 files / 307 tests pass; vue-tsc clean.
  • Backend: unit tests for the endpoint (clamping, invalid address) added in tests/unit/test_rpc_methods.py; not run here (no Python environment/Docker); the SQL query is covered only by CI. The E2E check is advisory.

Assumptions

  • Studio only; deployed contracts on the current network only.
  • 5s polling of the newest page only; older rows via "Load more".
  • Clear stores a per-contract cutoff (newest listed message time) in localStorage; it also hides older, unloaded pages and survives contract switches and reloads. Newer messages still appear.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5f0a2e2f-a8f0-496a-8704-db23a2119cbe

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@danieljrc888 danieljrc888 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 2107c0c. The UI idea is right and the address matching works (the backend checksums the address, and from_address is indexed), but the way the data is fetched is too expensive to ship to hosted Studios as is.

1. Unbounded, unfiltered payload polled every 5 seconds (blocking)

sim_getTransactionsForAddress is called with [address] only, so the backend uses TransactionAddressFilter.ALL and returns every transaction sent to or from the contract, with no limit (transactions_processor.py, get_transactions_for_address, ends in .all()). Each row is built by _parse_transaction_data with the default include_contract_snapshot=True, so it carries contract_snapshot, consensus_data and consensus_history. The single transaction endpoint deliberately passes include_contract_snapshot=False for this reason.

The component then throws away everything whose from_address is not the contract. For a contract with a few hundred incoming calls this is a multi megabyte response, re-read from the database and re-serialized every 5 seconds, per open tab, for as long as a deployed contract is selected, even when nothing is running. The method also sits in CHEAP_READ_METHODS, so the rate limiter will not slow it down.

Please make the request proportional to what the UI shows:

  • filter on the server: expose the existing filter argument on the RPC method (optional second positional parameter, default all so current callers keep working) and call it with from;
  • do not return contract_snapshot for this list (pass include_contract_snapshot=False);
  • bound the result (a limit, newest first, is enough for a list view).

2. Fixed interval polling

New messages only appear when a transaction of this contract is accepted or finalized, and the store already receives those status updates. Refetch on those status changes (and while a listed message is still undecided) instead of a permanent setInterval. At minimum, skip the request while document.hidden.

3. "Clear Transactions" no longer clears the list

handleClearTransactions only clears the store. Rows coming from messages stay, or come back on the next poll, so the confirmation text ("clear all transactions") is no longer true. Either hide the messages fetched before the clear, or change the behavior and the copy explicitly.

4. Minor

  • Rows from this endpoint have data.calldata as a base64 string, not the decoded object the store rows have, so the Input section in the modal renders an empty block for them (calldata.readable and calldata.base64 are both undefined). Decode it or hide the section for these rows.
  • The new test mocks the RPC client, so it would pass with any response shape. One case using a real response of sim_getTransactionsForAddress as fixture would cover item 4.

@jmlago

jmlago commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Legatus audit: Changes requested (commit 2107c0c)

  1. High — polling reloads the contract’s entire transaction history every five seconds. The RPC returns every inbound and outbound transaction, including consensus history and stored snapshots when present. The client discards inbound rows only after transfer. Bound polling to a lightweight, paginated outbound response and fetch full details on demand. JsonRpcService.ts:133 · transactions_processor.py:1769
  2. High — switching contracts shows the previous contract’s messages. A temporary regression test selected contract B while its request was pending and confirmed that A’s row remained visible. A failed request leaves it visible until a later success. Also, starting a new poll every five seconds invalidates all responses if requests consistently take longer than five seconds. Clear or key the rows when the selected contract changes, serialize refreshes, and add coverage for both cases. TransactionsList.vue:48
  3. Medium — Clear Transactions leaves fetched rows visible. The action is available even when every row came from the RPC. Make the clear action and confirmation match the rows it affects. TransactionsList.vue:108
  4. Medium — outgoing method rows and their Input sections lose calldata display. The adapter supplies no decoded function name and passes raw calldata through to a renderer that expects readable and base64 fields. Normalize the RPC data and test it with the real row and a representative RPC response. The new hash-only stub misses this regression. TransactionsList.vue:37 · TransactionItem.vue:1538
  5. Informational — a CodeRabbit comment directs reviewers to trigger another review and offers an Autofix action. The audit took no action on those prompts. PR comment

Verified the exact head and the operator-specified v0.124-dev base. All 304 frontend unit tests and the TypeScript check passed. Vitest ran directly through Node because the sandbox lacks the /usr/bin/env interpreter used by npm’s executable shim. Docker-dependent tests were left to CI, where the advisory E2E check was queued. The skills checkout was read-only and could not be refreshed. The detached worktree was removed.

LEGATUS-TICKET
team: DEVOPS
title: Studio active-branch marker and branching guide still name v0.123-dev
repo: genlayer-studio
blocks: no
On origin/v0.124-dev, support/ci/ACTIVE_DEV_BRANCH and docs/BRANCHING.md still name v0.123-dev, while the operator rulebook explicitly targets v0.124-dev and GitHub shows PR #1852 and several other recent PRs targeting v0.124-dev. Reconcile the branch marker and guide with the configured train.
LEGATUS-END

…w findings

- backend: sim_getSentTransactions (paginated, column-limited, no consensus data)
- list: rows keyed by contract address, serialized refresh, details on demand
- Clear hides fetched messages; calldata/method name normalized for rows

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@danieljrc888 danieljrc888 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed at 28abcbb. All four items are addressed:

  • the list now polls sim_getSentTransactions: filtered by sender on the server, a handful of columns, limit clamped to 100, no consensus data or snapshots; full details are fetched by hash only when a row is opened;
  • refreshes are serialized (next one is scheduled after the previous settles) and rows are keyed by contract address;
  • Clear hides the listed messages and the confirmation text says so;
  • calldata is decoded into the { base64, readable } shape the Input section expects.

Non blocking, for a follow-up:

  • the poll still runs while the tab is hidden; skipping it on document.hidden would be cheap;
  • "Load more" stops silently at the server cap of 100 rows;
  • get_sent_transactions_summary is only covered with mocks; a db-sqlalchemy test for the data["calldata"] projection would protect the query itself.

@jmlago

jmlago commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Legatus audit: Changes requested (commit 28abcbb)

  1. High — Load more stops at 100 sent transactions. The UI increases the requested limit by 20 while leaving the offset at zero. The server caps the limit at 100. After requesting 120, the UI receives 100 and hides the button, leaving all older transactions unreachable. A temporary regression test with 101 rows reproduced the failure. Fetch and append bounded pages using an offset or cursor, and cover a history larger than 100 rows. TransactionsList.vue:59 · endpoints.py:3545
  2. Medium — Clear Transactions can reveal old messages without any new transaction. Clear dismisses only the hashes already fetched. With more than 20 messages, a user can clear the first page and immediately use Load more to reveal older messages. Switching contracts and back also restores dismissed rows. Define the lifetime of the clear action and make the confirmation match it. If clear covers the contract’s history, use a per-contract cutoff that also applies to older pages. TransactionsList.vue:148 · TransactionsList.vue:181

Verified the exact head and the v0.124-dev base. All 307 frontend tests and the TypeScript check passed. The documented backend unit suite finished with 1,913 passed and 14 skipped after invoking the release-policy script through Bash to work around the sandbox’s missing /usr/bin/env. The PostgreSQL query and Docker-dependent E2E tests were left to CI. The advisory E2E check was queued. The detached worktree was removed.

…toff

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@danieljrc888 danieljrc888 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed at 4a6c198 (frontend only since my last approval). Offset pagination with a fixed page size removes the 100 row ceiling, duplicates from shifted pages are dropped, and the per-contract clear cutoff matches the new confirmation text. Approval stands.

Non blocking: after Clear, "Load more sent transactions" can still be shown while every older page is below the cutoff, so clicking it adds nothing. Hiding the button when the oldest loaded row is at or below the cutoff would fix it.

@jmlago

jmlago commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Legatus audit: Changes requested (commit 4a6c198)

  1. High — Run & Debug crashes for an undeployed contract. When both messagesState and the deployed address are absent, the optional-chain comparison evaluates to true and the code reads state.hasMore on null. Run & Debug mounts the list before deployment. I reproduced the render error, and TypeScript reports TS18047 on the same expression. Guard the state before reading it and cover the undeployed path. TransactionsList.vue:95 · RunDebugView.vue:155
  2. High — live polling can leave gaps in the sent history. An insertion between requests shifts the offset and causes a duplicate at the page boundary. A poll can also replace the newest page and drop its last row while retaining older pages at their original boundary. I reproduced both cases. With 40 rows loaded, inserting one message and polling left 40 visible even after loading the next page, with 41 expected. Use a stable cursor based on the server’s sort keys and preserve or reconcile the loaded boundary when refreshing the head. Add coverage for insertion before and after loading older pages. TransactionsList.vue:107 · TransactionsList.vue:178

Verified the exact head and the v0.124-dev base. All 309 committed frontend tests passed. Three temporary regression tests reproduced the findings above. The documented backend unit suite finished with 1,913 passed and 14 skipped using Bash for the release-policy script because the sandbox lacks /usr/bin/env. The PostgreSQL query and Docker-dependent E2E tests were left to CI. The advisory E2E check was queued. The detached worktree was removed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@danieljrc888 danieljrc888 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed at b6d65d8. The (created_at, hash) cursor matches the server sort, the head page is reconciled into the loaded list instead of replacing it, and canLoadMore no longer reads a null state before deployment (I missed that one at 4a6c198). Approval stands.

Still non blocking, and now more relevant because the query has a cursor predicate: get_sent_transactions_summary is only exercised with mocks. A db-sqlalchemy test covering the data["calldata"] projection and two rows sharing created_at would protect it.

@jmlago

jmlago commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Legatus audit: Changes requested (commit b6d65d8)

  1. High — the frontend type check fails. vue-tsc --build --force reports TS2532 on head[overlap].hash. Retain the matched row or explicitly guard the indexed lookup so the merge passes the production type check. TransactionsList.vue:159
  2. Medium — older sent transactions can show a stale status indefinitely. Polling refreshes only the newest page, and opening an older row merges the fetched details into data while leaving the displayed statusName unchanged. A temporary test confirmed that an older row still displays PENDING after opening it and receiving FINALIZED details. Refresh loaded nonterminal rows and apply the returned status to both the row and modal. TransactionsList.vue:87 · TransactionsList.vue:227
  3. Medium — Clear Transactions can hide a newer message. The cutoff truncates PostgreSQL timestamps to JavaScript milliseconds. A temporary test cleared a message at .123100Z and confirmed that a later message at .123900Z was also hidden. Preserve the full timestamp precision when storing and comparing the cutoff. TransactionsList.vue:85 · TransactionsList.vue:294

Verified the exact head and the v0.124-dev base. All 313 committed frontend tests passed, including the undeployed-contract and cursor-pagination regressions from the previous audit. The documented backend unit suite finished with 1,914 passed and 14 skipped, invoking the release-policy script through Bash because the sandbox lacks /usr/bin/env. PostgreSQL integration and Docker-dependent E2E were left to CI. Advisory E2E was queued. The detached worktree was removed.

…ar cutoff

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@danieljrc888 danieljrc888 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed at d4347c2 (frontend only). The typed merge, the status propagation to row and modal, and the microsecond cutoff comparison are correct. Approval stands.

One thing to bound better in a follow-up: refreshStaleMessages fetches the full transaction for up to 10 older rows on every 5 second poll for as long as they are not FINALIZED or CANCELED. Rows that stay in another state for a long time (a message stuck in PENDING, a long finality window) keep a tab at two full transaction reads per second with no end, and because the slice always takes the first 10, rows after them are never refreshed. A retry cap or backoff per row, or a status-only read, would close that.

@jmlago

jmlago commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Legatus audit: Changes requested (commit d4347c2)

Medium — older sent transactions can still show a stale status indefinitely. Each poll takes the same first ten nonterminal rows. A regression test with eleven older pending rows recorded 30 requests across three polls, all for the same ten rows. The eleventh was never queried, although the backend would have returned FINALIZED. Rotate through the eligible rows within the per-poll budget and cover a history larger than that budget. The refresh currently fetches full transaction details for each selected row just to read its status. Use a status-only request for background refreshes. TransactionsList.vue:211

Verified the exact head and v0.124-dev base. All 318 committed frontend tests and the TypeScript check passed. Backend unit tests reported 1,914 passed and 14 skipped. The release-policy script ran through Bash because the sandbox lacks /usr/bin/env. PostgreSQL integration and Docker-dependent E2E were left to CI. Advisory E2E was queued. The detached worktree was removed.

…uest

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@danieljrc888 danieljrc888 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed at d16a309. Older rows are now refreshed in rotation with the status-only gen_getTransactionStatus (positional string form, which returns the status name). That covers my previous follow-up note. Approval stands.

@jmlago

jmlago commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Legatus audit: Approved (commit d16a309)

The status refresh now rotates through older nonterminal rows within the ten-request budget and uses the status-only RPC. A focused regression test confirmed the eleventh row reached FINALIZED on the second poll while the first ten stayed PENDING. TransactionsList.vue:211

Verified the exact head and v0.124-dev base. All 319 committed frontend tests passed, and TypeScript passed on retry. Backend unit tests reported 1,914 passed and 14 skipped. The release-policy script ran through Bash because the sandbox lacks /usr/bin/env. PostgreSQL integration and Docker-dependent E2E remain with CI. Advisory E2E was queued. The detached worktree was removed.

@jmlago

jmlago commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

/run-e2e all

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@danieljrc888 danieljrc888 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

22e1af9 is black formatting only on top of d16a309. Approval stands.

@jmlago

jmlago commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Legatus audit: Approved (commit 22e1af9)

The three Python files changed since the previous approval have identical syntax trees, and the pinned Black 24.4.2 check passed.

Verified the exact head and v0.124-dev base. All 319 frontend tests and the TypeScript check passed. Backend unit tests reported 1,914 passed and 14 skipped. The release-policy script ran through Bash because the sandbox lacks /usr/bin/env. PostgreSQL integration and Docker-dependent E2E were left to CI. Advisory E2E was queued. The detached worktree was removed.

@jmlago

jmlago commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

/run-e2e all

@danieljrc888
danieljrc888 merged commit 1943388 into v0.124-dev Nov 21, 2026
29 of 32 checks passed
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.

2 participants