Skip to content

Commit

Permalink
Drop dependency on cardano-prelude
Browse files Browse the repository at this point in the history
Reflect usage of `unsafeIndex` with the bounds of `bytestring`.

`bytestring-0.11.3.0` was accidentally released with `unsafeIndex`
hidden from the export list. This issues was promptly fixed in
`bytestring-0.11.4.0`. So, we just need to exclude the affected version
in cabal file instead of rely on some custom implementation of the function
in a package that we don't normally use in ledger.
  • Loading branch information
lehins committed Jan 18, 2025
1 parent 7683b73 commit ba003e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions libs/cardano-ledger-core/cardano-ledger-core.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,14 @@ library
base16-bytestring,
base64-bytestring,
binary,
bytestring,
bytestring >=0.10 && <0.11.3 || >=0.11.4,
cardano-crypto,
cardano-crypto-class ^>=2.2,
cardano-crypto-praos ^>=2.2,
cardano-crypto-wrapper,
cardano-data ^>=1.2,
cardano-ledger-binary ^>=1.6,
cardano-ledger-byron,
cardano-prelude,
cardano-slotting,
cardano-strict-containers,
containers,
Expand Down
4 changes: 2 additions & 2 deletions libs/cardano-ledger-core/src/Cardano/Ledger/Address.hs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ import Cardano.Ledger.Credential (
)
import Cardano.Ledger.Hashes (ScriptHash (..))
import Cardano.Ledger.Keys (KeyHash (..), KeyRole (..))
import Cardano.Prelude (unsafeShortByteStringIndex)
import Control.DeepSeq (NFData)
import Control.Monad (guard, unless, when)
import Control.Monad.Trans.Fail (FailT (..), runFail)
Expand All @@ -109,6 +108,7 @@ import qualified Data.ByteString as BS
import qualified Data.ByteString.Base16 as B16
import qualified Data.ByteString.Lazy as BSL
import Data.ByteString.Short as SBS (ShortByteString, fromShort, index, length, toShort)
import Data.ByteString.Short.Internal as SBS (unsafeIndex)
import qualified Data.ByteString.Unsafe as BS (unsafeDrop, unsafeIndex, unsafeTake)
import Data.Default (Default (..))
import Data.Function (fix)
Expand Down Expand Up @@ -466,7 +466,7 @@ class AddressBuffer b where
instance AddressBuffer ShortByteString where
bufLength = SBS.length
{-# INLINE bufLength #-}
bufUnsafeIndex = unsafeShortByteStringIndex
bufUnsafeIndex = SBS.unsafeIndex
{-# INLINE bufUnsafeIndex #-}
bufToByteString = SBS.fromShort
{-# INLINE bufToByteString #-}
Expand Down

0 comments on commit ba003e0

Please sign in to comment.