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

create-testnet-data: take optional node configuration file as input or generate it #908

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

smelc
Copy link
Contributor

@smelc smelc commented Sep 20, 2024

…guration file# Changelog

- description: |
    `create-testnet-data` now takes a node configuration file as input. If a file is given, it is augmented with the hashes (and paths) of the genesis files. If no file is given, a default one is generated and the same augmentation with genesis hashes (and paths) is made.
# uncomment types applicable to the change:
  type:
  - feature        # introduces a new feature
  - breaking       # the API has changed in a breaking way
  # - compatible     # the API has changed but is non-breaking
  # - optimisation   # measurable performance improvements
  # - refactoring    # QoL changes
  # - bugfix         # fixes a defect
  # - test           # fixes/modifies tests
  # - maintenance    # not directly related to the code
  # - release        # related to a new release preparation
  # - documentation  # change in code docs, haddocks...

Context

How to trust this PR

TBD

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. See Running tests for more details
  • Self-reviewed the diff

@smelc smelc force-pushed the smelc/create-testnet-data-create-node-config-file branch from 4b6d12c to b75da64 Compare September 24, 2024 12:16
@@ -0,0 +1,206 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}

Check warning

Code scanning / HLint

Unused LANGUAGE pragma Warning

cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis/NodeConfiguration.hs:3:1-27: Warning: Unused LANGUAGE pragma
  
Found:
  {-# LANGUAGE LambdaCase #-}
  
Perhaps you should remove it.
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}

Check warning

Code scanning / HLint

Unused LANGUAGE pragma Warning

cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis/NodeConfiguration.hs:4:1-31: Warning: Unused LANGUAGE pragma
  
Found:
  {-# LANGUAGE NamedFieldPuns #-}
  
Perhaps you should remove it.
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE NumericUnderscores #-}

Check warning

Code scanning / HLint

Unused LANGUAGE pragma Warning

cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis/NodeConfiguration.hs:5:1-35: Warning: Unused LANGUAGE pragma
  
Found:
  {-# LANGUAGE NumericUnderscores #-}
  
Perhaps you should remove it.
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}

Check warning

Code scanning / HLint

Unused LANGUAGE pragma Warning

cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis/NodeConfiguration.hs:9:1-33: Warning: Unused LANGUAGE pragma
  
Found:
  {-# LANGUAGE TypeApplications #-}
  
Perhaps you should remove it.
-- protocol version for a given era that has had an intraera hardfork.
protocolVersions :: ShelleyBasedEra era -> Aeson.KeyMap Aeson.Value
protocolVersions sbe' =
Aeson.fromList $

Check notice

Code scanning / HLint

Redundant $ Note

cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis/NodeConfiguration.hs:32:20: Suggestion: Redundant $
  
Found:
  Aeson.fromList
    $ ([case sbe' of
          ShelleyBasedEraShelley
            -> ("LastKnownBlockVersion-Major", Aeson.Number 2)
          ShelleyBasedEraAllegra
            -> ("LastKnownBlockVersion-Major", Aeson.Number 3)
          ShelleyBasedEraMary
            -> ("LastKnownBlockVersion-Major", Aeson.Number 4)
          ShelleyBasedEraAlonzo
            -> ("LastKnownBlockVersion-Major", Aeson.Number 5)
          ShelleyBasedEraBabbage
            -> ("LastKnownBlockVersion-Major", Aeson.Number 8)
          ShelleyBasedEraConway
            -> ("LastKnownBlockVersion-Major", Aeson.Number 9),
        ("LastKnownBlockVersion-Minor", Aeson.Number 0),
        ("LastKnownBlockVersion-Alt", Aeson.Number 0)])
  
Perhaps:
  Aeson.fromList
    ([case sbe' of
        ShelleyBasedEraShelley
          -> ("LastKnownBlockVersion-Major", Aeson.Number 2)
        ShelleyBasedEraAllegra
          -> ("LastKnownBlockVersion-Major", Aeson.Number 3)
        ShelleyBasedEraMary
          -> ("LastKnownBlockVersion-Major", Aeson.Number 4)
        ShelleyBasedEraAlonzo
          -> ("LastKnownBlockVersion-Major", Aeson.Number 5)
        ShelleyBasedEraBabbage
          -> ("LastKnownBlockVersion-Major", Aeson.Number 8)
        ShelleyBasedEraConway
          -> ("LastKnownBlockVersion-Major", Aeson.Number 9),
      ("LastKnownBlockVersion-Minor", Aeson.Number 0),
      ("LastKnownBlockVersion-Alt", Aeson.Number 0)])
Comment on lines +33 to +43
( [ case sbe' of
ShelleyBasedEraShelley -> ("LastKnownBlockVersion-Major", Aeson.Number 2)
ShelleyBasedEraAllegra -> ("LastKnownBlockVersion-Major", Aeson.Number 3)
ShelleyBasedEraMary -> ("LastKnownBlockVersion-Major", Aeson.Number 4)
ShelleyBasedEraAlonzo -> ("LastKnownBlockVersion-Major", Aeson.Number 5)
ShelleyBasedEraBabbage -> ("LastKnownBlockVersion-Major", Aeson.Number 8)
ShelleyBasedEraConway -> ("LastKnownBlockVersion-Major", Aeson.Number 9)
, ("LastKnownBlockVersion-Minor", Aeson.Number 0)
, ("LastKnownBlockVersion-Alt", Aeson.Number 0)
]
)

Check warning

Code scanning / HLint

Redundant bracket Warning

cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis/NodeConfiguration.hs:(33,7)-(43,7): Warning: Redundant bracket
  
Found:
  ([case sbe' of
      ShelleyBasedEraShelley
        -> ("LastKnownBlockVersion-Major", Aeson.Number 2)
      ShelleyBasedEraAllegra
        -> ("LastKnownBlockVersion-Major", Aeson.Number 3)
      ShelleyBasedEraMary
        -> ("LastKnownBlockVersion-Major", Aeson.Number 4)
      ShelleyBasedEraAlonzo
        -> ("LastKnownBlockVersion-Major", Aeson.Number 5)
      ShelleyBasedEraBabbage
        -> ("LastKnownBlockVersion-Major", Aeson.Number 8)
      ShelleyBasedEraConway
        -> ("LastKnownBlockVersion-Major", Aeson.Number 9),
    ("LastKnownBlockVersion-Minor", Aeson.Number 0),
    ("LastKnownBlockVersion-Alt", Aeson.Number 0)])
  
Perhaps:
  [case sbe' of
     ShelleyBasedEraShelley
       -> ("LastKnownBlockVersion-Major", Aeson.Number 2)
     ShelleyBasedEraAllegra
       -> ("LastKnownBlockVersion-Major", Aeson.Number 3)
     ShelleyBasedEraMary
       -> ("LastKnownBlockVersion-Major", Aeson.Number 4)
     ShelleyBasedEraAlonzo
       -> ("LastKnownBlockVersion-Major", Aeson.Number 5)
     ShelleyBasedEraBabbage
       -> ("LastKnownBlockVersion-Major", Aeson.Number 8)
     ShelleyBasedEraConway
       -> ("LastKnownBlockVersion-Major", Aeson.Number 9),
   ("LastKnownBlockVersion-Minor", Aeson.Number 0),
   ("LastKnownBlockVersion-Alt", Aeson.Number 0)]
Base automatically changed from smelc/test-create-cardano to main September 24, 2024 17:02
@smelc smelc force-pushed the smelc/create-testnet-data-create-node-config-file branch from 6723d62 to 5181d0a Compare September 25, 2024 14:03
writeGenesisPathsToNodeConfigFile
tmpOutputNodeConfigPath2
( Map.fromList
[ ("ConwayGenesisFile", Text.pack $ conwayGenesisFilename)

Check notice

Code scanning / HLint

Redundant $ Note

cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis/CreateTestnetData.hs:375:47: Suggestion: Redundant $
  
Found:
  Text.pack $ conwayGenesisFilename
  
Perhaps:
  Text.pack conwayGenesisFilename
tmpOutputNodeConfigPath2
( Map.fromList
[ ("ConwayGenesisFile", Text.pack $ conwayGenesisFilename)
, ("ShelleyGenesisFile", Text.pack $ shelleyGenesisFilename)

Check notice

Code scanning / HLint

Redundant $ Note

cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis/CreateTestnetData.hs:376:48: Suggestion: Redundant $
  
Found:
  Text.pack $ shelleyGenesisFilename
  
Perhaps:
  Text.pack shelleyGenesisFilename
( Map.fromList
[ ("ConwayGenesisFile", Text.pack $ conwayGenesisFilename)
, ("ShelleyGenesisFile", Text.pack $ shelleyGenesisFilename)
, ("AlonzoGenesisFile", Text.pack $ alonzoGenesisFilename)

Check notice

Code scanning / HLint

Redundant $ Note

cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis/CreateTestnetData.hs:377:47: Suggestion: Redundant $
  
Found:
  Text.pack $ alonzoGenesisFilename
  
Perhaps:
  Text.pack alonzoGenesisFilename
rotationObject =
Aeson.Object $
Aeson.fromList
[ ("rpLogLimitBytes", Aeson.Number 5000000)

Check notice

Code scanning / HLint

Use underscore Note

cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis/NodeConfiguration.hs:156:44-50: Suggestion: Use underscore
  
Found:
  5000000
  
Perhaps:
  5_000_000
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

Successfully merging this pull request may close these issues.

1 participant