-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add candidate events #2754
Merged
Merged
Add candidate events #2754
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9eef2ca
Add events
shargon f040db1
Unify
shargon 703d704
Distribute gas after notification
erikzhang a80fa80
Erik's feedback
shargon de0412e
Optimize without neo
shargon 744a1d7
Update src/neo/SmartContract/Native/NeoToken.cs
shargon 23f55c5
Merge branch 'master' into candidate-events
shargon 08c8605
Fix UT
erikzhang f495f20
Merge branch 'master' into candidate-events
erikzhang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Merge it with
CandidateRegistered
? MaybeCandidateStateChanged
or something.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.
Explicit events seems to match closer to existing events in the system. For example; we have
Update
,Destroy
andDeploy
instead ofContractStateChanged
with aNew
/Updated
/Destroyed
parameter.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 we have
Register
andUnregister
, then we needVote
andUnvote
.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'd be totally fine with that too. However, we do not have
Burn
orMint
either. We just haveTransfer
with aNull
to
orfrom
respectively. It's not like everything needs to be (or even is) symmetrical in the system.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.
Then I prefer to merge Register and Unregister.🤭
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.
Unify is always good
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.
Unifying just makes post processing "harder" where explicit you can
switch
on the event name.I was trying to point out that
vote
could work similar to thetransfer
event. How about we vote for it🎉 for all explicit (CandidateRegistered, CandidateUnregistered, Vote, Unvote)
❤️ for implicit (
CandidateStateChanged
with extra param forRegistered
/Unregistered
state,vote
with no extra parameter and the consumer parses theto
field to determine if it is avote
orunvote
)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'd definitely like to see one
Vote
event. But for some reason I also like two events for candidate registration/unregistration. Go figure. Maybe that's because we have onevote
method and a pair ofregisterCandidate
/unregisterCandidate
. At the same time a pair of methods doesn't mean we need to have a pair of events.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.
My first choice would have been
registerCandidate
/unregisterCandidate
and a singlevote
, pretty much how it was PR'ed. But Erik seems to want all explicit or all implicit hence the 2 choices above 🤷♂️