ouroboros-consensus icon indicating copy to clipboard operation
ouroboros-consensus copied to clipboard

Change serialization of `OneEraGenTxId` to treat it as though it's simply a `ShortByteString`

Open fraser-iohk opened this issue 1 year ago • 5 comments

Description

This PR changes the serialization of OneEraGenTxId so that it's serialized and deserialized as an era-independent ShortByteString rather than as an era-tag-prefixed ShortByteString. As part of this, I've had to make a breaking change to the representation of TxId (GenTx ByronBlock), since there is now no way to identify which kind of Byron-era transaction ID we're deserializing – TxId, CertificateId, UpId, or VoteId – and these are all now represented simply in ByronGenTxId as a Hash.

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

fraser-iohk avatar Nov 19 '24 13:11 fraser-iohk

what should happen in the case that the blessed GenTxId era is disabled in the config? should we pick another era arbitrarily? should there be a way to order fallbacks?

          *** Failed! Falsified (after 15 tests):
          WithVersion (HardForkNodeToClientEnabled HardForkSpecificNodeToClientVersion4 (EraNodeToClientEnabled ByronNodeToClientVersion1 :* EraNodeToClientEnabled ShelleyNodeToClientVersion6 :* EraNodeToClientEnabled ShelleyNodeToClientVersion9 :* EraNodeToClientEnabled ShelleyNodeToClientVersion1 :* EraNodeToClientEnabled ShelleyNodeToClientVersion5 :* EraNodeToClientDisabled :* EraNodeToClientEnabled ShelleyNodeToClientVersion5 :* Nil)) (HardForkGenTxId {getHardForkGenTxId = S (S (S (Z (WrapGenTxId {unwrapGenTxId = txid: TxId {unTxId = SafeHash "fb4ea1312616d1a61645991aa8012a3aca2178e121759fb833177201080c5673"}}))))})
          DeserialiseFailure 0 "HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = \"Babbage\"})"
          When deserialising 5820fb4ea1312616d1a61645991aa8012a3aca2178e121759fb833177201080c5673
          Use --quickcheck-replay="(SMGen 1921722396195416107 8896093690400693515,14)" to reproduce.
          Use -p '/Roundtrip.SerialiseNodeToClient.roundtrip GenTxId/' to rerun this test only.

fraser-iohk avatar Nov 21 '24 01:11 fraser-iohk

what should happen in the case that the blessed GenTxId era is disabled in the config? should we pick another era arbitrarily? should there be a way to order fallbacks?

What about picking an era that is supported by all CardanoNodeToXVersions, eg Shelley should work I think?

Related: The next Network release (#1314) will have https://github.com/IntersectMBO/ouroboros-network/pull/5002, such that we can remove all old CardanoNodeToClientVersions that do not support all currently known eras.

amesgen avatar Nov 21 '24 10:11 amesgen

yeah, I saw the changes in network and kinda feel like this is irrelevant since we're dropping support for older NodeToClientVersions. does picking Shelley have any other risks that would be relevant? I did think about messing with the Arbitrary instances to always pick a sensible era instead

fraser-iohk avatar Nov 21 '24 10:11 fraser-iohk

does picking Shelley have any other risks that would be relevant?

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.

amesgen avatar Nov 21 '24 16:11 amesgen

added the no changelog label for -diffusion, whose only change is a new instance for HasBlessedGenTxIdEra

fraser-iohk avatar Dec 03 '24 12:12 fraser-iohk