-
Notifications
You must be signed in to change notification settings - Fork 16
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
vochain: refactor vote transaction check #864
Conversation
1. Reuse code and improve readability. Remove duplicates. 2. Add comments. 3. Fix issue with maxCensusSize and maxVoteOverwrite If a process already reached maxCensusSize, it should not discard votes that are doing an overwrite. 4. Use VoterID type instead of pubkey/address directly. So the pubkey/address primitives are now abstracted. Signed-off-by: p4u <pau@dabax.net>
d3ea4e7
to
aa0b0ef
Compare
@@ -14,25 +14,35 @@ import ( | |||
|
|||
// VoteTxCheck performs basic checks on a vote transaction. | |||
func (t *TransactionHandler) VoteTxCheck(vtx *vochaintx.VochainTx, forCommit bool) (*vstate.Vote, error) { |
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 is the method where I'd need review. It is a very crucial part of the system and the logic should be double-checked. @mvdan @altergui @lucasmenendez @jordipainan
Most of the functions we use from ethereum cryptography, are defined in the crypt/ethereum package. For coherency and better abstraction, we might use always the new type ethereum.Address{} instead of common.Address{} (from go-ethereum). Ideally the only package that would import the ethereum common and other go-ethereum packages would be crypto/ethereum, while the others relay on the types and primitives defined within crypto/ethereum. This approach would also bring better flexibility for changing the address schema to a new one. This commit is only part of the work. Signed-off-by: p4u <pau@dabax.net>
884099c
to
511cd31
Compare
LGTM, i didn't do my review in time, sorry about that, but here's a small (late) contribution: what testsuite covers of VoteTxCheck (i.e. tested on each CI run). the only significant omission is "// if vote exists, check if it has reached the max overwrite count" this is not covered. but it's precisely what Maria is working on. |
see commit messages