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

Remove use of ScriptWitnessFiles in spending scripts #1025

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Jimbo4350
Copy link
Contributor

Changelog

- description: |
    <insert-changelog-description-here>
# 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

Additional context for the PR goes here. If the PR fixes a particular issue please provide a link to the issue.

How to trust this PR

Highlight important bits of the PR that will make the review faster. If there are commands the reviewer can run to observe the new behavior, describe them.

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

Comment on lines +1052 to +1059
( optional ((,,)
<$> pScriptDatumOrFileSpendingCip69 sbe scriptFlagPrefix
<*> pScriptRedeemerOrFile scriptFlagPrefix
<*> ( case autoBalanceExecUnits of
AutoBalance -> pure (ExecutionUnits 0 0)
ManualBalance -> pExecutionUnits scriptFlagPrefix
))
)

Check notice

Code scanning / HLint

Redundant bracket Note

cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs:(1052,10)-(1059,10): Suggestion: Redundant bracket
  
Found:
  PlutusSpend.createPlutusScriptFromCliArgs
    <$>
      pScriptFor
        (scriptFlagPrefix ++ "-script-file")
        ((++ "-script-file") <$> scriptFlagPrefixDeprecated)
        ("The file containing the script to witness " ++ help)
    <>
      (optional
         ((,,) <$> pScriptDatumOrFileSpendingCip69 sbe scriptFlagPrefix
            <> pScriptRedeemerOrFile scriptFlagPrefix
            <>
              (case autoBalanceExecUnits of
                 AutoBalance -> pure (ExecutionUnits 0 0)
                 ManualBalance -> pExecutionUnits scriptFlagPrefix)))
  
Perhaps:
  PlutusSpend.createPlutusScriptFromCliArgs
    <$>
      pScriptFor
        (scriptFlagPrefix ++ "-script-file")
        ((++ "-script-file") <$> scriptFlagPrefixDeprecated)
        ("The file containing the script to witness " ++ help)
    <>
      optional
        ((,,) <$> pScriptDatumOrFileSpendingCip69 sbe scriptFlagPrefix
           <> pScriptRedeemerOrFile scriptFlagPrefix
           <>
             (case autoBalanceExecUnits of
                AutoBalance -> pure (ExecutionUnits 0 0)
                ManualBalance -> pExecutionUnits scriptFlagPrefix))
Comment on lines +1175 to +1178
[ PlutusSpend.PotentialDatum . Just <$> (pScriptDataOrFile
(scriptFlagPrefix ++ "-datum")
"The script datum."
"The script datum file.")

Check notice

Code scanning / HLint

Redundant bracket Note

cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs:(1175,49)-(1178,39): Suggestion: Redundant bracket
  
Found:
  PlutusSpend.PotentialDatum . Just
    <$>
      (pScriptDataOrFile
         (scriptFlagPrefix ++ "-datum") "The script datum."
         "The script datum file.")
  
Perhaps:
  PlutusSpend.PotentialDatum . Just
    <$>
      pScriptDataOrFile
        (scriptFlagPrefix ++ "-datum") "The script datum."
        "The script datum file."
pScriptDatumOrFileSpendingCip69 :: ShelleyBasedEra era -> String -> Parser PlutusSpend.ScriptDatumOrFileSpending
pScriptDatumOrFileSpendingCip69 sbe scriptFlagPrefix =
caseShelleyToBabbageOrConwayEraOnwards
(const $ datumMandatory)

Check notice

Code scanning / HLint

Redundant $ Note

cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs:1193:12: Suggestion: Redundant $
  
Found:
  const $ datumMandatory
  
Perhaps:
  const datumMandatory
pScriptDatumOrFileSpendingCip69 sbe scriptFlagPrefix =
caseShelleyToBabbageOrConwayEraOnwards
(const $ datumMandatory)
(const $ datumOptional)

Check notice

Code scanning / HLint

Redundant $ Note

cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs:1194:12: Suggestion: Redundant $
  
Found:
  const $ datumOptional
  
Perhaps:
  const datumOptional
Comment on lines +1199 to +1202
[ PlutusSpend.PotentialDatum . Just <$> (pScriptDataOrFile
(scriptFlagPrefix ++ "-datum")
"The script datum."
"The script datum file.")

Check notice

Code scanning / HLint

Redundant bracket Note

cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs:(1199,49)-(1202,39): Suggestion: Redundant bracket
  
Found:
  PlutusSpend.PotentialDatum . Just
    <$>
      (pScriptDataOrFile
         (scriptFlagPrefix ++ "-datum") "The script datum."
         "The script datum file.")
  
Perhaps:
  PlutusSpend.PotentialDatum . Just
    <$>
      pScriptDataOrFile
        (scriptFlagPrefix ++ "-datum") "The script datum."
        "The script datum file."
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeApplications #-}

Check warning

Code scanning / HLint

Unused LANGUAGE pragma Warning

cardano-cli/src/Cardano/CLI/EraBased/Script/Spend/Read.hs:4:1-33: Warning: Unused LANGUAGE pragma
  
Found:
  {-# LANGUAGE TypeApplications #-}
  
Perhaps you should remove it.
:: MonadIOTransError (FileError CliSpendScriptWitnessError) t m
=> ScriptDatumOrFileSpending
-> t m (ScriptDatum WitCtxTxIn)
handlePotentialScriptDatum InlineDatum = return $ InlineScriptDatum

Check notice

Code scanning / HLint

Redundant $ Note

cardano-cli/src/Cardano/CLI/EraBased/Script/Spend/Read.hs:119:49: Suggestion: Redundant $
  
Found:
  return $ InlineScriptDatum
  
Perhaps:
  return InlineScriptDatum
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}

Check warning

Code scanning / HLint

Unused LANGUAGE pragma Warning

cardano-cli/src/Cardano/CLI/EraBased/Script/Spend/Types.hs:4:1-27: Warning: Unused LANGUAGE pragma
  
Found:
  {-# LANGUAGE LambdaCase #-}
  
Perhaps you should remove it.
Comment on lines +23 to +25
data SpendScriptWitness era
= SpendScriptWitness { sswScriptWitness :: ScriptWitness WitCtxTxIn era }
deriving Show

Check notice

Code scanning / HLint

Use newtype instead of data Note

cardano-cli/src/Cardano/CLI/EraBased/Script/Spend/Types.hs:(23,1)-(25,15): Suggestion: Use newtype instead of data
  
Found:
  data SpendScriptWitness era
    = SpendScriptWitness {sswScriptWitness :: ScriptWitness WitCtxTxIn era}
    deriving Show
  
Perhaps:
  newtype SpendScriptWitness era
    = SpendScriptWitness {sswScriptWitness :: ScriptWitness WitCtxTxIn era}
    deriving Show
  
Note: decreases laziness
data SimpleOrPlutusScriptCliArgs
= OnDiskPlutusScriptCliArgs
(File ScriptInAnyLang In)
(ScriptDatumOrFileSpending) -- ^ Optional Datum (CIP-69)

Check warning

Code scanning / HLint

Redundant bracket Warning

cardano-cli/src/Cardano/CLI/EraBased/Script/Spend/Types.hs:37:7-33: Warning: Redundant bracket
  
Found:
  (ScriptDatumOrFileSpending)
  
Perhaps:
  ScriptDatumOrFileSpending
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