-
Notifications
You must be signed in to change notification settings - Fork 33
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
Support for confirmations when listening to events #207
Conversation
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #207 +/- ##
==========================================
+ Coverage 97.24% 97.30% +0.05%
==========================================
Files 58 59 +1
Lines 6944 7246 +302
==========================================
+ Hits 6753 7051 +298
- Misses 146 148 +2
- Partials 45 47 +2
Continue to review full report at Codecov.
|
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Nicko Guyer <[email protected]>
Signed-off-by: Nicko Guyer <[email protected]>
Signed-off-by: Nicko Guyer <[email protected]>
Signed-off-by: Nicko Guyer <[email protected]>
Signed-off-by: Nicko Guyer <[email protected]>
Signed-off-by: Nicko Guyer <[email protected]>
c18c8c7
to
95526ad
Compare
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
… confirmations Signed-off-by: Peter Broadhurst <[email protected]>
@@ -1,3 +1,13 @@ | |||
{ | |||
"go.lintTool": "golangci-lint" | |||
"go.lintTool": "golangci-lint", | |||
"cSpell.words": [ |
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.
👍🏼
intConf.requiredConfirmations = *conf.RequiredConfirmations | ||
} | ||
if conf.BlockCacheSize != nil { | ||
intConf.blockCacheSize = *conf.BlockCacheSize |
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.
should we enforce a safe upper bound (no idea what that should be though!)?
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 guess we haven't elsewhere on these. I propose no is ok for now
event: event, | ||
eventStream: eventStream, | ||
} | ||
bcm.pending[eventKey] = pending |
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.
Not requesting as part of this PR given I'm providing this comment at the last minute, it would be good to have a follow on that wraps updates to bcm.pending
with a RWMutex - I'm assuming there's a high likelihood of concurrent updates.
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.
Agree a good candidate to look at in the future, and deferrable.
func (bcm *blockConfirmationManager) dispatchConfirmed(confirmed *pendingEvent) { | ||
eventKey := bcm.keyForEvent(confirmed.event) | ||
bcm.log.Infof("Confirmed with %d confirmations event=%s", len(confirmed.confirmations), eventKey) | ||
delete(bcm.pending, eventKey) |
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.
Wouldn't we have already removed the key from bcm.pending
since we moved this event from bcm.pending
to confirmed
?
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.
Agreed re-reading the code
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
BlockConfirmationManager
(BCM) componentconfirmations
configuration sub-section section inopenapi
LogProcessor
and theEventStream
removed
eventsblockedReryDelaySec
config typo toblockedRetryDelaySec
hexFormatTransactionIndex
option that can be set tofalse
to disable the current behavior wheretransactionIndex
is delivered as0x01
etc. whereasblockNumber
/logIndex
are delivered as the string"1"