Skip to content
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

Test that consensus emits valid CBOR #479

Merged
merged 2 commits into from
Nov 13, 2023

Conversation

dnadales
Copy link
Member

Fixes IntersectMBO/ouroboros-network#3099

Sadly some CBOR validity tests need to be skipped due to:

This patch introduces an ad-hoc filtering mechanism to fix problems with legacy encoders.

@dnadales dnadales requested a review from a team as a code owner October 31, 2023 17:17
@dnadales dnadales force-pushed the dnadales/3099-test-that-consensus-emits-valid-cbor branch from 73dcec6 to 24060a6 Compare October 31, 2023 22:06
@@ -61,7 +61,7 @@ tests = adjustOption reduceTests $
, testGroup "SerialiseNodeToNode" $
roundtrip_SerialiseNodeToNode byronToCardanoCodeConfig
, testGroup "SerialiseNodeToClient" $
roundtrip_SerialiseNodeToClient byronToCardanoCodeConfig
roundtrip_SerialiseNodeToClient (const CheckCBORValidity) byronToCardanoCodeConfig
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is needed anymore.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns out we do, due to IntersectMBO/cardano-ledger#3800

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think keeping this is fine, we can remove the PParamsLegacyEncoder stuff after the next HF anyway.

@dnadales dnadales force-pushed the dnadales/3099-test-that-consensus-emits-valid-cbor branch 2 times, most recently from add6a91 to 643e2fe Compare November 8, 2023 20:04
-- | All roundtrip tests, skipping the specified CBOR validity tests.
--
--
-- TODO: the exclusion rule should only be considered for blocks __before__ Conway!
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to address this as a separate issue?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT, no Conway blocks are excluded at all, is this comment stale (ie a leftover from the FlatTerm roundtripping)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, what I meant is that we are using this to skip checks for legacy encoders before Conway. However, we should have a way to enable roundtrip_SerialiseNodeToClient at and after Conway. So I was thinking about changing the type of the filter function to something like:

(a, TestName) -> ShouldCheckCBORValidity

Copy link
Member

@amesgen amesgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, only two minor comments! LGTM after squashing (probably excluding 9244902)

@@ -61,7 +61,7 @@ tests = adjustOption reduceTests $
, testGroup "SerialiseNodeToNode" $
roundtrip_SerialiseNodeToNode byronToCardanoCodeConfig
, testGroup "SerialiseNodeToClient" $
roundtrip_SerialiseNodeToClient byronToCardanoCodeConfig
roundtrip_SerialiseNodeToClient (const CheckCBORValidity) byronToCardanoCodeConfig
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think keeping this is fine, we can remove the PParamsLegacyEncoder stuff after the next HF anyway.

-- | All roundtrip tests, skipping the specified CBOR validity tests.
--
--
-- TODO: the exclusion rule should only be considered for blocks __before__ Conway!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT, no Conway blocks are excluded at all, is this comment stale (ie a leftover from the FlatTerm roundtripping)?

From 20% to 100%. We've seen that when nothing changes, benchmarks can
be up to 40% slower on CI. So the threshold was bumped to account for
this variability.
This commits also add a filtering mechanism to skip CBOR validity
tests of legacy encoders.
@dnadales dnadales force-pushed the dnadales/3099-test-that-consensus-emits-valid-cbor branch from 0ddf493 to 55f49e6 Compare November 13, 2023 10:43
@dnadales dnadales enabled auto-merge November 13, 2023 10:45
@dnadales dnadales added this pull request to the merge queue Nov 13, 2023
Merged via the queue into main with commit d490501 Nov 13, 2023
13 checks passed
@dnadales dnadales deleted the dnadales/3099-test-that-consensus-emits-valid-cbor branch November 13, 2023 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test that Consensus emits valid CBOR
2 participants