diff --git a/cardano-testnet/src/Testnet/Defaults.hs b/cardano-testnet/src/Testnet/Defaults.hs index 4d232d3412f..526741706b8 100644 --- a/cardano-testnet/src/Testnet/Defaults.hs +++ b/cardano-testnet/src/Testnet/Defaults.hs @@ -32,7 +32,8 @@ module Testnet.Defaults , plutusV3SpendingScript ) where -import Cardano.Api (AnyCardanoEra (..), CardanoEra (..), File (..), pshow) +import Cardano.Api (AnyCardanoEra (..), CardanoEra (..), File (..), pshow, + unsafeBoundedRational) import qualified Cardano.Api.Shelley as Api import Cardano.Ledger.Alonzo.Core (PParams (..)) @@ -60,16 +61,13 @@ import qualified Data.Aeson as Aeson import qualified Data.Aeson.Key as Key import qualified Data.Aeson.KeyMap as KeyMapAeson import qualified Data.Default.Class as DefaultClass -import Data.Maybe import Data.Proxy import Data.Ratio import Data.Scientific import Data.Text (Text) import qualified Data.Text as Text import Data.Time (UTCTime) -import Data.Typeable import qualified Data.Vector as Vector -import GHC.Stack import Lens.Micro import Numeric.Natural import System.FilePath (()) @@ -573,35 +571,13 @@ defaultDelegatorStakeKeyPair n = , signingKey = File $ "stake-delegators" ("delegator" <> show n) "staking.skey" } --- TODO: We should not hardcode a script like this. We need to move --- plutus-example from plutus apps to cardano-node-testnet. This will --- let us directly compile the plutus validators and avoid bit rotting of --- hardcoded plutus scripts. -- | Default plutus script that succeeds regardless of redeemer --- NB: This cannot be used as a spending script plutusV3NonSpendingScript :: Text plutusV3NonSpendingScript = - Text.unlines ["{" - , "\"type\": \"PlutusScriptV3\"" - , ",\"description\": \"\"" - , ",\"cborHex\": \"4746010100228001\"" - , "}" - ] + "{ \"type\": \"PlutusScriptV3\", \"description\": \"\", \"cborHex\": \"46450101002499\" }" -- | Default plutus spending script that succeeds regardless of redeemer plutusV3SpendingScript :: Text plutusV3SpendingScript = - Text.unlines ["{" - , "\"type\": \"PlutusScriptV3\"" - , ",\"description\": \"\"" - , ",\"cborHex\": \"484701010022280001\"" - , "}" - ] - --- TODO: move to cardano-api -unsafeBoundedRational :: forall r. (HasCallStack, Typeable r, BoundedRational r) - => Rational - -> r -unsafeBoundedRational x = fromMaybe (error errMessage) $ boundRational x - where - errMessage = show (typeRep (Proxy @r)) <> " is out of bounds: " <> show x + "{ \"type\": \"PlutusScriptV3\", \"description\": \"\", \"cborHex\": \"46450101002499\" }" +