Skip to content
Merged
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
2 changes: 1 addition & 1 deletion eras/conway/impl/cddl-files/conway.cddl
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ signature = bytes .size 64

protocol_version = [major_protocol_version, uint]

major_protocol_version = 0 .. 12
major_protocol_version = 0 .. 11

transaction_body =
{ 0 : set<transaction_input>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import Test.HUnit (Assertion)
spec :: Spec
spec =
describe "Golden translation tests" $
it "golden/translation.cbor" $
xit "golden/translation.cbor" $
check "golden/translations.cbor"

check :: String -> Assertion
Expand Down
9 changes: 8 additions & 1 deletion eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/CDDL.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ module Test.Cardano.Ledger.Conway.CDDL (
module Test.Cardano.Ledger.Conway.CDDL,
) where

import Cardano.Ledger.BaseTypes (getVersion)
import Cardano.Ledger.Conway (ConwayEra)
import Cardano.Ledger.Core
import Codec.CBOR.Cuddle.Comments ((//-))
import Codec.CBOR.Cuddle.Huddle
import Data.Function (($))
Expand Down Expand Up @@ -155,7 +157,12 @@ header_body =
]

protocol_version :: Rule
protocol_version = "protocol_version" =:= arr [a $ major_protocol_version @ConwayEra, a VUInt]
protocol_version = "protocol_version" =:= arr [a $ conway_major_protocol_version, a VUInt]

conway_major_protocol_version :: Rule
conway_major_protocol_version =
"major_protocol_version"
=:= (getVersion @Integer (eraProtVerLow @ByronEra) ... getVersion @Integer (eraProtVerHigh @ConwayEra))

transaction_body :: Rule
transaction_body =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ firstHardForkCantFollow ::
, InjectRuleFailure "LEDGER" ConwayGovPredFailure era
) =>
ImpTestM era ()
firstHardForkCantFollow = do
firstHardForkCantFollow = whenMajorVersionAtMost @11 $ do
protver0 <- getProtVer
let protver1 = minorFollow protver0
protver2 = cantFollow protver1
Expand Down Expand Up @@ -1198,7 +1198,7 @@ secondHardForkCantFollow ::
, InjectRuleFailure "LEDGER" ConwayGovPredFailure era
) =>
ImpTestM era ()
secondHardForkCantFollow = do
secondHardForkCantFollow = whenMajorVersionAtMost @11 $ do
protver0 <- getProtVer
let protver1 = minorFollow protver0
protver2 = cantFollow protver1
Expand Down
4 changes: 4 additions & 0 deletions libs/cardano-ledger-binary/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Version history for `cardano-ledger-binary`

## 1.7.1.0

* Disable decoding version `12` and higher.

## 1.7.0.0

* Add `Random` instance for `Version`.
Expand Down
2 changes: 1 addition & 1 deletion libs/cardano-ledger-binary/cardano-ledger-binary.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: cardano-ledger-binary
version: 1.7.0.0
version: 1.7.1.0
license: Apache-2.0
maintainer: [email protected]
author: IOHK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,10 @@ unlessDecoderVersionAtLeast atLeast decoder = do
--------------------------------------------------------------------------------

decodeVersion :: Decoder s Version
decodeVersion = decodeWord64 >>= mkVersion64
decodeVersion = do
v <- decodeWord64 >>= mkVersion64
when (v >= natVersion @12) $ fail "Version number 12 and higher are not yet supported"
pure v
{-# INLINE decodeVersion #-}

-- | `Decoder` for `Rational`. Versions variance:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
Expand Down Expand Up @@ -205,7 +206,7 @@ deriving instance Arbitrary SystemStart
deriving instance Arbitrary BlockNo

instance Arbitrary Version where
arbitrary = genVersion minBound maxBound
arbitrary = genVersion minBound (natVersion @11)

genVersion :: HasCallStack => Version -> Version -> Gen Version
genVersion minVersion maxVersion =
Expand Down