-
Notifications
You must be signed in to change notification settings - Fork 111
Remove expiration buffer config and emit expiry events based on block timestamp #490
Conversation
5541352
to
783ac59
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.
Mostly looks good to me. Just suggested a few small changes.
core/core.go
Outdated
ChainID: config.EthereumChainID, | ||
MaxOrders: config.MaxOrdersInStorage, | ||
MaxExpirationTime: metadata.MaxExpirationTime, | ||
LatestBlockTimestamp: latestBlockTimestamp, |
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.
Does LatestBlockTimestamp
really need to be passed in as part of Config
on startup? It seems like:
- Unless there was a sudden unexpected shutdown, we will have already pruned any expired orders when the block watcher notified us of this block before Mesh was shutdown.
- The block watcher is going to notify us of the next latest block in a matter of seconds (or less) anyways.
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.
We could potentially miss a block re-org caused Unexpired
event emission since on restart the OrderWatcher would not know what the latestBlockTimestamp
was before the shutdown. It's an edge-case for sure, I just wanted to make sure the implementation was bullet proof. If you don't want to handle this edge-case, I can get rid of it.
…ric since it's used in multiple contexts
Co-Authored-By: Alex Browne <stephenalexbrowne@gmail.com>
…ect/0x-mesh into refactor/removeBufferRenameExpiry
…il to detect when it's not yet been set
…ion since the logic behaves correctly with it being set by the first event received
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.
Approved after CI passes.
Fixed: #419 and #418
This PR:
UNEXPIRED
order event type.