Reward Pruning - Solving Shade Staking + LP Rewards Gas Bugs

Greetings community,

One of the consistent ongoing problems of Secret Network is that due to privacy it is difficult to predict the amount of gas needed for a tx. The front end for Shade Protocol essentially needs to “guess” the amount of gas to suggest to a user. For transaction where the cost never changes, this works just fine. But for certain functions (such as staking or LP staking) where new reward campaigns are appended every 7-14 days, eventually the front-end will be “wrong”, forcing users to custom increase their gas via the wallet pop-up until they enter in an appropriate amount of gas OR the dev team needs to update the “guess” that the front-end suggests to users.

The long term solution to this is ensuring the different reward smart contracts are designed to be scalable and have gas costs from appended arrays increase slowly. We will aspire to improve these overtime.

In the interim, we are aiming to engage in what we call “Reward Pruning” - the process by which we would shrink the array of reward campaigns iterated across (this is what increases the gas costs for unstaking or claiming rewards) to a steady state every week, permanently removing the gas problems users are seeing.

How would this work? The ShadeDAO would start by pruning/deleting all reward campaigns tied to 2023. And then, as we enter into 2025, every time a new reward campaign is started/appended to the existing array, a corresponding reward campaign would be deleted from 2024 - ensuring the size of the array of reward campaigns stay stable.

In this set up, users will want to make sure they claim rewards at least once every year. If they do not, they will end up forfeiting the rewards (slowly but surely) to reward pruning.

While we believe this is not as elegant as a long term smart contract solution, the ShadeDAO can immediately act on this solution and begin to solve gas UX problems on the Shade app asap.

We look forward to your feedback,

Thanks,
Carter Woetzel (Shade Protocol Contributor)

1 Like