Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f34d071
feat: Update IexecPocoAccessorsFacet and related scripts for enhanced…
gfournierPro Sep 18, 2025
4a44957
feat: Remove useless file
gfournierPro Sep 22, 2025
99b1b47
feat: Refactor deal and task accessors in IexecPocoAccessorsFacet
gfournierPro Sep 22, 2025
be36a3a
feat: Update Arbitrum RPC URL in Hardhat configuration
gfournierPro Sep 22, 2025
7c7fe07
feat: move new upgrades scripts in accessors subfolder
gfournierPro Sep 22, 2025
8b261fd
feat: refactor deployment script for IexecPocoAccessorsFacet
gfournierPro Sep 22, 2025
b27b116
feat: change to pure instead of view
gfournierPro Sep 22, 2025
9e1d7eb
feat: remove commented code for IexecAccessorsFacet in deploy script
gfournierPro 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
gfournierPro Sep 22, 2025
99acad3
fix: remove commented code in update proxy script for IexecPocoAccess…
gfournierPro Sep 22, 2025
359d32c
refactor: remove unused functionsToRemove array in update proxy script
gfournierPro Sep 22, 2025
aa5d0e1
refactor: remove deployment record update for IexecPocoAccessorsFacet…
gfournierPro Sep 22, 2025
cc99fa1
feat: implement deployment and update logic for IexecPocoAccessorsFac…
gfournierPro Sep 22, 2025
ce727e7
refactor: simplify old accessor facets identification in deploy script
gfournierPro Sep 22, 2025
a74abf2
refactor: remove IexecAccessorsFacet contract as part of code cleanup
gfournierPro Sep 22, 2025
2aefd8e
refactor: change public constants to internal in FacetBase contract
gfournierPro Sep 22, 2025
552b7ad
refactor: enhance removal logic for specific constant functions in Ie…
gfournierPro Sep 22, 2025
342f64d
refactor: replace hardcoded constant function signatures with dynamic…
gfournierPro Sep 22, 2025
101ef27
refactor: clarify comment for constant facet address in deploy script
gfournierPro Sep 22, 2025
22b517e
refactor: update variable names for clarity in deploy and update scri…
gfournierPro Sep 22, 2025
78d8a97
refactor: replace function selector retrieval with linkContractToProx…
gfournierPro Sep 22, 2025
28c953f
Merge branch 'feature/new-viewer-fct' into feature/const-to-internal
gfournierPro Sep 22, 2025
7bd8bef
refactor: streamline upgrade process by removing redundant logs and e…
gfournierPro Sep 23, 2025
6e779b6
Merge branch 'main' into feature/const-to-internal
gfournierPro Sep 23, 2025
871d1f2
refactor: update error handling in viewCategory test to use revertedW…
gfournierPro Sep 23, 2025
99ed6a4
fix: update bigintToAddress function to specify byte length for hex c…
gfournierPro Sep 23, 2025
45ea533
refactor: reorder console logs for clarity in appRegistry token retri…
gfournierPro Sep 23, 2025
cf0c3fe
refactor: remove unnecessary console logs in appRegistry token retrie…
gfournierPro Sep 23, 2025
83d732c
refactor: change owner function visibility to internal and update TOD…
gfournierPro Sep 23, 2025
a5e6e90
refactor: improve logging for diamond functions before upgrade in dep…
gfournierPro Sep 23, 2025
9410bfa
refactor: streamline removal of old accessor facets and constant func…
gfournierPro Sep 23, 2025
01107ef
refactor: remove owner function and onlyOwner modifier in FacetBase c…
gfournierPro Sep 24, 2025
db8005a
refactor: add logging for constant functions scheduled for removal in…
gfournierPro Sep 24, 2025
7fb43fd
test: move from IexecAccessors to IexecPocoAccessors test file
gfournierPro Sep 24, 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
19 changes: 10 additions & 9 deletions contracts/facets/FacetBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,28 @@ import "../interfaces/IOwnable.sol";
*/
abstract contract FacetBase {
// Poco - Constants
uint256 public constant CONTRIBUTION_DEADLINE_RATIO = 7;
uint256 public constant REVEAL_DEADLINE_RATIO = 2;
uint256 public constant FINAL_DEADLINE_RATIO = 10;
uint256 public constant WORKERPOOL_STAKE_RATIO = 30;
uint256 public constant KITTY_RATIO = 10;
uint256 public constant KITTY_MIN = 1e9; // ADJUSTEMENT VARIABLE
uint256 internal constant CONTRIBUTION_DEADLINE_RATIO = 7;
uint256 internal constant REVEAL_DEADLINE_RATIO = 2;
uint256 internal constant FINAL_DEADLINE_RATIO = 10;
uint256 internal constant WORKERPOOL_STAKE_RATIO = 30;
uint256 internal constant KITTY_RATIO = 10;
uint256 internal constant KITTY_MIN = 1e9; // ADJUSTEMENT VARIABLE

// Seized funds of workerpools that do not honor their deals are sent
// out to this kitty address.
// It is determined with address(uint256(keccak256(bytes('iExecKitty'))) - 1).
address public constant KITTY_ADDRESS = 0x99c2268479b93fDe36232351229815DF80837e23;
address internal constant KITTY_ADDRESS = 0x99c2268479b93fDe36232351229815DF80837e23;

// Used with ERC-734 Key Manager identity contract for authorization management.
uint256 public constant GROUPMEMBER_PURPOSE = 4;
uint256 internal constant GROUPMEMBER_PURPOSE = 4;

modifier onlyOwner() {
require(_msgSender() == owner(), "Ownable: caller is not the owner");
_;
}

function owner() public view returns (address) {
function owner() internal view returns (address) {
// TODO use LibDiamond.contractOwner() instead of an external call when migrating all contracts to v8.
return IOwnable(address(this)).owner();
}

Expand Down
26 changes: 8 additions & 18 deletions contracts/facets/FacetBase.v8.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,20 @@ import {PocoStorageLib} from "../libs/PocoStorageLib.v8.sol";
*/
abstract contract FacetBase {
// Poco - Constants
uint256 public constant CONTRIBUTION_DEADLINE_RATIO = 7;
uint256 public constant REVEAL_DEADLINE_RATIO = 2;
uint256 public constant FINAL_DEADLINE_RATIO = 10;
uint256 public constant WORKERPOOL_STAKE_RATIO = 30;
uint256 public constant KITTY_RATIO = 10;
uint256 public constant KITTY_MIN = 1e9; // ADJUSTEMENT VARIABLE
uint256 internal constant CONTRIBUTION_DEADLINE_RATIO = 7;
uint256 internal constant REVEAL_DEADLINE_RATIO = 2;
uint256 internal constant FINAL_DEADLINE_RATIO = 10;
uint256 internal constant WORKERPOOL_STAKE_RATIO = 30;
uint256 internal constant KITTY_RATIO = 10;
uint256 internal constant KITTY_MIN = 1e9; // ADJUSTEMENT VARIABLE

// Seized funds of workerpools that do not honor their deals are sent
// out to this kitty address.
// It is determined with address(uint256(keccak256(bytes('iExecKitty'))) - 1).
address public constant KITTY_ADDRESS = 0x99c2268479b93fDe36232351229815DF80837e23;
address internal constant KITTY_ADDRESS = 0x99c2268479b93fDe36232351229815DF80837e23;

// Used with ERC-734 Key Manager identity contract for authorization management.
uint256 public constant GROUPMEMBER_PURPOSE = 4;

modifier onlyOwner() {
require(_msgSender() == owner(), "Ownable: caller is not the owner");
_;
}

function owner() public view returns (address) {
// Make an external call to delegatecall the OwnershipFacet.
return IERC5313(address(this)).owner();
}
uint256 internal constant GROUPMEMBER_PURPOSE = 4;

function _msgSender() internal view returns (address) {
return msg.sender;
Expand Down
176 changes: 0 additions & 176 deletions contracts/facets/IexecAccessorsFacet.sol

This file was deleted.

36 changes: 29 additions & 7 deletions scripts/upgrades/accessors/deploy-and-update-accessor-facet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ import { printFunctions } from '../upgrade-helper';
const newFacetFactory = new IexecPocoAccessorsFacet__factory(iexecLibOrders);
const newFacetAddress = await factoryDeployer.deployContract(newFacetFactory);

console.log('\n=== Step 2: Remove old facets (remove all functions of each facet) ===');
console.log(
'\n=== Step 2: Remove old facets (remove all functions of old accessors facets) ===',
);

const diamondLoupe = DiamondLoupeFacet__factory.connect(diamondProxyAddress, account);
const currentFacets = await diamondLoupe.facets();
Expand All @@ -67,17 +69,37 @@ import { printFunctions } from '../upgrade-helper';
console.log(` ${facet.facetAddress}: ${facet.functionSelectors.length} functions`);
});

const oldAccessorFacets = [
'0xEa232be31ab0112916505Aeb7A2a94b5571DCc6b', //IexecAccessorsFacet
'0xeb40697b275413241d9b31dE568C98B3EA12FFF0', //IexecPocoAccessorsFacet
];

console.log('Diamond functions before upgrade:');
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,
});

// Remove ALL functions from the old accessor facets using diamondLoupe.facetFunctionSelectors()
const oldAccessorFacets = [
'0xEa232be31ab0112916505Aeb7A2a94b5571DCc6b', //IexecAccessorsFacet
'0xeb40697b275413241d9b31dE568C98B3EA12FFF0', //IexecPocoAccessorsFacet
];
// Remove ALL functions from the old accessor facets using diamondLoupe.facetFunctionSelectors() except of constant founctions
for (const facetAddress of oldAccessorFacets) {
const selectors = await diamondLoupe.facetFunctionSelectors(facetAddress);
if (selectors.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ let [requester, appProvider, datasetProvider, scheduler, worker1, anyone]: Signe
let ordersAssets: OrdersAssets;
let ordersPrices: OrdersPrices;

describe('IexecAccessors', async () => {
describe('IexecPocoAccessors', async () => {
beforeEach('Deploy', async () => {
// Deploy all contracts
proxyAddress = await loadHardhatFixtureDeployment();
Expand Down
2 changes: 1 addition & 1 deletion utils/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function compactSignature(signature: string): string {
}

export function bigintToAddress(bigint: bigint) {
return ethers.getAddress(ethers.toBeHex(bigint));
return ethers.getAddress(ethers.toBeHex(bigint, 20));
}

export function minBigInt(a: bigint, b: bigint) {
Expand Down