-
Notifications
You must be signed in to change notification settings - Fork 14
feat: migrate old IexecAccessorsFacet to IexecPocoAccessorsFacet #259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… functionality and proxy updates
There was a problem hiding this 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.
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
test/byContract/IexecCategoryManager/IexecCategoryManager.test.ts
Outdated
Show resolved
Hide resolved
); | ||
} | ||
|
||
// ========= Token and Account Accessors ========= |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deploy/0_deploy.ts
Outdated
const facets = [ | ||
new IexecAccessorsABILegacyFacet__factory(), | ||
new IexecAccessorsFacet__factory(), | ||
// new IexecAccessorsFacet__factory(), to test the updated IexecPocoAccessorsFacet |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const hasSpecificFunction = facet.functionSelectors.includes(specificFunctionSignature); | ||
if (hasSpecificFunction) { | ||
oldAccessorFacets.add(facet.facetAddress); | ||
} |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explained on slack
hardhat.config.ts
Outdated
...(isArbitrumFork && { | ||
forking: { | ||
url: process.env.ARBITRUM_RPC_URL || 'https://arbitrum.gateway.tenderly.co', | ||
blockNumber: process.env.ARBITRUM_BLOCK_NUMBER |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const updatedFacetAddress = (await deployments.get('IexecPocoAccessorsFacet')).address; //C | |
const updatedFacetAddress = (await deployments.get('IexecPocoAccessorsFacet')).address; |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const newFacetFactory = new IexecPocoAccessorsFacet__factory(iexecLibOrders); //C | |
const newFacetFactory = new IexecPocoAccessorsFacet__factory(iexecLibOrders); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const functionsToRemove: string[] = []; | ||
const functionsToRemoveByFacet = new Map<string, string[]>(); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
… in proxy upgrade script
…pt for IexecPocoAccessorsFacet
…y for new facet integration
…nd update test to expect revert without reason
… for IexecPocoAccessorsFacet
… deploy script for IexecPocoAccessorsFacet
… for IexecPocoAccessorsFacet
…onated signer for fork testing
…old facets in deploy script
To test
on one terminal:
ARBITRUM_FORK=true npx hardhat node --no-deploy
on another terminal :