Skip to content

Commit cd65019

Browse files
authored
feat: Print facet names and save diamond description (#301)
1 parent 63d0017 commit cd65019

File tree

8 files changed

+355
-30
lines changed

8 files changed

+355
-30
lines changed

deploy/0_deploy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import { getDeployerAndOwnerSigners } from '../utils/deploy-tools';
4343
import {
4444
getFunctionSelectors,
4545
linkContractToProxy,
46-
printOnchainProxyFunctions,
46+
printOnchainDiamondDescription,
4747
} from '../utils/proxy-tools';
4848
import { getLibDiamondConfigOrEmpty } from '../utils/tools';
4949

@@ -128,7 +128,7 @@ export default async function deploy() {
128128
const functionCount = diamondFacets
129129
.map((facet) => facet.functionSelectors.length)
130130
.reduce((acc, curr) => acc + curr, 0);
131-
await printOnchainProxyFunctions(diamondProxyAddress);
131+
await printOnchainDiamondDescription(diamondProxyAddress);
132132
/**
133133
* Deploy registries and link them to the proxy.
134134
*/

deployments/arbitrum/.diamond.log

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
2+
💎 Diamond proxy has 15 facets with 102 total functions.
3+
Facets:
4+
- DiamondCutFacet: 0x6A4ccf4414c438424d3FB5183f9048EDfbB47847
5+
- DiamondLoupeFacet: 0xf509a2221FCB63645d5b24c3740E35f219f30db9
6+
- IexecAccessorsABILegacyFacet: 0x56CDC32332648b1220a89172191798852706EB35
7+
- IexecAccessorsFacet: 0xEa232be31ab0112916505Aeb7A2a94b5571DCc6b
8+
- IexecCategoryManagerFacet: 0x5f0483b9D7f959816A5CDD4C49E5C91C24561B43
9+
- IexecConfigurationExtraFacet: 0x7Ff117E7385Ac3E207AF1791fE7e66C7802aeCCd
10+
- IexecConfigurationFacet: 0x88eb05e62434057d3AA9e41FdaF7300A586b314D
11+
- IexecERC20Facet: 0xB0152eC6f48E64a92B66D4736aFA1b02d8D45169
12+
- IexecEscrowTokenFacet: 0xd9EB17A161581FBBAD2Ae998c0C19746EaAD0D6E
13+
- IexecOrderManagementFacet: 0x541d532E6C195Ba044a75325F367342f523627fB
14+
- IexecPoco1Facet: 0x46b555fE117DFd8D4eAC2470FA2d739c6c3a0152
15+
- IexecPoco2Facet: 0x5c7B589E6807B554ed278f335215B93bCB692162
16+
- IexecPocoAccessorsFacet: 0xeb40697b275413241d9b31dE568C98B3EA12FFF0
17+
- IexecRelayFacet: 0x8cBf58265F74b77f0D9cCA9f7e14685205496d8f
18+
- OwnershipFacet: 0x606CfE8BabBd286329281f14895634F913BfdB76
19+
Functions:
20+
- 0x4ec3b9e3 -> IexecAccessorsABILegacyFacet
21+
- 0x51152de1 -> IexecAccessorsABILegacyFacet
22+
- 0x5fde601d -> IexecAccessorsABILegacyFacet
23+
- 0x68a9ef1c -> IexecAccessorsABILegacyFacet
24+
- 0x7b244832 -> IexecAccessorsABILegacyFacet
25+
- 0x90fc26b1 -> IexecAccessorsABILegacyFacet
26+
- 0x9e986e81 -> IexecAccessorsABILegacyFacet
27+
- 0xe2e7a8c1 -> IexecAccessorsABILegacyFacet
28+
- allowance -> IexecAccessorsFacet
29+
- appregistry -> IexecAccessorsFacet
30+
- approve -> IexecERC20Facet
31+
- approveAndCall -> IexecERC20Facet
32+
- balanceOf -> IexecAccessorsFacet
33+
- broadcastAppOrder -> IexecRelayFacet
34+
- broadcastDatasetOrder -> IexecRelayFacet
35+
- broadcastRequestOrder -> IexecRelayFacet
36+
- broadcastWorkerpoolOrder -> IexecRelayFacet
37+
- callbackgas -> IexecAccessorsFacet
38+
- changeRegistries -> IexecConfigurationExtraFacet
39+
- claim -> IexecPoco2Facet
40+
- claimArray -> IexecPoco2Facet
41+
- computeDealVolume -> IexecPocoAccessorsFacet
42+
- configure -> IexecConfigurationFacet
43+
- contribute -> IexecPoco2Facet
44+
- contributeAndFinalize -> IexecPoco2Facet
45+
- contribution_deadline_ratio -> IexecAccessorsFacet
46+
- countCategory -> IexecAccessorsFacet
47+
- createCategory -> IexecCategoryManagerFacet
48+
- datasetregistry -> IexecAccessorsFacet
49+
- decimals -> IexecAccessorsFacet
50+
- decreaseAllowance -> IexecERC20Facet
51+
- deposit -> IexecEscrowTokenFacet
52+
- depositFor -> IexecEscrowTokenFacet
53+
- depositForArray -> IexecEscrowTokenFacet
54+
- diamondCut -> DiamondCutFacet
55+
- domain -> IexecConfigurationFacet
56+
- eip712domain_separator -> IexecAccessorsFacet
57+
- facetAddress -> DiamondLoupeFacet
58+
- facetAddresses -> DiamondLoupeFacet
59+
- facetFunctionSelectors -> DiamondLoupeFacet
60+
- facets -> DiamondLoupeFacet
61+
- fallback -> IexecEscrowTokenFacet
62+
- final_deadline_ratio -> IexecAccessorsFacet
63+
- finalize -> IexecPoco2Facet
64+
- frozenOf -> IexecAccessorsFacet
65+
- groupmember_purpose -> IexecAccessorsFacet
66+
- importScore -> IexecConfigurationFacet
67+
- increaseAllowance -> IexecERC20Facet
68+
- initialize -> IexecPoco2Facet
69+
- initializeAndClaimArray -> IexecPoco2Facet
70+
- initializeArray -> IexecPoco2Facet
71+
- kitty_address -> IexecAccessorsFacet
72+
- kitty_min -> IexecAccessorsFacet
73+
- kitty_ratio -> IexecAccessorsFacet
74+
- manageAppOrder -> IexecOrderManagementFacet
75+
- manageDatasetOrder -> IexecOrderManagementFacet
76+
- manageRequestOrder -> IexecOrderManagementFacet
77+
- manageWorkerpoolOrder -> IexecOrderManagementFacet
78+
- matchOrders -> IexecPoco1Facet
79+
- name -> IexecAccessorsFacet
80+
- owner -> OwnershipFacet
81+
- receive -> IexecEscrowTokenFacet
82+
- receiveApproval -> IexecEscrowTokenFacet
83+
- recover -> IexecEscrowTokenFacet
84+
- reopen -> IexecPoco2Facet
85+
- resultFor -> IexecAccessorsFacet
86+
- reveal -> IexecPoco2Facet
87+
- reveal_deadline_ratio -> IexecAccessorsFacet
88+
- setCallbackGas -> IexecConfigurationFacet
89+
- setTeeBroker -> IexecConfigurationFacet
90+
- sponsorMatchOrders -> IexecPoco1Facet
91+
- supportsInterface -> DiamondLoupeFacet
92+
- symbol -> IexecAccessorsFacet
93+
- teebroker -> IexecAccessorsFacet
94+
- token -> IexecAccessorsFacet
95+
- totalSupply -> IexecAccessorsFacet
96+
- transfer -> IexecERC20Facet
97+
- transferFrom -> IexecERC20Facet
98+
- transferOwnership -> OwnershipFacet
99+
- updateDomainSeparator -> IexecConfigurationFacet
100+
- verifyPresignature -> IexecPoco1Facet
101+
- verifyPresignatureOrSignature -> IexecPoco1Facet
102+
- verifySignature -> IexecPoco1Facet
103+
- viewAccount -> IexecAccessorsFacet
104+
- viewAccountABILegacy -> IexecAccessorsABILegacyFacet
105+
- viewCategory -> IexecAccessorsFacet
106+
- viewCategoryABILegacy -> IexecAccessorsABILegacyFacet
107+
- viewConfigABILegacy -> IexecAccessorsABILegacyFacet
108+
- viewConsumed -> IexecAccessorsFacet
109+
- viewContribution -> IexecAccessorsFacet
110+
- viewContributionABILegacy -> IexecAccessorsABILegacyFacet
111+
- viewDeal -> IexecAccessorsFacet
112+
- viewDealABILegacy_pt1 -> IexecAccessorsABILegacyFacet
113+
- viewDealABILegacy_pt2 -> IexecAccessorsABILegacyFacet
114+
- viewPresigned -> IexecAccessorsFacet
115+
- viewScore -> IexecAccessorsFacet
116+
- viewTask -> IexecAccessorsFacet
117+
- viewTaskABILegacy -> IexecAccessorsABILegacyFacet
118+
- withdraw -> IexecEscrowTokenFacet
119+
- withdrawTo -> IexecEscrowTokenFacet
120+
- workerpool_stake_ratio -> IexecAccessorsFacet
121+
- workerpoolregistry -> IexecAccessorsFacet
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
2+
💎 Diamond proxy has 17 facets with 107 total functions.
3+
Facets:
4+
- DiamondCutFacet: 0x6A4ccf4414c438424d3FB5183f9048EDfbB47847
5+
- DiamondLoupeFacet: 0xf509a2221FCB63645d5b24c3740E35f219f30db9
6+
- IexecAccessorsABILegacyFacet: 0x56CDC32332648b1220a89172191798852706EB35
7+
- IexecAccessorsFacet: 0xEa232be31ab0112916505Aeb7A2a94b5571DCc6b
8+
- IexecCategoryManagerFacet: 0x5f0483b9D7f959816A5CDD4C49E5C91C24561B43
9+
- IexecConfigurationExtraFacet: 0x7Ff117E7385Ac3E207AF1791fE7e66C7802aeCCd
10+
- IexecConfigurationFacet: 0x88eb05e62434057d3AA9e41FdaF7300A586b314D
11+
- IexecERC20Facet: 0xB0152eC6f48E64a92B66D4736aFA1b02d8D45169
12+
- IexecEscrowTokenFacet: 0xd9EB17A161581FBBAD2Ae998c0C19746EaAD0D6E
13+
- IexecOrderManagementFacet: 0x541d532E6C195Ba044a75325F367342f523627fB
14+
- IexecPoco1Facet: 0xB670bf6165f1Df353CeA45AFB622dd91EA973AB9
15+
- IexecPoco2Facet: 0x5c7B589E6807B554ed278f335215B93bCB692162
16+
- IexecPocoAccessorsFacet: 0x6C56FFFd001939d03779929702B2722C904a34da
17+
- IexecPocoBoostAccessorsFacet: 0xa23ABb680ecc9D2A51a0CcDE88604552340786Ae
18+
- IexecPocoBoostFacet: 0x248df8EFE953B39f965e5C7272283096d20f5956
19+
- IexecRelayFacet: 0x8cBf58265F74b77f0D9cCA9f7e14685205496d8f
20+
- OwnershipFacet: 0x606CfE8BabBd286329281f14895634F913BfdB76
21+
Functions:
22+
- 0x4ec3b9e3 -> IexecAccessorsFacet
23+
- 0x51152de1 -> IexecAccessorsFacet
24+
- 0x5fde601d -> IexecAccessorsFacet
25+
- 0x68a9ef1c -> IexecAccessorsFacet
26+
- 0x7b244832 -> IexecAccessorsFacet
27+
- 0x90fc26b1 -> IexecAccessorsFacet
28+
- 0x9e986e81 -> IexecAccessorsFacet
29+
- 0xe2e7a8c1 -> IexecAccessorsFacet
30+
- allowance -> IexecAccessorsFacet
31+
- appregistry -> IexecAccessorsFacet
32+
- approve -> IexecERC20Facet
33+
- approveAndCall -> IexecERC20Facet
34+
- balanceOf -> IexecAccessorsFacet
35+
- broadcastAppOrder -> IexecRelayFacet
36+
- broadcastDatasetOrder -> IexecRelayFacet
37+
- broadcastRequestOrder -> IexecRelayFacet
38+
- broadcastWorkerpoolOrder -> IexecRelayFacet
39+
- callbackgas -> IexecAccessorsFacet
40+
- changeRegistries -> IexecConfigurationExtraFacet
41+
- claim -> IexecPoco2Facet
42+
- claimArray -> IexecPoco2Facet
43+
- claimBoost -> IexecPocoBoostFacet
44+
- computeDealVolume -> IexecPocoAccessorsFacet
45+
- configure -> IexecConfigurationFacet
46+
- contribute -> IexecPoco2Facet
47+
- contributeAndFinalize -> IexecPoco2Facet
48+
- contribution_deadline_ratio -> IexecAccessorsFacet
49+
- countCategory -> IexecAccessorsFacet
50+
- createCategory -> IexecCategoryManagerFacet
51+
- datasetregistry -> IexecAccessorsFacet
52+
- decimals -> IexecAccessorsFacet
53+
- decreaseAllowance -> IexecERC20Facet
54+
- deposit -> IexecEscrowTokenFacet
55+
- depositFor -> IexecEscrowTokenFacet
56+
- depositForArray -> IexecEscrowTokenFacet
57+
- diamondCut -> DiamondCutFacet
58+
- domain -> IexecConfigurationFacet
59+
- eip712domain_separator -> IexecAccessorsFacet
60+
- facetAddress -> DiamondLoupeFacet
61+
- facetAddresses -> DiamondLoupeFacet
62+
- facetFunctionSelectors -> DiamondLoupeFacet
63+
- facets -> DiamondLoupeFacet
64+
- fallback -> IexecEscrowTokenFacet
65+
- final_deadline_ratio -> IexecAccessorsFacet
66+
- finalize -> IexecPoco2Facet
67+
- frozenOf -> IexecAccessorsFacet
68+
- groupmember_purpose -> IexecAccessorsFacet
69+
- importScore -> IexecConfigurationFacet
70+
- increaseAllowance -> IexecERC20Facet
71+
- initialize -> IexecPoco2Facet
72+
- initializeAndClaimArray -> IexecPoco2Facet
73+
- initializeArray -> IexecPoco2Facet
74+
- kitty_address -> IexecAccessorsFacet
75+
- kitty_min -> IexecAccessorsFacet
76+
- kitty_ratio -> IexecAccessorsFacet
77+
- manageAppOrder -> IexecOrderManagementFacet
78+
- manageDatasetOrder -> IexecOrderManagementFacet
79+
- manageRequestOrder -> IexecOrderManagementFacet
80+
- manageWorkerpoolOrder -> IexecOrderManagementFacet
81+
- matchOrders -> IexecPoco1Facet
82+
- matchOrdersBoost -> IexecPocoBoostFacet
83+
- name -> IexecAccessorsFacet
84+
- owner -> OwnershipFacet
85+
- pushResultBoost -> IexecPocoBoostFacet
86+
- receive -> IexecEscrowTokenFacet
87+
- receiveApproval -> IexecEscrowTokenFacet
88+
- recover -> IexecEscrowTokenFacet
89+
- reopen -> IexecPoco2Facet
90+
- resultFor -> IexecAccessorsFacet
91+
- reveal -> IexecPoco2Facet
92+
- reveal_deadline_ratio -> IexecAccessorsFacet
93+
- setCallbackGas -> IexecConfigurationFacet
94+
- setTeeBroker -> IexecConfigurationFacet
95+
- sponsorMatchOrders -> IexecPoco1Facet
96+
- sponsorMatchOrdersBoost -> IexecPocoBoostFacet
97+
- supportsInterface -> DiamondLoupeFacet
98+
- symbol -> IexecAccessorsFacet
99+
- teebroker -> IexecAccessorsFacet
100+
- token -> IexecAccessorsFacet
101+
- totalSupply -> IexecAccessorsFacet
102+
- transfer -> IexecERC20Facet
103+
- transferFrom -> IexecERC20Facet
104+
- transferOwnership -> OwnershipFacet
105+
- updateDomainSeparator -> IexecConfigurationFacet
106+
- verifyPresignature -> IexecPoco1Facet
107+
- verifyPresignatureOrSignature -> IexecPoco1Facet
108+
- verifySignature -> IexecPoco1Facet
109+
- viewAccount -> IexecAccessorsFacet
110+
- viewAccountABILegacy -> IexecAccessorsABILegacyFacet
111+
- viewCategory -> IexecAccessorsFacet
112+
- viewCategoryABILegacy -> IexecAccessorsABILegacyFacet
113+
- viewConfigABILegacy -> IexecAccessorsABILegacyFacet
114+
- viewConsumed -> IexecAccessorsFacet
115+
- viewContribution -> IexecAccessorsFacet
116+
- viewContributionABILegacy -> IexecAccessorsABILegacyFacet
117+
- viewDeal -> IexecAccessorsFacet
118+
- viewDealABILegacy_pt1 -> IexecAccessorsABILegacyFacet
119+
- viewDealABILegacy_pt2 -> IexecAccessorsABILegacyFacet
120+
- viewDealBoost -> IexecPocoBoostAccessorsFacet
121+
- viewPresigned -> IexecAccessorsFacet
122+
- viewScore -> IexecAccessorsFacet
123+
- viewTask -> IexecAccessorsFacet
124+
- viewTaskABILegacy -> IexecAccessorsABILegacyFacet
125+
- withdraw -> IexecEscrowTokenFacet
126+
- withdrawTo -> IexecEscrowTokenFacet
127+
- workerpool_stake_ratio -> IexecAccessorsFacet
128+
- workerpoolregistry -> IexecAccessorsFacet

scripts/boost/1_add-modules-to-proxy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { Ownable__factory } from '../../typechain/factories/rlc-faucet-contract/
1313
import config from '../../utils/config';
1414
import { getDeployerAndOwnerSigners } from '../../utils/deploy-tools';
1515
import { encodeModuleProxyUpdate, printBlockTime } from '../upgrades/upgrade-helper';
16-
import { printOnchainProxyFunctions } from '../../utils/proxy-tools';
16+
import { printOnchainDiamondDescription } from '../../utils/proxy-tools';
1717

1818
(async () => {
1919
const chainId = (await ethers.provider.getNetwork()).chainId;
@@ -75,7 +75,7 @@ import { printOnchainProxyFunctions } from '../../utils/proxy-tools';
7575
await time.increase(delay);
7676
console.log('Time traveling..');
7777
await printBlockTime();
78-
await printOnchainProxyFunctions(diamondProxyAddress);
78+
await printOnchainDiamondDescription(diamondProxyAddress);
7979
console.log('Executing proxy update..');
8080
await timelockInstance
8181
.connect(timelockAdminSigner)
@@ -84,5 +84,5 @@ import { printOnchainProxyFunctions } from '../../utils/proxy-tools';
8484
console.log(tx);
8585
tx.wait();
8686
});
87-
await printOnchainProxyFunctions(diamondProxyAddress);
87+
await printOnchainDiamondDescription(diamondProxyAddress);
8888
})();

scripts/sponsoring/1_add-modules-to-proxy.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
} from '../../typechain';
1515
import config from '../../utils/config';
1616
import { encodeModuleProxyUpdate, printBlockTime } from '../upgrades/upgrade-helper';
17-
import { printOnchainProxyFunctions } from '../../utils/proxy-tools';
17+
import { printOnchainDiamondDescription } from '../../utils/proxy-tools';
1818

1919
if (process.env.HANDLE_SPONSORING_UPGRADE_INTERNALLY != 'true') {
2020
(async () => {
@@ -39,7 +39,7 @@ export async function addModulesToProxy() {
3939
const iexecPoco2FacetAddress = (await hre.deployments.get('IexecPoco2Facet')).address;
4040
const iexecPocoAccessorsFacetAddress = (await hre.deployments.get('IexecPocoAccessorsFacet'))
4141
.address;
42-
await printOnchainProxyFunctions(diamondProxyAddress);
42+
await printOnchainDiamondDescription(diamondProxyAddress);
4343

4444
console.log('Functions about to be added to proxy:');
4545
const timelockAddress = await Ownable__factory.connect(
@@ -123,7 +123,7 @@ export async function addModulesToProxy() {
123123

124124
async function executeUpgrade() {
125125
await printBlockTime();
126-
await printOnchainProxyFunctions(diamondProxyAddress);
126+
await printOnchainDiamondDescription(diamondProxyAddress);
127127
console.log('Executing proxy update..');
128128
await timelockInstance
129129
.connect(timelockAdminSigner)
@@ -132,6 +132,6 @@ export async function addModulesToProxy() {
132132
console.log(x);
133133
return x.wait();
134134
});
135-
await printOnchainProxyFunctions(diamondProxyAddress);
135+
await printOnchainDiamondDescription(diamondProxyAddress);
136136
}
137137
}

scripts/upgrades/dry-run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ sed -i.bak '/deployments\/hardhat/d' .gitignore
2626
git add deployments/hardhat
2727
# Run the upgrade and print the git diff.
2828
npx hardhat run scripts/upgrades/${UPGRADE_SCRIPT} --network hardhat
29-
echo "\n=== Upgrade diff ==="
29+
echo -e "\n=== Upgrade diff ==="
3030
git --no-pager diff --name-status
3131
mv .gitignore.bak .gitignore

scripts/upgrades/v6.1.0-bulk-processing.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@ import {
88
FacetDetails,
99
getUpgradeContext,
1010
linkFacetsToDiamond,
11-
printOnchainProxyFunctions,
11+
printOnchainDiamondDescription,
1212
removeDanglingFacetDeploymentArtifacts,
1313
removeFacetsFromDiamond,
1414
removeFunctionsFromDiamond,
15+
saveOnchainDiamondDescription,
1516
} from '../../utils/proxy-tools';
1617
import { tryVerify } from '../verify';
1718
import { isArbitrumChainId, isArbitrumSepoliaChainId } from '../../utils/config';
1819

1920
async function main() {
2021
console.log('Performing bulk processing upgrade...');
21-
const { chainId, deployer, proxyOwner, proxyAddress, iexecLibOrders } =
22+
const { chainId, networkName, deployer, proxyOwner, proxyAddress, iexecLibOrders } =
2223
await getUpgradeContext();
2324

2425
// TODO read addresses from deployments.
@@ -80,8 +81,10 @@ async function main() {
8081
factory: new IexecPocoAccessorsFacet__factory(iexecLibOrders),
8182
},
8283
];
84+
// @dev Print diamond description before deploying new facets
85+
// to have the before / after comparison.
86+
await printOnchainDiamondDescription(proxyAddress);
8387
await deployFacets(deployer, chainId, facetsToAdd); // Adds deployed addresses to `facetsToAdd`.
84-
await printOnchainProxyFunctions(proxyAddress);
8588
await removeFacetsFromDiamond(proxyAddress, proxyOwner, facetsToRemove);
8689
if (isArbitrumChainId(chainId)) {
8790
// Remove these functions from Arbitrum Mainnet without completely removing their facet.
@@ -100,10 +103,11 @@ async function main() {
100103
];
101104
await removeFunctionsFromDiamond(proxyAddress, proxyOwner, functionSignatures);
102105
}
103-
await printOnchainProxyFunctions(proxyAddress);
106+
await printOnchainDiamondDescription(proxyAddress);
104107
await linkFacetsToDiamond(proxyAddress, proxyOwner, facetsToAdd);
105-
await printOnchainProxyFunctions(proxyAddress);
108+
await printOnchainDiamondDescription(proxyAddress);
106109
console.log('Upgrade performed successfully!');
110+
await saveOnchainDiamondDescription(proxyAddress, networkName);
107111
await removeDanglingFacetDeploymentArtifacts(proxyAddress);
108112
await tryVerify(facetsToAdd.map((facet) => facet.name));
109113
}

0 commit comments

Comments
 (0)