Game Warping and Guaranteed Loans

Nate Rush
Conspiratus
Published in
5 min readFeb 16, 2020

--

NOTE: This is a draft blog post that was written in 2017. I don’t know how I feel about most of the ideas presented here — but with all the discussion of flash loans I figured it’d be cool to post. Hopefully you get something cool out of it anyways! :)

In this blog post, we will explore trustless game warping and trustless loans, two actions uniquely enabled by smart contracts. Trustless game warping is enabled by the existence of smart contracts in general, and trustless loans are enabled by Ethereum’s synchronous transaction semantics. We explore the interaction between these two mechanisms and conclude that while there is likely some direct interaction, it may be more interesting to generalize ideas from trustless loans and apply them to a variety of problems. Cool!

Game Warping

Smart contracts allow for trust-less game warping. But what even is that? We refer our readers to Virgil’s lovely blog post found here, and borrow/modify an example from this blog post.

Imagine there is an on-chain prisoners dilemma occurring, where players can defect or cooperate with on-chain messages only. The standard prisoner's dilemma equilibrium of both defecting is worse for both players can cooperating — but cooperating is not an equilibrium.

INSERT PICTURE OF ORIGINAL GAME

But now imagine some game warper comes along and commits to the following bribes with a smart contract.

INSERT PICTURE OF BRIBES

Now, we get the resulting game, where in fact cooperating is the best strategy, and rational play will lead to that outcome:

INSERT PICTURE OF WARPED GAME

We also note another conclusion of the above blog post: “ if everyone plays Rationally, the game can be influenced for free!” That is, warping games requires some large budget but does not actually cost anything!

So, this is game warping. Changing the equilibrium and the outcome of games through bribes that often require large budgets, but may not actually cost anything at all.

Guaranteed Loans

Banks, rejoice! You can now give out loans to consumers with the following condition: the consumer can use the money in the loan for some amount of time, but if they fail to pay the loan back by the deadline (with the required interest), then the bank has the ability to rewind time — and act as though they never gave the loan in the first place.

Ethereum’s synchronous transactions semantics allow for pretty much exactly this.

Consider some smart contract that stores some large sum of money. It has a single function, called takeLoan, which takes as input an amount of money requested, and a forwarding address with some call data. When this function is called, the smart contract calls the address, with the amount of money requested, and with the call data.

After that call finishes and the loan contract regains control of execution, it requires the amount of money it currently holds is the value it had at the start plus the interest on the loan. Otherwise, it reverts the entire transaction.

Here’s an example of how this could be used:

  1. You’re pretty smart, and there is a massive arbitrage opportunity on two different on-chain markets.
  2. Unfortunately, taking advantage of this opportunity requires a large budget, and you don’t have that kinda capital.
  3. Instead, you make the call through the revert lender to this arbitrage opportunity — taking a loan for the capital you need.
  4. If you manage to exploit the opportunity, you can pay back the loan with ease in the same transaction. Otherwise, the whole transaction will revert, and so there is no risk for the lender itself.

In the naive form described above, there are probably serious front-running issues. But you get the idea. Loans that are guaranteed to be repaid, and so can be a cheap way of getting access to a large budget for a short period of time.

We note that this mechanism relies on its ability to revert the loan if payment is unsuccessful. As such, it is only possible because Ethereum’s synchronous call semantics; if each call generated a new transaction, reverting the original loan would become impossible.

Game Warping + Guaranteed Loans

So: we have a mechanism that requires a large budget. And we have a mechanism for getting a large budget. It seems like these two things were made together in the heavens.

But is this really the case?

The problem is that the loan’s guaranteed payback only exists as a result of the calls synchronous nature. If the original loan-giving cannot be reverted by the end of the transaction, then guaranteed nature is impossible.

Thus, any game warping that uses guaranteed loans necessary must play out over the course of a single transaction. However, as the loan must be taken and the actions made all at the same time, thus the transaction that takes the loan must also have the player actions within it.

But this seems like nonsense, as this requires players actually signing off/committing to actions before the game is actually warped. However, we note that the common knowledge that the game could be warped in this way through the publishing transaction could be exploited to make this reasonable.

For example, imagine if one of the prisoners in the dilemma was represented by a smart contract on-chain. Furthermore, they committed (using this smart contract) to cooperate, if there was a large loan taken out by the revert lender for the purpose warping the game to the optimal outcome.

Now: action is only required by the other prisoner during a transaction, and so this occurring in a single transaction is now reasonable.

Spin-offs

But this immediately raises two questions:

  1. Do we still need a large loan to warp the game in the example above?
  2. This whole lend/revert behavior is interesting. Can we generalize it?

The answer to the first question seems to be decidedly no. In the example given above where the first prisoner commits to cooperating if the loan occurs, we can change this commitment to say “I’ll cooperate if the other player is cooperating also — and they don’t need my signature in this case.” E.g. one the second prisoner can decide to cooperate, and then make a call through prisoner one’s smart contract agent without needing them. So: we don’t really need the loan to warp the game — just a certain flavor of commitment from players.

The answer to the second is yes, and we see a bit of it above. Imagine the following:

  1. A user maintains an agent on-chain. Practically, this can be thought of as a multi-sig wallet.
  2. For any call that passes through this agent, the user can specify a set of pre-conditions and post-conditions that must hold. If any of these conditions do not hold, then the entire transaction is reverted.
  3. Finally, the user can specify a set of actions that the agent can be triggered without the user itself, again with these pre and post-conditions.

The third point is likely the most interesting, as it allows the user to say “anyone can act on my behalf,” as long as they are doing X, Y, or Z. Practically, the revert lender is a great example of this exact behavior and could be specified in a user agent just through pre and post-conditions.

--

--