Proposal Name: Reward request for staking contract gas optimizations contribution
Proposal Category: Aip, Voting, Treasury
- The gas optimization contribution that has taken place continues to serve and save users a significant amount of funds for gas fees on a daily basis, so far as of 4th February, it has saved 80+ETH (which is 5.5% of the 3 years staking period) and expected to save a total of 1450ETH+ in the total 3 years staking period, please refer to the Dune dashboard.
- This proposal aims to review the proposed reward for AIP 161 , the feedback from the community was eye opening and insightful to shape the current proposal.
- In summary, back when the staking contract was being audited through AIP34, I found multiple gas optimizations findings, which were shared with Immunefi and classified as out of scope, since they are only concerned about security findings. thereafter, due to the time scarcity to form an AIP and wait for it to pass to implement the gas optimizations and the mainnet launch was in the following 2-3 weeks. I decided to get it implemented by reaching out to Horizen Labs. which they were happy about the findings and implemented the findings at the last moments.
- This proposal will set an example and a motivation for open source contributors to contribute to the DAO and obey by one of the main DAO’s guiding values:
“Collective Responsibility: We leave everything better than we found it.”
- Codeislight is a smart contract developer and a warden at Code4Arena. I joined the web3 space in 2021 and have always been intrigued by complex decentralized systems and eager to learn, grow, and contribute in the field.
- Lately, I have started to make open-source contributions and had the opportunity to come across the ApeCoin staking contract and contributed to make it much more optimized.
- The contribution that has been done has the best interest of the community at heart, and it is significantly saving on the cost to use the staking contract.
- Rewarding open source contribution that benefits the DAO community, attracts and incentivize others to add value to ApeCoin and result in a net positive for the DAO.
- Gas optimizations is an overall underestimated part of smart contracts, since it doesn’t impact the functionality or the security. The end user is the one that pays the price in extra unnecessary fees.
- A recap from last proposal, I had profiled the gas saving difference percentage between the unoptimized and optimized staking contract, it resulted in the following metrics:
- The percentages were used in a dune dashboard to calculate:
- the saved amount of fees so far.
- the expected to be saved in 3 years based on the saved amount so far.
- Based on the dune dashboard as of 4th February 2023:
- it has already saved 80+ ETH in gas fees.
- expected to save 1,450+ ETH in the total staking period of 3 years.
- Reflecting on AIP 161 feedbacks, the community overall feels that:
- The requested reward is excessive, that’s where this proposal will reduce the reward and explicitly specify the amount in the DAO’s native token $APE.
- Others feels that it’s Horizen Labs responsibility to compensate and not the DAO, I have reached out to Dean - Horizen Labs CEO for comment. He responded with the following “You asked me to fwd your code along to our engineers. I did that. I have made no commitment beyond that.”, so they are considering that they were just a platform to aggregate the open source contribution and not willing to offer any compensation. Instead, I should propose it to the DAO.
- The contribution goals have proved a full alignment with the DAO’s guiding values:
- Boldness: We don’t shy away from the weird, the hard, or the new.
- Equality: One APE equals one APE.
- Transparency: Processes and decisions are shared openly with the community.
- Collective Responsibility: We leave everything better than we found it.
- Persistence: Success is an ouroboros, not a straight line.
- So far the impact that it has made on saving users funds was great to observe, either way this proposal go, i am grateful for the opportunity to experience how is like to contribute to a DAO and very glad to meet many awesome and kind-hearted members that were very supportive from the early phase, when I had a hard time to reach out to Horizen Labs to share my findings.
- In gas profiling, hardhat-gas-reporter was used along with Hardhat unit testing setup to offer the right environment to profile the gas differences and reduction percentages on every function that the end users can use to deposit, claim and withdraw on all the 4 pools.
- Dune platform was used to quantify the gas saved based on the percentages from the gas profiling table. It made it easy to determine based on the LIVE data on-chain the saved gas fees on each function separately and calculate the expected funds to be saved in 3 years.
Steps to Implement
- Once this proposal pass, a 6000 APE$ can be rewarded to codeislight.eth
- 6000 APE$