Skip to content

Commit

Permalink
Revert "Made it possible to update PParams (#394)"
Browse files Browse the repository at this point in the history
This reverts commit ccca650.
  • Loading branch information
WhatisRT committed Apr 17, 2024
1 parent ccca650 commit d06be44
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 34 deletions.
32 changes: 10 additions & 22 deletions src/Ledger/Foreign/HSLedger.agda
Expand Up @@ -65,7 +65,7 @@ module Implementation where
}) where open import Algebra.PairOp ℕ zero _≡_ _+_
_≥ᵉ_ : ExUnits ExUnits Set
_≥ᵉ_ = _≡_
CostModel =
CostModel =
Language =
LangDepView =
Prices =
Expand Down Expand Up @@ -142,23 +142,16 @@ HSScriptStructure = record
instance _ = HSScriptStructure

open import Ledger.PParams it it it hiding (PParams)
open import Axiom.Set.Properties List-Model using (∉-∅)

opaque
unfolding List-Model

singleton-≢-∅ : {a} {x : a} ⦃ DecEq a ⦄ singleton x ≢ ∅
singleton-≢-∅ {x = x} ()

HsGovParams : GovParams
HsGovParams = record
{ Implementation
; ppUpd = let open PParamsDiff in λ where
.UpdateT -- cost parameter `a`
.updateGroups λ _ ❴ EconomicGroup ❵
.applyUpdate λ p a record p { a = a }
.ppdWellFormed λ _ true
.ppdWellFormed⇒hasGroup λ _ singleton-≢-∅
.UpdateT
.updateGroups λ _
.applyUpdate λ p _ p
.ppdWellFormed λ _ false
.ppdWellFormed⇒hasGroup λ ()
.ppdWellFormed⇒WF λ _ _ x x
; ppHashingScheme = it
}
Expand Down Expand Up @@ -262,11 +255,6 @@ instance
Convertible-DCert : Convertible DCert F.TxCert
Convertible-DCert = autoConvertible

Convertible-TxId : Convertible ℕ F.TxId
Convertible-TxId = λ where
.to x record { txid = x }
.from F.TxId.txid

Convertible-TxBody : Convertible TxBody F.TxBody
Convertible-TxBody = λ where
.to txb let open TxBody txb in record
Expand All @@ -276,7 +264,7 @@ instance
; txfee = txfee
; txvldt = to txvldt
; txsize = txsize
; txid = to txid
; txid = txid
; collateral = to collateral
; reqSigHash = to reqSigHash
; scriptIntHash = nothing
Expand All @@ -295,7 +283,7 @@ instance
; txADhash = nothing
; netwrk = nothing
; txsize = txsize
; txid = from txid
; txid = txid
; txvote = []
; txprop = []
; txdonation = ε
Expand Down Expand Up @@ -452,8 +440,8 @@ fromNeedsHash {NewCommittee _ _ _} x = to x
fromNeedsHash {NewConstitution _ _} x = to x
fromNeedsHash {TriggerHF _} x = to x
fromNeedsHash {ChangePParams _} x = to x
fromNeedsHash {TreasuryWdrl _} x = to 0 F., 0
fromNeedsHash {Info} x = to 0 F., 0
fromNeedsHash {TreasuryWdrl _} x = 0 F., 0
fromNeedsHash {Info} x = 0 F., 0

instance
Convertible-GovActionState : Convertible GovActionState F.GovActionState
Expand Down
29 changes: 19 additions & 10 deletions src/Ledger/Foreign/LedgerTypes.agda
Expand Up @@ -22,6 +22,7 @@ data Empty : Set where

{-# FOREIGN GHC
data AgdaEmpty deriving (Show, Generic)
instance ToExpr AgdaEmpty
#-}

data ComputationResult E A : Set where
Expand All @@ -40,6 +41,8 @@ data ComputationResult E A : Set where
return = pure
(Success a) >>= m = m a
(Failure e) >>= _ = Failure e
instance (ToExpr e, ToExpr a) => ToExpr (ComputationResult e a)
#-}
{-# COMPILE GHC ComputationResult = data ComputationResult (Success | Failure) #-}

Expand All @@ -49,12 +52,10 @@ HSMap : Set → Set → Set
HSMap K V = List (Pair K V)
Rational = Pair ℤ ℕ

record TxId : Set where
field txid :

Coin =
Addr =-- just payment credential

TxId =
Ix =
Epoch =
ScriptHash =
Expand All @@ -65,7 +66,7 @@ Datum = ⊤
Redeemer =
Anchor =
Network =
PParamsUpdate =
PParamsUpdate =
Script =

TxIn = Pair TxId Ix
Expand Down Expand Up @@ -93,7 +94,6 @@ ProtVer = Pair ℕ ℕ
type Ix = Integer
type Epoch = Integer
type ScriptHash = Integer
type PParamsUpdate = Integer
type AuxiliaryData = ()
type DataHash = ()
Expand All @@ -109,20 +109,20 @@ ProtVer = Pair ℕ ℕ
type Hash = Integer
data Tag = Spend | Mint | Cert | Rewrd | Vote | Propose deriving (Show, Generic)
instance ToExpr Tag
type RdmrPtr = (Tag, Ix)
type ExUnits = (Integer, Integer)
type ProtVer = (Integer, Integer)
type GovActionID = (TxId, Integer)
newtype TxId = MkTxId Integer
#-}
{-# COMPILE GHC Tag = data Tag (Spend | Mint | Cert | Rewrd | Vote | Propose) #-}
{-# COMPILE GHC TxId = data TxId (MkTxId) #-}

{-# FOREIGN GHC
data Credential
= ScriptObj Integer
| KeyHashObj Integer
deriving (Show, Eq, Generic)
instance ToExpr Credential
#-}
data Credential : Set where
ScriptObj : Hash Credential
Expand All @@ -141,6 +141,7 @@ RwdAddr = Pair Network Credential
| DRep
| SPO
deriving (Show, Eq, Generic)
instance ToExpr GovRole
#-}
data GovRole : Set where
CC DRep SPO : GovRole
Expand All @@ -152,6 +153,7 @@ data GovRole : Set where
| AbstainRep
| NoConfidenceRep
deriving (Show, Eq, Generic)
instance ToExpr VDeleg
#-}
data VDeleg : Set where
CredVoter : GovRole Credential VDeleg
Expand All @@ -169,6 +171,7 @@ data VDeleg : Set where
| DeRegDRep Credential
| CCRegHot Credential (Maybe Credential)
deriving (Show, Eq, Generic)
instance ToExpr TxCert
#-}
data TxCert : Set where
Delegate : Credential Maybe VDeleg Maybe Credential Coin TxCert
Expand Down Expand Up @@ -209,6 +212,7 @@ record TxBody : Set where
, scriptIntHash :: Maybe Hash
, txcerts :: [TxCert]
} deriving (Show, Generic)
instance ToExpr TxBody
#-}
{-# COMPILE GHC TxBody = data TxBody (MkTxBody) #-}

Expand All @@ -224,6 +228,7 @@ record TxWitnesses : Set where
, txdats :: [(DataHash, Datum)]
, txrdmrs :: [(RdmrPtr, (Redeemer, ExUnits))]
} deriving (Show, Generic)
instance ToExpr TxWitnesses
#-}
{-# COMPILE GHC TxWitnesses = data TxWitnesses (MkTxWitnesses) #-}

Expand All @@ -237,6 +242,7 @@ record Tx : Set where
, wits :: TxWitnesses
, txAD :: Maybe AuxiliaryData
} deriving (Show, Generic)
instance ToExpr Tx
#-}
{-# COMPILE GHC Tx = data Tx (MkTx) #-}

Expand All @@ -259,7 +265,7 @@ record PParams : Set where
drepActivity : Epoch
ccMinSize :
ccMaxTermLength :
costmdls :
costmdls : Empty
prices :
maxTxExUnits : ExUnits
maxBlockExUnits : ExUnits
Expand All @@ -286,13 +292,14 @@ record PParams : Set where
, drepActivity :: Epoch
, ccMinSize :: Integer
, ccMaxTermLength :: Integer
, costmdls :: ()
, costmdls :: AgdaEmpty
, prices :: ()
, maxTxExUnits :: ExUnits
, maxBlockExUnits :: ExUnits
, coinsPerUTxOWord :: Coin
, maxCollateralInputs :: Integer
} deriving (Show, Generic)
instance ToExpr PParams
#-}
{-# COMPILE GHC PParams = data PParams (MkPParams) #-}

Expand All @@ -304,6 +311,7 @@ record UTxOEnv : Set where
{ slot :: Integer
, pparams :: PParams
} deriving (Show, Generic)
instance ToExpr UTxOEnv
#-}
{-# COMPILE GHC UTxOEnv = data UTxOEnv (MkUTxOEnv) #-}

Expand All @@ -315,6 +323,7 @@ record UTxOState : Set where
{ utxo :: UTxO
, fees :: Coin
} deriving (Show, Generic)
instance ToExpr UTxOState
#-}
{-# COMPILE GHC UTxOState = data UTxOState (MkUTxOState) #-}

Expand Down Expand Up @@ -403,7 +412,7 @@ GovState = List (Pair GovActionID GovActionState)
| NewCommittee [(Credential, Epoch)] [Credential] Rational
| NewConstitution DataHash (Maybe ScriptHash)
| TriggerHF ProtVer
| ChangePParams PParamsUpdate
| ChangePParams ()
| TreasuryWdrl [(RwdAddr, Coin)]
| Info
Expand Down
2 changes: 0 additions & 2 deletions src/Ledger/PParams.lagda
Expand Up @@ -168,8 +168,6 @@ instance
((quote PoolThresholds , DecEq-PoolThresholds) ∷ [])
unquoteDecl DecEq-PParams = derive-DecEq
((quote PParams , DecEq-PParams) ∷ [])
unquoteDecl DecEq-PParamGroup = derive-DecEq
((quote PParamGroup , DecEq-PParamGroup) ∷ [])

instance
pvCanFollow? : ∀ {pv} {pv'} → Dec (pvCanFollow pv pv')
Expand Down

0 comments on commit d06be44

Please sign in to comment.