-
Notifications
You must be signed in to change notification settings - Fork 71
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
Slot Key Verification #121
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solid! Just a couple of nitpicks here and there.
One thing I would like to change though is naming! I think we need to come up with better naming, as I had a tough time differentiating global_params
vs global_params_all
etc etc.
To make sure I have a good understanding, what we have now is:
voting_strategy_params
: user-defined array of dataglobal_params
: voting strategy specific array, recorded in theglobal_voting_strategy_params
storage varglobal_params_all
andvoting_strategy_params_all
: a 2d immutable array consisting of all the differentglobal_params
. (voting_strategy_params_all
is used inget_cumulative_voting_power
andglobal_params_all
inregister_global_voting_strategy_params
)
Is that correct?
yeah this is what i used. i used |
What would you think about remove
And maybe keeping the same naming for space / voting_strategies context, as it makes it easier to navigate the code and not get lost. Not sure about this last one, just my thoughts :) |
I think its important we have yeah hmmmm i see your point. Although to me, yep i can keep same names with the space/voting strategy context. I think all of these ambiguities will be solved if we have a good natspec standard frankly |
we could do |
yes! There are three different variables though: the
The only issue I see is that it's hard to differentiate... or we could also do
? wdyt? |
why not just |
I haven't seen this "standard" but i think it would be an excellent idea indeed. Should it be |
I know I'm being a little "picky" here, but I do think that we need to be careful about those as we will probably be setting the standard for the rest of the codebase and the future, and naming is an important and difficult task :p After all, as Phil Karlton said, There are only two hard things in Computer Science: cache invalidation and naming things. ! |
cool lets do that then, |
completely agree, crucial we get this space contract right. |
think all the fixes are in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💪
# NOTE: We need to think carefully about how to handle the case where a voting strategy is removed. | ||
# Do we also need to remove the voting strategy params? Currently we are not. | ||
# Setting the voting strategy to 0 will remove it from the store, but what happens if someone re-adds the strategy but with different params? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw I think we should indeed remove the associated voting strategy params :)
Added slot key verification to the single slot strategy so that users can only submit proofs for the correct slots.
To do this I had to add another parameter called
global_voting_strategy_params
which is an array stored for each voting strategy set in the space.global_voting_strategy_params
has broader use case: it is fully general purpose and can be used to customize any voting strategy defined with specific parameters.For single slot proof,
global_voting_stategy_params
is structured as follows:global_voting_stategy_params[0]
= contract address where storage is read from. (eg ERC20 token contract address)global_voting_stategy_params[1]
= slot index of the mapping where storage is being read from.Also added a new data structure called
Immutable2DArray
which is used to holdglobal_voting_strategy_params
andvoting_strategy_params
for all strategies (array of arrays type structure)