Skip to content

Refactor distribute meta vault redemptions#725

Open
evgeny-stakewise wants to merge 3 commits into
v5-releasefrom
refactor-distribute-meta-vault-redemptions
Open

Refactor distribute meta vault redemptions#725
evgeny-stakewise wants to merge 3 commits into
v5-releasefrom
refactor-distribute-meta-vault-redemptions

Conversation

@evgeny-stakewise
Copy link
Copy Markdown
Contributor

No description provided.

Comment thread src/meta_vault/service.py
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

A lot of rework in this file.

Previously:

  • distribute_meta_vault_redemption_assets
  • and get_meta_vault_redemption_assets
    looked similar. Separation of concerns was unclear.
  • Also there was recursion.

Now:

  • distribute_meta_vault_redemption_assets - does the main job of distributing assets deeply
  • get_sub_vaults_redemptions - distributes from meta vault to direct sub vaults
  • Recursion was replaced with queue.

Copy link
Copy Markdown
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

Refactors how meta-vault redemption assets are distributed: replaces recursive distribution with a BFS traversal over the sub-vault tree, and changes the result so the returned mapping now also contains entries for root and intermediate meta vaults (not just leaves). The redemption-asset entry point in src/redemptions/tasks.py is split into a small wrapper plus a renamed pair of helpers (get_vault_to_redemption_assets_distributed / _direct) for clearer naming.

Changes:

  • Rewrite distribute_meta_vault_redemption_assets as an iterative BFS using a queue, and have get_sub_vaults_redemptions return only direct sub-vaults.
  • Include meta vaults (root and intermediate) in the returned mapping alongside their distributed leaves; tests updated accordingly.
  • Split get_redemption_assets in redemptions/tasks.py into get_vault_to_redemption_assets_distributed + _direct, demote a log line, and rework the comment about nonce handling.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
src/meta_vault/service.py Rewrites distribution as BFS using queue.Queue; reduces get_sub_vaults_redemptions to a thin wrapper; meta vaults now appear in the result.
src/redemptions/tasks.py Splits redemption-asset retrieval into _distributed + _direct helpers, downgrades zero-nonce log to debug, returns a defaultdict on the zero-nonce path.
src/meta_vault/tests/test_service.py Updates expected results to include meta-vault and nested-meta-vault entries in the distributed mapping.

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

Comment thread src/meta_vault/service.py Outdated
Comment thread src/meta_vault/service.py
Comment thread src/meta_vault/service.py
Comment thread src/meta_vault/service.py
Comment thread src/redemptions/tasks.py Outdated
evgeny-stakewise and others added 2 commits May 14, 2026 12:33
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Signed-off-by: evgeny-stakewise <[email protected]>
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.

3 participants