Preamble
As a result of Jeremy’s model I reread some papers on QTT and was thinking how we may want to change the current RM model to allow more rigid cross-action checking as well as making it closer to proper Quantitative Type Theory.
A question that I was posing myself is: what is the quantity field really about if not for usual quantity as in “I want X quantity of XAN or spacebucks”. The answer is, of course, that it is supposed to be quantity in the sense of quantitative type theory: “I want this specific resource to be usable X many times”.
In other words, this is a field that controls linearity, i.e. how many times can we use a resource (in the logical sense of resource). There are, moreover, two levels of linearity: global and local for the RM. Global linearity’s goal is to check that no resource can be consumed which has not been created and check double spending and creating. This is handled by the commitment/nullifier RSM mechanism. Now, the local linearity constraint is handled by the Delta Proving System. It says that we need to balance the kind of resources created an consumed. Ideally, the QTT semantics tells us that actually it is not the “kind” of a resource that we want to control consuming but resource itself (more on that later).
Alongside this observation, I started asking myself what does ephemerality really do on the RM level. It has only one functional difference: it does not require global linearity check (it can be consumed without previously being created); and one practical application (modulo logic triggers which is not important in this context): it can balance local linearity check (deltas). PS: Maybe also for balancing Compliance Units for cases where Compliance Instances need to be balanced in terms of created and consumed resources.
This brought me to another question: do we ever really care that a non-ephemeral resource has some local linearity using semantics described by, again, Jeremy’s post? The answer to me seemed to be “no”. We only care about local linearity if we have some intent-bearing resource onboard. Usual things like “spacebucks”, “XAN” etc which use other parties do not assume that we create and consume things in the same action. (here I might be wrong, please let me know if I am)
In other words, things that we care locally (i.e. in terms of local linearity) are exactly things which trigger intents logics. They are there to be created and consumed, which would correspond to them being fulfilled. They can also be created an consumed several times in case you want that constraint to be fulfilled several times. All of this can be encoded as a non-zero value of the quantity field.
This brought me to the following proposal:
Proposal
- Remove ephemerality field from a resource (their role will be played by non-zero quantity resources)
- Compliance Proof check skips root check in case the resource they are using has non-zero quantity.
- Delta’s preimage does not have resource kind as keys. Instead, it has the hash of a larger part of a resource, including logic, label, value, etc. I would say “everything but quantity” should be the key.
This corresponds to Jeremy’s requirement of requiring intent-bearing resources to be consumed in the same transaction (delta check ensures this), simplifies the design, and makes the RM closer to QTT.
Specifically:
Consequences
-
Usual resources we care about globally (like XAN, spacebucks, whatever) have 0-quantity. Their linearity is checked during global checks.
-
Intent-bearing resources exactly correspond to non-zero quantity resources. The new delta check ensures that the full resource is both created and used (sans quantity and other minor data we might want to skip).
-
Deltas actually track resources (or at least something closer to our definition of a resource, i.e. covers more data) and not kinds of resources.
-
Might be a bit cumbersome to make sure we have enough resources for compliance proofs for shielded case as they might require e.g. exactly one created and one nullified in the instance, but nothing I see as essentially problematic, just a bit inconvenient.
PS
If I am not mistaken Jeremy’s issue can also be fixed using only the last part 3 of my proposal. Namely make deltas account for the entire resource sans quantity. The ephemerality removal jumps at me though as the next logical step due to the prior discussion.