-
Notifications
You must be signed in to change notification settings - Fork 25
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
[BUG] - Inconsistency between MsgHasTx / MsgNextTx in the LocalTxMonitor #1009
Comments
Thanks for the excellent description!
Note that there already is a difference for Byron 😩 vs Shelley-based eras: Lines 149 to 154 in c1b7426
Line 160 in c1b7426
Note that Ideas:
|
Actually a |
I am not sure why this one feels too ad-hoc 😶 ? It seems like the right thing to do here. The whole wrapper around TxId is already quite arguable IMO. One other idea that could solve this particular problem (though wouldn't be a holistic solution overall since the same issue may occur with a different HFC-wrapped type), would be to alter the implementation of Fundamentally, there are only 2 cases to distinguish with this TxId as you are already pointing out: Byron, and the others. Starting from Shelley, all So one could think of a |
Just that it is unprincipled and later potentially surprising/confusing to rely on serialization for logic that is not directly related to serialization. In general, this case feels a bit similar to Lines 143 to 151 in c1b7426
Ideally, we would be able to do the same thing for |
What about making it only a 2-ary sum? Is that an option with the current type framework? Then at least the problem is less worse; we still don't get compatibility between Byron and post-Shelley eras, but it's arguably better than incompatibility across all eras. Plus, the inconvenience of not being able to compare a Byron transaction id with the rest is very likely not a big issue. |
Yeah, that should also be possible; in fact, something similar (replacing an |
I leave it you now and assume you'll update / close this ticket when resolved. For now, I'll implement a fallback in Ogmios to simply retry HasTx on |
The Consensus team discussed this last week:
|
Internal/ExternalSummary
The LocalTxMonitor protocol doesn't always respond appropriately to the
MsgHasTx
message. I've hunted down the issue and found that the root cause comes from the hard-fork combinator applied to theGenTxId
.Steps to reproduce
MsgHasTx
) using a TxId wrapped in any other era than the current one.False
MsgNextTx
) to confirm that the transaction is indeed in the snapshot.Here is a minimal reproduction example in Haskell (requires a serialized transaction to be passed as 1st argument)
This is what the script above yields for a valid transaction (with some comments for clarity)
Expected behavior
When the transaction is in the mempool,
MsgHasTx
should returnTrue
, regardless of the era in which theTxId
is being wrapped / submitted. We know it is in the mempool because it is returned in the nextMsgNextTx
call.I imagine that one might say: "But the transaction id isn't guaranteed to be equal and have compatible representation across eras!", yes. Sure. But in effect, it's been the case for ALL eras so far and given that the underlying type is the same and is era-independent, then the wrapping era we choose for
TxId
shouldn't matter.This is particularly annoying to deal with as it forces clients to keep track of the current era also in the mempool monitoring protocol (this is already sufficiently annoying with the local-state-query 😬 ...). This is problematic especially around hard forks.
Given that we look for the transaction id by looking at a membership in a set, a possible resolution path could be to derive the
Ord
instance (and while at it, theEq
too) on the inner type of theTxId
type instance, instead of the type itself (i.e.deriving newtype
). This way, it wouldn't matter where in the combinator is the underlying type, the equality/comparison will happen on the inner type which holds the era-independent transaction id.ouroboros-consensus/ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/HardFork/Combinator/Mempool.hs
Lines 251 to 254 in c1b7426
System info (please complete the following information):
Screenshots and attachments
ø
Additional context
ø
The text was updated successfully, but these errors were encountered: