-
Notifications
You must be signed in to change notification settings - Fork 33
Change serialization of OneEraGenTxId to treat it as though it's simply a ShortByteString
#1311
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
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
Show resolved
Hide resolved
...ros-consensus/Ouroboros/Consensus/HardFork/Combinator/Serialisation/SerialiseNodeToClient.hs
Outdated
Show resolved
Hide resolved
2e7dbb8 to
b340e48
Compare
|
added the |
b340e48 to
d144054
Compare
amesgen
left a comment
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
2e5d4d8 to
6b0701b
Compare
6b0701b to
9089409
Compare
9089409 to
146f924
Compare
146f924 to
8ffa243
Compare
…ted as a bytestring and is decoded into an arbitrary era
use PatternSynonyms rather than coerces for ByronDlgId / ByronUpdate*Id
use Shelley for blessedGenTxIdDecodeEra for CardanoShelleyEras
OneEraGenTxId { NS WrapGenTxId xs -> ShortByteString }
use CardanoNodeToClientVersion15 instead of creating a new version
move GenTxId to its own section and describe why it's not an NS of GenTxId
8ffa243 to
a3a4d2d
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.
(There still are a few unaddressed comments from the last review.)
In particular, once we have a self-contained overview of the change as mentioned above, we might want to ping people in the node diversity channel on Discord to give them a heads up and gather feedback, as any tool implementing LocalTxSubmission or TxSubmission2 will have to adapt to this serialization simplification.
Eg maybe this would be an opportunity to contribute to https://cardano-scaling.github.io/cardano-blueprint/mempool/txsubmission2.html cc @ch1bo
| source-repository-package | ||
| type: git | ||
| location: https://github.com/IntersectMBO/plutus | ||
| tag: be9ccfc7f8ecc6ebc577dcf3374a30530ecdb168 | ||
| --sha256: sha256-R7t5Luc1d9l2tXKg5Jgqye+vQAEONwCrQ9/JDkFCu9M= | ||
| subdir: | ||
| plutus-core | ||
| plutus-ledger-api | ||
| plutus-tx |
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.
Why do we need this?
Description
This PR changes the serialization of
OneEraGenTxIdso that it's serialized and deserialized as an era-independentShortByteStringrather 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 inByronGenTxIdas aHash.As this is a breaking change to the wire format, there's a new protocol version and a corresponding branch on
ouroboros-networkhere: fraser-iohk/one-era-gen-tx-id-protocol-version-bump