-
Notifications
You must be signed in to change notification settings - Fork 12
Conversation
Here, I'm using three really handy OpenZeppelin contracts:
|
/// @notice Equally share all tokens from some ERC-20 contract | ||
/// amongst all validators in the quorum. | ||
/// @param _token The token contract | ||
function shareERC20Tokens(IERC20 _token) external { |
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.
I know that we have a limited set of validators, but I'm still not comfortable pushing transfers like this in a for loop.
Maybe we can use the payment splitter from Open Zeppelin.
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.
True, I will take a look into that. Thanks!
|
||
// If this claim already has half of the quorum's approval, | ||
// then we can submit it to the history contract. | ||
if (numOfVotesInFavour > quorumSize / 2) { |
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.
I think this should be a parameter instead of a majority.
Also, should not be x/2 + 1
? If there are three validators and we want the majority it results in a 1 of 3
.
What happens when the quorum was reached and another validator publish the claim? Is there a risk of trying to add multiple times to history?
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.
if quorumSize
is 3 you need 2, division is integer, right? And it's >
, not >=
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 is true. I misread as >=
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.
Actually, if we change to ==
we solve the problem of including multiple times to the history. It would only add to History when the second validator (in this 2 of 3 example) post and ignore future validators.
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 current implementation of History
prevents its owner from claiming the same data twice. :-)
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.
But I see what you mean. Maybe we should change this to numOfVotesInFavour == 1 + quorumSize / 2
?
I think the tricky part is that there is no coordination between the multiple nodes. They will submit claims at the exact same time. What would happen in that case? Imagine the "same" transaction, coming from multiple nodes, in the same block. Would it work? |
7be0b31
to
4e5a38c
Compare
Rebased and applied @pedroargento suggestion to use |
4e5a38c
to
74f0749
Compare
74f0749
to
d055d7b
Compare
Applied @pedroargento's suggestion of using |
Doesn't it make sense to make the number of necessary votes a parameter? Maybe one DApp wants to have a super majority or wants to accept only 2 signatures even with a lot of possible validators. |
If we see a demand for such fine-grained configuration, sure. |
Great point. What will happen now that I've changed |
By using |
Yes, the |
I think we can optimize the codes a bit:
, we can simplify it to
Furthermore, if we want to optimize further. We can use a |
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.
Good code work!
Here are my thoughts:
We trying to define here is a multi-signature consensus model so on the definition of the members of the signature validator
is a bit inaccurate as members (or just a shared/distributed key) may not be validating the the claim and just signing. We could rename it to MEMBER_ROLE
or SIGNER_ROLE
.
I also remember that someone mentioned that Quorum can bring confusion to what this consensus model is really doing, and maybe the discussion can be retaken here. We can consider simplifying the name of this model to multisig or similar.
@xdaniortega Thanks for the feedback! |
This PR has been migrated to cartesi/rollups-contracts#49. |
Closes cartesi/rollups-contracts#48