-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat: added vote collector, refactored broadcast #36
Conversation
Please check |
…ain/greenfield-challenger into feat/refactor-collector-broadcast
submitter/tx_submitter.go
Outdated
@@ -34,119 +36,108 @@ func NewTxSubmitter(cfg *config.Config, executor *executor.Executor, daoManager | |||
} | |||
|
|||
func (s *TxSubmitter) SubmitTransactionLoop() { | |||
s.cachedEventHash = make(map[uint64][]byte, math.MaxInt) | |||
submitAttempt := 0 |
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.
As we discussed, the logic will change a bit after the in-turn challenger on chain.
"strings" | ||
"sync" | ||
"time" | ||
|
||
"github.com/panjf2000/ants/v2" |
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.
There are some TODO: revert
in this file. Could you check and fix them?
vote/data_provider.go
Outdated
func (h *DataHandler) FetchEventsForSelfVote() ([]*model.Event, error) { | ||
events, err := h.daoManager.GetEarliestEventsByStatusAndAfter(model.Verified, batchSize, h.lastIdForSelfVote) | ||
func (h *DataHandler) FetchEventsForSelfVote(currentHeight uint64) ([]*model.Event, error) { | ||
// TODO: Revert this |
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.
Please check this.
voteBroadcaster: voteBroadcaster, | ||
voteCollator: voteCollator, | ||
txSubmitter: txSubmitter, | ||
dbWiper: dbWiper, |
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.
Do we need wiper? Sometimes we need to review or query historical data. We may not need it now.
12e33b0
to
f819cd7
Compare
f819cd7
to
6205763
Compare
Description
added a vote collector that queries the blockchain for votes using eventhash and stores them for 2/3 consensus.
refactored broadcast to collate votes using eventhash instead of challengeid, broadcast votes periodically until expired height
refactored broadcaster, collator, submitter to use for loop instead of goroutine to solve performance issues
refactored workflow for collector, broadcaster, collator, submitter
added db wiper to periodically clear db
Rationale
services could not sync their votes to submit a msgattest
Example
none
Changes
Notable changes:
vote collector
vote broadcast
models, dao
data providers