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

Fill in Position-related ActionHandler implementations #1905

Closed
3 of 4 tasks
Tracked by #1725
zbuc opened this issue Jan 27, 2023 · 3 comments
Closed
3 of 4 tasks
Tracked by #1725

Fill in Position-related ActionHandler implementations #1905

zbuc opened this issue Jan 27, 2023 · 3 comments
Assignees
Labels

Comments

@zbuc
Copy link
Member

zbuc commented Jan 27, 2023

Related to the ActionHandler for component::dex.

This ticket tracks the consensus-side execution of the action handlers for position actions. The implementation of the DEX engine itself is tracked in #1724. Client-side logic like Planner support is tracked in #1991.

@zbuc zbuc self-assigned this Jan 27, 2023
@zbuc zbuc added the E-week label Feb 8, 2023
@conorsch
Copy link
Contributor

conorsch commented Feb 9, 2023

@zbuc Is this ticket still useful? Can you expand in the OP what the goal here is?

@zbuc
Copy link
Member Author

zbuc commented Feb 13, 2023

Let's keep this ticket open and use it for creating liquidity positions. We will also need a client-facing component. Will update.

zbuc added a commit that referenced this issue Mar 7, 2023
* Start implementing pcli side of lp actions

* dex: don't track position nonces, just position IDs

Tracking the position nonces was a red herring, because what we really care
about is that the position ID is used only once -- the nonce is just used as a
way to ensure that it's possible to create more than one position with the same
trading function.

* dex: don't return an LpNft from position_open()

The LpNft is only ever tracked by the client in their private state, it's never
used by the public part of the state machine, except as part of the value
balance checks for the transaction, so the state machine never has to work with
an LpNft.

* dex: move stateless checks out of PositionManager

We want to do all of the stateless checks in one place, and we also want to do
as little work as possible in `execute`, which runs serially.

* dex: implement ActionHandler for PositionClose

* dex: don't implement LP rewards, specifically

* dex: implement ActionHandler for PositionWithdraw, reorg PositionManager

This commit fills in the position withdrawal implementation, and also
reorganizes the code in the PositionManager trait, so that it's largely moved
into the body of the ActionHandlers. The PositionManager now has a single
method, `put_position`, which handles invalidating existing indexes and writing
new ones.

* storage: add test that deleting nonexistent keys works

We want to check that this is the case, so that we can unconditionally delete
indexes in the PositionManager.

* Clean up warnings

---------

Co-authored-by: Henry de Valence <hdevalence@penumbra.zone>
@hdevalence hdevalence changed the title Fill in existing stubbed implementations Fill in Position-related ActionHandler implementations Mar 15, 2023
@hdevalence
Copy link
Member

Folding into #1724

@hdevalence hdevalence closed this as not planned Won't fix, can't repro, duplicate, stale Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Testnet 49: Pasiphae
Development

No branches or pull requests

3 participants