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

remove server side constraint on unique offer ids #6551

Closed
turadg opened this issue Nov 9, 2022 · 0 comments · Fixed by #6556
Closed

remove server side constraint on unique offer ids #6551

turadg opened this issue Nov 9, 2022 · 0 comments · Fixed by #6556
Assignees
Labels
enhancement New feature or request wallet

Comments

@turadg
Copy link
Member

turadg commented Nov 9, 2022

What is the Problem Being Solved?

Each offer to the smart wallet has a unique offer ID, which fulfills two requirements:

  1. Offer status publishing on RPC reflects actual offers pushed. (No collisions.)
  2. Maps to look up offer results (offerToUsedInvitation, offerToInvitationMakers) have a stable unique key.

To avoid keeping track of every offer id, we opted for a high water mark of a serial number:

// To ensure every offer ID is unique we require that each is a number greater
// than has ever been used. This high water mark is sufficient to track that.
lastOfferId: 0,

Description of the Design

Requirement #1 is more the concern of the client, so leave it to them. If you push an offer with a colliding ID, vstorage publishing is undefined. It's easy to ensure they're unique by using UUID or a high-precision timestamp.

Requirement #2 already has a collection of ids that could collide, in the keys of those maps. If an offer will collide there, through an exception.

Security Considerations

--

Test Plan

This should be backwards compatible, but do integration testing with the Wallet UI.

@turadg turadg added enhancement New feature or request wallet labels Nov 9, 2022
@turadg turadg self-assigned this Nov 9, 2022
@mergify mergify bot closed this as completed in #6556 Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wallet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant