# Compensation Fees in Transaction Fee Distribution Users need to specify a fee when submitting their transactions. When it is a validator’s turn to propose a block, the validator collects transactions from the transaction pool, executes them in a certain order, and publishes them in a new block. Fees in a block are distributed to all validators pro rata. This is to weaken the incentive to steal transactions from other blocks, in case the block proposer receives the whole fee. The protocol has the following parameters: - $P$: Average gas price of the previous era. This value is updated at the end of each era, calculated by dividing total collected fees by total consumed gas. - $G$: Gas in a block. - $G_{\text{max}}$: Block gas limit. $G \leq G_{\text{max}}$ for every block. - $F$: Total fee collected from transactions in a block. - $N$ is the current number of validators, - $w_i$ is the normalized weight of validator $i$. In a given block, $F$ fee is collected from transactions amounting to $G$ gas. Let validator $i$ be the **block proposer**. If $G<G_\text{max}$, validator $i$ is obliged to come up with $$ F_c = P (G_\text{max}-G) $$ worth of tokens as compensation. This is deducted from their reward balance if sufficient, and from their bonded tokens if not. Deduction from stake is equivalent to slashing, and if it drops below minimum stake size, they cease to be a validator as usual. The compensation $F_c$ will be added up to $F$, which will be **distributed pro-rata to the validators**. Change in a validator $j$'s balance is equal to $$ \Delta_j = \begin{cases} w_i(F+F_c) - F_c & \text{if}\quad j=i\\ w_j(F+F_c) & \text{otherwise } \end{cases} $$ This scheme disincentivizes validators from being "lazy", i.e. proposing empty blocks in order not to incur the computational cost of processing transactions. The block proposer paying a compensation might seem unfair especially when there is a lack of submitted transactions. However, every validator's being subjected to it ensures fairness in the long term, even at times of low demand. ### Payouts Assume there exists the following strategies 1. Honest: Validator tries to fill up a block as much as possible. 2. Lazy: Validator proposes an empty block. Let $E(F)$ and $E(G)$ be the expected value of user fees and gas respectively, **in blocks proposed by honest validators**. Let $\alpha$ be the ratio of the honest validators' stake to total stake, i.e. $\alpha=1$ when all are honest and $\alpha=0$ when all are lazy. Let $V_\text{honest}$ and $V_\text{lazy}$ be the set of honest and lazy validators, and $V = V_\text{honest}\cup V_\text{lazy}$. Let $N$ be the number of blocks that is to be proposed in an era. All validators are expected to propose a block through the pseudorandom leader selection process. In Highway, a validator becomes the leader a number of times proportional to their weight. Then a validator $i$ would propose $w_iN$ blocks in a round. With the given ratio of honest validators, the expected change in the balance of an honest validator $i$ at the end of the era is equal to $$ \begin{aligned} E(\Delta^\text{honest}_i) =& w_iN[w_i(E(F)+P(G_\text{max}-E(G)))-P(G_\text{max}-E(G))] \\ & +w_i\sum_{j\in V_\text{honest},j\neq i} w_jN(E(F)+P(G_\text{max}-E(G)))\\ & +w_i\sum_{k\in V_\text{lazy}} w_kNPG_\text{max} \end{aligned} $$ Similarly, the expected value of the change in the balance of a lazy validator $i$ is equal to $$ \begin{aligned} E(\Delta^\text{lazy}_i) =& w_iN[w_iPG_\text{max}-PG_\text{max}] \\ & +w_i\sum_{j\in V_\text{honest}} w_jN(E(F)+P(G_\text{max}-E(G)))\\ & +w_i\sum_{k\in V_\text{lazy},k\neq i}w_kNPG_\text{max} \end{aligned} $$ We can substitute: - $\sum_{j\in V_\text{honest}} w_j = \alpha$, - $\sum_{j\in V_\text{honest}, j\neq i} w_j = \alpha - w_i$ where $i\in V_\text{honest}$ - $\sum_{k\in V_\text{lazy}} w_k = 1-\alpha$, - $\sum_{k\in V_\text{lazy}, k\neq i} w_k = 1-\alpha - w_i$ where $i\in V_\text{lazy}$, Then the expressions above simplify to $$ \begin{aligned} E(\Delta^\text{honest}_i) &= \alpha w_iN(E(F)-E(G)P) + w_iN E(G)P\\ E(\Delta^\text{lazy}_i) &= \alpha w_iN(E(F)-E(G)P) \end{aligned} $$ The difference $$ E(\Delta^\text{honest}_i) - E(\Delta^\text{lazy}_i) = w_iN E(G)P $$ shows that on average, an honest validator earns $w_iNE(G)P$ more than than a lazy validator per era, given that they have the same weight $w_i$. This is simply equal to the average fee collected from a block, multiplied with the number of blocks $i$ has to propose. This assumes that $P$ remains relatively stable era to era. Below is the code for verification ```python from sympy import * P = Symbol('P') Gmax = Symbol('Gmax') Gavg = Symbol('G') F = Symbol('F') alpha = Symbol('alpha') # alpha = 1 N = Symbol('N') w = Symbol('w') E_honest_payout = w*N*((F+(Gmax-Gavg)*P)*w-(Gmax-Gavg)*P) \ + (alpha-w)*w*N*(F+(Gmax-Gavg)*P) \ + (1-alpha)*w*N*(Gmax*P) E_honest_payout = simplify(E_honest_payout) E_lazy_payout = w*N*((Gmax*P)*w-(Gmax)*P) \ + w*alpha*N*(F+(Gmax-Gavg)*P) \ + w*(1-alpha-w)*N*(Gmax*P) E_lazy_payout = simplify(E_lazy_payout) pprint(E_honest_payout) pprint(E_lazy_payout) pprint(simplify(E_honest_payout - E_lazy_payout)) ``` ### Nash Equilibria TBD