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

5 [Vault] Unbounded Gas Consumption in Loops for Fee Distribution and Asset Management #344

Open
5 tasks done
chopan123 opened this issue Dec 26, 2024 · 1 comment · May be fixed by #399
Open
5 tasks done

5 [Vault] Unbounded Gas Consumption in Loops for Fee Distribution and Asset Management #344

chopan123 opened this issue Dec 26, 2024 · 1 comment · May be fixed by #399
Assignees

Comments

@chopan123
Copy link
Member

chopan123 commented Dec 26, 2024

Check the limits on when it is going to fail.

  • How many Asset, Strategies we need to add to make distribute_fee reach Soroban limits?
  • How many instructions of each type do we need to read soroban limits when executing rebalance ?
  • How many asset, strategies we need to add to make emergency_withdraw fail ?
  • How many Asset, Strategies Deposit with invest in true
  • How many Asset, Strategies Withdraw with amount bigger than idle funds

note Try 1 asset, find n strategies. then n assets, 1 strategy per asset.
Test it using Blend strategies.
use budget too

@chopan123 chopan123 changed the title 3 [Vault] Unbounded Gas Consumption in Loops for Fee Distribution and Asset Management 5 [Vault] Unbounded Gas Consumption in Loops for Fee Distribution and Asset Management Dec 26, 2024
@joaquinsoza joaquinsoza moved this to In Progress in DeFindex SCF#28 Jan 17, 2025
@joaquinsoza joaquinsoza moved this from In Progress to Done in DeFindex SCF#28 Jan 23, 2025
@joaquinsoza joaquinsoza moved this from Done to To Test / Review in DeFindex SCF#28 Jan 23, 2025
@joaquinsoza
Copy link
Collaborator

1 Asset n Strategies Hodl

  • 13 Hodl Strategies pass
  • 14 Hodl Strategies hits memory limit on withdrawal

1 Asset n Strategies Fixed

  • 10 Fixed Strategies pass
  • 11 Fixed Strategies hits memory limit on withdrawal

1 Asset n Strategies Blend

  • 2 Blend Strategies pass
  • 3 Blend Strategies hits CPU Instructions limit on withdrawal

1 Asset 1 Strategy Hodl Rebalance Limits

  • Invest hits MEMORY limit at 30 Instructions, 29 Passes
  • Unwind hits MEMORY limit at 30 Instructions, 29 Passes

1 Asset 1 Strategy Fixed Rebalance Limits

  • Invest hits MEMORY limit at 25 Instructions, 24 Passes
  • Unwind hits MEMORY limit at 26 Instructions, 25 Passes

1 Asset 1 Strategy Blend Rebalance Limits

  • Invest hits CPU limit at 5 Instructions, 4 Passes
  • Unwind hits CPU limit at 6 Instructions, 5 Passes

2 Asset Swap Limits Rebalance

  • SwapExactIn hits MEMORY limit at 6 Instructions, 5 Passes
  • SwapExactOut hits MEMORY limit at 6 Instructions, 5 Passes

N Asset 1 Strategy Hodl

  • Create Vault hits MEMORY limit at 27 Assets one strategy each, 26 Passes
  • Deposit hits MEMORY limit at 26 Assets one strategy each, 25 Passes
  • If sending all invest instructions together it hits the MEMORY limit at 25 Assets, 24 Passes. but it could be send in batches and we could have 25 Assets
  • Deposit and Invest hits MEMORY limit at 14 Assets one strategy each, 13 Passes
  • Withdraw hits MEMORY limit at 13 Assets one strategy each, 12 Passes
  • MAX 12 Assets 1 Strategy each

N Asset 1 Strategy Fixed

  • Create Vault hits MEMORY limit at 23 Assets one strategy each, 22 Passes
  • Deposit hits MEMORY limit at 26 Assets one strategy each, 25 Passes
  • If sending all invest instructions together it hits the MEMORY limit at 23 Assets, 22 Passes. but it could be send in batches and we could have 25 Assets
  • Deposit and Invest hits MEMORY limit at 12 Assets one strategy each, 11 Passes
  • Withdraw hits MEMORY limit at 11 Assets one strategy each, 10 Passes
  • MAX 11 Assets 1 Strategy each

N Asset 1 Strategy Blend

  • Create Vault hits MEMORY limit at 21 Assets one strategy each, 20 Passes
  • Deposit hits MEMORY limit at 26 Assets one strategy each, 25 Passes
  • If sending all invest instructions together it hits the CPU limit at 4 Assets, 3 Passes. but it could be send in batches and we could have 25 Assets
  • Deposit and Invest hits CPU limit at 4 Assets one strategy each, 3 Passes
  • Withdraw hits CPU limit at 5 Assets one strategy each, 4 Passes

@joaquinsoza joaquinsoza linked a pull request Jan 23, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To Test / Review
Development

Successfully merging a pull request may close this issue.

2 participants