From 1c8489b294721ce2261f9e30d80c961c319348a3 Mon Sep 17 00:00:00 2001 From: Uladzislau Hubar Date: Tue, 19 Dec 2023 23:47:39 +0100 Subject: [PATCH] Reverted back setting of the Hash/Score functions in the Hub, fixed tests, redeployed SHA256 and Log2PLDSF on Gnosis Mainnet --- deploy/007_deploy_sha256.ts | 1 - deploy/009_deploy_log2pldsf.ts | 1 - deploy/019_deploy_content_asset_storage_v2.ts | 26 +++++++++++-------- deployments/gnosis_mainnet_contracts.json | 16 ++++++------ test/v1/unit/HubController.test.ts | 12 +++------ utils/helpers.ts | 2 +- 6 files changed, 28 insertions(+), 30 deletions(-) diff --git a/deploy/007_deploy_sha256.ts b/deploy/007_deploy_sha256.ts index 3e95f069..a59113c4 100644 --- a/deploy/007_deploy_sha256.ts +++ b/deploy/007_deploy_sha256.ts @@ -7,7 +7,6 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const SHA256 = await hre.helpers.deploy({ newContractName: 'SHA256', passHubInConstructor: false, - setContractInHub: false, }); if (!isDeployed) { diff --git a/deploy/009_deploy_log2pldsf.ts b/deploy/009_deploy_log2pldsf.ts index 41e4895e..3be71f74 100644 --- a/deploy/009_deploy_log2pldsf.ts +++ b/deploy/009_deploy_log2pldsf.ts @@ -6,7 +6,6 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const Log2PLDSF = await hre.helpers.deploy({ newContractName: 'Log2PLDSF', - setContractInHub: false, }); if (!isDeployed) { diff --git a/deploy/019_deploy_content_asset_storage_v2.ts b/deploy/019_deploy_content_asset_storage_v2.ts index be92f66b..de188906 100644 --- a/deploy/019_deploy_content_asset_storage_v2.ts +++ b/deploy/019_deploy_content_asset_storage_v2.ts @@ -12,6 +12,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { console.log('Deploying ContentAssetStorage V2...'); + const isDeployed = hre.helpers.isDeployed('ContentAssetStorage'); + const ContentAssetStorage = await hre.helpers.deploy({ newContractName: 'ContentAssetStorageV2', newContractNameInHub: 'ContentAssetStorage', @@ -20,20 +22,22 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { setAssetStorageInHub: true, }); - const encodedData = ContentAssetStorage.interface.encodeFunctionData('setBaseURI', [ - `did:dkg:${hre.network.name.split('_')[0]}:${hre.network.config.chainId}/${ContentAssetStorage.address}/`, - ]); + if (!isDeployed) { + const encodedData = ContentAssetStorage.interface.encodeFunctionData('setBaseURI', [ + `did:dkg:${hre.network.name.split('_')[0]}:${hre.network.config.chainId}/${ContentAssetStorage.address}/`, + ]); - if (hre.network.config.environment == 'development') { - const { deployer } = await hre.getNamedAccounts(); + if (hre.network.config.environment === 'development') { + const { deployer } = await hre.getNamedAccounts(); - const hubControllerAddress = hre.helpers.contractDeployments.contracts['HubController'].evmAddress; - const HubController = await hre.ethers.getContractAt('HubController', hubControllerAddress, deployer); + const hubControllerAddress = hre.helpers.contractDeployments.contracts['HubController'].evmAddress; + const HubController = await hre.ethers.getContractAt('HubController', hubControllerAddress, deployer); - const setBaseURITx = await HubController.forwardCall(ContentAssetStorage.address, encodedData); - await setBaseURITx.wait(); - } else { - hre.helpers.setParametersEncodedData.push(['ContentAssetStorage', [encodedData]]); + const setBaseURITx = await HubController.forwardCall(ContentAssetStorage.address, encodedData); + await setBaseURITx.wait(); + } else { + hre.helpers.setParametersEncodedData.push(['ContentAssetStorage', [encodedData]]); + } } }; diff --git a/deployments/gnosis_mainnet_contracts.json b/deployments/gnosis_mainnet_contracts.json index 32568479..170bdb7e 100644 --- a/deployments/gnosis_mainnet_contracts.json +++ b/deployments/gnosis_mainnet_contracts.json @@ -90,10 +90,10 @@ }, "Log2PLDSF": { "deployed": true, - "deploymentTimestamp": 1703022975903, - "evmAddress": "0x7A1a6f2262da962E2f0c2117668C8b03976C43FF", - "gitBranch": "main", - "gitCommitHash": "c993c8564d17e5b8fbab770b020d7c926608ea24", + "deploymentTimestamp": 1703025999344, + "evmAddress": "0xcA9f750Cd07ACd2F1Ca9cB1d1Dfdcf19e2E9773e", + "gitBranch": "gnosis-mainnet-deployment", + "gitCommitHash": "e1347318d5badad802c1b802f3aa270be7843e26", "version": null }, "ParametersStorage": { @@ -138,10 +138,10 @@ }, "SHA256": { "deployed": true, - "deploymentTimestamp": 1703022954842, - "evmAddress": "0xDD21D2607D3f7e0fe939D25200f0256Cb7C7C9F7", - "gitBranch": "main", - "gitCommitHash": "c993c8564d17e5b8fbab770b020d7c926608ea24", + "deploymentTimestamp": 1703025987942, + "evmAddress": "0x01BF84f88861294Dc6FcAF14f6cAA9FAe604A528", + "gitBranch": "gnosis-mainnet-deployment", + "gitCommitHash": "e1347318d5badad802c1b802f3aa270be7843e26", "version": null }, "ScoringProxy": { diff --git a/test/v1/unit/HubController.test.ts b/test/v1/unit/HubController.test.ts index 4c3bdede..1a9a83b4 100644 --- a/test/v1/unit/HubController.test.ts +++ b/test/v1/unit/HubController.test.ts @@ -13,8 +13,6 @@ type HubControllerFixture = { }; describe('@v1 @unit HubController contract', function () { - this.timeout(1000000); - let accounts: SignerWithAddress[]; let HubController: HubController; let Profile: Profile; @@ -125,13 +123,9 @@ describe('@v1 @unit HubController contract', function () { const SHA256 = await hre.helpers.deploy({ newContractName: 'SHA256', passHubInConstructor: false, - setContractInHub: false, }); const ScoringProxy = await hre.helpers.deploy({ newContractName: 'ScoringProxy' }); - const Log2PLDSF = await hre.helpers.deploy({ - newContractName: 'Log2PLDSF', - setContractInHub: false, - }); + const Log2PLDSF = await hre.helpers.deploy({ newContractName: 'Log2PLDSF' }); const AssertionStorage = await hre.helpers.deploy({ newContractName: 'AssertionStorage' }); const IdentityStorage = await hre.helpers.deploy({ newContractName: 'IdentityStorage' }); const ShardingTableStorage = await hre.helpers.deploy({ newContractName: 'ShardingTableStorage' }); @@ -164,7 +158,9 @@ describe('@v1 @unit HubController contract', function () { { name: 'ParametersStorage', addr: ParametersStorage.address }, { name: 'WhitelistStorage', addr: WhitelistStorage.address }, { name: 'HashingProxy', addr: HashingProxy.address }, + { name: 'SHA256', addr: SHA256.address }, { name: 'ScoringProxy', addr: ScoringProxy.address }, + { name: 'Log2PLDSF', addr: Log2PLDSF.address }, { name: 'AssertionStorage', addr: AssertionStorage.address }, { name: 'IdentityStorage', addr: IdentityStorage.address }, { name: 'ShardingTableStorage', addr: ShardingTableStorage.address }, @@ -223,7 +219,7 @@ describe('@v1 @unit HubController contract', function () { ], }, { - contractName: 'ProogManagerV1', + contractName: 'ProofManagerV1', encodedData: [ '0x7ea63c6e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001', '0x7ea63c6e00000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001', diff --git a/utils/helpers.ts b/utils/helpers.ts index c531cf48..16eba1bc 100644 --- a/utils/helpers.ts +++ b/utils/helpers.ts @@ -138,7 +138,7 @@ export class Helpers { if (this.isDeployed(nameInHub)) { const contractInstance = await this.hre.ethers.getContractAt( - nameInHub, + this.getAbi(newContractName), this.contractDeployments.contracts[nameInHub].evmAddress, deployer, );