From 00a56658709be193cb88f7a6fe4d968ebe6c2e70 Mon Sep 17 00:00:00 2001 From: Thomas Winant Date: Wed, 28 Oct 2020 16:19:02 +0100 Subject: [PATCH] Update dependency on ledger and consensus The main reason is to pull in: https://github.com/input-output-hk/cardano-ledger-specs/pull/1943 --- cabal.project | 8 ++--- cardano-api/src/Cardano/Api/Typed.hs | 34 ++++++++----------- cardano-node-chairman/app/Cardano/Chairman.hs | 2 +- cardano-node/chairman/Cardano/Chairman.hs | 2 +- 4 files changed, 21 insertions(+), 25 deletions(-) diff --git a/cabal.project b/cabal.project index b3af2f039f9..29fe95c0039 100644 --- a/cabal.project +++ b/cabal.project @@ -110,8 +110,8 @@ source-repository-package source-repository-package type: git location: https://github.com/input-output-hk/cardano-ledger-specs - tag: 1a2d7717682f8191cf818362df28ac20fac19b83 - --sha256: 136pp0653w8chk53wnz6mlkdhf0ldglrb74p1i93d1xnf6ssvjhs + tag: 623bbb8d4b13bcb0157c5c576a69536387f1b5be + --sha256: 0nspz67p6ixw4zr6q4r2gzn37583mlag8f1g5pk0i4f1yisi69d1 subdir: byron/chain/executable-spec byron/crypto @@ -159,8 +159,8 @@ source-repository-package source-repository-package type: git location: https://github.com/input-output-hk/ouroboros-network - tag: 43080299637c24254774cd59d634e55be4844d4c - --sha256: 1k77y77k58rfxhnb4smw2kyci3xsswlcbxk2zicvdhkrifx09kpd + tag: 2dd5922820d419caf1239e27197c390e5e0e9949 + --sha256: 1ml9r3scnsqqpigiwlsjky9a4zlrp6797sg2m4yrvj7jq3hph2lq subdir: io-sim io-sim-classes diff --git a/cardano-api/src/Cardano/Api/Typed.hs b/cardano-api/src/Cardano/Api/Typed.hs index f5dade8d06f..af929e70e8c 100644 --- a/cardano-api/src/Cardano/Api/Typed.hs +++ b/cardano-api/src/Cardano/Api/Typed.hs @@ -469,6 +469,7 @@ import qualified Cardano.Chain.UTxO as Byron import Ouroboros.Consensus.Shelley.Eras (StandardShelley) import Ouroboros.Consensus.Shelley.Protocol.Crypto (StandardCrypto) +import qualified Cardano.Ledger.Core as Shelley (Script) import qualified Cardano.Ledger.Crypto as Shelley (DSIGN, KES, VRF) import qualified Shelley.Spec.Ledger.Address as Shelley @@ -1277,11 +1278,10 @@ getTxWitnesses (ByronTx Byron.ATxAux { Byron.aTaWitness = witnesses }) = getTxWitnesses (ShelleyTx Shelley.Tx { Shelley._witnessSet = - Shelley.WitnessSet { - Shelley.addrWits, - Shelley.bootWits, - Shelley.msigWits - } + Shelley.WitnessSet + addrWits + msigWits + bootWits }) = map ShelleyBootstrapWitness (Set.elems bootWits) ++ map ShelleyKeyWitness (Set.elems addrWits) @@ -1305,15 +1305,11 @@ makeSignedTransaction witnesses (ShelleyTxBody txbody txmetadata) = ShelleyTx $ Shelley.Tx txbody - Shelley.WitnessSet { - Shelley.bootWits = Set.fromList - [ w | ShelleyBootstrapWitness w <- witnesses ], - Shelley.addrWits = Set.fromList - [ w | ShelleyKeyWitness w <- witnesses ], - Shelley.msigWits = Map.fromList - [ (Shelley.hashMultiSigScript sw, sw) - | ShelleyScriptWitness sw <- witnesses ] - } + (Shelley.WitnessSet + (Set.fromList [ w | ShelleyKeyWitness w <- witnesses ]) + (Map.fromList [ (Shelley.hashMultiSigScript sw, sw) + | ShelleyScriptWitness sw <- witnesses ]) + (Set.fromList [ w | ShelleyBootstrapWitness w <- witnesses ])) (maybeToStrictMaybe txmetadata) makeByronKeyWitness :: NetworkId @@ -1379,14 +1375,14 @@ makeShelleyBootstrapWitness nwOrAddr (ShelleyTxBody txbody _) (ByronSigningKey s -- reuse that here. -- signature :: Shelley.SignedDSIGN StandardCrypto - (Shelley.Hash StandardCrypto (Shelley.TxBody StandardShelley)) + (Shelley.Hash StandardCrypto Shelley.EraIndependentTxBody) signature = makeShelleySignature txhash -- Make the signature with the extended key directly: (ShelleyExtendedSigningKey (Byron.unSigningKey sk)) - txhash :: Shelley.Hash StandardCrypto (Shelley.TxBody StandardShelley) - txhash = Crypto.hashWith CBOR.serialize' txbody + txhash :: Shelley.Hash StandardCrypto Shelley.EraIndependentTxBody + txhash = Shelley.eraIndTxBodyHash txbody -- And finally we need to provide the extra suffix bytes necessary to -- reconstruct the mini-Merkel tree that is a Byron address. The suffix @@ -1778,7 +1774,7 @@ instance HasTextEnvelope Script where scriptHash :: Script -> Hash Script -scriptHash (Script s) = ScriptHash (Shelley.hashAnyScript s) +scriptHash (Script s) = ScriptHash (Shelley.hashMultiSigScript s) makeMultiSigScript :: MultiSigScript -> Script makeMultiSigScript = Script . go @@ -1955,7 +1951,7 @@ toShelleyPoolParams StakePoolParameters { } = --TODO: validate pool parameters Shelley.PoolParams { - Shelley._poolPubKey = poolkh + Shelley._poolId = poolkh , Shelley._poolVrf = vrfkh , Shelley._poolPledge = toShelleyLovelace stakePoolPledge , Shelley._poolCost = toShelleyLovelace stakePoolCost diff --git a/cardano-node-chairman/app/Cardano/Chairman.hs b/cardano-node-chairman/app/Cardano/Chairman.hs index ac0e7eaa30e..a61aae81bad 100644 --- a/cardano-node-chairman/app/Cardano/Chairman.hs +++ b/cardano-node-chairman/app/Cardano/Chairman.hs @@ -469,7 +469,7 @@ localInitiatorNetworkApplication -> SecurityParam -> Versions NodeToClientVersion - (DictVersion NodeToClientVersion AgreedOptions) + NodeToClientVersionData (OuroborosApplication InitiatorMode LocalAddress ByteString m () Void) localInitiatorNetworkApplication chairmanTracer chainSyncTracer diff --git a/cardano-node/chairman/Cardano/Chairman.hs b/cardano-node/chairman/Cardano/Chairman.hs index 965b96905a9..6093849bc1d 100644 --- a/cardano-node/chairman/Cardano/Chairman.hs +++ b/cardano-node/chairman/Cardano/Chairman.hs @@ -493,7 +493,7 @@ localInitiatorNetworkApplication -> SocketPath -> ChainsVar m blk -> SecurityParam - -> Versions NodeToClientVersion (DictVersion NodeToClientVersion AgreedOptions) + -> Versions NodeToClientVersion NodeToClientVersionData (OuroborosApplication InitiatorMode LocalAddress ByteString m () Void) localInitiatorNetworkApplication chairmanTracer chainSyncTracer localTxSubmissionTracer