feat: Add ETL Indexing for mpt_issuance_history#3104
Conversation
6e3d1b9 to
8031c6b
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3104 +/- ##
===========================================
+ Coverage 82.60% 82.66% +0.06%
===========================================
Files 397 397
Lines 16024 16104 +80
Branches 8395 8439 +44
===========================================
+ Hits 13236 13312 +76
- Misses 1667 1670 +3
- Partials 1121 1122 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
9af68a0 to
a5c11bf
Compare
PeterChen13579
left a comment
There was a problem hiding this comment.
There is also Codecov that shows you some lines from source file that are missing tests. Please cover them.
| auto const mptHolders = getMPTHolderFromTx(tx.meta, tx.sttx); | ||
| holders.append_range(mptHolders); | ||
|
|
||
| auto txIndexData = getMPTokenIssuanceTxsFromTx(tx.meta, tx.sttx); |
There was a problem hiding this comment.
If I understood correctly, line 57 will scan through every txn on every incoming ledger number, if the txn's related ledger_entry is not mpt, it will return {}. But line 60, you scan the same data again for mpt fields, which won't exist if it already returned {} prior. Therefore, I would have a way to exit early instead of doing another scan
There was a problem hiding this comment.
Not quite. Line 57 only extracts newly created ltMPTOKEN holder records from successful metadata. I believe returning empty does not mean the transaction is unrelated to MPT.
Line 60 builds the MPT issuance transaction-history lookup, so it also needs to catch ltMPTOKEN_ISSUANCE metadata and MPT references in the submitted transaction body, such as sfMPTokenIssuanceID, MPT Amount, or MPT Issue. Early exit after line 57 would miss these valid MPT-related transactions.
| return {}; | ||
|
|
||
| auto const& fieldsName = | ||
| node.getFName() == xrpl::sfCreatedNode ? xrpl::sfNewFields : xrpl::sfFinalFields; |
There was a problem hiding this comment.
Can we confirm the affected-node field selection here is always valid?
CreatedNode uses sfNewFields, while ModifiedNode/DeletedNode use sfFinalFields. (I'm pretty sure this is right checking rippled code, but what is the mechanism that allows it to change? 🤔 ). (cc @yinyiqian1 @shawnxie999 )
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
getMPTokenIssuanceTxsFromTxto extract issuance transaction index records fromtesSUCCESStransactions.AffectedNodesgenerically forMPTokenandMPTokenIssuanceledger objects instead of relying on a transaction-type allowlist.MPTokenIssuanceobjects withmakeMptID(sequence, issuer), avoiding the hashed ledger-key trap.MPTExtso live and initial ETL data writes:mptoken_issuance_transactionsaccount_mptoken_issuance_transactionsTests
Adds unit coverage for:
MPTokenIssuanceCreate,Destroy,Set, andMPTokenAuthorizePayment,Clawback,OfferCreate, andAMMDeposit