-
Notifications
You must be signed in to change notification settings - Fork 0
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
Design Proposition For Performance Issue #3
Comments
Inventory Vat Approachprepared by: @anilhelvaci As stated in the problems targeted section, we are trying to relieve zoe from having to deal with Assumptions
SolutionThis approach presents a solution with the current features;
Diagram for operation
|
In
|
Design Proposition For KREAd Performance Issue
Context
See Agoric/agoric-sdk#8862
Problems targeted
zoe
vatcopyBag
AmountMath
operations withcopyBag
causes too much computationAlternative Inventory
The current KREAd implementation uses multiple
ZCFSeat
s to store equipped items and a duplicate of user's characterto ensure users can interact with the contract under Zoe's protection. What we propose has two main improvements to this implementation;
Wash Trades
Get rid of the duplicate character. Based on this comment from Chris Hibbert, it is explained that we can indeed execute "wash trades", wish means that the user can give and request the same asset when building an offer. Although It is important to notice that the proposal will need a different keyword for the want and give Character amount.
Dedicated purse over open ZCFSeat
To remove the dependency on the inventorySeat, we intend to use the Items issuer to make an empty Purse for each Character that will hold the equipped Items. This purse will be included in the Character record, replacing the inventory seat attribute. This way we can deposit and withdraw the required Items to assure the normal flow of KREAd without the performance load of the previous design.
When a user wish to sell a Character or an Item, the asset will be escrowed in Zoe, which contributes for the performance issue described above. To address this issue, one additional change we intend to implement is to create a dedicated Purse for every sellRecord, that will hold the asset until the sell is executed or the user decides to cancel it. This Purse will be recorded in the contract state, by including it in the MarketEntryGuard, along with the seller Seat.
Replace
ITEMS
issuerTo complement the change above, we wish to replace the ZCFMint created for Item into an IssuerKit. The reason behind this decision is based on the Vats where the Purses will be living in. When using the
makeZCFMint
method, the Purses created from the issuer returned, will live invat-zoe
, while with themakeIssuerKit
method, the Purses created will be stored invat-kread
. We expect that this will reduce the load on Zoe and improve its performance.vat-zoe
does not create a problem for Zoe, we can consider skipping this feature.Implementation Approaches
Both approaches below takes the idea above and implements them with different considerations.
Deploys a new Zoe contract that handles the inventory logic described above to relieve
vat-kread
from allcopyBag
computations(add, subtract).vat-kread
ApproachImplements alternative inventory approach inside the
kreadKit
(or a dedicated virtual object, TBD) to avoid vat-to-vat communication overhead.Migration
There are users who already minted characters and items with the existing way. We must implement a mechanism to migrate those users to the latest version. This means;
KREAdITEM
will changeITEMS
issuer, this is omittedinventorySeat
KREAdITEM
with the exact amounts that are equipped to the characterITEMS
issuer, this is omittedinventorySeat
We should probably perform this migration as old users try to interact with the application after the upgrade instead of trying to move all characters and items at once(for the sake of Zoe). So we end two main ways to do this;
migration
offer from the user if their character DOES NOT have a registered purseequip
,unequip
, ..etc) will not take longer timeITEMS
issuer changes) We can structure the offer in the frontend in a way that users include their unequipped items in their migration offers so that we have a plan for how to get rid of assets that still use oldITEMS
issuer.equip
,unequip
, ..etc).equip
,unequip
, ..etc) that include migration(we'll have manually look for in the usual operation includes any migration or not).How to migrate characters/items that are on sale?
This question has its own heading simply because it's a pretty big one and we don't have a high level of confidence in the possible directions we're considering to take.
The KREAd market place has currently 524 items and 35 characters in sale. All sales are managed with an open
ZCFSeat
. There are two types of item sales, (1) First sale, means items minted by KREAd and being sold directly by the protocol, (2) Secondary sale, means users are selling the items they own. All character sales are done by the users, meaning they are similar to secondary item sales. From Zoe's point of view, it makes no difference whether the sale is secondary or not because all payments escrowed in various number ofZCFSeat
s are managed by the same purse. However during the migration, we might have to deal with first and secondary sales differently. The reason being, secondary sales actually have a user expecting a payout when first sales send the payout to some protocol account. Which means, in order not to break customer experience we must take careful approach in this. This problem has both a product and technical aspect to it. The product side is more related to the secondary sales whereas technical side is going to care about the first sales. This is simply because the majority of 524 items on sale are first sales. Therefore, most of the load is coming from there. The ideas we've considered so far for the first item sales;internalSellSeat
;numberOfItemsInPurse
will decreaseOther Open Questions
ITEMS
issuer)The text was updated successfully, but these errors were encountered: