Skip to content
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

Consider updating design of ProposalVotes struct #34

Open
mialbu opened this issue May 31, 2022 · 0 comments
Open

Consider updating design of ProposalVotes struct #34

mialbu opened this issue May 31, 2022 · 0 comments

Comments

@mialbu
Copy link
Member

mialbu commented May 31, 2022

When multiple members vote at the same time, transactions can lead to have an insufficient system fee. This is due to the increased size of the ProposalVotes struct, that is deserialised in the method vote(). More precisely, the map voters is increasing whenever a member votes, which eventually increases the system fee for the next voters. In case two or more members create a transaction (i.e., including the required system fee) at the same time, the transaction that is processed later might fail due to a system fee that is too low.

Suggestion

Remove the map voters from the struct ProposalVotes and create storage entries for each member that is structured the following way:

Prefix: The script hash of the member
Key: The proposal id
Value: The member's vote for that proposal

Additionally, a new method could iterate through all members, create a map with their hash and their votes to provide information about what member voted how for a proposal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant