Skip to content

feat: ClosedSetOrderbook#14977

Closed
benesjan wants to merge 23 commits intonextfrom
06-11-feat_closedsetorderbook
Closed

feat: ClosedSetOrderbook#14977
benesjan wants to merge 23 commits intonextfrom
06-11-feat_closedsetorderbook

Conversation

@benesjan
Copy link
Copy Markdown
Contributor

@benesjan benesjan commented Jun 11, 2025

Fixes #14917

Note for reviewer

I think this PR is now quite complete and the only significant thing missing is the implementation and usage of ClosedSharedMutable here (relevant comment). But anyway that should be done in a followup PR so I think once the TODOs that are present in the code and that I want to get a feedback on are addressed I think this can be merged.

Copy link
Copy Markdown
Contributor Author

benesjan commented Jun 11, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@benesjan benesjan changed the title feat: ClosedSetOrderbook feat: ClosedSetOrderbook Jun 11, 2025
@benesjan benesjan force-pushed the 06-11-feat_closedsetorderbook branch 2 times, most recently from 8caa285 to ddc67dc Compare June 25, 2025 12:44
@benesjan benesjan force-pushed the 06-11-feat_closedsetorderbook branch from ddc67dc to 4de0321 Compare July 1, 2025 06:45
@benesjan benesjan force-pushed the 06-11-feat_closedsetorderbook branch 4 times, most recently from 74e6300 to 31ba402 Compare July 10, 2025 04:01
@benesjan benesjan changed the base branch from next to graphite-base/14977 July 10, 2025 06:09
@benesjan benesjan force-pushed the 06-11-feat_closedsetorderbook branch from 31ba402 to 586ca0a Compare July 10, 2025 06:09
@benesjan benesjan changed the base branch from graphite-base/14977 to 07-10-fix_bug_in_pxe_getnotes July 10, 2025 06:09
@benesjan benesjan force-pushed the 06-11-feat_closedsetorderbook branch from 6d37654 to 0fc9fb3 Compare July 10, 2025 08:33
@benesjan benesjan marked this pull request as ready for review July 10, 2025 09:08
@benesjan benesjan requested a review from LeilaWang as a code owner July 10, 2025 09:08
) {
// TODO: Why don't we have a way to directly initialize SharedMutable when it's created? If this is done
// in the constructor then it's safe as we cannot interact with an undeployed contract that has initializer.
// Waiting for delay to pass here is quite annoying.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious if reviewer thinks we would want to support something like this. When a contract needs to be initialized and the value is scheduled in #[initializer] then directly activating should be safe.

.transfer_in_private(maker, context.this_address(), bid_amount, authwit_nonce)
.call(&mut context);

// This contract is the "nullificator" of the order note meaning that this contract's nullifier key will be
Copy link
Copy Markdown
Contributor Author

@benesjan benesjan Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can rename this to "nelly" if we want to stick to that name instead.

// We get and nullify the order. We are working around PrivateImmutable here because the PrivateImmutable
// getter does not allow us to then destroy the note. This is of course intentional as the note is supposed
// to be immutable. But we want to nullify the note as it's valuable to communicate order fulfillment that way.
// TODO: Rework this. An option is to not use any state variable and instead manually handle the notes.
Copy link
Copy Markdown
Contributor Author

@benesjan benesjan Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is quite interesting as here we essentially want PrivateImmutable + destroy. As in the only "modification" allowed is a destruction.

Anyway I would probably solve this by expanding PrivateMutable to have some kind of get and destroy function and use it here.

WDYT?

out.value(),
prev,
index,
self.hints.sorted_kept_note_hash_indexes[index],
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a fix done by Leila. See this discussion on slack for context.

@benesjan benesjan requested a review from nventuro July 10, 2025 11:45
Base automatically changed from 07-10-fix_bug_in_pxe_getnotes to next July 10, 2025 14:34
@benesjan benesjan force-pushed the 06-11-feat_closedsetorderbook branch from cfba7d0 to 31188d7 Compare July 10, 2025 15:15
@benesjan
Copy link
Copy Markdown
Contributor Author

Failed to get @nventuro to review this for half a year so there is no point in keeping it around.

@benesjan benesjan closed this Feb 17, 2026
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.

Closed-set orderbook DEX

2 participants