From a3a252fe87ffeb95cd0ce8c92b40eafd51573ad9 Mon Sep 17 00:00:00 2001 From: Dzmitry Shuysky Date: Thu, 26 Sep 2024 17:39:30 +0200 Subject: [PATCH 1/2] Fix transaction witness set 'attach' functions --- src/Internal/Transaction.purs | 43 +++++++++++++---------------------- 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/src/Internal/Transaction.purs b/src/Internal/Transaction.purs index e01acd09bc..d9f331aa49 100644 --- a/src/Internal/Transaction.purs +++ b/src/Internal/Transaction.purs @@ -90,43 +90,32 @@ setScriptDataHash costModels rs ds tx@(Transaction { body, witnessSet }) attachDatum :: PlutusData -> Transaction -> Transaction attachDatum d = attachDatums [ d ] -attachDatums - :: Array PlutusData -> Transaction -> Transaction +attachDatums :: Array PlutusData -> Transaction -> Transaction attachDatums [] tx = tx attachDatums datums tx@(Transaction { witnessSet: TransactionWitnessSet ws }) = - do - updateTxWithWitnesses tx $ TransactionWitnessSet $ ws - { plutusData = nub $ ws.plutusData <> datums } + updateTxWithWitnesses tx $ TransactionWitnessSet $ ws + { plutusData = nub $ ws.plutusData <> datums + } -- | Attach a `PlutusScript` to a transaction by modifying its existing witness -- | set -attachPlutusScript - :: PlutusScript -> Transaction -> Transaction +attachPlutusScript :: PlutusScript -> Transaction -> Transaction attachPlutusScript ps = attachPlutusScripts [ ps ] -attachPlutusScripts - :: Array PlutusScript - -> Transaction - -> Transaction +attachPlutusScripts :: Array PlutusScript -> Transaction -> Transaction attachPlutusScripts ps tx@(Transaction { witnessSet: TransactionWitnessSet ws }) = - do - updateTxWithWitnesses tx - $ TransactionWitnessSet - $ ws { plutusScripts = nub $ ws.plutusScripts <> ps } + updateTxWithWitnesses tx $ TransactionWitnessSet $ ws + { plutusScripts = nub $ ws.plutusScripts <> ps + } -- | Attach a `NativeScript` to a transaction by modifying its existing witness -- | set -attachNativeScript - :: NativeScript -> Transaction -> Transaction +attachNativeScript :: NativeScript -> Transaction -> Transaction attachNativeScript ns tx@(Transaction { witnessSet: TransactionWitnessSet ws }) = - do - updateTxWithWitnesses tx - $ TransactionWitnessSet - $ ws { nativeScripts = nub $ ws.nativeScripts <> [ ns ] } + updateTxWithWitnesses tx $ TransactionWitnessSet $ ws + { nativeScripts = nub $ ws.nativeScripts <> [ ns ] + } -updateTxWithWitnesses - :: Transaction - -> TransactionWitnessSet - -> Transaction -updateTxWithWitnesses tx@(Transaction t) ws = - over Transaction _ { witnessSet = t.witnessSet <> ws } tx +updateTxWithWitnesses :: Transaction -> TransactionWitnessSet -> Transaction +updateTxWithWitnesses tx ws = + over Transaction _ { witnessSet = ws } tx From 16c6b8822f58c50bb7692c889cea05c6f1885f5c Mon Sep 17 00:00:00 2001 From: Dzmitry Shuysky Date: Thu, 26 Sep 2024 17:51:58 +0200 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b0c018e17..c10b16eccc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,82 +7,90 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) -- [[v9.3.1]](#v931) +- [[Unreleased]](#unreleased) - [Fixed](#fixed) -- [[v9.3.0]](#v930) +- [[v9.3.1]](#v931) - [Fixed](#fixed-1) +- [[v9.3.0]](#v930) + - [Fixed](#fixed-2) - [Changed](#changed) - [[v9.2.0]](#v920) - [Added](#added) - [Changed](#changed-1) - [Removed](#removed) - - [Fixed](#fixed-2) + - [Fixed](#fixed-3) - [[v9.1.0]](#v910) - [Added](#added-1) - - [Changed](#changed-2 + - [Changed](#changed-2) - [Removed](#removed-1) - - [Fixed](#fixed-3) + - [Fixed](#fixed-4) - [[v9.0.0]](#v900) - [Deprecated](#deprecated) - [Added](#added-2) - [Removed](#removed-2) - [Changed](#changed-3) - - [Fixed](#fixed-4) + - [Fixed](#fixed-5) - [[v8.0.0]](#v800) - [Added](#added-3) - [Changed](#changed-4) - - [Fixed](#fixed-5) + - [Fixed](#fixed-6) - [Removed](#removed-3) - [[v7.0.0]](#v700) - [Added](#added-4) - [Changed](#changed-5) - - [Fixed](#fixed-6) + - [Fixed](#fixed-7) - [Removed](#removed-4) - [[v6.0.0]](#v600) - [Added](#added-5) - [Changed](#changed-6) - - [Fixed](#fixed-7) + - [Fixed](#fixed-8) - [Removed](#removed-5) - [[v5.0.0]](#v500) - [Added](#added-6) - [Changed](#changed-7) - [Removed](#removed-6) - - [Fixed](#fixed-8) + - [Fixed](#fixed-9) - [Runtime Dependencies](#runtime-dependencies) - [[v4.0.2] - 2023-01-17](#v402---2023-01-17) - - [Fixed](#fixed-9) + - [Fixed](#fixed-10) - [[v4.0.1] - 2022-12-20](#v401---2022-12-20) - [Added](#added-7) - [[v4.0.0] - 2022-12-15](#v400---2022-12-15) - [Added](#added-8) - [Changed](#changed-8) - [Removed](#removed-7) - - [Fixed](#fixed-10) + - [Fixed](#fixed-11) - [Runtime Dependencies](#runtime-dependencies-1) - [[3.0.0] - 2022-11-21](#300---2022-11-21) - [Added](#added-9) - [Changed](#changed-9) - [Removed](#removed-8) - - [Fixed](#fixed-11) + - [Fixed](#fixed-12) - [Runtime Dependencies](#runtime-dependencies-2) - [[2.0.0] - 2022-09-12](#200---2022-09-12) - [Added](#added-10) - [Changed](#changed-10) - [Removed](#removed-9) - - [Fixed](#fixed-12) + - [Fixed](#fixed-13) - [[2.0.0-alpha] - 2022-07-05](#200-alpha---2022-07-05) - [Added](#added-11) - [Removed](#removed-10) - [Changed](#changed-11) - - [Fixed](#fixed-13) -- [[1.1.0] - 2022-06-30](#110---2022-06-30) - [Fixed](#fixed-14) -- [[1.0.1] - 2022-06-17](#101---2022-06-17) +- [[1.1.0] - 2022-06-30](#110---2022-06-30) - [Fixed](#fixed-15) +- [[1.0.1] - 2022-06-17](#101---2022-06-17) + - [Fixed](#fixed-16) - [[1.0.0] - 2022-06-10](#100---2022-06-10) +## [Unreleased] + +### Fixed + +- Fixed transaction witness set 'attach' functions. Previously, the updated witness set was incorrectly appended to the existing set, causing performance degradation when processing constraints for complex transactions. ([#1653](https://github.com/Plutonomicon/cardano-transaction-lib/pull/1653)) + ## [v9.3.1] ### Fixed