From 0570b1397dfe21d811933497faecd812fbddcc73 Mon Sep 17 00:00:00 2001 From: kingofclubstroy <100493790+kingofclubstroyDev@users.noreply.github.com> Date: Thu, 2 Apr 2026 14:45:27 -0700 Subject: [PATCH 1/2] sapience-2 --- client/library/library/audits/sapience-2.html | 48 +++++++++++++++++++ .../collections/public/sapience-2-issues.html | 0 2 files changed, 48 insertions(+) create mode 100644 client/library/library/audits/sapience-2.html create mode 100644 content/collections/public/sapience-2-issues.html diff --git a/client/library/library/audits/sapience-2.html b/client/library/library/audits/sapience-2.html new file mode 100644 index 00000000..0dc9dae9 --- /dev/null +++ b/client/library/library/audits/sapience-2.html @@ -0,0 +1,48 @@ + + + + The security audit was performed by the Macro security team from March 26 to March 29, 2026. + + + + + + + + + + + + + + +

We audited the following contracts with f2b6bd9231ae9915f9ba88f6bef02e7a914e6288 commit hash:

+ +
diff --git a/content/collections/public/sapience-2-issues.html b/content/collections/public/sapience-2-issues.html new file mode 100644 index 00000000..e69de29b From 06db706d0dcc93cb0ad5baf7d50c3e44a087edba Mon Sep 17 00:00:00 2001 From: kingofclubstroy <100493790+kingofclubstroyDev@users.noreply.github.com> Date: Thu, 2 Apr 2026 15:05:48 -0700 Subject: [PATCH 2/2] fix --- .../collections/public/sapience-2-issues.html | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/content/collections/public/sapience-2-issues.html b/content/collections/public/sapience-2-issues.html index e69de29b..863a126e 100644 --- a/content/collections/public/sapience-2-issues.html +++ b/content/collections/public/sapience-2-issues.html @@ -0,0 +1,38 @@ + + Verification + medium + low + fixed + TODO + + ## [L-1] Add ability to view `tradeHash` to verify parameters being signed + + Users can view their trade approval hash via [`getTradeApprovalHash()`](https://github.com/sapiencexyz/sapience/blob/cfbaaa8045706ed96a604cb4484b55f11809553b/packages/protocol/src/SecondaryMarketEscrow.sol#L185-L198) to verify the data hash being to be signed by the user. This requires inputting a `tradeHash` which contains a hash of important trade data including the token and collateral types, amount and price. Allowing users to be able to input this data and generate the trade hash used in the trade approval hash would help verify what they are actually signing, since a malicious hash could result in negative outcomes for the user. + + **Remediations to Consider** + + Add the ability to generate the trade hash with its input parameters to more easily verify what exactly is being signed. + + + + + Duplicate code + low + fixed + TODO + + ## [Q-1] Duplicate code used to generate `TradeApprovalHash` + + --- | --- | + | **Impact** | low | + + The trade approval hash which is signed and verified in trades is generated in the public view function [`getTradeApprovalHash()`](https://github.com/sapiencexyz/sapience/blob/cfbaaa8045706ed96a604cb4484b55f11809553b/packages/protocol/src/SecondaryMarketEscrow.sol#L185-L198), as well as independently in both [`_isTradeApprovalValid()`](https://github.com/sapiencexyz/sapience/blob/cfbaaa8045706ed96a604cb4484b55f11809553b/packages/protocol/src/SecondaryMarketEscrow.sol#L262-L282) and [`_isTradeApprovalValidWithEIP1271Fallback()`](https://github.com/sapiencexyz/sapience/blob/cfbaaa8045706ed96a604cb4484b55f11809553b/packages/protocol/src/SecondaryMarketEscrow.sol#L284-L315). Although the result is the same valid hash, and no branch calculates it multiple times, it is best practice to reduce duplicate code where possible to prevent issues creeping up if changes are made in the future. + + **Remediations to Consider** + + Use [`getTradeApprovalHash()`](https://github.com/sapiencexyz/sapience/blob/cfbaaa8045706ed96a604cb4484b55f11809553b/packages/protocol/src/SecondaryMarketEscrow.sol#L185-L198) wherever the approval hash is required to prevent duplicate code. + + --- + + + \ No newline at end of file