# Gas reservation I was trying to come up with a practical solution of making sure validators keep their end of the deal and execute transactions submitted with reserved gas. The problem is the lack of law enforcement, so we can't physically enforce validators to do that. We can otherwise cryptographically verify whether a transaction has been sent from a user. So the only thing we need to do is get the validators to deposit some tokens, and make it so that honoring the agreement is a dominant strategy. Important things to know: - Unlike a strict round-robin block proposal scheme, Highway has adaptable round lengths for each validator. It's not like we have a limited number of computation slots that can be auctioned off. What we can do is to set the incentives so that the probability of validators' honoring reservation agreements is maximized. - We distribute transaction fees to all validators proportional to their weight. - A block by block granularity for reservation may be impractical. Users may not know in advance the exact time during the day they want to transact. Here is a sketch: 1. Violet (a validator) wants to hedge her future transaction fee revenue by offering to include a certain gas worth of transactions at a certain gas price. Violet announces that they will accept 0.1 CLX/gas. 2. Alice likes the price and reserves 100 gas (worth 10 CLX) by putting a 5% reservation fee (0.5 CLX) in escrow. To confirm the reservation, Violet also sends the same amount to the reservation contract, at which point the tokens are locked. Fast forward to the day Alice reserved for. We have 2 options: - Alice doesn't submit a transaction in time. The locked tokens are burned. - Alice submits a transaction and attaches the remaining 95%. Either Violet or another validator includes the transaction in a block. Then Violet receives her deposit back & the 5% Alice put in escrow. The rest is distributed to all validators (including Violet) proportional to stake as usual. ### Analysis Alice has two strategies on the day she reserved gas: *submit* and *don't submit*. If Alice chooses *submit* (a transaction), Violet has the strategies *include* (the transaction) and *don't include*. If Alice chooses *don't submit*, Violet's only strategy is *don't include*. Whether Alice chooses to submit or not submit is non-attributable---there is no cryptographic way of proving that she did it in time. Because Violet's strategy depends on Alice's, this makes her strategy non-attributable too, except *include*---Alice must have submitted if Violet included. *Submit* is a dominant strategy for Alice unless she has a change of heart and suddenly decides that the gas she reserved is of no use to her (More specifically, the utility she receives from consuming that gas becomes smaller than the rest of the fee she is supposed to pay). In that case, her dominant strategy would be *don't submit*. *Include* is a dominant strategy unless the market price for gas has increased too much. Let $q$ be the amount of gas Alice has reserved, $p_0$ be the price at which Alice has reserved, $p_1$ be the market gas price on the day Alice has reserved for, $r$ be the reservation fee percentage (5% in the above example), $w$ be Violet's normalized weight. Violet's payout for *include* is $$p_0q(1-r)w + p_0qr$$ and for *don't include* is $$p_1qw - p_0qr.$$ Then solving for $p_1$, Violet's dominant strategy is *include* as long as $$p_1 < p_0 (1-r+2r/w).$$ Example: Let's say $r=5\%$ and $w=1\%$. Then unless the price of gas increases $(1-0.05+2\times 0.05/0.01) = 10.95$ times till the day Alice reserved for, *include* is a dominant strategy for Violet. The reason for Violet's locking up the same amount as Alice is to have a griefing factor of 1. Otherwise, Alice and Violet could lock up different amounts. ### Discussion > Andreas: Is it really necessary that the validator also deposits a reservation fee? Wouldn't it suffice to give them a larger share of the transaction fees, so they have an incentive to include the transactions? Let's assume Violet doesn't have to put a deposit, and say Alice reserves some gas for 6 months later. 3 months later, Bob comes around, reserving the same amount of gas at a higher price. Let's also say Violet can't include both Alice and Bob's transactions---she has to choose one. Violet then chooses Bob's transaction as a rational actor. If Violet had put some deposit, it would be harder for Bob to turn Violet from her commitment, but still not impossible.