Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: Add ETL Indexing for mpt_issuance_history#3104

Merged
PeterChen13579 merged 17 commits into
XRPLF:developfrom
BryanJ1ang:brjiang-mpt-rpc-pr2
Jul 7, 2026
Merged

feat: Add ETL Indexing for mpt_issuance_history#3104
PeterChen13579 merged 17 commits into
XRPLF:developfrom
BryanJ1ang:brjiang-mpt-rpc-pr2

Conversation

@BryanJ1ang

@BryanJ1ang BryanJ1ang commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds live ETL indexing for mptoken_issuance_history by extracting MPT issuance references from transaction metadata and transaction fields, then writing both MPT transaction index shapes during the existing MPT ETL pass. Successful transactions are indexed from affected MPT ledger objects; failed transactions are indexed only when they carry an attached MPT issuance reference.

Changes

  • Adds getMPTokenIssuanceTxsFromTx to extract issuance transaction index records from tesSUCCESS transactions.
  • Scans AffectedNodes generically for MPToken and MPTokenIssuance ledger objects instead of relying on a transaction-type allowlist.
  • Reconstructs issuance IDs for MPTokenIssuance objects with makeMptID(sequence, issuer), avoiding the hashed ledger-key trap.
  • Deduplicates distinct issuances per transaction and attaches the transaction’s affected accounts for account-level fanout.
  • Extends MPTExt so live and initial ETL data writes:
    • existing MPT holder index data
    • mptoken_issuance_transactions
    • account_mptoken_issuance_transactions
  • Adds a Prometheus counter for MPT issuance transaction index rows written by ETL.
  • Logs unexpectedly large per-transaction fanout.

Tests

Adds unit coverage for:

  • failed transactions producing no records
  • MPTokenIssuanceCreate, Destroy, Set, and MPTokenAuthorize
  • generic transaction-type coverage through Payment, Clawback, OfferCreate, and AMMDeposit
  • ID reconstruction from issuance nodes
  • multi-issuance fanout and deduplication
  • affected-account propagation
  • ETL extension writes to both backend index paths while preserving existing holder indexing

@BryanJ1ang BryanJ1ang force-pushed the brjiang-mpt-rpc-pr2 branch 2 times, most recently from 6e3d1b9 to 8031c6b Compare June 17, 2026 14:41
@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.47368% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.65%. Comparing base (bace632) to head (d282bb7).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
src/etl/impl/ext/MPT.cpp 80.95% 3 Missing and 1 partial ⚠️
src/etl/MPTHelpers.cpp 94.44% 1 Missing and 2 partials ⚠️
src/data/DBHelpers.hpp 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3104      +/-   ##
===========================================
+ Coverage    82.61%   82.65%   +0.04%     
===========================================
  Files          397      397              
  Lines        16034    16110      +76     
  Branches      8399     8441      +42     
===========================================
+ Hits         13246    13316      +70     
- Misses        1667     1670       +3     
- Partials      1121     1124       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@BryanJ1ang BryanJ1ang changed the title Feat: Add ETL Indexing for mpt_issuance_history feat: Add ETL Indexing for mpt_issuance_history Jun 18, 2026
@PeterChen13579 PeterChen13579 self-requested a review June 25, 2026 19:43
@BryanJ1ang BryanJ1ang force-pushed the brjiang-mpt-rpc-pr2 branch from 9af68a0 to a5c11bf Compare June 25, 2026 21:09

@PeterChen13579 PeterChen13579 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There is also Codecov that shows you some lines from source file that are missing tests. Please cover them.

Comment thread src/etl/MPTHelpers.cpp Outdated
Comment thread src/etl/MPTHelpers.cpp Outdated
Comment thread src/etl/MPTHelpers.cpp Outdated
Comment thread src/etl/impl/ext/MPT.cpp
Comment thread src/etl/MPTHelpers.cpp Outdated
Comment thread src/etl/MPTHelpers.cpp
Comment thread tests/unit/etl/ext/MPTTests.cpp Outdated
Comment thread src/etl/MPTHelpers.cpp Outdated
PeterChen13579
PeterChen13579 previously approved these changes Jul 2, 2026
godexsoft
godexsoft previously approved these changes Jul 2, 2026

@godexsoft godexsoft left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks fine to me from Clio/code perspective 👍
Would be nice to get answer for @PeterChen13579 's question just to make sure.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds live ETL indexing support for MPToken issuance history by extracting issuance references from transactions/metadata and writing them through the existing MPT ETL extension, with new unit coverage and shared test fixtures.

Changes:

  • Introduces etl::getMPTokenIssuanceTxsFromTx to extract and deduplicate per-issuance transaction index records (including affected-accounts fanout).
  • Extends etl::impl::MPTExt to write mptoken_issuance_transactions + account_mptoken_issuance_transactions, emit a Prometheus counter, and warn on unexpectedly large per-tx fanout.
  • Adds unit tests and common test helpers for constructing MPToken / MPTokenIssuance affected nodes.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/unit/etl/MPTHelpersTests.cpp Adds focused unit coverage for issuance-tx extraction, deduping, and deterministic ordering.
tests/unit/etl/ext/MPTTests.cpp Extends MPTExt unit tests to assert issuance-index writes, dedup/fanout behavior, and “no-op” cases.
tests/unit/CMakeLists.txt Registers the new MPTHelpers unit test file in the unit test target.
tests/common/util/MPTokenTestObjects.hpp Declares reusable helpers to construct MPT-related metadata nodes for tests.
tests/common/util/MPTokenTestObjects.cpp Implements reusable helpers to construct MPToken / MPTokenIssuance nodes.
tests/common/CMakeLists.txt Adds new MPToken test helper implementation to the common test utilities target.
src/etl/MPTHelpers.hpp Declares the new issuance-transaction extraction helper API with documentation.
src/etl/MPTHelpers.cpp Implements issuance-transaction extraction by scanning affected nodes and tx fields.
src/etl/impl/ext/MPT.hpp Adds a Prometheus counter member and renames private write helper to reflect expanded responsibilities.
src/etl/impl/ext/MPT.cpp Writes issuance transaction index rows (and per-account fanout) alongside existing holder indexing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/etl/MPTHelpers.cpp
Comment thread src/etl/impl/ext/MPT.cpp Outdated
Comment thread src/etl/MPTHelpers.cpp
Comment thread src/etl/MPTHelpers.cpp Outdated
Comment thread tests/unit/etl/ext/MPTTests.cpp Outdated

@mathbunnyru mathbunnyru left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, if we could switch to std::flat_set in a separate PR when we merge this, it would be great 👍

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Comment thread tests/unit/etl/ext/MPTTests.cpp
@PeterChen13579 PeterChen13579 merged commit 52d28f8 into XRPLF:develop Jul 7, 2026
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.

6 participants