Token Logic Modules Introduction
Introduction
Token Logic Module (TLM) processing consists of the following sequential steps:
Background: Max Claimable Amount
tl;dr Max Claimable Amount ∝ (Application Stake / Number of Suppliers per Session)
Per Algorithm 1 of the Relay Mining paper (https://arxiv.org/pdf/2305.10672), the maximum amount a supplier can claim from an application in a single session MUST NOT exceed the Application's stake divided by the number of suppliers in the session.
This is referred to as "Relay Mining Payable Relay Accumulation" in the paper and is described by the following pseudo-code:
TLM (pre) Processing
tl;dr Determine if the claim amount is greater than the maximum claimable amount prior to running each individual TLM.
Prior to processing each individual TLM, we need to understand if the amount claimed by the supplier adheres to the optimistic maxIA set per the limits of the Relay Mining algorithm.
Suppliers always have the option to over-service an Application (i.e. do free work) in order to ensure high quality service in the network. This may lead to offchain reputation benefits (e.g. Gateways favoring them), but suppliers' onchain rewards are always limited by the cumulative amounts Applications' stakes (at session start; per service) and the number of Suppliers in the session.
Max Claimable Amount (MCA) = Application Stake / NumSuppliersPerSession
Claim Amount (CA)
Max Claimable Amount (MCA) = (AppStake / NumSuppliersPerSession)
Questions evaluated prior to TLM processing:
Is CA > MCA?
Yes → Broadcast event that Settlement Amount (SA) = MCA (Application Overserviced Event), then process TLMs with SA = MCA.
No → SA = CA; process TLMs with SA = CA.
Possible TLM examples:
TLM: Burn Equals Mint
TLM: Global Inflation
TLM: Global Inflation Reimbursement Request
TLM: ...
Token Logic Modules Pre-Processing
In order for the MaxClaimableAmount to prevent Applications from over-servicing, the Application.Stake must be claimable only by Suppliers from the same session (i.e. the same service).
For a given application MaxClaimableAmount is Application.Stake / NumSuppliersPerSession and defined per session/service.
If an Application is able to send traffic to n services then it could be over-servicing up to n times its stake for a given session number by performing MaxClaimableAmount * NumSuppliersPerSession * n > Application.Stake worth of work.
To avoid this type of over-servicing, the Pocket protocol requires Applications to only be able to stake for EXACTLY ONE service.
Was this helpful?
