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

Taker metadata #175

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Conversation

jarry-xiao
Copy link
Contributor

@jarry-xiao jarry-xiao commented Sep 15, 2021

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.

@Henry-E
Copy link

Henry-E commented Sep 16, 2021

Would it be possible to add a high level overview of what this PR is about? Curious to understand it better

@jarry-xiao
Copy link
Contributor Author

Would it be possible to add a high level overview of what this PR is about? Curious to understand it better
Added :)

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> {
Copy link
Contributor

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)
Copy link
Contributor

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 {
Copy link
Contributor

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.

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.

3 participants