-
Notifications
You must be signed in to change notification settings - Fork 328
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
Taker metadata #175
base: master
Are you sure you want to change the base?
Taker metadata #175
Conversation
Would it be possible to add a high level overview of what this PR is about? Curious to understand it better |
|
dex/src/state.rs
Outdated
@@ -802,6 +799,13 @@ impl<'a, H: QueueHeader> Queue<'a, H> { | |||
} | |||
} | |||
|
|||
impl<'a, H: QueueHeader> Index<usize> for Queue<'a, H> { |
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.
Is this used in this batch of changes?
dex/src/state.rs
Outdated
@@ -3136,9 +3251,15 @@ impl State { | |||
if eq_buf.len() < 128 { | |||
Err(DexErrorCode::EventQueueTooSmall)? | |||
} | |||
let account_flags = if consume_events_authority.is_some() { | |||
(AccountFlag::Initialized | AccountFlag::EventQueue | AccountFlag::IncludeTakerMetadata) |
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.
Given that IncludeTakerMetadata
can only be used with a consume events atuhority, we can remove IncludeTakerMeatadata
and just re-use the CrankAuthorityRequired
flag.
@@ -1317,6 +1345,19 @@ pub enum EventView { | |||
fee_tier: FeeTier, | |||
client_order_id: Option<NonZeroU64>, | |||
}, | |||
MakerFill { |
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.
Using this MakerFill doesn't actually do anything because the EventView
is not what is stored in the EventQueue
account. It's just a view of its data. So to add a field, one has to update the Event
struct in a non breaking way.
This PR fixes some of the bugs present from the crank authority PR and adds the public key of the taker's open orders account to every maker fill.
This is useful because this can allow for a downstream program that composes with Serum to simultaneously process a taker and maker fill in the same transaction. It is very helpful to have both parties on the trade fill when initializing a perpetual swap or an option for example.