-
Notifications
You must be signed in to change notification settings - Fork 23
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
Change serialization of OneEraGenTxId
to treat it as though it's simply a ShortByteString
#1311
base: main
Are you sure you want to change the base?
Conversation
46a029e
to
e0cd631
Compare
what should happen in the case that the blessed
|
e0cd631
to
78c7730
Compare
What about picking an era that is supported by all Related: The next Network release (#1314) will have IntersectMBO/ouroboros-network#5002, such that we can remove all old |
78c7730
to
21b5d07
Compare
yeah, I saw the changes in network and kinda feel like this is irrelevant since we're dropping support for older |
I can't think of anything; everything that uses our code shouldn't care about this at all due to #1017; and I don't think that external services (like custom tx submission clients) do either. |
ouroboros-consensus-cardano/src/ouroboros-consensus-cardano/Ouroboros/Consensus/Cardano/Node.hs
Outdated
Show resolved
Hide resolved
...ros-consensus/Ouroboros/Consensus/HardFork/Combinator/Serialisation/SerialiseNodeToClient.hs
Outdated
Show resolved
Hide resolved
2e7dbb8
to
b340e48
Compare
added the |
…ted as a bytestring and is decoded into an arbitrary era
b340e48
to
d144054
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! (Sorry for not sending this review earlier, just noticed it while closing tabs)
I think it makes sense to also give a self-contained overview of what changes here for external implementations of mini-protocols involving tx ids, such that they can easily adapt to this change without having to read the code (ideally, we would have CDDL specs as tracked by #7, but we aren't there yet).
ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Ledger/SupportsMempool.hs
Outdated
Show resolved
Hide resolved
...oros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/HardFork/Combinator/AcrossEras.hs
Outdated
Show resolved
Hide resolved
...nsus/src/ouroboros-consensus/Ouroboros/Consensus/HardFork/Combinator/Serialisation/Common.hs
Outdated
Show resolved
Hide resolved
-- need to handle the cases where 'ShortByteString's are serialised with | ||
-- an era tag ('encodeNS'). | ||
|
||
encodeNodeToClient _cc v (HardForkGenTxId (OneEraGenTxId txid)) = |
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.
Can we share the NodeToClient and NodeToNode logic?
-- absolutely horrible. should be HasLatestStableGenTxIdEra probably. | ||
-- especially nasty because it's a K () rather than an equivalent (but | ||
-- non-existent) 'Void :: (Type -> Type) -> Type' | ||
class HasBlessedGenTxIdEra (xs :: [Type]) where | ||
blessedGenTxIdEra :: NS (K ()) xs |
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.
Just brainstorming an alternative: Instead of having a typeclass for this, we could also "hardcode" this choice in the serialization logic (e.g. sth like: "use the first index when xs
has length 1, otherwise, use the second index). The downside is that one can't customize this for a hypothetical different HardForkBlock
that would need to customize this, but that seems unlikely.
...oros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/HardFork/Combinator/Embed/Nary.hs
Outdated
Show resolved
Hide resolved
…ation for `HasBlessedGenTxIdEra`
Description
This PR changes the serialization of
OneEraGenTxId
so that it's serialized and deserialized as an era-independentShortByteString
rather than as an era-tag-prefixedShortByteString
. As part of this, I've had to make a breaking change to the representation ofTxId (GenTx ByronBlock)
, since there is now no way to identify which kind of Byron-era transaction ID we're deserializing –TxId
,CertificateId
,UpId
, orVoteId
– and these are all now represented simply inByronGenTxId
as aHash
.As this is a breaking change to the wire format, there's a new protocol version and a corresponding branch on
ouroboros-network
here: fraser-iohk/one-era-gen-tx-id-protocol-version-bump