[explorer/puller] fix: recover Symbol metadata state during rollback - #2465
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #2465 +/- ##
==========================================
- Coverage 95.63% 95.36% -0.28%
==========================================
Files 719 679 -40
Lines 53893 50630 -3263
Branches 1405 1405
==========================================
- Hits 51540 48282 -3258
+ Misses 2295 2290 -5
Partials 58 58
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
daoka
marked this pull request as ready for review
August 2, 2026 23:21
daoka
requested review from
Jaguar0625 and
Wayonb
and removed request for
Jaguar0625
August 2, 2026 23:21
Jaguar0625
reviewed
Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the current behavior?
Symbol Metadata rollback recovery derives natural keys only from current
symbol_metadatarows updated at or after the fork height.Mosaic Metadata transactions preserve the unresolved target mosaic ID in their
body, but do not persist the resolved target ID needed to reconstruct the
canonical Metadata natural key.
This is a follow-up to #2463.
What's the issue?
An orphaned Metadata update can leave an empty value. Symbol core removes the current Metadata entry in that case.
If the Explorer current-state row has already been removed, rollback recovery has no natural key with which to query the canonical Node state. The missing Metadata entry therefore cannot be restored from current rows alone.
Mosaic aliases require additional handling because the raw transaction body contains the unresolved mosaic ID, while the Metadata natural key uses the resolved mosaic ID.
How have you changed the behavior?
This change persists the resolved Mosaic Metadata target as a private
symbol_transaction_mosaicsrelation:role = 'metadata_target'amount = 0position = 0Account and Namespace Metadata transactions do not create this relation. The unresolved values in
bodyandraw_payloadremain unchanged.Rollback recovery now:
body.targetMosaicId.Malformed transaction bodies, missing or duplicate target relations, invalid sentinels, and malformed hexadecimal identifiers fail deterministically before rollback writes begin.
The exactly-one relation contract is enforced by application validation rather than a partial unique index. The existing relation primary key permits different mosaic IDs for the same transaction and role, and retaining application validation allows malformed persisted state to be detected and tested explicitly.
metadata_targetis private persistence state. It must not be exposed through publictransferMosaicIdsearches or Mosaic-detail transaction results.There is no public API breaking change. This updates the pre-release declarative schema without adding an
ALTER TYPEcompatibility shim. Existing development databases with the old enum or non-canonical Metadata keys must be recreated.REST, frontend, NEM, and the merged Lock synchronization behavior are unchanged.