Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

[CDEC-418] Reunite orphan Bi instances in txp #3179

Merged
merged 1 commit into from
Jul 5, 2018
Merged

Conversation

intricate
Copy link
Contributor

@intricate intricate commented Jul 3, 2018

Description

This PR reunites orphan Bi instances from txp/src/Pos/Txp/Binary* with their type definitions.

Notes

It turned out that moving the Bi instance for (DataMsg TxMsgContents) was a lot more involved than I had anticipated.

Since DataMsg is a type defined in infra rather than txp, I decided that the Bi instance was best suited to be in infra. However, if I were to do this, infra would then have to depend upon txp since TxMsgContents is a type defined in Pos.Txp.Network.Types. This would introduce a circular dependency since txp already depends upon infra.

As a result of this, I ended up moving TxMsgContents from txp to infra.

I also moved all of the Arbitrary instances from Test.Pos.Txp.Arbitrary (txp-test) to Test.Pos.Core.Arbitrary.Txp (core-test) since they were all instances of core types anyways.

Linked issue

https://iohk.myjetbrains.com/youtrack/issue/CDEC-418

Type of change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • 🛠 New feature (non-breaking change which adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)
  • 🏭 Refactoring that does not change existing functionality but does improve things like code readability, structure etc
  • 🔨 New or improved tests for existing code
  • ⛑ git-flow chore (backport, hotfix, etc)

Developer checklist

  • I have read the style guide document, and my code follows the code style of this project.
  • If my code deals with exceptions, it follows the guidelines.
  • I have updated any documentation accordingly, if needed. Documentation changes can be reflected in opening a PR on cardanodocs.com, amending the inline Haddock comments, any relevant README file or one of the document listed in the docs directory.

Testing checklist

  • I have added tests to cover my changes.
  • All new and existing tests passed.

QA Steps

Screenshots (if available)

@@ -65,6 +66,10 @@ data DataMsg contents = DataMsg
{ dmContents :: !contents
} deriving (Generic, Show, Eq)

instance Bi (DataMsg TxMsgContents) where
Copy link
Contributor

@Jimbo4350 Jimbo4350 Jul 3, 2018

Choose a reason for hiding this comment

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

Shouldn't this be in txp/src/Pos/Txp/Network/Types.hs with TxMsgContents as per: https://iohk.myjetbrains.com/youtrack/issue/CDEC-401 @erikd

Copy link
Member

Choose a reason for hiding this comment

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

Normally probably yes, and in the end, maybe yes, but right now, definitely no :).

What we are aiming for at the moment is to fix txp so it no longer depends in infra and in the end, make infra depend on txp. We also want to avoid doing this in one huge PR that takes a week or more to get ready and then days to review etc.

So, we are temporarily going to contravene our normal good practices and do what ever it takes to fix the way txp and infra depend on each other.

Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

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

Waiting on Erik's feedback

@intricate intricate force-pushed the intricate/CDEC-418 branch 3 times, most recently from ee38f0f to 7944820 Compare July 4, 2018 05:36
Copy link
Member

@erikd erikd left a comment

Choose a reason for hiding this comment

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

Looks good to me. Needs a rebase and would be good to fix the stylish haskell wibbles along the way.

Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

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

LGTM!

@erikd
Copy link
Member

erikd commented Jul 4, 2018

I'm going to merge this as soon as it passes CI :)

@erikd erikd changed the title [WIP] [CDEC-418] Reunite orphan Bi instances in txp [CDEC-418] Reunite orphan Bi instances in txp Jul 5, 2018
@erikd erikd merged commit 5175273 into develop Jul 5, 2018
@erikd erikd deleted the intricate/CDEC-418 branch July 5, 2018 01:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants