singular-registry
LicenseApache-2.0
Safe HaskellNone
LanguageGHC2021

Singular.Registry.Deployment.Manifest

Description

One owner for the deployment record as a file: the manifest and reference-script values with their JSON instances, reading and writing one, choosing one from a command line or the environment, the txid#index spelling and its parse, an address as the exact hex bytes the ledger serialises, the byte-rendering helper hex and the shared error helper die the deployment family shares. Nothing here queries a node.

This module is an internal owner behind the Deployment facade: callers import the facade, which re-exports the unchanged public surface. See the deployment ownership guide for the dependency direction between the owners.

Synopsis

The manifest

data Deployment Source #

A registry that exists, recorded well enough to find it again and to refuse to use the wrong one.

Constructors

Deployment 

Fields

  • depRelease :: Text

    Release tag or candidate commit the deployment was made from

  • depLeanRevision :: Text

    Revision of the model that release was built against

  • depNetworkMagic :: Word32

    Network the deployment lives on

  • depSeedOutRef :: Text

    txid#index the boot mint consumed; the registry's identity

  • depCageToken :: Text

    Hex asset name of the registry token (SHA-256 of the seed)

  • depStatePolicy :: Text

    Applied state script hash, which is the registry's policy id

  • depRequestHash :: Text

    Applied request validator hash

  • depApplicationHash :: Text

    Naming application validator hash

  • depRepresentativePolicy :: Text

    The registry-bound ACTIVE token policy: `witness(1, registry)` applied (#157 C5/C7). Renamed from the representative policy it became; the manifest key keeps its spelling so existing manifests and the attach check still read it.

  • depProcessTime :: Integer

    Phase-1 window (ms) the registry was booted with

  • depRetractTime :: Integer

    Phase-2 window (ms) the registry was booted with

  • depTip :: Integer

    Oracle tip (lovelace) the registry was booted with

  • depReferenceScripts :: [ReferenceScript]

    The outputs published once and reused by every later run

  • depBootstrapTxs :: [Text]

    Transaction ids that created all of the above, in order

Instances

Instances details
FromJSON Deployment Source # 
Instance details

Defined in Singular.Registry.Deployment.Manifest

Methods

parseJSON :: Value -> Parser Deployment

parseJSONList :: Value -> Parser [Deployment]

omittedField :: Maybe Deployment

ToJSON Deployment Source # 
Instance details

Defined in Singular.Registry.Deployment.Manifest

Methods

toJSON :: Deployment -> Value

toEncoding :: Deployment -> Encoding

toJSONList :: [Deployment] -> Value

toEncodingList :: [Deployment] -> Encoding

omitField :: Deployment -> Bool

Generic Deployment Source # 
Instance details

Defined in Singular.Registry.Deployment.Manifest

Associated Types

type Rep Deployment 
Instance details

Defined in Singular.Registry.Deployment.Manifest

type Rep Deployment = D1 ('MetaData "Deployment" "Singular.Registry.Deployment.Manifest" "singular-registry-0.1.0.0-Ixhbs5JE28qkUXbRQkkWU" 'False) (C1 ('MetaCons "Deployment" 'PrefixI 'True) (((S1 ('MetaSel ('Just "depRelease") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: (S1 ('MetaSel ('Just "depLeanRevision") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "depNetworkMagic") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Word32))) :*: ((S1 ('MetaSel ('Just "depSeedOutRef") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "depCageToken") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "depStatePolicy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "depRequestHash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)))) :*: ((S1 ('MetaSel ('Just "depApplicationHash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: (S1 ('MetaSel ('Just "depRepresentativePolicy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "depProcessTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Integer))) :*: ((S1 ('MetaSel ('Just "depRetractTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Integer) :*: S1 ('MetaSel ('Just "depTip") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Integer)) :*: (S1 ('MetaSel ('Just "depReferenceScripts") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [ReferenceScript]) :*: S1 ('MetaSel ('Just "depBootstrapTxs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [Text]))))))

Methods

from :: Deployment -> Rep Deployment x Source #

to :: Rep Deployment x -> Deployment Source #

Show Deployment Source # 
Instance details

Defined in Singular.Registry.Deployment.Manifest

Methods

showsPrec :: Int -> Deployment -> ShowS Source #

show :: Deployment -> String Source #

showList :: [Deployment] -> ShowS Source #

Eq Deployment Source # 
Instance details

Defined in Singular.Registry.Deployment.Manifest

Methods

(==) :: Deployment -> Deployment -> Bool Source #

(/=) :: Deployment -> Deployment -> Bool Source #

type Rep Deployment Source # 
Instance details

Defined in Singular.Registry.Deployment.Manifest

type Rep Deployment = D1 ('MetaData "Deployment" "Singular.Registry.Deployment.Manifest" "singular-registry-0.1.0.0-Ixhbs5JE28qkUXbRQkkWU" 'False) (C1 ('MetaCons "Deployment" 'PrefixI 'True) (((S1 ('MetaSel ('Just "depRelease") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: (S1 ('MetaSel ('Just "depLeanRevision") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "depNetworkMagic") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Word32))) :*: ((S1 ('MetaSel ('Just "depSeedOutRef") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "depCageToken") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "depStatePolicy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "depRequestHash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)))) :*: ((S1 ('MetaSel ('Just "depApplicationHash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: (S1 ('MetaSel ('Just "depRepresentativePolicy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "depProcessTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Integer))) :*: ((S1 ('MetaSel ('Just "depRetractTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Integer) :*: S1 ('MetaSel ('Just "depTip") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Integer)) :*: (S1 ('MetaSel ('Just "depReferenceScripts") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [ReferenceScript]) :*: S1 ('MetaSel ('Just "depBootstrapTxs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [Text]))))))

data ReferenceScript Source #

One reference-script output: what it carries, where it is, and the hash a node must agree it holds.

Constructors

ReferenceScript 

Fields

  • refRole :: Text

    Which script this is (state, request, application, …)

  • refHash :: Text

    Hex script hash the output must carry

  • refOutRef :: Text

    txid#index of the output

  • refAddress :: Text

    Address the output sits at, in the bech32 form a person reads. Informational: refAddressBytes is what the code queries.

  • refAddressBytes :: Text

    The same address as the hex bytes the ledger serialises, which round-trips exactly

Instances

Instances details
FromJSON ReferenceScript Source # 
Instance details

Defined in Singular.Registry.Deployment.Manifest

Methods

parseJSON :: Value -> Parser ReferenceScript

parseJSONList :: Value -> Parser [ReferenceScript]

omittedField :: Maybe ReferenceScript

ToJSON ReferenceScript Source # 
Instance details

Defined in Singular.Registry.Deployment.Manifest

Methods

toJSON :: ReferenceScript -> Value

toEncoding :: ReferenceScript -> Encoding

toJSONList :: [ReferenceScript] -> Value

toEncodingList :: [ReferenceScript] -> Encoding

omitField :: ReferenceScript -> Bool

Generic ReferenceScript Source # 
Instance details

Defined in Singular.Registry.Deployment.Manifest

Associated Types

type Rep ReferenceScript 
Instance details

Defined in Singular.Registry.Deployment.Manifest

type Rep ReferenceScript = D1 ('MetaData "ReferenceScript" "Singular.Registry.Deployment.Manifest" "singular-registry-0.1.0.0-Ixhbs5JE28qkUXbRQkkWU" 'False) (C1 ('MetaCons "ReferenceScript" 'PrefixI 'True) ((S1 ('MetaSel ('Just "refRole") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "refHash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "refOutRef") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: (S1 ('MetaSel ('Just "refAddress") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "refAddressBytes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)))))

Methods

from :: ReferenceScript -> Rep ReferenceScript x Source #

to :: Rep ReferenceScript x -> ReferenceScript Source #

Show ReferenceScript Source # 
Instance details

Defined in Singular.Registry.Deployment.Manifest

Methods

showsPrec :: Int -> ReferenceScript -> ShowS Source #

show :: ReferenceScript -> String Source #

showList :: [ReferenceScript] -> ShowS Source #

Eq ReferenceScript Source # 
Instance details

Defined in Singular.Registry.Deployment.Manifest

Methods

(==) :: ReferenceScript -> ReferenceScript -> Bool Source #

(/=) :: ReferenceScript -> ReferenceScript -> Bool Source #

type Rep ReferenceScript Source # 
Instance details

Defined in Singular.Registry.Deployment.Manifest

type Rep ReferenceScript = D1 ('MetaData "ReferenceScript" "Singular.Registry.Deployment.Manifest" "singular-registry-0.1.0.0-Ixhbs5JE28qkUXbRQkkWU" 'False) (C1 ('MetaCons "ReferenceScript" 'PrefixI 'True) ((S1 ('MetaSel ('Just "refRole") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "refHash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "refOutRef") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: (S1 ('MetaSel ('Just "refAddress") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "refAddressBytes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)))))

readDeployment :: FilePath -> IO Deployment Source #

Read a manifest, naming the file when it will not parse.

writeDeployment :: FilePath -> Deployment -> IO () Source #

Write a manifest, formatted for a person to read in review.

Choosing one

deploymentPathFromArgs :: [String] -> Maybe FilePath Source #

The manifest a command line names, if any. --deployment PATH and --deployment=PATH are both accepted; absent, the caller keeps its existing behaviour of booting its own registry.

deploymentPathFromEnvironment :: IO (Maybe FilePath) Source #

deploymentPathFromArgs for this process, falling back to SINGULAR_DEPLOYMENT.

Output references

renderOutRef :: TxIn -> Text Source #

txid#index, the spelling every Cardano tool prints.

parseOutRef :: Text -> Either String TxIn Source #

Parse txid#index back, naming what was wrong with it.

renderAddrBytes :: Addr -> Text Source #

An address as the manifest records it: exact bytes, in hex.

The mirror's path

mirrorPathFor :: FilePath -> FilePath Source #

Where the proof mirror for a manifest lives: the manifest's own path with a .mirror.json extension, so the two travel together and neither is guessed from a separate flag.

Shared rendering, for the deployment family only

die :: String -> IO a Source #

hex :: ByteString -> String Source #