Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ingest: Update ingestion library and horizon to adapt to protocol 23 representation of evictions #5619

Open
wants to merge 6 commits into
base: protocol-23
Choose a base branch
from

Conversation

tamirms
Copy link
Contributor

@tamirms tamirms commented Mar 4, 2025

PR Checklist

PR Structure

  • This PR has reasonably narrow scope (if not, break it down into smaller PRs).
  • This PR avoids mixing refactoring changes with feature changes (split into two PRs
    otherwise).
  • This PR's title starts with name of package that is most changed in the PR, ex.
    services/friendbot, or all or doc if the changes are broad or impact many
    packages.

Thoroughness

  • This PR adds tests for the most critical parts of the new functionality or fixes.
  • I've updated any docs (developer docs, .md
    files, etc... affected by this change). Take a look in the docs folder for a given service,
    like this one.

Release planning

  • I've reviewed the changes in this PR and if I consider them worthwhile for being mentioned on release notes then I have updated the relevant CHANGELOG.md within the component folder structure. For example, if I changed horizon, then I updated (services/horizon/CHANGELOG.md. I add a new line item describing the change and reference to this PR. If I don't update a CHANGELOG, I acknowledge this PR's change may not be mentioned in future release notes.
  • I've decided if this PR requires a new major/minor version according to
    semver, or if it's mainly a patch change. The PR is targeted at the next
    release branch if it's not a patch change.

What

CAP-62 and CAP-66 updates the LedgerCloseMeta xdr to no longer populate the evictedPersistentLedgerEntries field. Instead, both persistent and temporary ledger keys will be included in the evictedTemporaryLedgerKeys field which will be renamed to evictedKeys in protocol 23.

The ingestion library previously presented evictions of persistent ledger entries as a Change instance with the Reason set to LedgerEntryChangeReasonEviction. This allowed downstream consumers of a Change stream to handle evictions as if they were equivalent to ledger entry deletions. However, in protocol 23 we can no longer maintain this strategy because the full contents of the evicted ledger entry will not be present in the LedgerCloseMeta xdr. We will only have the ledger key for the evicted ledger entry.

This means that ledger entry evictions will need to be handled outside of Change stream processing by downstream services. The second commit of this PR fixes the asset stats processor in Horizon to adapt to this new reality where evictions no longer appear in the Change stream.

The asset stats processor can ignore evicted contract balance ledger entries because contract balance ledger entries are deleted from the horizon db immediately upon expiration. However, the asset stats processor still needs to ingest the stellar asset contract instance storage so that we can link stellar classic assets with their corresponding contract id. So when the stellar asset contract instance storage is evicted we also need to handle that event so we can remove the link between stellar classic asset and the stellar asset contract id.

Also fixes #5578

Known limitations

[N/A]

@tamirms tamirms requested a review from a team March 4, 2025 22:32
Copy link
Contributor

@Shaptic Shaptic left a comment

Choose a reason for hiding this comment

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

This looks good from a change perspective if I understand it correctly, but I don't feel great about reviewing the asset changes since I'm relatively unfamiliar with them.

Either way, though, integration tests will reveal issues once RPC gets tagged off, assuming we have some for SAC+eviction+asset stats?

@tamirms
Copy link
Contributor Author

tamirms commented Mar 5, 2025

Either way, though, integration tests will reveal issues once RPC gets tagged off, assuming we have some for SAC+eviction+asset stats?

@Shaptic yeah, we have a issue to capture writing the protocol 23 eviction / restoration integration tests: #5613

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.

2 participants