cancel-on-disconnect #820
jordy25519
started this conversation in
Ideas
Replies: 1 comment
-
i like the level of detail in this post @jordy25519 do you think would be curious to hear the pros of going beyond that |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Proposal to provide a CEX like cancel-on-disconnect feature for Drift protocol.
Simple kill-switch to guarantee when a subaccount is detected offline its orders will not be matched.
motivation: Drift gateway provdies a CEX like interface already and this feature is a nice addition to that
Sketch
Users can opt-in to cancel-on-disconnect at anytime by doing the following:
pda(PROGRAM_ID, subaccount_id, b'heatbeat')
where
n
is a protocol wide or user defined parameter.clients should submit a periodic tx to update heartbeat slot.
current_slot - last_heartbeat_slot
<n
can initiate a special cancel tx on the subaccount (similar to current timestamp expire behaviour). additionally, add make/take validations to prevent fills on disconnected subaccount orders.Considerations
during congestion, a heartbeat tx not landing causes orders to expire unwarranted. The heartbeat period can be adjusted to compensate for reliability by trading latency of the kill-switch.
not sure if the fees are acceptable,
~0.43-0.95
SOL (+expiry fees) per day to use the heartbeat, assuming 5000 lamports per txmaybe filler bots have incentives to not cancel orders in a timely way, not sure how this is handled with order expiry timestamp currently. the same filler bot reward / user fees may be used.
Alternatives Considered
Add a
heartbeat_slot
toUserAccount
main drawback is breaking change, while one (small) benefit is that any tx could be used to update the heartbeat slot
Beta Was this translation helpful? Give feedback.
All reactions