-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Refactor events subsystem #7000
Conversation
e0ffe9f
to
ed83b8a
Compare
I'm happy to take a crack at this now if deemed necessary. |
ed83b8a
to
3ae06e3
Compare
} | ||
me.blockMsgCache.Add(tsb.Cid(), msgsI) | ||
for i, tsb := range ts.Cids() { | ||
msgs, err := me.cs.ChainGetBlockMessages(context.TODO(), tsb) |
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.
get message block by block. but in fact there are many messages not to be executed or duplicate. could use ChainGetMessagesInTipset here?
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.
That's a good point, but something for a followup patch. I'm replicating the current behavior here.
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.
Hm. Actually, I think this code is correct as-is. We want to know if a message was included in the tipset, even if it wasn't executed. That way we can check to see if the message successfully applied. Otherwise, we'll keep waiting for the message to show up even though it never will.
Any context here @magik6k?
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.
The ideal/intended behavior is:
- Repriced messages should be applied (otherwise repricing messages to get them unstuck will only make things worse)
- If a different message with the same nonce was executed after the desired confidence we should tell the api consumer about that.
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'm a bit out of my depth here. Does anything need to be changed?
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 think this is fine for now as it doesn't seem to change the current behavior
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.
First pass, this looks sane so far.
I'll have to do a second pass to focus on the details, as this is a rather complex patch.
bd3f313
to
aedba70
Compare
Codecov Report
@@ Coverage Diff @@
## master #7000 +/- ##
==========================================
- Coverage 39.05% 39.05% -0.01%
==========================================
Files 607 610 +3
Lines 64625 64716 +91
==========================================
+ Hits 25242 25274 +32
- Misses 35000 35044 +44
- Partials 4383 4398 +15
Continue to review full report at Codecov.
|
aedba70
to
4de7312
Compare
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.
Looks good, definitely better than the current code which definitely needs this cleanup.
The only thing which needs to be done here, other than resolving conflicts, is adding ChainGetPath
to lotus-gateway, otherwise we'll break lotus-lite.
(also some nits / notes on changed behavior, but I'm fine with those)
confidence: confidence, | ||
// Stash the tipset for future triggers. | ||
for _, handler := range tipsets { | ||
handler.ts = to |
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 will make the final call with a tipset that's potentially later than what the previous code would do (not AtOrAfter the specified height), but given how those tipsets are used, that's likely not an issue
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.
You sure about that? This will stash the first non-null tipset after the target height. If there's a reorg, we'll set this to nil then re-set it to the new tipset.
The reader can just re-subscribe when they're ready to catch up. This prevents a slow reader from bogging down the entire system.
This lets us always call check (accurately).
bb2ab3e
to
1cf556c
Compare
This builds on #6974.
Changes
Architecture
The architecture isn't significantly different from the current one.
The main problem with this architecture is that it's entirely synchronous (callbacks). I'd prefer to use channels, but that's a larger refactor and I assume there are assumptions being made about everything happening in lock-step.
Future
Future improvements:
StateChanged
TODO (before merge)
Improve test coverage (at least test the fixed bugs/edge cases).frob