Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ source-repository-package
-- see CONTRIBUTING.md#to-update-the-referenced-agda-ledger-spec
index-state:
, hackage.haskell.org 2025-12-11T11:28:18Z
, cardano-haskell-packages 2025-12-10T11:48:32Z
, cardano-haskell-packages 2025-12-24T01:24:22Z

packages:
-- == Byron era ==
Expand Down Expand Up @@ -103,3 +103,22 @@ source-repository-package
subdir: merkle-tree-incremental mempack-scls scls-cbor scls-cardano scls-format scls-core
--sha256: 1sprdlsgj0b4s9fw0hybl19yfnqdahkskkmw9mq5ng23f80qwbvs
tag: 55d9af32aab35909a4f083797876d3e802835225

source-repository-package
type: git
location: https://github.com/IntersectMBO/cardano-base.git
--sha256: sha256-13DXeYP6hmmC3NQa9hevhalScal+eO9Pw/dnYqo7nC0=
tag: c3169a9fc24f702fa4b3ab1b75d47ffff6a42067
subdir:
base-deriving-via
cardano-base
cardano-binary
cardano-crypto-class
cardano-crypto-praos
cardano-slotting
cardano-strict-containers
heapwords
measures

allow-newer:
plutus-core:cardano-crypto-class
4 changes: 2 additions & 2 deletions eras/byron/ledger/impl/cardano-ledger-byron.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ library
binary,
bytestring,
canonical-json,
cardano-binary,
cardano-binary >=1.7.3,
cardano-crypto,
cardano-crypto-wrapper >=1.6,
cardano-ledger-binary >=1.8,
Expand Down Expand Up @@ -346,7 +346,7 @@ library testlib
byron-spec-chain,
byron-spec-ledger,
bytestring,
cardano-binary:{cardano-binary, testlib} >=1.7.2,
cardano-binary:{cardano-binary, testlib},
cardano-crypto,
cardano-crypto-wrapper:{cardano-crypto-wrapper, testlib},
cardano-ledger-binary:{cardano-ledger-binary, testlib},
Expand Down
2 changes: 1 addition & 1 deletion eras/byron/ledger/impl/src/Cardano/Chain/Block/Block.hs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ decCBORABlockOrBoundary epochSlots = do
decCBOR @Word >>= \case
0 -> ABOBBoundary <$> decCBORABoundaryBlock
1 -> ABOBBlock <$> decCBORABlock epochSlots
t -> cborError $ DecoderErrorUnknownTag "Block" (fromIntegral t)
t -> cborError $ DecoderErrorUnknownTag "Block" t

encCBORABlockOrBoundary ::
ProtocolMagicId -> EpochSlots -> ABlockOrBoundary a -> Encoding
Expand Down
6 changes: 3 additions & 3 deletions eras/byron/ledger/impl/src/Cardano/Chain/Block/Header.hs
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ decCBORHeaderToHash epochSlots = do
void decCBORABoundaryHeader
pure Nothing
1 -> Just <$!> decCBORHeader epochSlots
t -> cborError $ DecoderErrorUnknownTag "Header" (fromIntegral t)
t -> cborError $ DecoderErrorUnknownTag "Header" t

--------------------------------------------------------------------------------
-- Header Formatting
Expand Down Expand Up @@ -691,13 +691,13 @@ instance DecCBOR BlockSignature where
instance DecCBOR (ABlockSignature ByteSpan) where
decCBOR = do
enforceSize "BlockSignature" 2
decCBOR >>= \case
decCBOR @Word8 >>= \case
2 ->
ABlockSignature
<$ enforceSize "BlockSignature" 2
<*> decCBOR
<*> decCBOR
t -> cborError $ DecoderErrorUnknownTag "BlockSignature" t
t -> cborError $ DecoderErrorUnknownTag "BlockSignature" $ fromIntegral @Word8 @Word t

--------------------------------------------------------------------------------
-- ToSign
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeApplications #-}

module Cardano.Chain.Byron.API.Mempool (
ApplyMempoolPayloadErr (..),
Expand Down Expand Up @@ -70,7 +71,7 @@ instance DecCBOR ApplyMempoolPayloadErr where
1 -> MempoolDlgErr <$> decCBOR
2 -> MempoolUpdateProposalErr <$> decCBOR
3 -> MempoolUpdateVoteErr <$> decCBOR
tag -> cborError $ DecoderErrorUnknownTag "ApplyMempoolPayloadErr" tag
tag -> cborError $ DecoderErrorUnknownTag "ApplyMempoolPayloadErr" $ fromIntegral @Word8 @Word tag

applyMempoolPayload ::
MonadError ApplyMempoolPayloadErr m =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ instance DecCBOR AddrSpendingData where
decodeWord8Canonical >>= \case
0 -> VerKeyASD <$> decCBOR
2 -> RedeemASD <$> decCBOR
tag -> cborError $ DecoderErrorUnknownTag "AddrSpendingData" tag
tag -> cborError $ DecoderErrorUnknownTag "AddrSpendingData" $ fromIntegral @Word8 @Word tag

-- | Type of an address. It corresponds to constructors of 'AddrSpendingData'.
-- It's separated, because 'Address' doesn't store 'AddrSpendingData', but we
Expand Down Expand Up @@ -110,7 +110,7 @@ instance DecCBOR AddrType where
decodeWord8Canonical >>= \case
0 -> pure ATVerKey
2 -> pure ATRedeem
tag -> cborError $ DecoderErrorUnknownTag "AddrType" tag
tag -> cborError $ DecoderErrorUnknownTag "AddrType" $ fromIntegral @Word8 @Word tag

instance HeapWords AddrType where
heapWords = \case
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ instance DecCBOR LovelaceError where
1 -> checkSize 2 >> LovelaceTooLarge <$> decCBOR
2 -> checkSize 2 >> LovelaceTooSmall <$> decCBOR
3 -> checkSize 3 >> LovelaceUnderflow <$> decCBOR <*> decCBOR
_ -> cborError $ DecoderErrorUnknownTag "TxValidationError" tag
_ -> cborError $ DecoderErrorUnknownTag "TxValidationError" $ fromIntegral @Word8 @Word tag

-- | Maximal possible value of 'Lovelace'
maxLovelaceVal :: Word64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ instance DecCBOR NetworkMagic where
case tag of
0 -> matchSize "NetworkMagic" 1 len $> NetworkMainOrStage
1 -> matchSize "NetworkMagic" 2 len >> NetworkTestnet <$> decCBOR
_ -> cborError $ DecoderErrorUnknownTag "NetworkMagic" tag
_ -> cborError $ DecoderErrorUnknownTag "NetworkMagic" $ fromIntegral @Word8 @Word tag

makeNetworkMagic :: AProtocolMagic a -> NetworkMagic
makeNetworkMagic pm = case getRequiresNetworkMagic pm of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ instance DecCBOR TxFeePolicy where
tag <- decCBOR @Word8
case tag of
0 -> TxFeePolicyTxSizeLinear <$> decodeKnownCborDataItem
_ -> cborError $ DecoderErrorUnknownTag "TxFeePolicy" tag
_ -> cborError $ DecoderErrorUnknownTag "TxFeePolicy" $ fromIntegral @Word8 @Word tag

instance Monad m => ToJSON m TxFeePolicy where
-- We multiply by 1e9 to keep compatibility with 'Nano' coefficients
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}

module Cardano.Chain.Delegation.Validation.Scheduling (
-- * Scheduling
Expand Down Expand Up @@ -168,7 +169,7 @@ instance DecCBOR Error where
2 -> checkSize 3 >> MultipleDelegationsForSlot <$> decCBOR <*> decCBOR
3 -> checkSize 2 >> NonGenesisDelegator <$> decCBOR
4 -> checkSize 3 >> WrongEpoch <$> decCBOR <*> decCBOR
_ -> cborError $ DecoderErrorUnknownTag "Scheduling.Error" tag
_ -> cborError $ DecoderErrorUnknownTag "Scheduling.Error" $ fromIntegral @Word8 @Word tag

-- | Update the delegation 'State' with a 'Certificate' if it passes
-- all the validation rules. This is an implementation of the delegation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ instance DecCBOR (AMempoolPayload ByteSpan) where
1 -> MempoolDlg <$> decCBOR
2 -> MempoolUpdateProposal <$> decCBOR
3 -> MempoolUpdateVote <$> decCBOR
tag -> cborError $ DecoderErrorUnknownTag "MempoolPayload" tag
tag -> cborError $ DecoderErrorUnknownTag "MempoolPayload" $ fromIntegral @Word8 @Word tag
9 changes: 5 additions & 4 deletions eras/byron/ledger/impl/src/Cardano/Chain/Ssc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}

module Cardano.Chain.Ssc (
SscPayload (..),
Expand Down Expand Up @@ -75,7 +76,7 @@ instance DecCBOR SscPayload where
dropSscPayload :: Dropper s
dropSscPayload = do
actualLen <- decodeListLen
decCBOR >>= \case
decCBOR @Word8 >>= \case
0 -> do
matchSize "CommitmentsPayload" 3 actualLen
dropCommitmentsMap
Expand All @@ -91,7 +92,7 @@ dropSscPayload = do
3 -> do
matchSize "CertificatesPayload" 2 actualLen
dropVssCertificatesMap
t -> cborError $ DecoderErrorUnknownTag "SscPayload" t
t -> cborError $ DecoderErrorUnknownTag "SscPayload" $ fromIntegral @Word8 @Word t

--------------------------------------------------------------------------------
-- SscProof
Expand Down Expand Up @@ -168,7 +169,7 @@ instance DecCBOR SscProof where
dropSscProof :: Dropper s
dropSscProof = do
actualLen <- decodeListLen
decCBOR >>= \case
decCBOR @Word8 >>= \case
0 -> do
matchSize "CommitmentsProof" 3 actualLen
dropBytes
Expand All @@ -184,7 +185,7 @@ dropSscProof = do
3 -> do
matchSize "CertificatesProof" 2 actualLen
dropBytes
t -> cborError $ DecoderErrorUnknownTag "SscProof" t
t -> cborError $ DecoderErrorUnknownTag "SscProof" $ fromIntegral @Word8 @Word t

--------------------------------------------------------------------------------
-- CommitmentsMap
Expand Down
2 changes: 1 addition & 1 deletion eras/byron/ledger/impl/src/Cardano/Chain/UTxO/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ instance DecCBOR TxIn where
tag <- decCBOR @Word8
case tag of
0 -> uncurry TxInUtxo <$> decodeKnownCborDataItem
_ -> cborError $ DecoderErrorUnknownTag "TxIn" tag
_ -> cborError $ DecoderErrorUnknownTag "TxIn" $ fromIntegral @Word8 @Word tag

instance HeapWords TxIn where
heapWords (TxInUtxo txid _w16) = 3 + heapWords txid + 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ instance DecCBOR TxInWitness where
2 -> do
matchSize "TxInWitness.RedeemWitness" len 2
uncurry RedeemWitness <$> decodeKnownCborDataItem
tag -> cborError $ DecoderErrorUnknownTag "TxInWitness" tag
tag -> cborError $ DecoderErrorUnknownTag "TxInWitness" $ fromIntegral @Word8 @Word tag

-- | Data that is being signed when creating a TxSig
newtype TxSigData = TxSigData
Expand Down
2 changes: 1 addition & 1 deletion eras/byron/ledger/impl/src/Cardano/Chain/UTxO/UTxO.hs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ instance DecCBOR UTxOError where
case tag of
0 -> matchSize "UTxOError" 2 len >> UTxOMissingInput <$> decCBOR
1 -> matchSize "UTxOError" 1 len $> UTxOOverlappingUnion
_ -> cborError $ DecoderErrorUnknownTag "UTxOError" tag
_ -> cborError $ DecoderErrorUnknownTag "UTxOError" $ fromIntegral @Word8 @Word tag

empty :: UTxO
empty = UTxO mempty
Expand Down
4 changes: 2 additions & 2 deletions eras/byron/ledger/impl/src/Cardano/Chain/UTxO/Validation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ instance DecCBOR TxValidationError where
6 -> checkSize 3 >> TxValidationTxTooLarge <$> decCBOR <*> decCBOR
7 -> checkSize 1 $> TxValidationUnknownAddressAttributes
8 -> checkSize 1 $> TxValidationUnknownAttributes
_ -> cborError $ DecoderErrorUnknownTag "TxValidationError" tag
_ -> cborError $ DecoderErrorUnknownTag "TxValidationError" $ fromIntegral @Word8 @Word tag

-- | Validate that:
--
Expand Down Expand Up @@ -353,7 +353,7 @@ instance DecCBOR UTxOValidationError where
decodeWord8 >>= \case
0 -> UTxOValidationTxValidationError <$> decCBOR
1 -> UTxOValidationUTxOError <$> decCBOR
tag -> cborError $ DecoderErrorUnknownTag "UTxOValidationError" tag
tag -> cborError $ DecoderErrorUnknownTag "UTxOValidationError" $ fromIntegral @Word8 @Word tag

-- | Validate a transaction and use it to update the 'UTxO'
updateUTxOTx ::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}

module Cardano.Chain.Update.ApplicationName (
ApplicationName (..),
Expand Down Expand Up @@ -94,7 +95,7 @@ instance DecCBOR ApplicationNameError where
case tag of
0 -> checkSize 2 >> ApplicationNameTooLong <$> decCBOR
1 -> checkSize 2 >> ApplicationNameNotAscii <$> decCBOR
_ -> cborError $ DecoderErrorUnknownTag "ApplicationNameError" tag
_ -> cborError $ DecoderErrorUnknownTag "ApplicationNameError" $ fromIntegral @Word8 @Word tag

instance B.Buildable ApplicationNameError where
build = \case
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}

module Cardano.Chain.Update.SoftwareVersion (
SoftwareVersion (..),
Expand Down Expand Up @@ -96,7 +97,7 @@ instance DecCBOR SoftwareVersionError where
tag <- decodeWord8
case tag of
0 -> SoftwareVersionApplicationNameError <$> decCBOR
_ -> cborError $ DecoderErrorUnknownTag "SoftwareVersionError" tag
_ -> cborError $ DecoderErrorUnknownTag "SoftwareVersionError" $ fromIntegral @Word8 @Word tag

instance B.Buildable SoftwareVersionError where
build = \case
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}

module Cardano.Chain.Update.SystemTag (
SystemTag (..),
Expand Down Expand Up @@ -97,7 +98,7 @@ instance DecCBOR SystemTagError where
case tag of
0 -> checkSize 2 >> SystemTagNotAscii <$> decCBOR
1 -> checkSize 2 >> SystemTagTooLong <$> decCBOR
_ -> cborError $ DecoderErrorUnknownTag "SystemTagError" tag
_ -> cborError $ DecoderErrorUnknownTag "SystemTagError" $ fromIntegral @Word8 @Word tag

instance B.Buildable SystemTagError where
build = \case
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}

module Cardano.Chain.Update.Validation.Endorsement (
Environment (..),
Expand Down Expand Up @@ -140,7 +141,7 @@ instance DecCBOR Error where
tag <- decodeWord8
case tag of
0 -> MultipleProposalsForProtocolVersion <$> decCBOR
_ -> cborError $ DecoderErrorUnknownTag "Endorsement.Error" tag
_ -> cborError $ DecoderErrorUnknownTag "Endorsement.Error" $ fromIntegral @Word8 @Word tag

-- | Register an endorsement.
--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}

-- | Blockchain interface validation rules.
module Cardano.Chain.Update.Validation.Interface (
Expand Down Expand Up @@ -211,7 +212,7 @@ instance DecCBOR Error where
1 -> checkSize 2 >> Voting <$> decCBOR
2 -> checkSize 2 >> Endorsement <$> decCBOR
3 -> checkSize 2 >> NumberOfGenesisKeysTooLarge <$> decCBOR
_ -> cborError $ DecoderErrorUnknownTag "Interface.Error" tag
_ -> cborError $ DecoderErrorUnknownTag "Interface.Error" $ fromIntegral @Word8 @Word tag

-- | Signal combining signals from various rules
data Signal = Signal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}

-- | Validation rules for registering updates
--
Expand Down Expand Up @@ -290,7 +291,7 @@ instance DecCBOR Error where
11 -> checkSize 2 >> SoftwareVersionError <$> decCBOR
12 -> checkSize 2 >> SystemTagError <$> decCBOR
13 -> checkSize 1 >> pure NullUpdateProposal
_ -> cborError $ DecoderErrorUnknownTag "Registration.Error" tag
_ -> cborError $ DecoderErrorUnknownTag "Registration.Error" $ fromIntegral @Word8 @Word tag

data TooLarge n = TooLarge
{ tlActual :: n
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}

-- | Validation rules for registering votes and confirming proposals
--
Expand Down Expand Up @@ -119,7 +120,7 @@ instance DecCBOR Error where
1 -> checkSize 2 >> VotingProposalNotRegistered <$> decCBOR
2 -> checkSize 2 >> VotingVoterNotDelegate <$> decCBOR
3 -> checkSize 2 >> VotingVoteAlreadyCast <$> decCBOR
_ -> cborError $ DecoderErrorUnknownTag "Voting.Error" tag
_ -> cborError $ DecoderErrorUnknownTag "Voting.Error" $ fromIntegral @Word8 @Word tag

-- | Register a vote and confirm the corresponding proposal if it passes the
-- voting threshold. This corresponds to the @UPVOTE@ rules in the spec.
Expand Down
5 changes: 3 additions & 2 deletions eras/mary/impl/cardano-ledger-mary.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ library
base >=4.18 && <5,
base16-bytestring,
bytestring,
cardano-crypto-class,
cardano-crypto-class ^>=2.3,
cardano-data ^>=1.3,
cardano-ledger-allegra ^>=1.9,
cardano-ledger-binary >=1.4,
Expand Down Expand Up @@ -163,10 +163,11 @@ library testlib
build-depends:
base,
bytestring,
cardano-base:testlib,
cardano-crypto-class,
cardano-data:testlib,
cardano-ledger-allegra:testlib,
cardano-ledger-binary:{cardano-ledger-binary, testlib},
cardano-ledger-binary,
cardano-ledger-core:{cardano-ledger-core, testlib},
cardano-ledger-mary,
cardano-ledger-shelley:{cardano-ledger-shelley, testlib},
Expand Down
Loading