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

Make STS rules above UTXO era-independent. #1922

Merged
merged 2 commits into from
Oct 20, 2020
Merged

Make STS rules above UTXO era-independent. #1922

merged 2 commits into from
Oct 20, 2020

Commits on Oct 20, 2020

  1. Make STS rules above UTXO era-independent.

    Honestly it's embarassing that I failed to notice that this worked. We
    carry a few more constraints in the STS instances and Embed instances.
    But the payoff is that we only have to override the specific rules we
    want to change in each era, and not re-plumb everything.
    
    Obviously this means that, in the future, if we make a change in a
    different rule then we have to go back and turn the era-independent one
    into an era-dependent version (and add instances for all intermediate
    eras). But still, this feels like a definite improvement.
    nc6 committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    ed6ca70 View commit details
    Browse the repository at this point in the history
  2. Remove cycles between Embed and STS instances

    `Embed sub super` has the `STS super` super-class constraint, but `Embed sub
    super` is almost always used as a super-class constraint of `Embed sub super`
    itself. This is a cycle. My hypothesis is that these cycles are fine, *until*
    you start relying on constraints that are implied by them, because the
    corresponding dictionaries will be recursive too. I believe this is what caused
    some tests to hang.
    
    To remedy this, remove the `STS super` super-class constraint from the `Embed`
    class. Next, remove the new redundant constraints and add the constraints that
    are now missing.
    
    Finally, remove the cycle between each pair of `Embed` and `STS` instances. For
    example:
    
    ```diff
    instance
      ( ..
        Embed (UTXO era) (UTXOW era),
        ..
      ) =>
      STS (UTXOW era)
      where
      ..
    
    instance
      ( ..
    -   STS (UTXOW era),
        ..
      ) =>
      Embed (UTXO era) (UTXOW era)
      where
      ..
    ```
    mrBliss committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    98bd3f7 View commit details
    Browse the repository at this point in the history