Skip to content

Conversation

@Dhanraj30
Copy link
Contributor

#1739

What

support for classic accounts and trustlines in snapshots.

Why

Support classic accounts and trustlines in snapshots. This change is being made to ensure that legacy account and trustline information is correctly included in the ledger snapshots. Classic accounts and trustlines were previously overlooked, which caused issues

Known limitations

N/A

@janewang
Copy link
Contributor

@Dhanraj30 Could you fix the coding formatting please

Comment on lines -292 to +296
LedgerKey::Trustline(k) => current.account_ids.contains(&k.account_id),
LedgerKey::Trustline(k) => {
current.account_ids.contains(&k.account_id) ||
current.account_ids.iter().any(|id| match &k.asset {
TrustLineAsset::CreditAlphanum4(a4) => a4.issuer == *id,
TrustLineAsset::CreditAlphanum12(a12) => a12.issuer == *id,
Copy link
Member

Choose a reason for hiding this comment

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

Pulling in every trustline for an asset unfortunately doesn't scale well with the current implementation of snapshots, which was why I left it out. If you pass in the address for a very popular asset, the file becomes huge and unusable.

For assets with much less trust lines though I can see this being very useful so maybe we should add it.

I think this use case will be better served by the following issue that hopefully we can implement in the near future:

Thoguhts @fnando ?

@sagpatil sagpatil requested a review from Copilot June 24, 2025 19:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for classic accounts and trustlines in snapshots by updating the filtering logic for trustline and contract data entries.

  • Updates trustline filtering to also consider asset issuers from legacy accounts.
  • Adjusts the ledger entry saving logic for contract data to bypass the original condition.
Comments suppressed due to low confidence (1)

cmd/soroban-cli/src/commands/snapshot/create.rs:351

  • The change to always save entries for ContractData (line 351) bypasses the original 'keep' condition. Please verify that this behavior aligns with the intended snapshot inclusion requirements for legacy accounts.
                            true

let keep = match &key {
LedgerKey::Account(k) => current.account_ids.contains(&k.account_id),
LedgerKey::Trustline(k) => current.account_ids.contains(&k.account_id),
LedgerKey::Trustline(k) => {
Copy link

Copilot AI Jun 24, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider extracting the complex trustline filtering logic (lines 292-298) into a helper function to improve readability and maintainability.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog (Not Ready)

Development

Successfully merging this pull request may close these issues.

3 participants