Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
929c550
Implement standart canonical state instances
qnikst Dec 15, 2025
ae17f46
Introduce an example utility to read scls file
qnikst Dec 15, 2025
705602f
Remove OVERLAPPING pragma as we do not need them anymore
qnikst Dec 16, 2025
f1ca45d
Parethises hunt
qnikst Dec 16, 2025
61fa238
Put scls package source-repository-package repository in a single entry
qnikst Dec 16, 2025
ee0a666
Update the path to cls repository
qnikst Dec 16, 2025
ea03b5c
carnano-ledger-conway fix typo in tests
qnikst Dec 16, 2025
1bc03ed
Remove ImportQualifiedPost
qnikst Dec 16, 2025
c71bf0a
Use explicit import
qnikst Dec 16, 2025
7aa9529
Support Nonce namespace
qnikst Dec 18, 2025
82219d9
Merge branch 'master' into scls-canonical-2
qnikst Jan 7, 2026
e5d2cc3
Update usage to support changes in cardano-ledger
qnikst Jan 7, 2026
4dd40d8
SCLS: update canonical gov/constitution with proxy types
qnikst Jan 13, 2026
22862dc
Scls gov/committee/v0 use proxy types for instances
qnikst Jan 13, 2026
f0a1750
Update style in Nonce namespace
qnikst Jan 14, 2026
d05eed3
Support proxe data types in PParams
qnikst Jan 14, 2026
b3c522e
Do not use CoinPerByte in proxy types for the PParams
qnikst Jan 14, 2026
5bf0cfa
Introduce CanonicalExUnits proxy type
qnikst Jan 14, 2026
5258282
Introduce CanonicalPurposeId proxy type
qnikst Jan 14, 2026
b07eb5f
Introduce CanonicalRewardAccount
qnikst Jan 14, 2026
d807767
Add CanonicalWithOrigin proxy type
qnikst Jan 14, 2026
5eba199
Implement CanonicalNonce type
qnikst Jan 14, 2026
9d04e42
Introduce canonical types for the PoolStake
qnikst Jan 14, 2026
2ae0d57
Add more canonical wrappers
qnikst Jan 14, 2026
08558df
WIP
qnikst Jan 15, 2026
72bd5c4
Add test-suite
qnikst Jan 19, 2026
5328f14
Introduce a hierarchy for namespaces
qnikst Jan 19, 2026
fded10f
Introduce testlib and updates
qnikst Jan 19, 2026
8ce326e
Update hierarchy
qnikst Jan 19, 2026
bc93ce8
Port era-dependent scls code a-top of the canonical-ledger library
qnikst Jan 19, 2026
fb21740
Restructure SCLS libraries
qnikst Jan 20, 2026
5b871a1
Merge remote-tracking branch 'origin/master' into scls-canonical-2
qnikst Jan 21, 2026
5240e65
Merge remote-tracking branch 'origin/master' into scls-canonical-2
qnikst Jan 21, 2026
0cc8548
Update cardano-canonical to support new Metadata representation
qnikst Jan 21, 2026
19ed0f9
Update scls code to the lastest changes in the library
qnikst Jan 23, 2026
dcf7d53
Merge remote-tracking branch 'origin/master' into scls-canonical-2
qnikst Jan 23, 2026
283dfe2
Update scls to support RewardAccount renaming
qnikst Jan 23, 2026
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
1 change: 1 addition & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ packages:
libs/small-steps
libs/cardano-data
libs/vector-map
libs/cardano-canonical
eras/byron/chain/executable-spec
eras/byron/ledger/executable-spec
eras/byron/ledger/impl
Expand Down
88 changes: 84 additions & 4 deletions eras/conway/impl/cardano-ledger-conway.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,76 @@ library testlib
time,
tree-diff,

library scls
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We try to avoid abbreviations as much as possible

Suggested change
library scls
library canonical-state

exposed-modules:
Cardano.Ledger.Conway.SCLS
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will be a better prefix. Again abbreviations are not really saving time.

Suggested change
Cardano.Ledger.Conway.SCLS
Cardano.Ledger.Conway.CanonicalState

Cardano.Ledger.Conway.SCLS.Namespace.GovCommittee
Cardano.Ledger.Conway.SCLS.Namespace.GovConstitution
Cardano.Ledger.Conway.SCLS.Namespace.GovPParams
Cardano.Ledger.Conway.SCLS.Namespace.GovProposals
Cardano.Ledger.Conway.SCLS.Namespace.UTxO

visibility: public
hs-source-dirs: scls/src
default-language: Haskell2010
ghc-options:
-Wall
-Wcompat
-Wincomplete-record-updates
-Wincomplete-uni-patterns
-Wpartial-fields
-Wredundant-constraints
-Wunused-packages
-Werror

build-depends:
base,
-- bytestring,
cardano-canonical,
cardano-ledger-allegra,
cardano-ledger-alonzo,
cardano-ledger-babbage,
cardano-ledger-binary,
cardano-ledger-conway,
cardano-ledger-core,
cardano-ledger-mary,
cardano-ledger-shelley,
-- cardano-slotting,
-- cardano-strict-containers,
bytestring,
cborg,
containers,
-- mempack,
-- scls-cbor,
-- scls-core,

library scls-testlib
exposed-modules:
Cardano.Ledger.Conway.SCLS.Arbitrary

visibility: public
hs-source-dirs: scls/testlib
default-language: Haskell2010
ghc-options:
-Wall
-Wcompat
-Wincomplete-record-updates
-Wincomplete-uni-patterns
-Wpartial-fields
-Wredundant-constraints
-Wunused-packages
-Werror

build-depends:
QuickCheck,
base,
cardano-ledger-core,
cardano-ledger-conway:{cardano-ledger-conway, testlib, scls},
cardano-ledger-babbage:{cardano-ledger-babbage, testlib},
cardano-ledger-shelley:{cardano-ledger-shelley, testlib},
cardano-canonical:{cardano-canonical, testlib},
generic-random,

executable gen-golden
main-is: GenerateGoldenFileMain.hs
hs-source-dirs: test
Expand Down Expand Up @@ -275,6 +345,7 @@ test-suite tests
Test.Cardano.Ledger.Conway.Binary.CddlSpec
Test.Cardano.Ledger.Conway.GoldenSpec
Test.Cardano.Ledger.Conway.GoldenTranslation
Test.Cardano.Ledger.Conway.Scls

default-language: Haskell2010
ghc-options:
Expand All @@ -284,7 +355,7 @@ test-suite tests
-Wincomplete-uni-patterns
-Wredundant-constraints
-Wpartial-fields
-Wunused-packages
-- -Wunused-packages
-threaded
-rtsopts
-with-rtsopts=-N
Expand All @@ -295,8 +366,17 @@ test-suite tests
cardano-ledger-allegra,
cardano-ledger-alonzo:{cardano-ledger-alonzo, testlib},
cardano-ledger-binary:testlib,
cardano-ledger-conway,
cardano-ledger-conway:cddl,
cardano-ledger-conway:{cardano-ledger-conway, cddl, scls, scls-testlib},
cardano-ledger-core:{cardano-ledger-core, testlib},
cardano-ledger-shelley:testlib,
cardano-ledger-shelley:{testlib},
scls-cardano:testlib,
testlib,

--
containers,
bytestring,
cardano-ledger-byron,
cardano-strict-containers,
cardano-canonical,
cardano-ledger-byron,
-- cardano-ledger-test,
25 changes: 25 additions & 0 deletions eras/conway/impl/scls/src/Cardano/Ledger/Conway/SCLS.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module Cardano.Ledger.Conway.SCLS (
module Cardano.Ledger.SCLS.Common,
module Cardano.Ledger.SCLS.Namespace.Blocks.V0,
module Cardano.Ledger.Conway.SCLS.Namespace.GovCommittee,
module Cardano.Ledger.Conway.SCLS.Namespace.GovConstitution,
module Cardano.Ledger.Conway.SCLS.Namespace.GovPParams,
module Cardano.Ledger.Conway.SCLS.Namespace.GovProposals,
module Cardano.Ledger.SCLS.Namespace.Nonces.V0,
module Cardano.Ledger.SCLS.Namespace.PoolStake.V0,
module Cardano.Ledger.SCLS.Namespace.Pots.V0,
module Cardano.Ledger.SCLS.Namespace.Snapshots.V0,
module Cardano.Ledger.Conway.SCLS.Namespace.UTxO,
) where

import Cardano.Ledger.Conway.SCLS.Namespace.GovCommittee
import Cardano.Ledger.Conway.SCLS.Namespace.GovConstitution
import Cardano.Ledger.Conway.SCLS.Namespace.GovPParams
import Cardano.Ledger.Conway.SCLS.Namespace.GovProposals
import Cardano.Ledger.Conway.SCLS.Namespace.UTxO
import Cardano.Ledger.SCLS.Common
import Cardano.Ledger.SCLS.Namespace.Blocks.V0
import Cardano.Ledger.SCLS.Namespace.Nonces.V0
import Cardano.Ledger.SCLS.Namespace.PoolStake.V0
import Cardano.Ledger.SCLS.Namespace.Pots.V0
import Cardano.Ledger.SCLS.Namespace.Snapshots.V0
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{-# LANGUAGE RecordWildCards #-}

module Cardano.Ledger.Conway.SCLS.Namespace.GovCommittee (
module Cardano.Ledger.SCLS.Namespace.GovCommittee.V0,
mkCanonicalCommitteeState,
fromCanonicalCommitteeState,
) where

import Cardano.Ledger.Conway (ConwayEra)
import Cardano.Ledger.SCLS.Common (
fromCanonicalCredential,
mkCanonicalCredential,
)
import Cardano.Ledger.SCLS.Namespace.GovCommittee.V0
import Cardano.Ledger.State (CommitteeState (..))
import qualified Data.Map.Strict as Map

mkCanonicalCommitteeState :: CommitteeState ConwayEra -> CanonicalCommitteeState
mkCanonicalCommitteeState CommitteeState {..} =
CanonicalCommitteeState
( Map.fromList
[ (mkCanonicalCredential k, mkCanonicalCommitteeAuthorization v)
| (k, v) <- Map.toList csCommitteeCreds
]
)

fromCanonicalCommitteeState :: CanonicalCommitteeState -> CommitteeState ConwayEra
fromCanonicalCommitteeState CanonicalCommitteeState {..} =
CommitteeState
( Map.fromList
[ (fromCanonicalCredential k, fromCanonicalCommitteeAuthorization v)
| (k, v) <- Map.toList csCommitteeCreds
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE RecordWildCards #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Cardano.Ledger.Conway.SCLS.Namespace.GovConstitution (
module Cardano.Ledger.SCLS.Namespace.GovConstitution.V0,
) where

import Cardano.Ledger.Conway (ConwayEra)
import Cardano.Ledger.Conway.Governance (Constitution (..))
import Cardano.Ledger.SCLS.Namespace.GovConstitution.V0

instance IsCanonicalConstitution (Constitution ConwayEra) where
mkCanonicalConstitution Constitution {..} = CanonicalConstitution {..}
fromCanonicalConstitution CanonicalConstitution {..} = Constitution {..}
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE RecordWildCards #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Cardano.Ledger.Conway.SCLS.Namespace.GovPParams (
module Cardano.Ledger.SCLS.Namespace.GovPParams.V0,
) where

import Cardano.Ledger.Alonzo.PParams (OrdExUnits (..))
import Cardano.Ledger.Conway (ConwayEra)
import Cardano.Ledger.Conway.PParams (
ConwayPParams (..),
DRepVotingThresholds (..),
PoolVotingThresholds (..),
THKD (..),
)
import Cardano.Ledger.Core (PParams (..))
import Cardano.Ledger.SCLS.Common (
CoinPerByte (..),
fromCanonicalCoin,
mkCanonicalCoin,
)
import Cardano.Ledger.SCLS.Namespace.GovPParams.V0
import Data.Function ((&))

instance IsCanonicalPParams (PParams ConwayEra) where
mkCanonicalPParams (PParams ConwayPParams {..}) =
CanonicalPParams
{ ccppA0 = unTHKD cppA0
, ccppTxFeePerByte = mkCanonicalCoin $ unCoinPerByte $ unTHKD cppTxFeePerByte
, ccppTxFeeFixed = mkCanonicalCoin $ unTHKD cppTxFeeFixed
, ccppMaxBBSize = unTHKD cppMaxBBSize
, ccppMaxTxSize = unTHKD cppMaxTxSize
, ccppMaxBHSize = unTHKD cppMaxBHSize
, ccppKeyDeposit = mkCanonicalCoin $ unTHKD cppKeyDeposit
, ccppPoolDeposit = mkCanonicalCoin $ unTHKD cppPoolDeposit
, ccppEMax = unTHKD cppEMax
, ccppNOpt = unTHKD cppNOpt
, ccppRho = unTHKD cppRho
, ccppTau = unTHKD cppTau
, ccppProtocolVersion = cppProtocolVersion
, ccppMinPoolCost = mkCanonicalCoin $ unTHKD cppMinPoolCost
, ccppCoinsPerUTxOByte = mkCanonicalCoin $ unCoinPerByte $ unTHKD cppCoinsPerUTxOByte
, ccppCostModels = mkCanonicalCostModels $ unTHKD cppCostModels
, ccppPrices = mkCanonicalPrices $ unTHKD cppPrices
, ccppMaxTxExUnits = unTHKD cppMaxTxExUnits & unOrdExUnits & mkCanonicalExUnits
, ccppMaxBlockExUnits = unTHKD cppMaxBlockExUnits & unOrdExUnits & mkCanonicalExUnits
, ccppMaxValSize = unTHKD cppMaxValSize
, ccppCollateralPercentage = unTHKD cppCollateralPercentage
, ccppMaxCollateralInputs = unTHKD cppMaxCollateralInputs
, ccppPoolVotingThresholds = mkCanonicalPoolVotingThresholds $ unTHKD cppPoolVotingThresholds
, ccppDRepVotingThresholds = mkCanonicalDRepVotingThresholds $ unTHKD cppDRepVotingThresholds
, ccppCommitteeMinSize = unTHKD cppCommitteeMinSize
, ccppCommitteeMaxTermLength = unTHKD cppCommitteeMaxTermLength
, ccppGovActionLifetime = unTHKD cppGovActionLifetime
, ccppGovActionDeposit = mkCanonicalCoin $ unTHKD cppGovActionDeposit
, ccppDRepDeposit = mkCanonicalCoin $ unTHKD cppDRepDeposit
, ccppDRepActivity = unTHKD cppDRepActivity
, ccppMinFeeRefScriptCostPerByte = unTHKD cppMinFeeRefScriptCostPerByte
}

fromCanonicalPParams CanonicalPParams {..} =
PParams
ConwayPParams
{ cppA0 = THKD ccppA0
, cppTxFeePerByte = THKD (CoinPerByte $ fromCanonicalCoin ccppTxFeePerByte)
, cppTxFeeFixed = THKD (fromCanonicalCoin ccppTxFeeFixed)
, cppMaxBBSize = THKD ccppMaxBBSize
, cppMaxTxSize = THKD ccppMaxTxSize
, cppMaxBHSize = THKD ccppMaxBHSize
, cppKeyDeposit = THKD (fromCanonicalCoin ccppKeyDeposit)
, cppPoolDeposit = THKD (fromCanonicalCoin ccppPoolDeposit)
, cppEMax = THKD ccppEMax
, cppNOpt = THKD ccppNOpt
, cppRho = THKD ccppRho
, cppTau = THKD ccppTau
, cppProtocolVersion = ccppProtocolVersion
, cppMinPoolCost = THKD (fromCanonicalCoin ccppMinPoolCost)
, cppCoinsPerUTxOByte = THKD (CoinPerByte $ fromCanonicalCoin ccppCoinsPerUTxOByte)
, cppCostModels = THKD (fromCanonicalCostModels ccppCostModels)
, cppPrices = THKD (fromCanonicalPrices ccppPrices)
, cppMaxTxExUnits = THKD (ccppMaxTxExUnits & fromCanonicalExUnits & OrdExUnits)
, cppMaxBlockExUnits = THKD (ccppMaxBlockExUnits & fromCanonicalExUnits & OrdExUnits)
, cppMaxValSize = THKD ccppMaxValSize
, cppCollateralPercentage = THKD ccppCollateralPercentage
, cppMaxCollateralInputs = THKD ccppMaxCollateralInputs
, cppPoolVotingThresholds = THKD (fromCanonicalPoolVotingThresholds ccppPoolVotingThresholds)
, cppDRepVotingThresholds = THKD (fromCanonicalDRepVotingThresholds ccppDRepVotingThresholds)
, cppCommitteeMinSize = THKD ccppCommitteeMinSize
, cppCommitteeMaxTermLength = THKD ccppCommitteeMaxTermLength
, cppGovActionLifetime = THKD ccppGovActionLifetime
, cppGovActionDeposit = THKD (fromCanonicalCoin ccppGovActionDeposit)
, cppDRepDeposit = THKD (fromCanonicalCoin ccppDRepDeposit)
, cppDRepActivity = THKD ccppDRepActivity
, cppMinFeeRefScriptCostPerByte = THKD ccppMinFeeRefScriptCostPerByte
}

instance IsCanonicalDRepVotingThresholds DRepVotingThresholds where
mkCanonicalDRepVotingThresholds DRepVotingThresholds {..} = CanonicalDRepVotingThresholds {..}
fromCanonicalDRepVotingThresholds CanonicalDRepVotingThresholds {..} = DRepVotingThresholds {..}

instance IsCanonicalPoolVotingThresholds PoolVotingThresholds where
fromCanonicalPoolVotingThresholds CanonicalPoolVotingThresholds {..} = PoolVotingThresholds {..}
mkCanonicalPoolVotingThresholds PoolVotingThresholds {..} = CanonicalPoolVotingThresholds {..}
Loading
Loading