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

Add candidate events #2754

Merged
merged 9 commits into from
May 26, 2022
Merged

Add candidate events #2754

merged 9 commits into from
May 26, 2022

Conversation

shargon
Copy link
Member

@shargon shargon commented May 23, 2022

Close #2752

@shargon shargon requested a review from erikzhang May 23, 2022 18:51
},
new ContractEventDescriptor
{
Name = "CandidateUnregistered",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge it with CandidateRegistered? Maybe CandidateStateChanged or something.

Copy link
Contributor

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 and Deploy instead of ContractStateChanged with a New/Updated/Destroyed parameter.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have Register and Unregister, then we need Vote and Unvote.

Copy link
Contributor

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 or Mint either. We just have Transfer with a Null to or from respectively. It's not like everything needs to be (or even is) symmetrical in the system.

Copy link
Member

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.🤭

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unify is always good

Copy link
Contributor

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.

Then I prefer to merge Register and Unregister.🤭

I was trying to point out that vote could work similar to the transfer event. How about we vote for it

🎉 for all explicit (CandidateRegistered, CandidateUnregistered, Vote, Unvote)
❤️ for implicit (CandidateStateChanged with extra param for Registered/Unregistered state, vote with no extra parameter and the consumer parses the to field to determine if it is a vote or unvote)

Copy link
Contributor

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 one vote method and a pair of registerCandidate/unregisterCandidate. At the same time a pair of methods doesn't mean we need to have a pair of events.

Copy link
Contributor

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 single vote, pretty much how it was PR'ed. But Erik seems to want all explicit or all implicit hence the 2 choices above 🤷‍♂️

@roman-khimov
Copy link
Contributor

Just as a side note --- how about committee change events? Committee is a very powerful entity in the system and monitoring changes there can be important. We can emit notifications only when something changes there to optimize the number of events.

@erikzhang
Copy link
Member

how about committee change events?

If we decide to add it, it's better to put it in a separate pr.

@erikzhang erikzhang merged commit 26a5a7d into master May 26, 2022
@erikzhang erikzhang deleted the candidate-events branch May 26, 2022 22:47
roman-khimov added a commit to nspcc-dev/neo-go that referenced this pull request May 27, 2022
roman-khimov added a commit to nspcc-dev/neo-go that referenced this pull request May 28, 2022
ixje added a commit to CityOfZion/neo-mamba that referenced this pull request Jul 5, 2022
ixje added a commit to CityOfZion/neo-mamba that referenced this pull request Jul 5, 2022
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

Successfully merging this pull request may close these issues.

Add vote related notifications
4 participants