makerdao / dss-gov

GNU Affero General Public License v3.0
4 stars 6 forks source link

Add usage of gas reserve for ping/clear #12

Closed gbalabasquer closed 4 years ago

gbalabasquer commented 4 years ago

Super simple first proposal to give incentives to the clear function. This can probably be more gas efficient using assembly and we could also change the logic creating contracts and destructing them instead of storage (like gas token v2). This is just a first idea of how it would be.

If we move on using storage we might want to make the number of slots manageable by governance. The only problem with that is it will require some record of how much gas has been staked on each ping or keep the general accumulator but after some time there might not be more gas to refund (if the value decreased over time).

kmbarry1 commented 4 years ago

While these gas tricks are neat, should we consider just minting a small amount of MKR to a successful clearer? It has the advantage that you don't have to worry about running out or using too many storage slots. It's also somewhat logical to get rewarded with MKR for helping to secure the Maker protocol.

gbalabasquer commented 4 years ago

While these gas tricks are neat, should we consider just minting a small amount of MKR to a successful clearer? It has the advantage that you don't have to worry about running out or using too many storage slots. It's also somewhat logical to get rewarded with MKR for helping to secure the Maker protocol.

Maybe, however I see some negative points:

kmbarry1 commented 4 years ago

Fair points. The inflation could be eliminated by transferring a little MKR from the account being deactivated to the caller of clear instead of minting, which also directly punishes the person who became inactive, but that might be even more controversial than inflation.

I suspect MKR holders would enthusiastically run bots to have the chance to increase their MKR share relative to others, so I would think the incentives are sufficient (I could be wrong).

Price volatility of MKR is a big problem. It would probably be necessary to use a combination of oracle price and a gov-controlled sanity limit, which comes with complexity, cost, and risk. Then again, ETH is volatile too and will require some level of adaptive management as well.

gbalabasquer commented 4 years ago

Yes I have thought on transferring MKR from user to the other, but honestly that feels more like an extra entry barrier than just spending more money in a tx. Even if the end $$ is more with the gas option there isn't this feeling of possible MKR loss for trying to be good citizen and vote in the system.

Btw ETH price doesn't matter, as we would be measuring in gas units, that is why I also feel this option as superior. It doesn't matter the status of the network or any price, clearing a user means you will always recover X amount of gas usage for a certain transaction. The only thing that can change it, is a hard fork (if the prices of storage operations change). That is why mainly I think we need to explore the manageable option. If storage becomes 20x more expensive, then the whole ping/clear function will be blocked as can't fit in a block with a cycle of 50.

gbalabasquer commented 4 years ago

I've made the gas staking manageable, this way if a hard fork is coming, which is significantly changing the gas cost of SSTORE, governance can adapt it before that happening. However if a person had already staked an amount and the value changes, then that same amount staked is used on burning his/her position. I'll proceed merging this PR today if there isn't any objection, anyway this functionality will kept being worked.