Skip to content

FLO-20: eliminate per-position capability controller bloat#247

Open
holyfuchs wants to merge 1 commit intomainfrom
holyfuchs/FLO-20-createPosition-storage-bloat
Open

FLO-20: eliminate per-position capability controller bloat#247
holyfuchs wants to merge 1 commit intomainfrom
holyfuchs/FLO-20-createPosition-storage-bloat

Conversation

@holyfuchs
Copy link
Member

Closes: #229

Replace per-position capabilities.storage.issue() calls with a contract-level _borrowPool() that directly borrows the Pool from storage. Position, PositionSink, and PositionSource no longer hold a Capability field — they call the contract function directly — so no new CapabilityController is created per position.

@holyfuchs holyfuchs requested a review from a team as a code owner March 9, 2026 11:33
@holyfuchs holyfuchs force-pushed the holyfuchs/FLO-20-createPosition-storage-bloat branch from 87ad2e1 to a56de6a Compare March 12, 2026 13:14
@holyfuchs
Copy link
Member Author

creation of FlowALPPositionResources.cdc on main required a rewrite

@holyfuchs holyfuchs requested a review from jordanschalm March 12, 2026 13:15
access(all) fun depositCapacity(from: auth(FungibleToken.Withdraw) &{FungibleToken.Vault}) {
if let pool = self.pool.borrow() {
pool.depositAndPush(
if let pool = FlowALPPositionResources.poolCap?.borrow() {
Copy link
Member

Choose a reason for hiding this comment

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

Kind of weird that this doesn't bind the non-nil pool value inside the conditional block. I guess because there is an optional operation on poolCap first. Almost seems like a Cadence bug, though -- I feel like the if..let statement should only consider the value assigned to pool.

Copy link
Member

Choose a reason for hiding this comment

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

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.

FLO-20: createPosition() Causes Storage Bloat by Redundantly Issuing Pool Capabilities

2 participants