-
Notifications
You must be signed in to change notification settings - Fork 116
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
Multisig example #1047
Multisig example #1047
Conversation
55260c2
to
cfd254a
Compare
eb5cbb3
to
9c2c3ab
Compare
Blocked by raw bytes return from |
9c2c3ab
to
20aca89
Compare
1eaa311
to
aa51f3e
Compare
293f691
to
762a248
Compare
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.
A "multisig" shouldn't just allow anyone and everyone to vote. The voters should be specified in advance
to, | ||
method, | ||
data, | ||
value, |
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.
What is value
?
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.
It's the amount of native tokens sent along with the execution.
I wanted to keep it simple, having some kind of value contribution will make it more complex since we need to handle the value amount (with a floor to ensure the account always has enough funds), and refunds if the execution fails.
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.
So the value is just passed by the actor who executes the proposal. It's probably a bit unfair, but it was a bit better than just passing 0.
Currently blocked by address passing #1121 |
36b8f2c
to
44c962b
Compare
c5dd019
to
000bce5
Compare
b5d2e22
to
be21b8f
Compare
be21b8f
to
6a07ba0
Compare
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.
overall this program is a really cool example 🚀!
One note: important to have thorough commenting on examples, since this is prob the first place devs will look. I would add helpful comments to things like public functions, statekeys, struct fields, etc...
|
||
#[state_keys] | ||
pub enum StateKeys { | ||
LastProposalId, |
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.
definitely not in this PR, but it seems redundant to store the LastProposalId
when it's effectively the length of Proposals(u64)
. Maybe we should expose a host function that gets the length/size of a statekey?
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.
(this key was renamed to NextProposalId
instead)
I'm not sure if we could have such a host function, the data may not be stored in a contiguous space of memory and it may be hard to have such an information. What we may want though is a Vec
library program (if we are able to write stateful libraries in the future) that stores this information. This is a good remark !
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.
The reason we might want this Vec
library is that storing a Vec
as a state key is going to make it costly to pull it from storage because we can only get the full vec.
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.
yea, a wayyyys back the initial thought was to have host functions that would reduce the amount of data pulled into WASM(stuff like getting values in a map, vec, etc...). we don't have host functions for maps anymore because of StateKeys
but vecs are a little different.
under the hood a Vecs
could be stored differently, and come with additional get functions like get_index
. Could also do something similar to solidity, and just handle them i differently under the hood in get/set methods.
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.
That's very interesting! I don't know if we really want this at the vm level though, it feels more like a program-level thing, the vm may not need to be aware of that, but I'm happy to try both !!
Co-authored-by: Richard Pringle <[email protected]> Signed-off-by: Franfran <[email protected]>
f3a0d8f
to
fa49279
Compare
get let's say), then it's going to read all bytes expected from the DeferDeserialize and will read all bytes of the subsequent fields too. Solutions:
It's a security issue if this |
943abcd
to
54c708c
Compare
superseded by #1581 |
Write a multisig example where someone can propose an arbitrary external call. People can then vote on this proposition. Once the quorum is reached, anyone can execute this external call.