From d8962eeaf2b2ecb06e1a1c4edd4f0467352508e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20James=20Toussaint?= <33313130+jeremyjams@users.noreply.github.com> Date: Fri, 28 Feb 2025 13:19:17 +0100 Subject: [PATCH 1/3] Index first parameter of match an claim events in Voucher contract --- CHANGELOG.md | 2 +- contracts/beacon/IVoucher.sol | 2 +- contracts/beacon/Voucher.sol | 7 +++---- docs/IVoucher.md | 2 +- package.json | 7 ++----- scripts/voucherHubUtils.ts | 2 +- test/beacon/Voucher.test.ts | 2 +- 7 files changed, 10 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad029fea..477e1411 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,9 @@ # Changelog ## vNEXT +- Index first parameter of match an claim events in `Voucher` contract. (#61, #72) - Add upgrade workflow. (#64) - Add Halborn "Poco v5.5 & Voucher v1.0" audit report ( #70) -- Add `dealId` to `TaskClaimedWithVoucher` event. (#61) - Add type-checking script (#53) - Run partial upgrade tests on fork. - Should maintain consistent voucher addresses (#61) diff --git a/contracts/beacon/IVoucher.sol b/contracts/beacon/IVoucher.sol index 7f263b00..dd3e98dc 100644 --- a/contracts/beacon/IVoucher.sol +++ b/contracts/beacon/IVoucher.sol @@ -11,7 +11,7 @@ interface IVoucher { event AccountUnauthorized(address indexed account); event OrdersMatchedWithVoucher(bytes32 indexed dealId); event OrdersBoostMatchedWithVoucher(bytes32 indexed dealId); - event TaskClaimedWithVoucher(bytes32 indexed taskId, bytes32 indexed dealId); + event TaskClaimedWithVoucher(bytes32 indexed taskId); function setExpiration(uint256 expiration) external; function authorizeAccount(address account) external; diff --git a/contracts/beacon/Voucher.sol b/contracts/beacon/Voucher.sol index 3b464322..a680ed79 100644 --- a/contracts/beacon/Voucher.sol +++ b/contracts/beacon/Voucher.sol @@ -214,8 +214,7 @@ contract Voucher is Initializable, IVoucher { if (task.status != IexecLibCore_v5.TaskStatusEnum.FAILED) { IexecPoco2(iexecPoco).claim(taskId); } - bytes32 dealId = task.dealid; - IexecLibCore_v5.Deal memory deal = IexecPocoAccessors(iexecPoco).viewDeal(dealId); + IexecLibCore_v5.Deal memory deal = IexecPocoAccessors(iexecPoco).viewDeal(task.dealid); // If the deal was matched by the voucher, then the voucher should be refunded. // If the deal was partially or not sponsored by the voucher, then the requester // should be refunded. @@ -230,7 +229,7 @@ contract Voucher is Initializable, IVoucher { deal.requester ); } - emit TaskClaimedWithVoucher(taskId, dealId); + emit TaskClaimedWithVoucher(taskId); } /** @@ -263,7 +262,7 @@ contract Voucher is Initializable, IVoucher { deal.requester ); } - emit TaskClaimedWithVoucher(taskId, dealId); + emit TaskClaimedWithVoucher(taskId); } /** diff --git a/docs/IVoucher.md b/docs/IVoucher.md index d47dc809..d8c66322 100644 --- a/docs/IVoucher.md +++ b/docs/IVoucher.md @@ -35,7 +35,7 @@ event OrdersBoostMatchedWithVoucher(bytes32 dealId) ### TaskClaimedWithVoucher ```solidity -event TaskClaimedWithVoucher(bytes32 taskId, bytes32 dealId) +event TaskClaimedWithVoucher(bytes32 taskId) ``` ### setExpiration diff --git a/package.json b/package.json index 699b706f..2ab2b14e 100644 --- a/package.json +++ b/package.json @@ -35,11 +35,8 @@ "lint": "solhint 'contracts/**/*.sol' --fix && eslint . --fix" }, "lint-staged": { - "*.ts": [ - "npm run lint:ts" - ], - "*.sol": [ - "npm run lint:sol" + "*.{ts,sol}": [ + "npm run lint" ] }, "devDependencies": { diff --git a/scripts/voucherHubUtils.ts b/scripts/voucherHubUtils.ts index 475dff16..3397045a 100644 --- a/scripts/voucherHubUtils.ts +++ b/scripts/voucherHubUtils.ts @@ -89,6 +89,6 @@ export async function getExpectedVoucherProxyCodeHash(voucherBeaconAddress: stri * * Also see test/NextVersionUpgrade.test.ts to double check behavior. */ - return '0x31a4f4707138270dd34b040129096c67e1039fb242deebb8a0d0f8ed9da82232'; + return '0x1904181fa3fbe85a0796789e46d9ee31e5585fbdbabce28931332862d68c9313'; } } diff --git a/test/beacon/Voucher.test.ts b/test/beacon/Voucher.test.ts index d832b07c..3fa53a24 100644 --- a/test/beacon/Voucher.test.ts +++ b/test/beacon/Voucher.test.ts @@ -769,7 +769,7 @@ describe('Voucher', function () { .to.emit(voucherHub, 'VoucherRefunded') .withArgs(voucherAddress, taskSponsoredAmount) .to.emit(voucherAsOwner, 'TaskClaimedWithVoucher') - .withArgs(taskId, dealId); + .withArgs(taskId); const { voucherCreditBalance: voucherCreditBalancePostClaim, voucherSrlcBalance: voucherSrlcBalancePostClaim, From 0f472c6d37553896d4fe84a0261b66e7a20fefab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20James=20Toussaint?= <33313130+jeremyjams@users.noreply.github.com> Date: Fri, 28 Feb 2025 15:04:01 +0100 Subject: [PATCH 2/3] Update copyright year --- contracts/beacon/IVoucher.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/beacon/IVoucher.sol b/contracts/beacon/IVoucher.sol index dd3e98dc..9bbaaefd 100644 --- a/contracts/beacon/IVoucher.sol +++ b/contracts/beacon/IVoucher.sol @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2024 IEXEC BLOCKCHAIN TECH +// SPDX-FileCopyrightText: 2024-2025 IEXEC BLOCKCHAIN TECH // SPDX-License-Identifier: Apache-2.0 import {IexecLibOrders_v5} from "@iexec/poco/contracts/libs/IexecLibOrders_v5.sol"; From f8389fbbb4ae29e8ccb8544373f8bacc52bcf5e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20James=20Toussaint?= <33313130+jeremyjams@users.noreply.github.com> Date: Fri, 28 Feb 2025 15:07:21 +0100 Subject: [PATCH 3/3] Update test proxy hash value --- scripts/voucherHubUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/voucherHubUtils.ts b/scripts/voucherHubUtils.ts index 3397045a..5c7fc9b5 100644 --- a/scripts/voucherHubUtils.ts +++ b/scripts/voucherHubUtils.ts @@ -89,6 +89,6 @@ export async function getExpectedVoucherProxyCodeHash(voucherBeaconAddress: stri * * Also see test/NextVersionUpgrade.test.ts to double check behavior. */ - return '0x1904181fa3fbe85a0796789e46d9ee31e5585fbdbabce28931332862d68c9313'; + return '0xe0f74e59778f75b77efb2064c8358a84106c7a95517a2c8503e38996071e6522'; } }