Skip to content

fix: unknown sender and tx ID on explorer transactions#1372

Merged
MicBun merged 4 commits into
mainfrom
fixLegacyGetLastTransac
May 11, 2026
Merged

fix: unknown sender and tx ID on explorer transactions#1372
MicBun merged 4 commits into
mainfrom
fixLegacyGetLastTransac

Conversation

@MicBun
Copy link
Copy Markdown
Contributor

@MicBun MicBun commented May 11, 2026

resolves: https://github.com/truflation/website/issues/3873

Summary by CodeRabbit

  • API Changes

    • Consolidated transaction history retrieval into a single endpoint with updated parameters and richer response (includes caller, fee details, and distribution fields).
    • Removed legacy transaction history variants.
  • Infrastructure

    • Updated fee collection routing across multiple write operations to use the standardized bridge interface.
    • Streamlined transaction event processing and validation to rely on the ledger-backed path.

Review Change Stack

@MicBun MicBun requested a review from pr-time-tracker May 11, 2026 11:16
@MicBun MicBun self-assigned this May 11, 2026
@MicBun MicBun added the type: fix fixing something label May 11, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9fdd83c9-1ca3-48a3-bfc1-221971a6d90f

📥 Commits

Reviewing files that changed from the base of the PR and between bf8f95a and 9794c3d.

📒 Files selected for processing (4)
  • extensions/tn_settlement/settlement_integration_test.go
  • internal/migrations/010-get-latest-write-activity.sql
  • internal/migrations/erc20-bridge/001-actions.sql
  • tests/streams/utils/feefund/feefund_kwiltest.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/migrations/010-get-latest-write-activity.sql

📝 Walkthrough

Walkthrough

This PR routes fee balance checks/transfers to the hoodi_tt (and sepolia_bridge where applicable), removes runtime SQL namespace substitution in the migration loader, updates the prod-migration generator alias mapping, and consolidates transaction-history into a ledger-backed get_last_transactions action.

Changes

Fee Collection Bridge Migration to hoodi_tt

Layer / File(s) Summary
Fee Collection Action Updates
internal/migrations/001-common-actions.sql, internal/migrations/003-primitive-insertion.sql, internal/migrations/004-composed-taxonomy.sql, internal/migrations/024-attestation-actions.sql, internal/migrations/erc20-bridge/001-actions.sql
Replace ethereum_bridge.balance(@caller) / ethereum_bridge.transfer(...) with hoodi_tt.balance(@caller) / hoodi_tt.transfer(...) (and correct sepolia_bridge.* usage in the ERC20 bridge). Fee checks, insufficient-balance guards, and computed fee amounts are unchanged.
Build System / Prod Generator
internal/migrations/migration.go, scripts/generate_prod_migrations.py
GetSeedScriptStatements returns SQL file contents verbatim (no runtime namespace substitution); transform_fee now recognizes hoodi_tt and legacy ethereum_bridge and substitutes either to eth_truf for .prod.sql generation.
Tests / Comments / Funding
tests/streams/utils/feefund/feefund_kwiltest.go, tests/streams/order_book/settlement_payout_test.go, tests/streams/withdrawal_fee_test.go, extensions/tn_settlement/settlement_integration_test.go
Update test bridge constants, inline comments, and increase injected TRUF balances where required; clarify dev vs mainnet fee-collection paths in comments.

Transaction History View Consolidation

Layer / File(s) Summary
Transaction History Schema and Query
internal/migrations/010-get-latest-write-activity.sql
Redefine get_last_transactions($data_provider TEXT, $limit_size INT8) as the single ledger-backed implementation returning rows per fee distribution with caller, fee_*, and distribution fields; remove legacy v1/v2 wrapper control flow from this migration file.
Transaction History Test Integration
tests/streams/transaction_events_ledger_test.go
Remove legacy v1 validation, delete legacy row types/helpers, and update fetchLastTransactions to call consolidated get_last_transactions instead of get_last_transactions_v2.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • williamrusdyputra
  • outerlook

Poem

🐰 From bridges old to TRUF anew,
hoodi_tt hums and fees flow through.
SQLs kept pure, views joined as one,
rabbits cheer — the migration's done! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 69.23% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title references fixing 'unknown sender and tx ID on explorer transactions', which directly relates to the primary change in the changeset: refactoring transaction history actions (removing legacy get_last_transactions_v1 and get_last_transactions_v2, consolidating to get_last_transactions with expanded schema including caller and fee fields) and updating fee-collection to use hoodi_tt instead of ethereum_bridge.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fixLegacyGetLastTransac

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@holdex
Copy link
Copy Markdown

holdex Bot commented May 11, 2026

Bug Report Checklist

Status Commit Link Bug Author HR Card
✅ Submitted commit link @MicBun HR Card

If this commit or author is incorrect, reply in this PR with:

@holdex bug dispute <correct-commit-url> && bug author @correct-user

Use git blame to identify the right commit and author before posting.

See available commands to help comply with our Guidelines.

@holdex
Copy link
Copy Markdown

holdex Bot commented May 11, 2026

Time Submission Status

Member Status Time Action Last Update
MicBun ✅ Submitted 2h Update time May 11, 2026, 12:45 PM

You can submit time with the command. Example:

@holdex pr submit-time 15m

See available commands to help comply with our Guidelines.

@MicBun
Copy link
Copy Markdown
Contributor Author

MicBun commented May 11, 2026

@holdex pr submit-time 2h

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/migrations/010-get-latest-write-activity.sql`:
- Around line 9-13: Update the migration docstring to stop referencing
non-existent cleanup scripts: either add the missing maintenance DROP scripts
for get_last_transactions_v1 and get_last_transactions_v2 to the repo, or change
the comment in internal/migrations/010-get-latest-write-activity.sql to explain
the actual cleanup path (e.g., that retired variants are dropped elsewhere or
will be removed manually), and remove the `maintenance/` reference; mention the
specific retired functions get_last_transactions_v1 and get_last_transactions_v2
and keep the note about preserving `$data_provider` for SDK backward
compatibility so operators know what to do after migration.

In `@internal/migrations/migration.go`:
- Line 99: Embedded SQL content appended via statements = append(statements,
string(content)) still contains legacy "ethereum_bridge" namespace references
which break literal file migrations; update the SQL files themselves so the
embedded content is correct: replace all "ethereum_bridge" occurrences in
internal/migrations/erc20-bridge/001-actions.sql (lines noted),
internal/migrations/erc20-bridge/002-public-transfer-actions.sql, and
internal/migrations/032-order-book-actions.sql with the appropriate environment
namespaces (dev: hoodi_tt or hoodi_tt2 or sepolia_bridge; prod: eth_truf or
eth_usdc), or parameterize the SQL before embedding if you need
environment-specific values, and re-run tests to ensure scripts/migrate.sh
applies the corrected SQL without runtime substitution.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d2661737-4beb-4f02-a321-849f1a66a325

📥 Commits

Reviewing files that changed from the base of the PR and between abe776e and bf8f95a.

📒 Files selected for processing (11)
  • internal/migrations/001-common-actions.sql
  • internal/migrations/003-primitive-insertion.sql
  • internal/migrations/004-composed-taxonomy.sql
  • internal/migrations/010-get-latest-write-activity.sql
  • internal/migrations/024-attestation-actions.sql
  • internal/migrations/migration.go
  • scripts/generate_prod_migrations.py
  • tests/streams/order_book/settlement_payout_test.go
  • tests/streams/transaction_events_ledger_test.go
  • tests/streams/utils/feefund/feefund_kwiltest.go
  • tests/streams/withdrawal_fee_test.go

Comment thread internal/migrations/010-get-latest-write-activity.sql
Comment thread internal/migrations/migration.go
@MicBun
Copy link
Copy Markdown
Contributor Author

MicBun commented May 11, 2026

@holdex bug commit 9bbb1c1 && bug author @MicBun

@trufnetwork trufnetwork deleted a comment from holdex Bot May 11, 2026
@MicBun MicBun merged commit c0693b9 into main May 11, 2026
8 of 9 checks passed
@MicBun MicBun deleted the fixLegacyGetLastTransac branch May 11, 2026 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix fixing something

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant