Skip to content

Commit

Permalink
Merge branch 'master' into aniketd/conway-certs-3442
Browse files Browse the repository at this point in the history
  • Loading branch information
Soupstraw authored Jul 20, 2023
2 parents 2dd1826 + 8731cbe commit d4770d2
Show file tree
Hide file tree
Showing 200 changed files with 1,109 additions and 1,072 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

env:
# Modify this value to "invalidate" the cabal cache.
CABAL_CACHE_VERSION: "2023-02-14"
CABAL_CACHE_VERSION: "2023-07-17"

# current ref from: 27.02.2022
SECP256K1_REF: ac83be33d0956faf6b7f61a60ab524ef7d6a473a
Expand All @@ -42,7 +42,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ghc: ["8.10.7", "9.2.7", "9.6.1"]
ghc: ["8.10.7", "9.2.8", "9.6.2"]
os: [ubuntu-latest]

steps:
Expand Down Expand Up @@ -135,7 +135,7 @@ jobs:
- name: Install fourmolu
run: |
mkdir -p "$HOME/.local/bin"
curl -sL https://github.com/fourmolu/fourmolu/releases/download/v0.10.1.0/fourmolu-0.10.1.0-linux-x86_64 -o "$HOME/.local/bin/fourmolu"
curl -sL https://github.com/fourmolu/fourmolu/releases/download/v0.13.1.0/fourmolu-0.13.1.0-linux-x86_64 -o "$HOME/.local/bin/fourmolu"
chmod a+x "$HOME/.local/bin/fourmolu"
echo "$HOME/.local/bin" >> $GITHUB_PATH
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<a href="https://github.com/input-output-hk/cardano-ledger/actions/workflows/haskell.yml">
<img alt="GitHub Workflow Status (master)" src="https://img.shields.io/github/actions/workflow/status/input-output-hk/cardano-ledger/haskell.yml?branch=master&style=for-the-badge" />
</a>
[![docs](https://img.shields.io/badge/documentation-Haddock-yellow?style=for-the-badge)](https://input-output-hk.github.io/cardano-ledger/)
</p>

This repository contains the formal specifications, executable models,
Expand Down
7 changes: 2 additions & 5 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@ repository cardano-haskell-packages
c00aae8461a256275598500ea0e187588c35a5d5d7454fb57eac18d9edb86a56
d4a35cd3121aa00d18544bb0ac01c3e1691d618f462c46129271bccf39f7e8ee

-- See CONTRIBUTING for some Nix commands you will need to run if you
-- update either of these.
index-state: 2023-07-14T00:00:00Z
index-state:
-- Bump this if you need newer packages from Hackage
, hackage.haskell.org 2023-06-01T19:11:19Z
, hackage.haskell.org 2023-07-17T00:00:00Z
-- Bump this if you need newer packages from CHaP
, cardano-haskell-packages 2023-07-14T00:00:00Z
, cardano-haskell-packages 2023-07-17T09:39:52Z

packages:
eras/allegra/impl
Expand Down
2 changes: 1 addition & 1 deletion eras/allegra/impl/src/Cardano/Ledger/Allegra/TxAuxData.hs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ instance Memoized AllegraTxAuxData where

type instance MemoHashIndex AllegraTxAuxDataRaw = EraIndependentTxAuxData

instance (c ~ EraCrypto era) => HashAnnotated (AllegraTxAuxData era) EraIndependentTxAuxData c where
instance c ~ EraCrypto era => HashAnnotated (AllegraTxAuxData era) EraIndependentTxAuxData c where
hashAnnotated = getMemoSafeHash

deriving newtype instance
Expand Down
16 changes: 8 additions & 8 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Rules/Bbody.hs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ import NoThunks.Class (NoThunks (..))
data AlonzoBbodyPredFailure era
= ShelleyInAlonzoBbodyPredFailure (ShelleyBbodyPredFailure era)
| TooManyExUnits
-- | Computed Sum of ExUnits for all plutus scripts
!ExUnits
-- ^ Computed Sum of ExUnits for all plutus scripts
-- | Maximum allowed by protocal parameters
!ExUnits
-- ^ Maximum allowed by protocal parameters
deriving (Generic)

newtype AlonzoBbodyEvent era
Expand Down Expand Up @@ -147,15 +147,15 @@ bbodyTransition =

actualBodySize
== fromIntegral (bhviewBSize bh)
?! ShelleyInAlonzoBbodyPredFailure
( WrongBlockBodySizeBBODY actualBodySize (fromIntegral $ bhviewBSize bh)
)
?! ShelleyInAlonzoBbodyPredFailure
( WrongBlockBodySizeBBODY actualBodySize (fromIntegral $ bhviewBSize bh)
)

actualBodyHash
== bhviewBHash bh
?! ShelleyInAlonzoBbodyPredFailure
( InvalidBodyHashBBODY @era actualBodyHash (bhviewBHash bh)
)
?! ShelleyInAlonzoBbodyPredFailure
( InvalidBodyHashBBODY @era actualBodyHash (bhviewBHash bh)
)

ls' <-
trans @(EraRule "LEDGERS" era) $
Expand Down
40 changes: 20 additions & 20 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Rules/Utxo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -121,37 +121,37 @@ data AlonzoUtxoPredFailure era
BadInputsUTxO
!(Set (TxIn (EraCrypto era)))
| OutsideValidityIntervalUTxO
-- | transaction's validity interval
!ValidityInterval
-- ^ transaction's validity interval
-- | current slot
!SlotNo
-- ^ current slot
| MaxTxSizeUTxO
-- | the actual transaction size
!Integer
-- ^ the actual transaction size
-- | the max transaction size
!Integer
-- ^ the max transaction size
| InputSetEmptyUTxO
| FeeTooSmallUTxO
-- | the minimum fee for this transaction
!Coin
-- ^ the minimum fee for this transaction
-- | the fee supplied in this transaction
!Coin
-- ^ the fee supplied in this transaction
| ValueNotConservedUTxO
-- | the Coin consumed by this transaction
!(Value era)
-- ^ the Coin consumed by this transaction
-- | the Coin produced by this transaction
!(Value era)
-- ^ the Coin produced by this transaction
| -- | the set of addresses with incorrect network IDs
WrongNetwork
-- | the expected network id
!Network
-- ^ the expected network id
-- | the set of addresses with incorrect network IDs
!(Set (Addr (EraCrypto era)))
-- ^ the set of addresses with incorrect network IDs
| WrongNetworkWithdrawal
-- | the expected network id
!Network
-- ^ the expected network id
-- | the set of reward addresses with incorrect network IDs
!(Set (RewardAcnt (EraCrypto era)))
-- ^ the set of reward addresses with incorrect network IDs
| -- | list of supplied transaction outputs that are too small
OutputTooSmallUTxO
![TxOut era]
Expand All @@ -166,35 +166,35 @@ data AlonzoUtxoPredFailure era
OutputTooBigUTxO
![(Integer, Integer, TxOut era)]
| InsufficientCollateral
-- | balance computed
!Coin
-- ^ balance computed
-- | the required collateral for the given fee
!Coin
-- ^ the required collateral for the given fee
| -- | The UTxO entries which have the wrong kind of script
ScriptsNotPaidUTxO
!(UTxO era)
| ExUnitsTooBigUTxO
-- | Max EXUnits from the protocol parameters
!ExUnits
-- ^ Max EXUnits from the protocol parameters
-- | EXUnits supplied
!ExUnits
-- ^ EXUnits supplied
| -- | The inputs marked for use as fees contain non-ADA tokens
CollateralContainsNonADA !(Value era)
| -- | Wrong Network ID in body
WrongNetworkInTxBody
-- | Actual Network ID
!Network
-- ^ Actual Network ID
-- | Network ID in transaction body
!Network
-- ^ Network ID in transaction body
| -- | slot number outside consensus forecast range
OutsideForecast
!SlotNo
| -- | There are too many collateral inputs
TooManyCollateralInputs
-- | Max allowed collateral inputs
!Natural
-- ^ Max allowed collateral inputs
-- | Number of collateral inputs
!Natural
-- ^ Number of collateral inputs
| NoCollateralInputs
deriving (Generic)

Expand Down
14 changes: 7 additions & 7 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Rules/Utxow.hs
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,20 @@ data AlonzoUtxowPredFailure era
MissingRedeemers
![(ScriptPurpose era, ScriptHash (EraCrypto era))]
| MissingRequiredDatums
-- | Set of missing data hashes
!(Set (DataHash (EraCrypto era)))
-- ^ Set of missing data hashes
-- | Set of received data hashes
!(Set (DataHash (EraCrypto era)))
-- ^ Set of received data hashes
| NonOutputSupplimentaryDatums
-- | Set of unallowed data hashes
!(Set (DataHash (EraCrypto era)))
-- ^ Set of unallowed data hashes
-- | Set of acceptable supplimental data hashes
!(Set (DataHash (EraCrypto era)))
-- ^ Set of acceptable supplimental data hashes
| PPViewHashesDontMatch
-- | The PPHash in the TxBody
!(StrictMaybe (ScriptIntegrityHash (EraCrypto era)))
-- ^ The PPHash in the TxBody
-- | Computed from the current Protocol Parameters
!(StrictMaybe (ScriptIntegrityHash (EraCrypto era)))
-- ^ Computed from the current Protocol Parameters
| -- | Set of witnesses which were needed and not supplied
MissingRequiredSigners
(Set (KeyHash 'Witness (EraCrypto era)))
Expand Down Expand Up @@ -401,7 +401,7 @@ alonzoStyleWitness = do

-- ================================

extSymmetricDifference :: (Ord k) => [a] -> (a -> k) -> [b] -> (b -> k) -> ([a], [b])
extSymmetricDifference :: Ord k => [a] -> (a -> k) -> [b] -> (b -> k) -> ([a], [b])
extSymmetricDifference as fa bs fb = (extraA, extraB)
where
intersection = Set.fromList (map fa as) `Set.intersection` Set.fromList (map fb bs)
Expand Down
6 changes: 3 additions & 3 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Scripts/Data.hs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ deriving via Mem PlutusData era instance Era era => DecCBOR (Annotator (Data era

type instance MemoHashIndex PlutusData = EraIndependentData

instance (EraCrypto era ~ c) => HashAnnotated (Data era) EraIndependentData c where
instance EraCrypto era ~ c => HashAnnotated (Data era) EraIndependentData c where
hashAnnotated = getMemoSafeHash

instance Typeable era => NoThunks (Data era)
Expand All @@ -134,7 +134,7 @@ newtype BinaryData era = BinaryData ShortByteString
deriving newtype (Eq, NoThunks, Ord, Show, SafeToHash)
deriving (Generic)

instance (EraCrypto era ~ c) => HashAnnotated (BinaryData era) EraIndependentData c
instance EraCrypto era ~ c => HashAnnotated (BinaryData era) EraIndependentData c

instance Typeable era => EncCBOR (BinaryData era) where
encCBOR (BinaryData sbs) = encodeTag 24 <> encCBOR sbs
Expand Down Expand Up @@ -185,7 +185,7 @@ dataHashSize :: StrictMaybe (DataHash c) -> Integer
dataHashSize SNothing = 0
dataHashSize (SJust _) = 10

instance (Crypto c) => HeapWords (StrictMaybe (DataHash c)) where
instance Crypto c => HeapWords (StrictMaybe (DataHash c)) where
heapWords SNothing = heapWords0
heapWords (SJust a) = heapWords1 a

Expand Down
2 changes: 1 addition & 1 deletion eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ alonzoMinFeeTx ::
Coin
alonzoMinFeeTx pp tx =
(tx ^. sizeTxF <×> pp ^. ppMinFeeAL)
<+> pp ^. ppMinFeeBL
<+> (pp ^. ppMinFeeBL)
<+> txscriptfee (pp ^. ppPricesL) allExunits
where
allExunits = totExUnits tx
Expand Down
4 changes: 2 additions & 2 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxAuxData.hs
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,14 @@ validateAlonzoTxAuxData pv auxData@AlonzoTxAuxData {atadMetadata = metadata} =
all validMetadatum metadata
&& all (validScript pv) (getAlonzoTxAuxDataScripts auxData)

instance (EraCrypto era ~ c) => HashAnnotated (AuxiliaryData era) EraIndependentTxAuxData c where
instance EraCrypto era ~ c => HashAnnotated (AuxiliaryData era) EraIndependentTxAuxData c where
hashAnnotated = getMemoSafeHash

deriving newtype instance NFData (AuxiliaryData era)

deriving instance Eq (AuxiliaryData era)

deriving instance (HashAlgorithm (HASH (EraCrypto era))) => Show (AuxiliaryData era)
deriving instance HashAlgorithm (HASH (EraCrypto era)) => Show (AuxiliaryData era)

type instance MemoHashIndex AlonzoTxAuxDataRaw = EraIndependentTxAuxData

Expand Down
2 changes: 1 addition & 1 deletion eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxBody.hs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ pattern AlonzoTxBody

type instance MemoHashIndex AlonzoTxBodyRaw = EraIndependentTxBody

instance (c ~ EraCrypto era) => HashAnnotated (AlonzoTxBody era) EraIndependentTxBody c where
instance c ~ EraCrypto era => HashAnnotated (AlonzoTxBody era) EraIndependentTxBody c where
hashAnnotated = getMemoSafeHash

-- ==============================================================================
Expand Down
2 changes: 1 addition & 1 deletion eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxOut.hs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ encodeAddress28 network paymentCred = do

encodeDataHash32 ::
forall c.
(HashAlgorithm (HASH c)) =>
HashAlgorithm (HASH c) =>
DataHash c ->
Maybe (SizeHash (HASH c) :~: 32, DataHash32)
encodeDataHash32 dataHash = do
Expand Down
6 changes: 3 additions & 3 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxSeq.hs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ deriving stock instance Eq (Tx era) => Eq (TxSeq era)

instance
forall era.
(Era era) =>
Era era =>
EncCBORGroup (TxSeq era)
where
encCBORGroup (TxSeq' _ bodyBytes witsBytes metadataBytes invalidBytes) =
Expand All @@ -167,7 +167,7 @@ instance

hashTxSeq ::
forall era.
(Era era) =>
Era era =>
AlonzoTxSeq era ->
Hash (EraCrypto era) EraIndependentBlockBody
hashTxSeq = hashAlonzoTxSeq
Expand All @@ -176,7 +176,7 @@ hashTxSeq = hashAlonzoTxSeq
-- | Hash a given block body
hashAlonzoTxSeq ::
forall era.
(Era era) =>
Era era =>
AlonzoTxSeq era ->
Hash (EraCrypto era) EraIndependentBlockBody
hashAlonzoTxSeq (TxSeq' _ bodies ws md vs) =
Expand Down
6 changes: 3 additions & 3 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxWits.hs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ unTxDats (TxDats' m) = m
nullDats :: TxDats era -> Bool
nullDats (TxDats' d) = Map.null d

instance (Era era) => DecCBOR (Annotator (TxDatsRaw era)) where
instance Era era => DecCBOR (Annotator (TxDatsRaw era)) where
decCBOR = decode $ fmap (TxDatsRaw . keyBy hashData) <$> listDecodeA From
{-# INLINE decCBOR #-}

Expand Down Expand Up @@ -301,7 +301,7 @@ instance Era era => EncCBOR (TxDats era)
deriving via
(Mem TxDatsRaw era)
instance
(Era era) => DecCBOR (Annotator (TxDats era))
Era era => DecCBOR (Annotator (TxDats era))

-- =====================================================
-- AlonzoTxWits instances
Expand Down Expand Up @@ -529,7 +529,7 @@ instance Era era => EncCBOR (Redeemers era)
deriving via
(Mem RedeemersRaw era)
instance
(Era era) => DecCBOR (Annotator (Redeemers era))
Era era => DecCBOR (Annotator (Redeemers era))

instance
( EraScript era
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ genScripts ::
Gen (Map.Map (ScriptHash (EraCrypto era)) (Script era))
genScripts = keyBy (hashScript @era) <$> (arbitrary :: Gen [Script era])

instance (Era era) => Arbitrary (TxDats era) where
instance Era era => Arbitrary (TxDats era) where
arbitrary = TxDats . keyBy hashData <$> arbitrary

instance
Expand Down Expand Up @@ -214,8 +214,7 @@ instance

genAlonzoScript ::
forall era.
( Era era
) =>
Era era =>
[Language] ->
Gen (AlonzoScript era)
genAlonzoScript langs = do
Expand Down
4 changes: 2 additions & 2 deletions eras/babbage/impl/src/Cardano/Ledger/Babbage/Rules/Utxo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ data BabbageUtxoPredFailure era
= AlonzoInBabbageUtxoPredFailure !(AlonzoUtxoPredFailure era) -- Inherited from Alonzo
| -- | The collateral is not equivalent to the total collateral asserted by the transaction
IncorrectTotalCollateralField
-- | collateral provided
!Coin
-- ^ collateral provided
-- | collateral amount declared in transaction body
!Coin
-- ^ collateral amount declared in transaction body
| -- | list of supplied transaction outputs that are too small,
-- together with the minimum value for the given output.
BabbageOutputTooSmallUTxO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import Lens.Micro
type instance TranslationContext (BabbageEra c) = ()

instance
(Crypto c) =>
Crypto c =>
TranslateEra (BabbageEra c) NewEpochState
where
translateEra ctxt nes =
Expand Down
Loading

0 comments on commit d4770d2

Please sign in to comment.