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

Add LoE to the ChainDB QSM test

Open Niols opened this issue 1 year ago • 6 comments

Closes #541

This PR adds a new instruction to the ChainDB q-s-m test, which updates the Limit on Eagerness (LoE) fragment and retriggers chain selection. This requires a model implementation of the LoE.

Niols avatar May 27 '24 14:05 Niols

The test failure in getChain_addChain makes sense: The test is making sure that for every chain bc, adding its blocks to an empty model causes the selection to be bc. With the LoE enabled and at Genesis (as is the case in the counterexamples), this of course fails when the chain is sufficiently long.

One way to fix this would be to discard these test cases, or even just disable the LoE completely for them.

The failure of alwaysPickPreferredChain seems to be for a very similar reason.

Indeed, it was as simple as that. Fixed in 660b331b0126243c79a054a197596fb63a2e050d. Could you check it, and in particular tell me if the comment of alwaysPickPreferredChain is correct? (The one for getChain_addChain is exactly what you wrote.)

Niols avatar May 29 '24 12:05 Niols

Now rebased on top of #1125.

Niols avatar May 29 '24 13:05 Niols

After 14 hours of tests, I find a counter-example to this PR. Reproducible on branch niols/loe-chaindb-qsm at commit 2da9483a2947902df18b6da30f8ffbb7133a3ce5 with:

cabal run ouroboros-consensus:storage-test -- \
  -p '/ChainDB q-s-m/' \
  --quickcheck-tests 500_000 \
  --quickcheck-replay="(SMGen 16524770743761658109 16657631389868279761,58)"

Niols avatar May 30 '24 10:05 Niols

Actually, upon inspecting this bug, it turns out that this failure is not LoE-related. The LoE is very much disabled and it looks like this has to do with GCing or streaming. I don't exactly know what this should do, but the behaviour of the model looks wrong to me.

Niols avatar May 30 '24 10:05 Niols

Yup, I can reproduce with the same seed on genesis/milestone-13 and main with an additional:

+source-repository-package
+  type: git
+  location: https://github.com/UnkindPartition/tasty
+  tag: dcbf32078133aa2b569774c417cc49a49f5c573b
+  subdir: quickcheck
+  --sha256: 0rwfcv0iq50ckzdgdssgkil6g9n76w1k6yxs0q4fdrkf5nlh4vv5

in cabal.project. I don't understand why I manage to reproduce when the code of the test changed so much, but oh well.

Niols avatar May 30 '24 13:05 Niols

As noted by @amesgen, this is probably https://github.com/IntersectMBO/ouroboros-consensus/issues/299.

Niols avatar May 31 '24 18:05 Niols