Skip to content

Conversation

geo2a
Copy link
Contributor

@geo2a geo2a commented Sep 22, 2025

Summary

This PR refactors the era-crossing ThreadNet. I'm undertaking this process with the following two goals:

  • understand the ThreadNet tests and document my understanding. The ThreadNet tests are an important part of our testing infrastructure, but they have for some time been considered poorly understood and documented.
  • massage the ThreadNet testing infrastructure into a form that would enable testing the Conway-Dijkstra era transition.

A catalogue of ThreadNet tests

To achieve the first goal, I've added a doc that describes the idea behind the ThreadNet tests an enumerates them, see https://github.com/IntersectMBO/ouroboros-consensus/blob/26a161621ed3a4c1af5100e8f56e6bf85626152c/docs/website/contents/references/threadnet_tests.md

Refactoring of the Shelley-based era crossing tests

To achieve the second goal, the PR makes the following changes:

  • Slightly relax the ShelleyBasedHardForkConstraints constraint alias. Before this PR, the proto1 and proto2 type variables were hard coded to be TProas. After this PR, they are only constrained to be the same. This instantiating them to Praos. This enables expressing the between the Praos eras, i.e. from Babbage onward.
  • Refactor the protocolInfoShelleyBasedHardFork function which constructs the hard fork protocol info for two Shelley-based eras. The refactoring abstracts the function in the same way that the first change abstracts ShelleyBasedHardForkConstraints, i.e. allows using protocols other than TPraos. The protocols in both eras still have to coincide though, as they are bound by the proto1 ~ proto2 constraint from ShelleyBasedHardForkConstraints. I'm deliberately duplicating the argument that constructs the protocol info, even though the same function is passed at the call sites (namely, protocolInfoTPraosShelleyBased). We may benefit from this if we ever remove the proto1 ~ proto2 constraint to test the transition from Alonzo to Babbage, which goes from TPraos into Praos.
  • Refactor the code that constructs the transactions that are emitted by the nodes during the tests. I was trying to make the intent of these transactions more clear:
    • every era crossing test needs a single transaction that updates the protocol version.
    • the part of the transaction payload that updates the decentralisation parameter is not needed in the era crossing tests.

@geo2a geo2a changed the title Geo2a/threadnet refactor Factor out TestSetup in era-crossing ThreadNet tests Sep 22, 2025
@geo2a geo2a force-pushed the geo2a/threadnet-refactor branch 2 times, most recently from d401429 to 7daa24e Compare September 22, 2025 11:24
@geo2a geo2a force-pushed the geo2a/threadnet-refactor branch 5 times, most recently from 55d3fb6 to 3ca483d Compare October 6, 2025 13:17
@geo2a geo2a force-pushed the geo2a/threadnet-refactor branch 2 times, most recently from c791ead to 6223a5e Compare October 14, 2025 09:44
geo2a added 4 commits October 14, 2025 12:58
- move `TestSetup` to an existing shared module
- abstract `TestSetup` over the protocol
- abstract `protocolInfoShelleyBasedHardFork`
- minimise syntactic differences
- make the transactions' intent more clear by only including the relevant
payloads
- add comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant