Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
f34d071
feat: Update IexecPocoAccessorsFacet and related scripts for enhanced…
gfournieriExec Sep 18, 2025
4a44957
feat: Remove useless file
gfournieriExec Sep 22, 2025
99b1b47
feat: Refactor deal and task accessors in IexecPocoAccessorsFacet
gfournieriExec Sep 22, 2025
be36a3a
feat: Update Arbitrum RPC URL in Hardhat configuration
gfournieriExec Sep 22, 2025
7c7fe07
feat: move new upgrades scripts in accessors subfolder
gfournieriExec Sep 22, 2025
8b261fd
feat: refactor deployment script for IexecPocoAccessorsFacet
gfournieriExec Sep 22, 2025
b27b116
feat: change to pure instead of view
gfournieriExec Sep 22, 2025
9e1d7eb
feat: remove commented code for IexecAccessorsFacet in deploy script
gfournieriExec Sep 22, 2025
27f02ab
Merge branch 'main' into feature/new-viewer-fct
Le-Caignec Sep 22, 2025
2939683
feat: remove blockNumber configuration for Arbitrum forking
gfournieriExec Sep 22, 2025
99acad3
fix: remove commented code in update proxy script for IexecPocoAccess…
gfournieriExec Sep 22, 2025
359d32c
refactor: remove unused functionsToRemove array in update proxy script
gfournieriExec Sep 22, 2025
aa5d0e1
refactor: remove deployment record update for IexecPocoAccessorsFacet…
gfournieriExec Sep 22, 2025
cc99fa1
feat: implement deployment and update logic for IexecPocoAccessorsFac…
gfournieriExec Sep 22, 2025
ce727e7
refactor: simplify old accessor facets identification in deploy script
gfournieriExec Sep 22, 2025
a74abf2
refactor: remove IexecAccessorsFacet contract as part of code cleanup
gfournieriExec Sep 22, 2025
2aefd8e
refactor: change public constants to internal in FacetBase contract
gfournieriExec Sep 22, 2025
552b7ad
refactor: enhance removal logic for specific constant functions in Ie…
gfournieriExec Sep 22, 2025
342f64d
refactor: replace hardcoded constant function signatures with dynamic…
gfournieriExec Sep 22, 2025
101ef27
refactor: clarify comment for constant facet address in deploy script
gfournieriExec Sep 22, 2025
22b517e
refactor: update variable names for clarity in deploy and update scri…
gfournieriExec Sep 22, 2025
78d8a97
refactor: replace function selector retrieval with linkContractToProx…
gfournieriExec Sep 22, 2025
28c953f
Merge branch 'feature/new-viewer-fct' into feature/const-to-internal
gfournieriExec Sep 22, 2025
7bd8bef
refactor: streamline upgrade process by removing redundant logs and e…
gfournieriExec Sep 23, 2025
6e779b6
Merge branch 'main' into feature/const-to-internal
gfournieriExec Sep 23, 2025
871d1f2
refactor: update error handling in viewCategory test to use revertedW…
gfournieriExec Sep 23, 2025
99ed6a4
fix: update bigintToAddress function to specify byte length for hex c…
gfournieriExec Sep 23, 2025
45ea533
refactor: reorder console logs for clarity in appRegistry token retri…
gfournieriExec Sep 23, 2025
cf0c3fe
refactor: remove unnecessary console logs in appRegistry token retrie…
gfournieriExec Sep 23, 2025
6eddbd5
feat: add dataset, app, and workerpool accessors with corresponding v…
gfournieriExec Sep 23, 2025
83d732c
refactor: change owner function visibility to internal and update TOD…
gfournieriExec Sep 23, 2025
a5e6e90
refactor: improve logging for diamond functions before upgrade in dep…
gfournieriExec Sep 23, 2025
9410bfa
refactor: streamline removal of old accessor facets and constant func…
gfournieriExec Sep 23, 2025
01107ef
refactor: remove owner function and onlyOwner modifier in FacetBase c…
gfournieriExec Sep 24, 2025
db8005a
refactor: add logging for constant functions scheduled for removal in…
gfournieriExec Sep 24, 2025
7fb43fd
test: move from IexecAccessors to IexecPocoAccessors test file
gfournieriExec Sep 24, 2025
3e408b8
Merge branch 'feature/const-to-internal' into feature/add-view-assets…
gfournieriExec Sep 24, 2025
446ccac
refactor: reorganize dataset, app, and workerpool accessors in IexecA…
gfournieriExec Sep 24, 2025
5fabe28
refactor: update accessors to use interfaces for Dataset, App, and Wo…
gfournieriExec Sep 24, 2025
a0a68cb
fix: add missing newline in IexecPocoAccessorsFacet.sol imports
gfournieriExec Sep 24, 2025
ab33303
refactor: remove unnecessary line breaks in IWorkerpool interface
gfournieriExec Sep 24, 2025
09ff593
Merge branch 'main' into feature/add-view-assets-functions
gfournieriExec Sep 24, 2025
406c10b
refactor: sepolia arbitrum enhance proxy owner signer logic and encap…
gfournieriExec Sep 24, 2025
9185de0
Merge branch 'main' into feature/add-view-assets-functions
gfournieriExec Sep 25, 2025
b8c1d65
feat: enhance IexecPocoAccessors tests with app and dataset creation …
gfournieriExec Sep 25, 2025
e6b3360
refactor: update IexecWrapper to use constants for app and dataset cr…
gfournieriExec Sep 25, 2025
d191b3f
refactor: update IexecWrapper to use IWorkerpool factory for workerpo…
gfournieriExec Sep 25, 2025
c58bfaf
fix: update test/utils/IexecWrapper.ts
gfournieriExec Sep 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions contracts/facets/IexecPocoAccessorsFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import {PocoStorageLib, IRegistry} from "../libs/PocoStorageLib.v8.sol";
import {FacetBase} from "./FacetBase.v8.sol";
import {IexecLibCore_v5} from "../libs/IexecLibCore_v5.sol";
import {IexecLibOrders_v5} from "../libs/IexecLibOrders_v5.sol";
import {IDataset} from "../registries/datasets/IDataset.v8.sol";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we indicate that this is version 8 in the file name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good question, matched what was already done with IWorkpool file can change it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep them ISO yes. Otherwise we'll need to modify IexecPoco1Facet and IexecPocoBoostFacet.

import {IApp} from "../registries/apps/IApp.v8.sol";
import {IWorkerpool} from "../registries/workerpools/IWorkerpool.v8.sol";
import {IexecPocoAccessors} from "../interfaces/IexecPocoAccessors.sol";
import {IexecPocoCommon} from "./IexecPocoCommon.sol";
import {SignatureVerifier} from "./SignatureVerifier.v8.sol";
Expand Down Expand Up @@ -196,6 +199,51 @@ contract IexecPocoAccessorsFacet is
return $.m_callbackgas;
}

// ========= Dataset Accessors =========

function viewDataset(
address dataset
) external view returns (IexecLibCore_v5.DatasetInfo memory) {
IDataset datasetContract = IDataset(dataset);
return
IexecLibCore_v5.DatasetInfo({
owner: datasetContract.owner(),
m_datasetName: datasetContract.m_datasetName(),
m_datasetMultiaddr: datasetContract.m_datasetMultiaddr(),
m_datasetChecksum: datasetContract.m_datasetChecksum()
});
}

// ========= App Accessors =========

function viewApp(address app) external view returns (IexecLibCore_v5.AppInfo memory) {
IApp appContract = IApp(app);
return
IexecLibCore_v5.AppInfo({
owner: appContract.owner(),
m_appName: appContract.m_appName(),
m_appType: appContract.m_appType(),
m_appMultiaddr: appContract.m_appMultiaddr(),
m_appChecksum: appContract.m_appChecksum(),
m_appMREnclave: appContract.m_appMREnclave()
});
}

// ========= Workerpool Accessors =========

function viewWorkerpool(
address workerpool
) external view returns (IexecLibCore_v5.WorkerpoolInfo memory) {
IWorkerpool workerpoolContract = IWorkerpool(workerpool);
return
IexecLibCore_v5.WorkerpoolInfo({
owner: workerpoolContract.owner(),
m_workerpoolDescription: workerpoolContract.m_workerpoolDescription(),
m_workerStakeRatioPolicy: workerpoolContract.m_workerStakeRatioPolicy(),
m_schedulerRewardRatioPolicy: workerpoolContract.m_schedulerRewardRatioPolicy()
});
}

// ========= Constants Accessors =========

function contribution_deadline_ratio() external pure returns (uint256) {
Expand Down
13 changes: 13 additions & 0 deletions contracts/interfaces/IexecAccessors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,17 @@ interface IexecAccessors is IOracle {
function kitty_address() external view returns (address);
function groupmember_purpose() external view returns (uint256);
function eip712domain_separator() external view returns (bytes32);

// ========= Dataset Accessors =========
function viewDataset(
address dataset
) external view returns (IexecLibCore_v5.DatasetInfo memory);

// ========= App Accessors =========
function viewApp(address app) external view returns (IexecLibCore_v5.AppInfo memory);

// ========= Workerpool Accessors =========
function viewWorkerpool(
address workerpool
) external view returns (IexecLibCore_v5.WorkerpoolInfo memory);
}
13 changes: 13 additions & 0 deletions contracts/interfaces/IexecPocoAccessors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,19 @@ interface IexecPocoAccessors {
function teebroker() external view returns (address);
function callbackgas() external view returns (uint256);

// ========= Dataset Accessors =========
function viewDataset(
address dataset
) external view returns (IexecLibCore_v5.DatasetInfo memory);

// ========= App Accessors =========
function viewApp(address app) external view returns (IexecLibCore_v5.AppInfo memory);

// ========= Workerpool Accessors =========
function viewWorkerpool(
address workerpool
) external view returns (IexecLibCore_v5.WorkerpoolInfo memory);

// ========= Constants Accessors =========
function contribution_deadline_ratio() external view returns (uint256);
function reveal_deadline_ratio() external view returns (uint256);
Expand Down
22 changes: 22 additions & 0 deletions contracts/libs/IexecLibCore_v5.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,28 @@ library IexecLibCore_v5 {
string description;
uint256 workClockTimeRef;
}
struct DatasetInfo {
address owner;
string m_datasetName;
bytes m_datasetMultiaddr;
bytes32 m_datasetChecksum;
}

struct AppInfo {
address owner;
string m_appName;
string m_appType;
bytes m_appMultiaddr;
bytes32 m_appChecksum;
bytes m_appMREnclave;
}

struct WorkerpoolInfo {
address owner;
string m_workerpoolDescription;
uint256 m_workerStakeRatioPolicy;
uint256 m_schedulerRewardRatioPolicy;
}
Comment on lines +19 to +40
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option could be to have those structs directly in the asset contract interface. I’m not sure which solution is better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be an option but this would imply having v6 and v8 interfaces in asset contract interface

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But that's work fine as well
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok to put them inside LibCore since viewDataset is in the PoCo's code not in registries.


/**
* Clerk - Deals
Expand Down
12 changes: 12 additions & 0 deletions contracts/registries/apps/IApp.v8.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-FileCopyrightText: 2023-2025 IEXEC BLOCKCHAIN TECH <contact@iex.ec>
// SPDX-License-Identifier: Apache-2.0

pragma solidity ^0.8.0;
interface IApp {
function owner() external view returns (address);
function m_appName() external view returns (string memory);
function m_appType() external view returns (string memory);
function m_appMultiaddr() external view returns (bytes memory);
function m_appChecksum() external view returns (bytes32);
function m_appMREnclave() external view returns (bytes memory);
}
10 changes: 10 additions & 0 deletions contracts/registries/datasets/IDataset.v8.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SPDX-FileCopyrightText: 2023-2025 IEXEC BLOCKCHAIN TECH <contact@iex.ec>
// SPDX-License-Identifier: Apache-2.0

pragma solidity ^0.8.0;
interface IDataset {
function owner() external view returns (address);
function m_datasetName() external view returns (string memory);
function m_datasetMultiaddr() external view returns (bytes memory);
function m_datasetChecksum() external view returns (bytes32);
}
7 changes: 4 additions & 3 deletions contracts/registries/workerpools/IWorkerpool.v8.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
pragma solidity ^0.8.0;

interface IWorkerpool {
function m_schedulerRewardRatioPolicy() external returns (uint256);

function m_workerStakeRatioPolicy() external returns (uint256);
function owner() external view returns (address);
function m_workerpoolDescription() external view returns (string memory);
function m_schedulerRewardRatioPolicy() external view returns (uint256);
function m_workerStakeRatioPolicy() external view returns (uint256);
}
48 changes: 26 additions & 22 deletions scripts/upgrades/accessors/deploy-and-update-accessor-facet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { printFunctions } from '../upgrade-helper';

// Use impersonated signer only for fork testing, otherwise use account signer
const proxyOwnerSigner =
process.env.ARBITRUM_FORK === 'true'
process.env.ARBITRUM_FORK === 'true' || process.env.ARBITRUM_SEPOLIA_FORK === 'true'
? await ethers.getImpersonatedSigner(proxyOwnerAddress)
: account;
const diamondProxyAsOwner = DiamondCutFacet__factory.connect(
Expand Down Expand Up @@ -73,27 +73,31 @@ import { printFunctions } from '../upgrade-helper';
await printFunctions(diamondProxyAddress);

const removalCuts: IDiamond.FacetCutStruct[] = [];
const constantFunctionSignatures = [
'CONTRIBUTION_DEADLINE_RATIO()',
'FINAL_DEADLINE_RATIO()',
'GROUPMEMBER_PURPOSE()',
'KITTY_ADDRESS()',
'KITTY_MIN()',
'KITTY_RATIO()',
'REVEAL_DEADLINE_RATIO()',
'WORKERPOOL_STAKE_RATIO()',
];
const constantFunctionsToRemove = constantFunctionSignatures.map((sig) =>
ethers.id(sig).slice(0, 10),
);
console.log(
`Removing specific constant functions from diamond Proxy - will remove ${constantFunctionsToRemove.length} specific constant functions`,
);
removalCuts.push({
facetAddress: ZeroAddress,
action: FacetCutAction.Remove,
functionSelectors: constantFunctionsToRemove,
});

// constant functions are deployed within IexecAccessorsFacet on arbitrum sepolia
if (process.env.ARBITRUM_FORK === 'true' || chainId == 42161n) {
const constantFunctionSignatures = [
'CONTRIBUTION_DEADLINE_RATIO()',
'FINAL_DEADLINE_RATIO()',
'GROUPMEMBER_PURPOSE()',
'KITTY_ADDRESS()',
'KITTY_MIN()',
'KITTY_RATIO()',
'REVEAL_DEADLINE_RATIO()',
'WORKERPOOL_STAKE_RATIO()',
];
const constantFunctionsToRemove = constantFunctionSignatures.map((sig) =>
ethers.id(sig).slice(0, 10),
);
console.log(
`Removing specific constant functions from diamond Proxy - will remove ${constantFunctionsToRemove.length} specific constant functions`,
);
removalCuts.push({
facetAddress: ZeroAddress,
action: FacetCutAction.Remove,
functionSelectors: constantFunctionsToRemove,
});
}

const oldAccessorFacets = [
'0xEa232be31ab0112916505Aeb7A2a94b5571DCc6b', //IexecAccessorsFacet
Expand Down
37 changes: 36 additions & 1 deletion test/byContract/iexecPocoAccessors/IexecPocoAccessors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,23 @@ import {
getIexecAccounts,
getTaskId,
} from '../../../utils/poco-tools';
import { IexecWrapper } from '../../utils/IexecWrapper';
import {
APP_CHECKSUM,
APP_MR_ENCLAVE,
APP_MULTIADDR,
DATASET_CHECKSUM,
DATASET_MULTIADDR,
IexecWrapper,
} from '../../utils/IexecWrapper';
import { loadHardhatFixtureDeployment } from '../../utils/hardhat-fixture-deployer';
import { hashDomain, randomAddress } from '../../utils/utils';

/**
* Test state view functions.
*/

// Asset test data constants

const appPrice = 1000n;
const datasetPrice = 1_000_000n;
const workerpoolPrice = 1_000_000_000n;
Expand Down Expand Up @@ -243,6 +252,32 @@ describe('IexecPocoAccessors', async () => {
expect(await iexecPoco.callbackgas()).to.equal(100_000n);
});

it('viewDataset', async function () {
const datasetInfo = await iexecPoco.viewDataset(datasetAddress);
expect(datasetInfo.owner).to.equal(datasetProvider.address);
expect(datasetInfo.m_datasetName).to.equal('my-dataset');
expect(datasetInfo.m_datasetMultiaddr).to.equal(DATASET_MULTIADDR);
expect(datasetInfo.m_datasetChecksum).to.equal(DATASET_CHECKSUM);
});

it('viewApp', async function () {
const appInfo = await iexecPoco.viewApp(appAddress);
expect(appInfo.owner).to.equal(appProvider.address);
expect(appInfo.m_appName).to.equal('my-app');
expect(appInfo.m_appType).to.equal('APP_TYPE_0');
expect(appInfo.m_appMultiaddr).to.equal(APP_MULTIADDR);
expect(appInfo.m_appChecksum).to.equal(APP_CHECKSUM);
expect(appInfo.m_appMREnclave).to.equal(APP_MR_ENCLAVE);
});

it('viewWorkerpool', async function () {
const workerpoolInfo = await iexecPoco.viewWorkerpool(workerpoolAddress);
expect(workerpoolInfo.owner).to.equal(scheduler.address);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The owner of the workerpool is the scheduler 🤔 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here yes
image

expect(workerpoolInfo.m_workerpoolDescription).to.equal('my-workerpool');
expect(workerpoolInfo.m_workerStakeRatioPolicy).to.equal(30n);
expect(workerpoolInfo.m_schedulerRewardRatioPolicy).to.equal(1n);
});

it('contributionDeadlineRatio', async function () {
expect(await iexecPoco.contribution_deadline_ratio()).to.equal(7);
});
Expand Down
27 changes: 18 additions & 9 deletions test/utils/IexecWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import {
Interface,
TypedDataDomain,
ZeroAddress,
ZeroHash,
} from 'ethers';
import hre, { ethers } from 'hardhat';
import {
AppRegistry,
AppRegistry__factory,
DatasetRegistry,
DatasetRegistry__factory,
IWorkerpool__factory,
IexecAccessors__factory,
IexecConfigurationFacet__factory,
IexecInterfaceNative__factory,
Expand All @@ -29,7 +29,6 @@ import {
Registry__factory,
WorkerpoolRegistry,
WorkerpoolRegistry__factory,
Workerpool__factory,
} from '../../typechain';
import { TransferEvent } from '../../typechain/contracts/registries/IRegistry';
import { IexecPoco1__factory } from '../../typechain/factories/contracts/interfaces/IexecPoco1.v8.sol/IexecPoco1__factory';
Expand All @@ -52,6 +51,12 @@ import {
setNextBlockTimestamp,
} from '../../utils/poco-tools';

export const APP_MULTIADDR = '0x68656c6c6f20776f726c64'; // "hello world" in hex
export const APP_CHECKSUM = '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef';
export const APP_MR_ENCLAVE = '0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890';
export const DATASET_MULTIADDR = '0x646174617365742064617461'; // "dataset data" in hex
export const DATASET_CHECKSUM =
'0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321';
export class IexecWrapper {
proxyAddress: string;
accounts: IexecAccounts;
Expand Down Expand Up @@ -129,8 +134,7 @@ export class IexecWrapper {
* @returns value of worker stake
*/
async computeWorkerTaskStake(workerpoolAddress: string, workerpoolPrice: bigint) {
// TODO make "m_workerStakeRatioPolicy()" as view function in IWorkerpool.v8 and use it.
const workerStakeRatio = await Workerpool__factory.connect(
const workerStakeRatio = await IWorkerpool__factory.connect(
workerpoolAddress,
this.accounts.anyone,
).m_workerStakeRatioPolicy();
Expand All @@ -143,7 +147,7 @@ export class IexecWrapper {
* @returns value of the reward
*/
async getSchedulerRewardRatio(workerpoolAddress: string) {
return await Workerpool__factory.connect(
return await IWorkerpool__factory.connect(
workerpoolAddress,
this.accounts.anyone,
).m_schedulerRewardRatioPolicy();
Expand Down Expand Up @@ -302,9 +306,9 @@ export class IexecWrapper {
this.accounts.appProvider.address,
'my-app',
'APP_TYPE_0',
ZeroHash,
ZeroHash,
ZeroHash,
APP_MULTIADDR,
APP_CHECKSUM,
APP_MR_ENCLAVE,
)
.then((tx) => tx.wait());
return await extractRegistryEntryAddress(appReceipt);
Expand All @@ -317,7 +321,12 @@ export class IexecWrapper {
this.accounts.datasetProvider,
);
const datasetReceipt = await datasetRegistry
.createDataset(this.accounts.datasetProvider.address, 'my-dataset', ZeroHash, ZeroHash)
.createDataset(
this.accounts.datasetProvider.address,
'my-dataset',
DATASET_MULTIADDR,
DATASET_CHECKSUM,
)
.then((tx) => tx.wait());
return await extractRegistryEntryAddress(datasetReceipt);
}
Expand Down