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

Resolve Hedgehog StateT-outside-of-GenT issue #569

Closed
mhuesch opened this issue Jun 10, 2019 · 2 comments
Closed

Resolve Hedgehog StateT-outside-of-GenT issue #569

mhuesch opened this issue Jun 10, 2019 · 2 comments
Assignees

Comments

@mhuesch
Copy link
Contributor

mhuesch commented Jun 10, 2019

Background

From the hedgehog-1.0 Changelog, we see:

Simplify MonadGen, this breaks the use of StateT on the outside of a GenT for the time being, it still works fine on the inside though and you can use distributeT to run it

It turns out that we need this exact configuration for Goblins' TinkerM:

type TinkerM g = StateT (GoblinData g) Gen

More context is given here:

We also simplify MonadGen significantly, with all functions being implemented in terms of toGen / fromGen. This comes at the cost of StateT and RWST instances, but you can still run these on the inside of the transformer and get a MonadGen, it's just slightly less conveniant. If anyone can figure out how to implement MonadTransControl for TreeT then they will be easy possible on the back of that.

I (@mhuesch) have spent a few days equivalent trying to hack around this issue with MonadTransControl, and haven't made much progress.

Proposed Solution

Make it work 🙂

I see 3 possible routes:

  1. Solve MonadTransControl in full generality (what Jacob describes above)
  2. Write instances specific to our TinkerM case, which might be able to cheat and avoid issues which arise for full generality.
  3. Come up with an alternative way to thread genomes around.

I considered ReaderT for a bit, but we only want to consume genome when we tinker/conjure, and a ReaderT solution would have to meter out genome each time it did a bind (I think).

@mhuesch
Copy link
Contributor Author

mhuesch commented Jun 10, 2019

Next Action

  • Try each approach above

@mhuesch mhuesch self-assigned this Jun 10, 2019
@mhuesch mhuesch transferred this issue from input-output-hk/cardano-ledger-byron Jun 11, 2019
@mhuesch mhuesch changed the title Resolve Hedgehog StateT-outside-of-GenT issue Rewrite goblins to operate over Gen/Tree datatypes Jun 18, 2019
@mhuesch mhuesch changed the title Rewrite goblins to operate over Gen/Tree datatypes Resolve Hedgehog StateT-outside-of-GenT issue Jun 18, 2019
@mhuesch
Copy link
Contributor Author

mhuesch commented Jun 18, 2019

Closing this and continuing the issue in #556

@mhuesch mhuesch closed this as completed Jun 18, 2019
nc6 added a commit that referenced this issue May 19, 2020
566: Changes for epoch boundary integration r=nc6 a=nc6

Unfortunately we do need to serialise boundary blocks, because we need to create the initial one for testing.

569: Add ToCBOR and FromCBOR instances for ChainValidationState r=intricate a=mrBliss

This requires `ToCBOR` and `FromCBOR` instances for a whole bunch of other types
too.

The consensus storage layer needs these instances in order to write/read snapshots of the ledger state to/from disk.

Roundtrip property tests and golden tests still need to be written. Can somebody of the ledger team do this? Feel free to push more commits to this PR.

 I tried to adhere to the existing style as much as I could, but I might have made some mistakes.

Co-authored-by: Nicholas Clarke <nick@topos.org.uk>
Co-authored-by: mrBliss <dewinant@gmail.com>
Co-authored-by: Luke Nadur <19835357+intricate@users.noreply.github.com>
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

No branches or pull requests

1 participant