Skip to content

Conversation

gfournieriExec
Copy link
Contributor

@gfournieriExec gfournieriExec commented Sep 18, 2025

To test
on one terminal:
ARBITRUM_FORK=true npx hardhat node --no-deploy
on another terminal :

(export ARBITRUM_FORK=true; \
npx hardhat run scripts/upgrades/accessors/deploy-and-update-accessor-facet.ts --network external-hardhat)

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates from the old IexecAccessorsFacet to a new IexecPocoAccessorsFacet as part of a diamond proxy upgrade process. The migration includes expanding the accessor functionality to include token, account, category, registry, and constants accessors.

Key changes:

  • Replaces the old accessor facet with an expanded IexecPocoAccessorsFacet containing comprehensive accessor methods
  • Adds scripts for deploying and updating the diamond proxy with the new facet
  • Updates configuration to support Arbitrum fork testing
  • Updates test expectations to reflect new error handling behavior

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
contracts/facets/IexecPocoAccessorsFacet.sol Expanded facet with comprehensive accessor methods for tokens, accounts, categories, registries, and constants
contracts/interfaces/IexecPocoAccessors.sol Updated interface definition to include all new accessor methods
scripts/updateProxy/update-diamond-proxy.ts Main orchestration script for the proxy update process
scripts/updateProxy/1_update-proxy-with-new-facet.ts Detailed diamond cut implementation to replace old accessor facets
scripts/updateProxy/0_deploy-updated-accessor-facet.ts Script to deploy the new accessor facet
hardhat.config.ts Added Arbitrum fork configuration for testing
deploy/0_deploy.ts Commented out old accessor facet deployment
test/byContract/IexecCategoryManager/IexecCategoryManager.test.ts Updated test assertion for error handling

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

codecov bot commented Sep 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.29%. Comparing base (f7c634b) to head (999aac0).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #259      +/-   ##
==========================================
- Coverage   83.66%   78.29%   -5.37%     
==========================================
  Files          38       38              
  Lines        1218     1304      +86     
  Branches      227      229       +2     
==========================================
+ Hits         1019     1021       +2     
- Misses        199      283      +84     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

);
}

// ========= Token and Account Accessors =========
Copy link
Contributor

Choose a reason for hiding this comment

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

Which token ? RLC or SRLC ?
Can we precise that ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

const facets = [
new IexecAccessorsABILegacyFacet__factory(),
new IexecAccessorsFacet__factory(),
// new IexecAccessorsFacet__factory(), to test the updated IexecPocoAccessorsFacet
Copy link
Contributor

Choose a reason for hiding this comment

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

can you replace it directly with the new facet ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

already the case, will remove the line with the comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

await expect(
iexecPocoAsAnyone.viewCategory(lastCategoryIndex + 1n),
).to.be.revertedWithoutReason();
).to.be.revertedWithPanic(0x32);
Copy link
Contributor

Choose a reason for hiding this comment

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

why it changed ?
Why we don't want to introduced custom error ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Checking why it change
But at least we don't want to change the logic with intoducing a custom error now
Could be done later if needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines 79 to 82
const hasSpecificFunction = facet.functionSelectors.includes(specificFunctionSignature);
if (hasSpecificFunction) {
oldAccessorFacets.add(facet.facetAddress);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand this part ? Can you explain it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

explained on slack

...(isArbitrumFork && {
forking: {
url: process.env.ARBITRUM_RPC_URL || 'https://arbitrum.gateway.tenderly.co',
blockNumber: process.env.ARBITRUM_BLOCK_NUMBER
Copy link
Contributor

Choose a reason for hiding this comment

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

Why specify the block number ? By default, I think it uses the latest block. Isn’t it correct to rely on the default value ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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


const [account] = await ethers.getSigners();

const updatedFacetAddress = (await deployments.get('IexecPocoAccessorsFacet')).address; //C
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const updatedFacetAddress = (await deployments.get('IexecPocoAccessorsFacet')).address; //C
const updatedFacetAddress = (await deployments.get('IexecPocoAccessorsFacet')).address;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

}

// Functions to add - ALL functions from the new facet, but exclude any that exist in other (non-accessor) facets
const newFacetFactory = new IexecPocoAccessorsFacet__factory(iexecLibOrders); //C
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const newFacetFactory = new IexecPocoAccessorsFacet__factory(iexecLibOrders); //C
const newFacetFactory = new IexecPocoAccessorsFacet__factory(iexecLibOrders);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines 86 to 87
const functionsToRemove: string[] = [];
const functionsToRemoveByFacet = new Map<string, string[]>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Using functionsToRemoveByFacet is enough, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gfournieriExec gfournieriExec merged commit 786bee4 into main Sep 23, 2025
3 of 4 checks passed
@gfournieriExec gfournieriExec deleted the feature/new-viewer-fct branch September 23, 2025 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants