-
Notifications
You must be signed in to change notification settings - Fork 305
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
auction: process triggers/execute DAs #4254
Conversation
0539ed2
to
1d66fb7
Compare
Interesting find, I didn't think about the position nonces during the design. Can we clarify this a little bit? One case we should think through is what happens if the position ID is already used. Since the auction data is public, any position ID that the chain can deterministically derive from it can also be predicted by an external party. Someone could attempt to claim the position ID first and grief the auction that way.
|
@hdevalence Thanks for the suggestion, I implemented it if you want to take a look - the current logic has an ugly failure mode because the position manager returns coarse errors (i.e. it's not possible to distinguish between a duplicate position id and an incoherent position state). I will fix it myself as part of M1 so that we only retry opening if the position id is squatted, and either terminate the auction, or bubble up the error, if a more serious error occurs. |
I think as a first pass we could ignore the error details and retry unconditionally |
@hdevalence could you give this a +1? |
Will do as soon as I'm back at the computer |
I did a round of improvements, thank you for the engaged review and feedback, I think this PR is much better as a result of your attention. In particular, I want to call out the following changes:
|
crates/core/component/auction/src/component/action_handler/dutch/schedule.rs
Show resolved
Hide resolved
@hdevalence this is ready for another round of review |
/// This method errors if the block interval is not a multiple of the | ||
/// specified `step_count`, or if it operates over an invalid block |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method doesn't actually error in this case though right? The step_size
will be rounded down. I'm not sure it matters here but it doesn't quite match the description.
|
||
// Compute the step size, based on the block interval and the number of | ||
// discrete steps the auction specifies. | ||
let step_size = block_interval / *step_count; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it OK to assume that step_count != 0
here but not above? The behavior should be consistent, right? Maybe we should make TriggerData
have private fields and enforce the invariants we want on construction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! My comments are non-blocking, and could be addressed in follow-up PRs if we want to get to them.
Thanks a lot for the review, I think this is mergeable but I agree with your comments about
I will do that in a followup PR, and open a ticket in the meantime |
Describe your changes
This PR implements #4240, in particular it adds the "end block" DA auction logic, and:
HandleDutchTriggers
trait, responsible for streaming auction state recorded for execution at atrigger_height
execute_dutch_auction
, which encapsulate auction LP logic and state updatespenumbra_dex::lp::Position
to take a user specified random nonce (computed based off the auction description, step index, and a counter, in order to evade id-squatting)TriggerData
into its own submodule (DA step function utils)Checklist before requesting a review
If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. Otherwise, I declare my belief that there are not consensus-breaking changes, for the following reason: