Expand description
Fee excesses associated with transactions or transitions.
These are represented as a ‘left’ and ‘right’ excess, which describe the unresolved fee excesses in the fee tokens of the first (or leftmost) and last (or rightmost) transactions in the transition.
Assumptions:
- Transactions are grouped by their fee token.
- The ‘fee transfer’ transaction to dispense those fees is part of this group.
- The fee excess for each token is 0 across the group.
- No transactions with fees paid in another token are executed while the previous fee token’s excess is non-zero.
By maintaining these assumptions, we can ensure that the un-settled fee excesses can be represented by excesses in (at most) 2 tokens. Consider, for example, any consecutive subsequence of the transactions
..[txn@2][ft@2][txn@3][txn@3][ft@3][txn@4][ft@4][txn@5][txn@5][ft@5][txn@6][ft@6]..
where [txn@i]
and [ft@i]
are transactions and fee transfers respectively
paid in token i.
The only groups which may have non-zero fee excesses are those which
contain the start and end of the subsequence.
The code below also defines a canonical representation where fewer
than 2 tokens have non-zero excesses. See the internal function
FeeExcess::rebalance
below for details and the implementation.
Port of the implementation from: https://github.com/MinaProtocol/mina/blob/2ee6e004ba8c6a0541056076aab22ea162f7eb3a/src/lib/mina_base/fee_excess.ml#L1
Structs§
Functions§
- assert_
equal_ checked - eliminate_
fee_ 🔒excess - Eliminate a fee excess, either by combining it with one to the left/right, or by checking that it is zero.
- eliminate_
fee_ 🔒excess_ checked