-
Notifications
You must be signed in to change notification settings - Fork 101
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
[AIP-47][Discussion] Aggregators V2 #226
Comments
@igor-aptos could we use this to parallelize serial ID assignment? E.g. every order submitted to an order book gets a unique order ID, and the txns can parallelize? |
@alnoki Aggregators can be used when you are performing add/sub operations to a resource frequently. For example, for each NFT mint and burn operation, we need increment or decrement the
Here, the transaction is reading If you want to generate universally unique 256 bit integers in a parallelizable manner, then you can use AUIDs which were introduced in AIP-36. |
@vusirikala thanks for the tip. I asked a related question in #154 (comment) Namely I was hoping to get sequential parallelizable IDs |
Yes, you can use this (aggregators v2) to get sequential parallelizable IDs with this! that is exactly what token minting will be doing for populating index field, you can check more about that in AIP-43 |
@alnoki Great question. That's actually the reason we introduced the notion of Does that make sense? The conclusion is you could potentially use |
@igor-aptos @vusirikala thank you for the explanations above
In my particular case, I'd be storing the assigned serial ID in a struct field, then inserting the struct to a custom data structure. How would this affect parallelism? |
@alnoki That's perfect! Aggregators are designed to parallelize these types of cases. You can instantiate your Serial ID to be an |
Got it, thanks! This is moreso for a future design, but I've got this discussion bookmarked on our org repo for future consideration |
A few concerns:
|
What elements are supported and what is the outcome of using an unsupported element? |
@davidiw - IntElement is of u64 or u128 type. calling any method with unsupported type will return EUNSUPPORTED_AGGREGATOR_TYPE / EUNSUPPORTED_AGGREGATOR_SNAPSHOT_TYPE error. Note also about a third struct that was recently added - DerivedStringSnapshot, with a padding field that makes sure it has constant serialized size. I've updated the AIP text with more details, and code references. @alinush :
|
AIP Discussion
Abstraction for enabling efficient concurrent modifications of a counter, that has an optional limit defined, and be able to efficiently extract it's value and store it in another resource.
It revamps and expands on current notion of
Aggregators
, and adds new notion ofAggregatorSnapshots
.Specifically, allow aggregators to be used efficiently for control flow based on whether numeric operations would be executed or overflow/underflow, as well as allowing values from aggregators to be stored elsewhere, without incurring performance impact.
Read more about it here: https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-47.md
The text was updated successfully, but these errors were encountered: