-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gas reductions #1101
Gas reductions #1101
Conversation
@area some initial directions above |
After looking through |
Notes on
|
@area what do you think of my moving forward with the |
When we originally talked about looking at gas optimisations, I thought we agreed we'd be looking at no function changes? Either way, as ever, this type of change has to go through product.
I like this one. Increases the cost for the first objection, but for 'good' motions, reduces the cost, which is probably what we want to optimise. This might affect the frontend, though, so we'd need to check with them that it's okay.
I think it's important that people are able to change their votes, otherwise they're incentivised to wait until the last minute to vote in case any new information comes to light (which then nullifies the benefits of the 'fast forward' functionality).
I don't really understand what you're proposing here, so you're going to have to go in to a lot more detail for me to give feedback on this one (I suspect on a call). |
7462c44
to
72e6cc0
Compare
Noting that the optimization regarding not setting submit & reveal times has reduced the cost for creating a motion by 5000 gas, but increased the average cost of staking by 1500 gas (probably because the variables are set for the first time, rather than being updated). |
e5ee7ef
to
c1c8ac4
Compare
Is this cost of staking only for motions that get objected to? |
@arrenv question: how important is it that users be able to configure both the length of time for submitting votes, and for revealing votes, as separate values? One proposed gas optimization is collapsing them into a single value (e.g. 48-hours for each period, rather than allowing 48-hours to submit votes and 24-hours to reveal votes, or something like that). Would that be an acceptable optimization? |
Is it a one time gas saving, or ongoing for each Motion? |
@arrenv ongoing, as we would have to update only one storage slot, not two, as the motion moves through the lifecycle. That said, it wouldn't improve every transaction (e.g. it wont affect most vote submission/reveal transactions), but it would affect a handful. |
In my opinion, I don't see a big implication in merging them from a user and governance standpoint, it would make the options slightly simpler when setting it up and as a user understanding the configuration. However, how would this affect previous Colonies that already have it as it is currently. The UI would need to be able to handle both cases depending on the version, right? |
2a23586
to
3c966e1
Compare
@rdig in this PR we are proposing to skip some of the lifecycle timestamp updates, until they are strictly necessary. @area wanted to to ask if you were using these timestamps earlier in the flow, and if so whether the change would affect the front-end. Specifically, would it affect the front-end if we didn't set the |
Yes, it will impact the frontend somewhat but I can't recall to what extent as it was a long time ago that we've implemented that. At any rate, if this change is needed / wanted for the contracts, we'll accommodate it in the front-end, especially now since we're in "rebuild" mode |
Noting that @area is asking whether this would introduce upgrade issues to colonies who already have this extension installed |
After a call with Raul there are no issues with the frontend and this change. |
Reviewing the code, I do not see any upgrade issues with this change. Currently, |
b7ef4e2
to
ad7a155
Compare
I think we are ready to merge |
Where did we end up here? |
@area the higher cost comes during the objection, since when the objection stakes we phase into voting and must set the submit and reveal timestamps. The initial affirmative stake does not have a higher gas cost. We essentially defer the initial variable setting to the objection stake, and avoid the intermediate (and redundant) updates entirely. |
Gas cost data
Looking at these data, and considering current patterns of app usage, I would say that the following functions would most benefit from gas optimization:
OneTxPayment.makePayment
VotingReputation.stakeMotion
VotingReputation.claimReward
VotingReputation.revealVote
VotingReputation.submitVote
After analysis, the biggest change here comes from removing the setting of
SUBMIT_END
andREVEAL_END
timestamps inVotingReputation
prior to the stakes being set. Previously, they had been redundantly set twice.