Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump cardano-node from 1.32.1 to 1.33.0 #3071

Merged
merged 24 commits into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c7e1a38
cabal: Bump index-state to 2021-01-01
rvl Jan 4, 2022
e060d1d
stack.yaml: Bump cardano-node from 1.32.1 to 1.33.0
rvl Jan 4, 2022
30bf958
stack.yaml: Bump LTS snapshot from 18.13 to 18.21
rvl Jan 4, 2022
5bd3b15
Bump Hackage.nix and Stackage.nix to latest
rvl Jan 4, 2022
f6ef68d
cabal.project: Bump cardano-node from 1.32.1 to 1.33.0
rvl Jan 4, 2022
90fb307
Cabal: Remove deprecated shelley-spec-ledger build-deps
rvl Jan 4, 2022
3d2a1af
haddock: Update links to cardano-ledger CDDL files
rvl Jan 4, 2022
c415d9a
docs: Update version matrix
rvl Jan 4, 2022
54099bd
Dependency churn
rvl Jan 4, 2022
598207f
One does not simply define a MonadSTM instance
rvl Jan 5, 2022
749c8bb
API churn
rvl Jan 5, 2022
0916501
Regenerate nix
rvl Jan 4, 2022
4bbbe61
fixup! stack.yaml: Bump cardano-node from 1.32.1 to 1.33.0
rvl Jan 5, 2022
431f1a9
Handle new UnknownTxIns from ledger evaluateTransactionExecutionUnits
Anviking Jan 5, 2022
765bd5b
Remove redundant constraint
Anviking Jan 5, 2022
f8bc2f5
Fix StakePoolMetadata generator creating too large values
sevanspowell Jan 6, 2022
82aeff0
Restrict TxIndex generation
sevanspowell Jan 7, 2022
3920fa7
Reduce range of TxIxs further
sevanspowell Jan 7, 2022
2f1af8f
Tweak generation and coverage
sevanspowell Jan 7, 2022
5e0f827
Add missing swagger error for RedeemerUnresolvedInputs
sevanspowell Jan 7, 2022
d6fdbe2
Fix simplifyAddress implementation
sevanspowell Jan 7, 2022
97ad203
Fix JSON golden files
sevanspowell Jan 7, 2022
839a02c
Add new prop_balanceTransactionUnresolvedInputs
Anviking Jan 7, 2022
852adff
Tweak ErrAssignRedeemersUnresolvedTxIns error
Anviking Jan 7, 2022
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ See **Installation Instructions** for each available [release](https://github.co
>
> | cardano-wallet | cardano-node (compatible versions) | SMASH (compatible versions)
> | --- | --- | ---
> | `master` branch | [1.32.1](https://github.com/input-output-hk/cardano-node/releases/tag/1.32.1) | [1.6.1](https://github.com/input-output-hk/smash/releases/tag/1.6.1)
> | `master` branch | [1.33.0](https://github.com/input-output-hk/cardano-node/releases/tag/1.33.0) | [1.6.1](https://github.com/input-output-hk/smash/releases/tag/1.6.1)
> | [v2021-12-15](https://github.com/input-output-hk/cardano-wallet/releases/tag/v2021-12-15) | [1.32.1](https://github.com/input-output-hk/cardano-node/releases/tag/1.32.1) | [1.6.1](https://github.com/input-output-hk/smash/releases/tag/1.6.1)
> | [v2021-11-11](https://github.com/input-output-hk/cardano-wallet/releases/tag/v2021-11-11) | [1.30.1](https://github.com/input-output-hk/cardano-node/releases/tag/1.30.1) | [1.6.1](https://github.com/input-output-hk/smash/releases/tag/1.6.1)
> | [v2021-09-29](https://github.com/input-output-hk/cardano-wallet/releases/tag/v2021-09-29) | [1.30.1](https://github.com/input-output-hk/cardano-node/releases/tag/1.30.1) | [1.6.0](https://github.com/input-output-hk/smash/releases/tag/1.6.0)
Expand Down
18 changes: 10 additions & 8 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
--
--------------------------------------------------------------------------------

index-state: 2021-12-01T00:00:00Z
index-state: 2022-01-01T00:00:00Z
with-compiler: ghc-8.10.7

packages:
Expand Down Expand Up @@ -81,7 +81,7 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-base
tag: e8a48cf0500b03c744c7fc6f2fedb86e8bdbe055
tag: 41545ba3ac6b3095966316a99883d678b5ab8da8
subdir:
base-deriving-via
binary
Expand Down Expand Up @@ -127,7 +127,7 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-ledger
tag: bf008ce028751cae9fb0b53c3bef20f07c06e333
tag: 1a9ec4ae9e0b09d54e49b2a40c4ead37edadcce5
subdir:
eras/alonzo/impl
eras/alonzo/test-suite
Expand All @@ -144,17 +144,17 @@ source-repository-package
libs/cardano-ledger-core
libs/cardano-ledger-pretty
libs/cardano-protocol-tpraos
libs/cardano-data
libs/compact-map
libs/set-algebra
libs/small-steps
libs/small-steps-test
libs/non-integral
eras/shelley/chain-and-ledger/executable-spec
eras/shelley/chain-and-ledger/shelley-spec-ledger-test
eras/shelley/chain-and-ledger/dependencies/non-integer

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-node
tag: 4f65fb9a27aa7e3a1873ab4211e412af780a3648
tag: 814df2c146f5d56f8c35a681fe75e85b905aed5d
subdir:
cardano-api
cardano-cli
Expand Down Expand Up @@ -196,7 +196,7 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: d613de3d872ec8b4a5da0c98afb443f322dc4dab
tag: d2d219a86cda42787325bb8c20539a75c2667132
subdir:
io-sim
io-classes
Expand All @@ -205,10 +205,12 @@ source-repository-package
ouroboros-consensus
ouroboros-consensus-byron
ouroboros-consensus-cardano
ouroboros-consensus-protocol
ouroboros-consensus-shelley
ouroboros-network
ouroboros-network-framework
ouroboros-network-testing
strict-stm
typed-protocols
typed-protocols-cborg
typed-protocols-examples
Expand Down
6 changes: 2 additions & 4 deletions lib/core/cardano-wallet-core.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ library
, servant
, servant-client
, servant-server
, shelley-spec-ledger
, shelley-spec-ledger-test
, split
, splitmix
, statistics
, stm
, streaming-commons
, strict-containers
, strict-non-empty-containers
, strict-stm
, string-interpolate
, template-haskell
, text
Expand Down Expand Up @@ -356,7 +356,6 @@ test-suite unit
, plutus-ledger-api
, pretty-simple
, regex-pcre-builtin
, shelley-spec-ledger
, OddWord
, ouroboros-consensus
, QuickCheck
Expand All @@ -369,7 +368,6 @@ test-suite unit
, scrypt
, servant
, servant-server
, shelley-spec-ledger-test
, should-not-typecheck
, splitmix
, strict-non-empty-containers
Expand Down
19 changes: 14 additions & 5 deletions lib/core/src/Cardano/Api/Gen.hs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ import Data.String
import Data.Text
( Text )
import Data.Word
( Word64 )
( Word16, Word32, Word64 )
import Network.Socket
( PortNumber )
import Numeric.Natural
Expand Down Expand Up @@ -212,9 +212,16 @@ genTxId :: Gen TxId
genTxId = TxId <$> genShelleyHash

genTxIndex :: Gen TxIx
genTxIndex = do
(Large (n :: Word)) <- arbitrary
pure $ TxIx n
genTxIndex = frequency
[ ( 45, do
-- 2 ^ 32 - 1 is the upper limit on TxIxs in the Byron era
n <- chooseInteger (0, fromIntegral $ ((2 :: Word32) ^ (32 :: Word32)) - 1)
pure $ TxIx $ fromIntegral n
)
-- Make sure to choose some small values too
, ( 45, (TxIx . fromIntegral) <$> chooseInteger (0, fromIntegral (maxBound :: Word16)) )
, ( 10, pure $ TxIx 0 )
]

genTxInsCollateral :: CardanoEra era -> Gen (TxInsCollateral era)
genTxInsCollateral era =
Expand Down Expand Up @@ -968,7 +975,8 @@ genStakePoolMetadata =

genDescription :: Gen T.Text
genDescription = do
n <- arbitrary
-- There is a overall limit of 512 bytes for metadata
n <- chooseInt (0, 64)
T.pack <$> vector n

genTicker :: Gen T.Text
Expand Down Expand Up @@ -1227,6 +1235,7 @@ genTxBodyContent era = do
}

let witnesses = collectTxBodyScriptWitnesses txBody
-- No use of a script language means no need for collateral
if Set.null (languages witnesses)
then do
pparams <- BuildTxWith <$> liftArbitrary genProtocolParameters
Expand Down
11 changes: 11 additions & 0 deletions lib/core/src/Cardano/Wallet/Api/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4246,6 +4246,17 @@ instance IsServerError ErrAssignRedeemers where
, "for one of your redeemers since I am unable to decode it"
, "into a valid Plutus data:", pretty r <> "."
]
ErrAssignRedeemersUnresolvedTxIns ins ->
-- Note that although this error is thrown from
-- '_assignScriptRedeemers', it's more related to balanceTransaction
-- in general than to assigning redeemers. Hence we don't mention
-- redeemers in the message.
apiError err400 UnresolvedInputs $ T.unwords
[ "The transaction I was given contains inputs I don't know"
, "about. Please ensure all foreign inputs are specified as "
, "part of the API request. The unknown inputs are:\n\n"
, pretty ins
]
ErrAssignRedeemersPastHorizon e ->
toServerError e

Expand Down
1 change: 1 addition & 0 deletions lib/core/src/Cardano/Wallet/Api/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1659,6 +1659,7 @@ data ApiErrorCode
| TransactionAlreadyBalanced
| RedeemerScriptFailure
| RedeemerTargetNotFound
| UnresolvedInputs
| RedeemerInvalidData
| ExistingKeyWitnesses
deriving (Eq, Generic, Show, Data, Typeable)
Expand Down
92 changes: 88 additions & 4 deletions lib/core/src/Cardano/Wallet/DB/Sqlite/CheckpointsOld.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}

{-# OPTIONS_GHC -fno-warn-orphans #-}

-- |
-- Copyright: © 2021 IOHK
-- License: Apache-2.0
Expand Down Expand Up @@ -96,14 +101,22 @@ import Cardano.Wallet.Primitive.Types.TokenMap
( AssetId (..) )
import Cardano.Wallet.Util
( invariant )
import Control.Applicative
( Alternative )
import Control.Monad
( forM, forM_, unless, void, when )
( MonadPlus, forM, forM_, unless, void, when )
import Control.Monad.Class.MonadSTM
( MonadSTM (..) )
import Control.Monad.IO.Class
( MonadIO (..) )
import Control.Monad.Trans.Class
( lift )
import Control.Monad.Trans.Except
( ExceptT (..), runExceptT )
import Control.Monad.Trans.Maybe
( MaybeT (..) )
import Control.Monad.Trans.Reader
( ReaderT (..) )
import Data.Bifunctor
( bimap, second )
import Data.DBVar
Expand All @@ -129,6 +142,7 @@ import Data.Typeable
import Database.Persist.Sql
( Entity (..)
, SelectOpt (..)
, SqlBackend
, deleteWhere
, insertMany_
, insert_
Expand Down Expand Up @@ -156,6 +170,11 @@ import qualified Cardano.Wallet.Primitive.Types.Coin as W
import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle
import qualified Cardano.Wallet.Primitive.Types.Tx as W
import qualified Cardano.Wallet.Primitive.Types.UTxO as W
import qualified Control.Concurrent.STM.TBQueue as STM
import qualified Control.Concurrent.STM.TMVar as STM
import qualified Control.Concurrent.STM.TQueue as STM
import qualified Control.Concurrent.STM.TVar as STM
import qualified Control.Monad.STM as STM
import qualified Data.Map.Merge.Strict as Map
import qualified Data.Map.Strict as Map

Expand All @@ -172,7 +191,7 @@ mkStoreWalletsCheckpoints = Store{loadS=load,writeS=write,updateS=update}
write = error "mkStoreWalletsCheckpoints: not implemented"

update _ (Insert wid a) =
writeS (mkStoreCheckpoints wid) a
writeS (mkStoreCheckpoints wid) a
update _ (Delete wid) = do
-- FIXME LATER during ADP-1043:
-- Deleting an entry in the Checkpoint table
Expand Down Expand Up @@ -377,7 +396,7 @@ class AddressBookIso s => PersistAddressBook s where
:: W.WalletId -> Prologue s -> SqlPersistT IO ()
insertDiscoveries
:: W.WalletId -> W.SlotNo -> Discoveries s -> SqlPersistT IO ()

loadPrologue
:: W.WalletId -> SqlPersistT IO (Maybe (Prologue s))
loadDiscoveries
Expand Down Expand Up @@ -491,7 +510,7 @@ instance
, WalletKey key
, key ~ SharedKey
) => PersistAddressBook (Shared.SharedState n key) where

insertPrologue wid (SharedPrologue st) = do
let Shared.SharedState prefix accXPub pTemplate dTemplateM gap _ = st
insertSharedState prefix accXPub gap pTemplate dTemplateM
Expand Down Expand Up @@ -652,3 +671,68 @@ selectRndStatePending wid = do
where
assocFromEntity (RndStatePendingAddress _ accIx addrIx addr) =
((W.Index accIx, W.Index addrIx), addr)

{-------------------------------------------------------------------------------
Provide ReaderT instance for MonadSTM
Copy link
Member

Choose a reason for hiding this comment

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

Looks like a MonadSTM instance for ReaderT, though, no?

-------------------------------------------------------------------------------}

instance MonadSTM (ReaderT SqlBackend IO) where
type STM (ReaderT SqlBackend IO) = WrapSTM
atomically = liftIO . STM.atomically . unWrapSTM

type TVar (ReaderT SqlBackend IO) = TVar IO
type TMVar (ReaderT SqlBackend IO) = TMVar IO
type TBQueue (ReaderT SqlBackend IO) = TBQueue IO
type TQueue (ReaderT SqlBackend IO) = TQueue IO

newTVar = WrapSTM . STM.newTVar
readTVar = WrapSTM . STM.readTVar
writeTVar = \v -> WrapSTM . STM.writeTVar v
retry = WrapSTM STM.retry
orElse = \(WrapSTM a) (WrapSTM b) -> WrapSTM (STM.orElse a b)
modifyTVar = \v -> WrapSTM . STM.modifyTVar v
modifyTVar' = \v -> WrapSTM . STM.modifyTVar' v
stateTVar = \v -> WrapSTM . STM.stateTVar v
swapTVar = \v -> WrapSTM . STM.swapTVar v
check = WrapSTM . STM.check
newTMVar = WrapSTM . STM.newTMVar
newEmptyTMVar = WrapSTM STM.newEmptyTMVar
takeTMVar = WrapSTM . STM.takeTMVar
tryTakeTMVar = WrapSTM . STM.tryTakeTMVar
putTMVar = \v -> WrapSTM . STM.putTMVar v
tryPutTMVar = \v -> WrapSTM . STM.tryPutTMVar v
readTMVar = WrapSTM . STM.readTMVar
tryReadTMVar = WrapSTM . STM.tryReadTMVar
swapTMVar = \v -> WrapSTM . STM.swapTMVar v
isEmptyTMVar = WrapSTM . STM.isEmptyTMVar
newTQueue = WrapSTM STM.newTQueue
readTQueue = WrapSTM . STM.readTQueue
tryReadTQueue = WrapSTM . STM.tryReadTQueue
peekTQueue = WrapSTM . STM.peekTQueue
tryPeekTQueue = WrapSTM . STM.tryPeekTQueue
flushTBQueue = WrapSTM . STM.flushTBQueue
writeTQueue = \q -> WrapSTM . STM.writeTQueue q
isEmptyTQueue = WrapSTM . STM.isEmptyTQueue
newTBQueue = WrapSTM . STM.newTBQueue
readTBQueue = WrapSTM . STM.readTBQueue
tryReadTBQueue = WrapSTM . STM.tryReadTBQueue
peekTBQueue = WrapSTM . STM.peekTBQueue
tryPeekTBQueue = WrapSTM . STM.tryPeekTBQueue
writeTBQueue = \q -> WrapSTM . STM.writeTBQueue q
lengthTBQueue = WrapSTM . STM.lengthTBQueue
isEmptyTBQueue = WrapSTM . STM.isEmptyTBQueue
isFullTBQueue = WrapSTM . STM.isFullTBQueue

newTVarIO = liftIO . STM.newTVarIO
readTVarIO = liftIO . STM.readTVarIO
newTMVarIO = liftIO . STM.newTMVarIO
newEmptyTMVarIO = liftIO STM.newEmptyTMVarIO
newTQueueIO = liftIO STM.newTQueueIO
newTBQueueIO = liftIO . STM.newTBQueueIO

-- | MonadSTM is an injective typeclass, so we need a unique newtype to target.
newtype WrapSTM a = WrapSTM { unWrapSTM :: STM.STM a }
deriving (Applicative, Functor, Monad)

deriving instance MonadPlus WrapSTM
deriving instance Alternative WrapSTM
2 changes: 2 additions & 0 deletions lib/core/src/Cardano/Wallet/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@ data ErrAssignRedeemers
-- ^ Redeemer's data isn't a valid Plutus' data.
| ErrAssignRedeemersPastHorizon PastHorizonException
-- ^ Evaluating the Plutus script failed past the visible horizon.
| ErrAssignRedeemersUnresolvedTxIns [TxIn]
-- ^ The transaction contains inputs which couldn't be resolved.
deriving (Generic, Eq, Show)

-- | Possible signing error
Expand Down
Loading