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

[CDEC-505] Move Pos.Core.Genesis to Pos.Chain.Genesis #3593

Merged
merged 1 commit into from
Sep 14, 2018

Conversation

ruhatch
Copy link
Contributor

@ruhatch ruhatch commented Sep 13, 2018

Description

This moves the Pos.Core.Genesis module group into the chain package. This is also involves moving Core.Config type to Genesis.Config, so touches all the site where that Config was propagated. This is laying the foundation for a Chain.Config type that will combine Genesis.Config, Txp.Config, etc.

Linked issue

CDEC-505

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.
  • [~] CHANGELOG entry has been added and is linked to the correct PR on GitHub.

Testing checklist

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

QA Steps

Screenshots (if available)

Copy link
Contributor

@mhuesch mhuesch left a comment

Choose a reason for hiding this comment

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

LGTM. I'll let @parsonsmatt give the official approval, since he's doing a more in-depth review.

-- StaticConfig
--------------------------------------------------------------------------------

data StaticConfig
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this new name. GenesisConfiguration was fairly misleading because plenty of stuff in there isn't Genesis related per se. We still have that issue with GenesisSpec, I suppose. But this seems like progress.

@@ -1,6 +1,6 @@
{-# LANGUAGE Rank2Types #-}

module Pos.Core.Configuration.GenesisHash
module Pos.Chain.Genesis.Hash
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

deriving instance Hashable Address => Semigroup GenesisNonAvvmBalances
deriving instance Hashable Address => Monoid GenesisNonAvvmBalances
deriving instance Semigroup GenesisNonAvvmBalances
deriving instance Monoid GenesisNonAvvmBalances
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉

hasKnownFeePolicy BlockVersionData {bvdTxFeePolicy = TxFeePolicyTxSizeLinear {}} =
True
hasKnownFeePolicy _ = False
arbitraryVssCerts = mkVssCertificatesMapLossy <$> arbitrary
Copy link
Contributor

Choose a reason for hiding this comment

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

Moved from here

hexToBS :: Text -> ByteString
hexToBS ts = case B16.decode ts of
Left err -> error $ "decode failed: " <> show err
Right bs -> bs
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

As a side note, I like *.Example module naming idiom much better than my *.ExampleHelpers. Even if the module contains helpers.


instance Monad m => ToJSON m GenesisNonAvvmBalances where
toJSON = toJSON . getGenesisNonAvvmBalances

instance ReportSchemaErrors m => FromJSON m GenesisNonAvvmBalances where
instance
(Monad m, Applicative m, MonadError SchemaError m)
Copy link
Contributor

Choose a reason for hiding this comment

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

Monad and Applicatve are redundant here as MonadError implies them

@@ -42,7 +43,10 @@ instance Monad m => ToJSON m GenesisProtocolConstants where
, ("vssMinTTL", toJSON gpcVssMinTTL)
]

instance ReportSchemaErrors m => FromJSON m GenesisProtocolConstants where
instance
(Monad m, MonadError SchemaError m)
Copy link
Contributor

Choose a reason for hiding this comment

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

Monad is redudant here

@@ -39,7 +39,10 @@ instance Buildable GenesisWStakeholders where
instance Monad m => ToJSON m GenesisWStakeholders where
toJSON (GenesisWStakeholders stks) = toJSON stks

instance ReportSchemaErrors m => FromJSON m GenesisWStakeholders where
instance
(Monad m, MonadError SchemaError m)
Copy link
Contributor

Choose a reason for hiding this comment

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

Redundant monad

@ruhatch ruhatch merged commit 295647b into develop Sep 14, 2018
KtorZ pushed a commit that referenced this pull request Nov 9, 2018
[CDEC-505] Move Pos.Core.Genesis to Pos.Chain.Genesis
KtorZ pushed a commit to input-output-hk/cardano-wallet-legacy that referenced this pull request Nov 9, 2018
…hk/ruhatch/CDEC-505

[CDEC-505] Move Pos.Core.Genesis to Pos.Chain.Genesis
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants