Repository navigation
DXP-79: show transactions sent by the contract in the Transactions list - #1852
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
danieljrc888
left a comment
There was a problem hiding this comment.
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
filterargument on the RPC method (optional second positional parameter, defaultallso current callers keep working) and call it withfrom; - do not return
contract_snapshotfor this list (passinclude_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.calldataas 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.readableandcalldata.base64are 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_getTransactionsForAddressas fixture would cover item 4.
|
Legatus audit: Changes requested (commit 2107c0c)
Verified the exact head and the operator-specified LEGATUS-TICKET |
…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
left a comment
There was a problem hiding this comment.
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,limitclamped 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.hiddenwould be cheap; - "Load more" stops silently at the server cap of 100 rows;
get_sent_transactions_summaryis only covered with mocks; a db-sqlalchemy test for thedata["calldata"]projection would protect the query itself.
|
Legatus audit: Changes requested (commit 28abcbb)
Verified the exact head and the |
…toff Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
danieljrc888
left a comment
There was a problem hiding this comment.
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.
|
Legatus audit: Changes requested (commit 4a6c198)
Verified the exact head and the |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
danieljrc888
left a comment
There was a problem hiding this comment.
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.
|
Legatus audit: Changes requested (commit b6d65d8)
Verified the exact head and the |
…ar cutoff Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
danieljrc888
left a comment
There was a problem hiding this comment.
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.
|
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 |
…uest Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
danieljrc888
left a comment
There was a problem hiding this comment.
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.
|
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 |
|
/run-e2e all |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
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 |
|
/run-e2e all |
What
The bottom "Transactions" list also shows transactions sent by the current contract (messages it emitted).
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 oldsim_getTransactionsForAddressis untouched.{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
TransactionsList.messages.test.tsuses the realTransactionItemwith 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-tscclean.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