Skip to content

Commit

Permalink
Update to cardano-node 1.27.0
Browse files Browse the repository at this point in the history
Update stack resolver to 1.27.0.
Disambiguate `SL` qualifiers in Compatibility module
Fix Transaction module after node bump
Add cardano-ledger-core dependency
Update deps in cabal.project
cluster: adapt to new cardano-cli changes
Update readme

Co-authored-by: Johannes Lund <johannes.lund@iohk.io>
  • Loading branch information
jonathanknowles and Anviking committed Jun 7, 2021
1 parent 44f6536 commit 3e0622e
Show file tree
Hide file tree
Showing 62 changed files with 522 additions and 329 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ See **Installation Instructions** for each available [release](https://github.co
>
> | cardano-wallet | cardano-node (compatible versions) | SMASH (compatible versions)
> | --- | --- | ---
> | `master` branch | [1.26.2](https://github.com/input-output-hk/cardano-node/releases/tag/1.26.2) | [1.4.0](https://github.com/input-output-hk/smash/releases/tag/1.4.0)
> | `master` branch | [1.27.0](https://github.com/input-output-hk/cardano-node/releases/tag/1.27.0) | [1.4.0](https://github.com/input-output-hk/smash/releases/tag/1.4.0)
> | [v2021-05-26](https://github.com/input-output-hk/cardano-wallet/releases/tag/v2021-05-26) | [1.26.2](https://github.com/input-output-hk/cardano-node/releases/tag/1.26.2) | [1.4.0](https://github.com/input-output-hk/smash/releases/tag/1.4.0)
> | [v2021-04-28](https://github.com/input-output-hk/cardano-wallet/releases/tag/v2021-04-28) | [1.26.2](https://github.com/input-output-hk/cardano-node/releases/tag/1.26.2) | [1.4.0](https://github.com/input-output-hk/smash/releases/tag/1.4.0)
> | [v2021-04-08](https://github.com/input-output-hk/cardano-wallet/releases/tag/v2021-04-08) | [1.25.1](https://github.com/input-output-hk/cardano-node/releases/tag/1.25.1) | [1.3.0](https://github.com/input-output-hk/smash/releases/tag/1.3.0)
Expand Down
18 changes: 9 additions & 9 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-base
tag: 101e7752cf4b23fd0b411736f523b8f6c43f6bc2
tag: 47db5b818ca4fa051f2e44cdf5e7c5c18c1fb0bf
subdir: binary
binary/test
cardano-crypto-class
cardano-crypto-praos
cardano-crypto-tests
strict-containers
slotting

source-repository-package
Expand All @@ -44,7 +45,7 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-ledger-specs
tag: 2e0e7b625492e5e0182464247f4c26d6949ab6f7
tag: e8f19bcc9c8f405131cb95ca6ada26b2b4eac638
subdir: byron/chain/executable-spec
byron/crypto
byron/crypto/test
Expand All @@ -57,23 +58,21 @@ source-repository-package
shelley/chain-and-ledger/dependencies/non-integer
shelley/chain-and-ledger/executable-spec
shelley/chain-and-ledger/shelley-spec-ledger-test
cardano-ledger-core

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-node
tag: 3531289c9f79eab7ac5d3272ce6e6821504fec4c
tag: 8fe46140a52810b6ca456be01d652ca08fe730bf
subdir: cardano-api
cardano-api/test
cardano-cli
cardano-config
cardano-node
cardano-node-chairman
hedgehog-extras

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-prelude
tag: ee4e7b547a991876e6b05ba542f4e62909f4a571
tag: bb4ed71ba8e587f672d06edf9d2e376f4b055555
subdir: cardano-prelude
cardano-prelude-test

Expand All @@ -90,7 +89,7 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/iohk-monitoring-framework
tag: f6ab0631275d04dff1b990283bbf9671093e7505
tag: 808724ff8a19a33d0ed06f9ef59fbd900b08553c
subdir: contra-tracer
iohk-monitoring
plugins/backend-aggregation
Expand All @@ -103,7 +102,7 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 7f90c8c59ffc7d61a4e161e886d8962a9c26787a
tag: 9b279c7548ee549e1ed755cd1acb69b6e69d0c7b
subdir: cardano-client
io-sim
io-sim-classes
Expand All @@ -115,6 +114,7 @@ source-repository-package
ouroboros-consensus-mock
ouroboros-consensus-shelley
ouroboros-network
ouroboros-network-testing
ouroboros-network-framework
typed-protocols
typed-protocols-examples
Expand Down
4 changes: 3 additions & 1 deletion lib/shelley/cardano-wallet.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ library
, cardano-crypto-wrapper
, cardano-wallet-launcher
, cardano-ledger-byron
, cardano-ledger-core
, cardano-ledger-shelley-ma
, cardano-slotting
, cardano-wallet-cli
Expand Down Expand Up @@ -206,9 +207,10 @@ test-suite unit
, cardano-addresses
, cardano-api
, cardano-crypto-class
, cardano-ledger-core
, cardano-wallet
, cardano-wallet-core
, cardano-wallet-test-utils
, cardano-wallet
, containers
, contra-tracer
, fmt
Expand Down
41 changes: 25 additions & 16 deletions lib/shelley/src/Cardano/Wallet/Shelley/Compatibility.hs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ import Ouroboros.Network.Point
( WithOrigin (..) )
import Shelley.Spec.Ledger.BaseTypes
( interval0, strictMaybeToMaybe, urlToText )
import Shelley.Spec.Ledger.Serialization
( ToCBORGroup )
import Type.Reflection
( Typeable, typeRep )

Expand All @@ -278,6 +280,7 @@ import qualified Cardano.Chain.Common as Byron
import qualified Cardano.Crypto.Hash as Crypto
import qualified Cardano.Ledger.Core as SL.Core
import qualified Cardano.Ledger.Crypto as SL
import qualified Cardano.Ledger.Era as Ledger.Era
import qualified Cardano.Ledger.SafeHash as SafeHash
import qualified Cardano.Ledger.Shelley as SL
import qualified Cardano.Ledger.Shelley.Constraints as SL
Expand Down Expand Up @@ -309,6 +312,7 @@ import qualified Ouroboros.Network.Block as O
import qualified Ouroboros.Network.Point as Point
import qualified Shelley.Spec.Ledger.Address as SL
import qualified Shelley.Spec.Ledger.API as SL
import qualified Shelley.Spec.Ledger.API as SLAPI
import qualified Shelley.Spec.Ledger.BaseTypes as SL
import qualified Shelley.Spec.Ledger.BlockChain as SL
import qualified Shelley.Spec.Ledger.Credential as SL
Expand Down Expand Up @@ -433,7 +437,7 @@ toCardanoBlockHeader gp = \case
toShelleyBlockHeader (W.getGenesisBlockHash gp) blk

toShelleyBlockHeader
:: Era e
:: (Era e, ToCBORGroup (Ledger.Era.TxSeq e))
=> W.Hash "Genesis"
-> ShelleyBlock e
-> W.BlockHeader
Expand All @@ -453,7 +457,9 @@ toShelleyBlockHeader genesisHash blk =
SL.bheaderPrev header
}

getProducer :: Era e => ShelleyBlock e -> W.PoolId
getProducer
:: (Era e, ToCBORGroup (Ledger.Era.TxSeq e))
=> ShelleyBlock e -> W.PoolId
getProducer (ShelleyBlock (SL.Block (SL.BHeader header _) _) _) =
fromPoolKeyHash $ SL.hashKey (SL.bheaderVk header)

Expand Down Expand Up @@ -597,7 +603,7 @@ fromMaxTxSize =
Quantity . fromIntegral

fromShelleyPParams
:: forall era. W.EraInfo Bound -> SL.PParams era -> W.ProtocolParameters
:: forall era. W.EraInfo Bound -> SLAPI.PParams era -> W.ProtocolParameters
fromShelleyPParams eraInfo pp = W.ProtocolParameters
{ decentralizationLevel =
decentralizationLevelFromPParams pp
Expand Down Expand Up @@ -635,7 +641,7 @@ fromShelleyPParams eraInfo pp = W.ProtocolParameters
-- convert it into a percentage.
--
decentralizationLevelFromPParams
:: SL.PParams era
:: SLAPI.PParams era
-> W.DecentralizationLevel
decentralizationLevelFromPParams pp =
W.DecentralizationLevel $ fromUnitInterval
Expand All @@ -645,7 +651,7 @@ decentralizationLevelFromPParams pp =
d = SL._d pp

txParametersFromPParams
:: SL.PParams era
:: SLAPI.PParams era
-> W.TxParameters
txParametersFromPParams pp = W.TxParameters
{ getFeePolicy = W.LinearFee
Expand All @@ -658,17 +664,17 @@ txParametersFromPParams pp = W.TxParameters
naturalToDouble = fromIntegral

desiredNumberOfStakePoolsFromPParams
:: SL.PParams era
:: SLAPI.PParams era
-> Word16
desiredNumberOfStakePoolsFromPParams pp = fromIntegral (SL._nOpt pp)

minimumUTxOvalueFromPParams
:: SL.PParams era
:: SLAPI.PParams era
-> W.Coin
minimumUTxOvalueFromPParams = toWalletCoin . SL._minUTxOValue

stakeKeyDepositFromPParams
:: SL.PParams era
:: SLAPI.PParams era
-> W.Coin
stakeKeyDepositFromPParams = toWalletCoin . SL._keyDeposit

Expand Down Expand Up @@ -780,7 +786,10 @@ fromNonMyopicMemberRewards =
. Map.mapKeys (bimap fromShelleyCoin fromStakeCredential)
. O.unNonMyopicMemberRewards

optimumNumberOfPools :: forall era. (SL.PParams era ~ SL.Core.PParams era) => SL.Core.PParams era -> Int
optimumNumberOfPools
:: forall era. (SLAPI.PParams era ~ SL.Core.PParams era)
=> SL.Core.PParams era
-> Int
optimumNumberOfPools = unsafeConvert . SL._nOpt
where
-- A value of ~100 can be expected, so should be fine.
Expand Down Expand Up @@ -809,9 +818,9 @@ fromShelleyTxOut
:: ( SL.ShelleyBased era
, SL.Core.Value era ~ SL.Coin
)
=> SL.TxOut era
=> SLAPI.TxOut era
-> W.TxOut
fromShelleyTxOut (SL.TxOut addr amount) = W.TxOut
fromShelleyTxOut (SLAPI.TxOut addr amount) = W.TxOut
(fromShelleyAddress addr)
(TokenBundle.fromCoin $ fromShelleyCoin amount)

Expand All @@ -834,7 +843,7 @@ toShelleyCoin (W.Coin c) = SL.Coin $ safeCast c

-- NOTE: For resolved inputs we have to pass in a dummy value of 0.
fromShelleyTx
:: SL.Tx (Cardano.ShelleyLedgerEra ShelleyEra)
:: SLAPI.Tx (Cardano.ShelleyLedgerEra ShelleyEra)
-> ( W.Tx
, [W.DelegationCertificate]
, [W.PoolCertificate]
Expand All @@ -854,7 +863,7 @@ fromShelleyTx tx =
SL.Tx bod@(SL.TxBody ins outs certs wdrls fee _ _ _) _ mmd = tx

fromAllegraTx
:: SL.Tx (Cardano.ShelleyLedgerEra AllegraEra)
:: SLAPI.Tx (Cardano.ShelleyLedgerEra AllegraEra)
-> ( W.Tx
, [W.DelegationCertificate]
, [W.PoolCertificate]
Expand All @@ -879,7 +888,7 @@ fromAllegraTx tx =
toSLMetadata (MA.AuxiliaryData blob _scripts) = SL.Metadata blob

fromMaryTx
:: SL.Tx (Cardano.ShelleyLedgerEra MaryEra)
:: SLAPI.Tx (Cardano.ShelleyLedgerEra MaryEra)
-> ( W.Tx
, [W.DelegationCertificate]
, [W.PoolCertificate]
Expand All @@ -905,7 +914,7 @@ fromMaryTx tx =
toSLMetadata (MA.AuxiliaryData blob _scripts) = SL.Metadata blob

fromMaryTxOut
:: SL.TxOut (Cardano.ShelleyLedgerEra MaryEra)
:: SLAPI.TxOut (Cardano.ShelleyLedgerEra MaryEra)
-> W.TxOut
fromMaryTxOut (SL.TxOut addr value) =
W.TxOut (fromShelleyAddress addr) $
Expand Down Expand Up @@ -1085,7 +1094,7 @@ unsealShelleyTx wrap = wrap

sealShelleyTx
:: forall era b c. (O.ShelleyBasedEra (Cardano.ShelleyLedgerEra era))
=> (SL.Tx (Cardano.ShelleyLedgerEra era) -> (W.Tx, b, c))
=> (SLAPI.Tx (Cardano.ShelleyLedgerEra era) -> (W.Tx, b, c))
-> Cardano.Tx era
-> (W.Tx, W.SealedTx)
sealShelleyTx fromTx (Cardano.ShelleyTx _era tx) =
Expand Down
20 changes: 10 additions & 10 deletions lib/shelley/src/Cardano/Wallet/Shelley/Launch/Cluster.hs
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ withCluster tr dir LocalClusterConfig{..} onClusterStart =
waitForSocket tr bftSocket

(rawTx, faucetPrv) <- prepareKeyRegistration tr dir
tx <- signTx tr dir rawTx [] [faucetPrv]
tx <- signTx tr dir rawTx [faucetPrv]
submitTx tr bftSocket "pre-registered stake key" tx

waitGroup <- newChan
Expand Down Expand Up @@ -781,7 +781,7 @@ setupStakePoolData tr dir name params url pledgeAmt mRetirementEpoch = do
]
(rawTx, faucetPrv) <- preparePoolRegistration
tr dir stakePub certificates pledgeAmt
tx <- signTx tr dir rawTx [] [faucetPrv, stakePrv, opPrv]
tx <- signTx tr dir rawTx [faucetPrv, stakePrv, opPrv]

let cfg = CardanoNodeConfig
{ nodeDir = dir
Expand Down Expand Up @@ -1294,6 +1294,9 @@ sendFaucet tr conn dir what targets = do

let targetAssets = concatMap (snd . TokenBundle.toFlatList . fst . snd) targets

scripts <- forM (nub $ concatMap (map snd . snd . snd) targets) $
writeMonetaryPolicyScriptFile dir

cli tr $
[ "transaction", "build-raw"
, "--tx-in", faucetInput
Expand All @@ -1304,14 +1307,13 @@ sendFaucet tr conn dir what targets = do
, "--out-file", file
] ++
concatMap (uncurry mkOutput . fmap fst) targets ++
mkMint targetAssets
mkMint targetAssets ++
(concatMap (\f -> ["--minting-script-file", f]) scripts)

policyKeys <- forM (nub $ concatMap (snd . snd) targets) $
\(skey, keyHash) -> writePolicySigningKey dir keyHash skey
scripts <- forM (nub $ concatMap (map snd . snd . snd) targets) $
writeMonetaryPolicyScriptFile dir

tx <- signTx tr dir file scripts (faucetPrv:policyKeys)
tx <- signTx tr dir file (faucetPrv:policyKeys)
submitTx tr conn (what ++ " faucet tx") tx

batch :: Int -> [a] -> ([a] -> IO b) -> IO ()
Expand Down Expand Up @@ -1354,7 +1356,7 @@ moveInstantaneousRewardsTo tr conn dir targets = do
testData <- getShelleyTestDataPath
let bftPrv = testData </> "bft-leader" <> ".skey"

tx <- signTx tr dir file [] [faucetPrv, bftPrv]
tx <- signTx tr dir file [faucetPrv, bftPrv]
submitTx tr conn "MIR certificates" tx
where
mkVerificationKey
Expand Down Expand Up @@ -1445,18 +1447,16 @@ signTx
:: Tracer IO ClusterLog
-> FilePath -- ^ Output directory
-> FilePath -- ^ Tx body file
-> [FilePath] -- ^ Script files
-> [FilePath] -- ^ Signing keys for witnesses
-> IO FilePath
signTx tr dir rawTx scripts keys = do
signTx tr dir rawTx keys = do
let file = dir </> "tx.signed"
cli tr $
[ "transaction", "sign"
, "--tx-body-file", rawTx
, "--mainnet"
, "--out-file", file
]
++ concatMap (\s -> ["--script-file", s]) scripts
++ concatMap (\key -> ["--signing-key-file", key]) keys
pure file

Expand Down
Loading

0 comments on commit 3e0622e

Please sign in to comment.