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

[CDEC-509] Remove HasGenesisHash in favour of explicit parameters #3522

Merged
merged 1 commit into from
Sep 5, 2018

Conversation

ruhatch
Copy link
Contributor

@ruhatch ruhatch commented Aug 30, 2018

Description

Almost there with the Data.Reflection constraints from core.

Linked issue

CDEC-509

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)

@ruhatch ruhatch requested review from erikd and mhuesch August 30, 2018 21:29
@ruhatch ruhatch force-pushed the ruhatch/CDEC-509 branch 4 times, most recently from c96cef7 to 9ba020c Compare August 31, 2018 16:54
@ruhatch ruhatch requested a review from parsonsmatt September 4, 2018 12:42
erikd
erikd previously requested changes Sep 5, 2018
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.

This is going to need to be rebased against develop anyway, but I wonder if GenesisHash should not be included in Config.

@ruhatch
Copy link
Contributor Author

ruhatch commented Sep 5, 2018

@erikd The GenesisHash is in the Config type as configGenesisHash :: GenesisHash here

-> m (Maybe SerializedBlund)
dbGetSerBlundPureDefault h = do
dbGetSerBlundPureDefault _ h = do
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're not even using it, why pass it in?

-> m (Maybe SerializedUndo)
dbGetSerUndoPureDefault h = do
dbGetSerUndoPureDefault _ h = do
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto re why pass it in?

loadHeadersByDepth (k + 1) upToReal
-- loadHeadersByDepth always returns nonempty list unless you
-- pass depth 0 (we pass k+1). It throws if upToReal is
-- absent. So it either throws or returns nonempty.
Copy link
Contributor

Choose a reason for hiding this comment

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

can we encode this in the type? eg make it return NewestFirst NonEmpty BlockHeader?

runNode coreConfig txpConfig nr plugins = runNode' coreConfig
nr
workers'
plugins
Copy link
Contributor

Choose a reason for hiding this comment

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

This indentation style is too sensitive to changes in lengths of any params or adding/removing any parameters. Instead, prefer something like:

runNode coreConfig txpConfig nr plugs =
    runNode'
        coreConfig
        nr
        workers'
        plugins

Then a change to a parameter name or addition of a parameter will only affect the relevant line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, good point! I'm using Brittany at the moment, so I'll look into a way to remove that kind of indentation...

@ruhatch ruhatch dismissed erikd’s stale review September 5, 2018 18:13

Misunderstanding!

@ruhatch ruhatch merged commit d60aa7f into develop Sep 5, 2018
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