Skip to content

add second void output to file contracts

Luke Champine requested to merge missed-payouts into master

Currently, file contracts have a single "void" output, where coins are burnt to prevent certain misaligned-incentive attacks (e.g. the renter DoS'ing the host). During a revision, missed payout funds are moved from the renter to void, and missed payout collateral is moved from the host to the void. This works perfectly well, but it has one unfortunate side-effect: the void output contains a mixture of renter and host coins. The reason this is unfortunate is that, were the coins cleanly separated, we could trivially compute the original number of coins paid in by the renter and the host (i.e. the original values of ValidProofOutputs). If we separate the coins by adding a new void output to MissedProofOutputs, and specify that index 2 is the "renter void" and index 3 is the "host void", then we can calculate the original funds via:

missed := contract.LastRevision.NewMissedProofOutputs
origRenterFunds := missed[0] + missed[2]
origHostFunds := missed[1] + missed[3]

For reporting purposes, it's important that we know how much the renter originally paid into a contract, so currently we track this via separate metadata in the modules.RenterContract object. But there is no way to determine this value simply by looking at the most recent revision of the contract. You would have to lookup the parent ID in the blockchain.

This doesn't help Sia in the short-term, since we'll need to maintain compatibility for a while with hosts that don't support 2 void payouts. But down the road, I think it will be a useful property to have.


This code is passing tests despite making only small changes to the host, which I find somewhat surprising. It's possible that the host is not fully validating the missed proof outputs when accepting contract revisions. This warrants further investigation.

Merge request reports