-
Notifications
You must be signed in to change notification settings - Fork 158
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
fix alonzo block serialization #2274
Conversation
Additionally, clean up the arbitrary Block instance to work in Alonzo.
60f0cbd
to
3dba118
Compare
@@ -214,6 +214,7 @@ instance CC.Crypto c => EraModule.SupportsSegWit (AlonzoEra c) where | |||
fromTxSeq = Alonzo.txSeqTxns | |||
toTxSeq = Alonzo.TxSeq | |||
hashTxSeq = Alonzo.hashTxSeq | |||
numSegComponents = 3 |
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.
Would it not be easier to have this return the total number of segregated components, rather than just the "non-body" ones?
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.
I think it would. I wasn't sure if that was breaking the abstraction, though (ie why should SupportsSegWit
know about block size). but maybe that's silly.
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.
oh wait, you mean to not include the block header. yea, that's better!
alignedValidFlags' prev n (x : xs) = | ||
Seq.replicate (x - prev - 1) (IsValidating True) | ||
Seq.>< IsValidating False | ||
Seq.<| alignedValidFlags' x (n - (x - prev)) 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.
Urgh, yes, good catch.
I added a method to the SupportsSegWit class to return the number of non-body segments. This is used in the Block serialization to enforce the number of items in a Block.
3dba118
to
8409011
Compare
This commit hash matches and the sources.json content matches-or-exceeds that of the first cardano-ledger-specs commit that provides everything we require for our initial Alonzo integration (ie no serialization tests, but a Mary-to-Alonzo HF ThreadNet test). We needed to introduce the `Coherent` QuickCheck modifier because PR IntersectMBO/cardano-ledger#2274 loosened the `Arbitrary` instance for Shelley blocks. We have a few tests that assumed the arbitrary blocks would pass "integrity" checks and that the header's claim for the block body's size was mostly correct. The follow-up IntersectMBO/cardano-ledger#2280 re-introduced the generator for coherent header-body pairs, and the new `Coherent` modifier lets us select that for the requisite properties.
This commit hash matches and the sources.json content matches-or-exceeds that of the first cardano-ledger-specs commit that provides everything we require for our initial Alonzo integration (ie no serialization tests, but a Mary-to-Alonzo HF ThreadNet test). We needed to introduce the `Coherent` QuickCheck modifier because PR IntersectMBO/cardano-ledger#2274 loosened the `Arbitrary` instance for Shelley blocks. We have a few tests that assumed the arbitrary blocks would pass "integrity" checks and that the header's claim for the block body's size was mostly correct. The follow-up IntersectMBO/cardano-ledger#2280 re-introduced the generator for coherent header-body pairs, and the new `Coherent` modifier lets us select that for the requisite properties.
This commit hash matches and the sources.json content matches-or-exceeds that of the first cardano-ledger-specs commit that provides everything we require for our initial Alonzo integration (ie no serialization tests, but a Mary-to-Alonzo HF ThreadNet test). We needed to introduce the `Coherent` QuickCheck modifier because PR IntersectMBO/cardano-ledger#2274 loosened the `Arbitrary` instance for Shelley blocks. We have a few tests that assumed the arbitrary blocks would pass "integrity" checks and that the header's claim for the block body's size was mostly correct. The follow-up IntersectMBO/cardano-ledger#2280 re-introduced the generator for coherent header-body pairs, and the new `Coherent` modifier lets us select that for the requisite properties.
This commit hash matches and the sources.json content matches-or-exceeds that of the first cardano-ledger-specs commit that provides everything we require for our initial Alonzo integration (ie no serialization tests, but a Mary-to-Alonzo HF ThreadNet test). We needed to introduce the `Coherent` QuickCheck modifier because PR IntersectMBO/cardano-ledger#2274 loosened the `Arbitrary` instance for Shelley blocks. We have a few tests that assumed the arbitrary blocks would pass "integrity" checks and that the header's claim for the block body's size was mostly correct. The follow-up IntersectMBO/cardano-ledger#2280 re-introduced the generator for coherent header-body pairs, and the new `Coherent` modifier lets us select that for the requisite properties.
This commit hash matches and the sources.json content matches-or-exceeds that of the first cardano-ledger-specs commit that provides everything we require for our initial Alonzo integration (ie no serialization tests, but a Mary-to-Alonzo HF ThreadNet test). We needed to introduce the `Coherent` QuickCheck modifier because PR IntersectMBO/cardano-ledger#2274 loosened the `Arbitrary` instance for Shelley blocks. We have a few tests that assumed the arbitrary blocks would pass "integrity" checks and that the header's claim for the block body's size was mostly correct. The follow-up IntersectMBO/cardano-ledger#2280 re-introduced the generator for coherent header-body pairs, and the new `Coherent` modifier lets us select that for the requisite properties.
The Alonzo blocks now pass the roundtrip serialization tests. I had to:
PreAlonzo
constraint from the block generator. (Now that I have looked at that generator in detail, I see more cleanup that I want to do, but I will do that in a follow up PR. generators for serialization should be much more "white noise" than what we have).SupportsSegWit
class to return the number of non-body segments. This is used in the Block serialization to enforce the number of items in a Block.alignedValidFlags
function that is used in AlonzoTxSeq
decoding. It is supposed to be the moral dual ofnonValidatingIndices
, but the recursive step was not taking into account the index of the lastFalse
that it had seen.