-
Notifications
You must be signed in to change notification settings - Fork 10
feat(sharing)!: Remove result proxy address from sharing contract config and matched deal #438
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
56ca934
Remove result proxy address from sharing contract
zguesmi e1de79b
Add cleanup todos
zguesmi 6696d42
Update changelog
zguesmi ca5bd50
Update abis
zguesmi a11ae61
Merge branch 'develop' into feature/deprecated-result-proxy-config
zguesmi 08a92dd
Add upgrade unit test
zguesmi 519e9c0
Format
zguesmi 32028df
Fix linting error
zguesmi 2813cc8
Clean
zguesmi 826b1cd
Clean
zguesmi c501af8
Include review
zguesmi 8dac743
Add PR number to changelog
zguesmi 0c2f2e7
Fix tests on the CI
zguesmi 32fd0e5
Run tests on hardhat network (forked)
zguesmi ad9ff43
Fix CI
zguesmi 25ebadb
Debug CI
zguesmi 14c94f1
Debug CI
zguesmi 62f0d1e
Debug CI
zguesmi 25f7d1f
Remove debugging flags
zguesmi 74e1c91
Clean
zguesmi 65e07fe
Debug upgrade tests on CI
zguesmi 7afc0af
Debug upgrade tests on CI
zguesmi ae4f26e
Remove upgrade tests as it interferes with local-fork script
zguesmi e330b35
Revert naming changes
zguesmi af797bd
Run tests on hardhat fork
zguesmi 2760952
Debug upgrade tests on CI
zguesmi 68cbf12
Merge branch 'develop' into feature/deprecated-result-proxy-config
zguesmi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
packages/sharing-smart-contract/contracts/__test/DataProtectorSharingV2Mock.sol
zguesmi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| /****************************************************************************** | ||
| * Copyright 2024-2025 IEXEC BLOCKCHAIN TECH * | ||
| * * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); * | ||
| * you may not use this file except in compliance with the License. * | ||
| * You may obtain a copy of the License at * | ||
| * * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 * | ||
| * * | ||
| * Unless required by applicable law or agreed to in writing, software * | ||
| * distributed under the License is distributed on an "AS IS" BASIS, * | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * | ||
| * See the License for the specific language governing permissions and * | ||
| * limitations under the License. * | ||
| ******************************************************************************/ | ||
|
|
||
| pragma solidity ^0.8.24; | ||
|
|
||
| import {ERC721BurnableUpgradeable, ERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721BurnableUpgradeable.sol"; | ||
| import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; | ||
| import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; | ||
| import {MulticallUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/MulticallUpgradeable.sol"; | ||
| import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol"; | ||
| import {Math} from "@openzeppelin/contracts/utils/math/Math.sol"; | ||
| import {DataProtectorSharing} from "../DataProtectorSharing.sol"; | ||
| import {AddOnlyAppWhitelistRegistry, IAddOnlyAppWhitelist} from "../registry/AddOnlyAppWhitelistRegistry.sol"; | ||
| import {IRegistry} from "../interfaces/IRegistry.sol"; | ||
| import {ManageOrders} from "../ManageOrders.sol"; | ||
|
|
||
| /** | ||
| * @notice This contract is for upgradeability testing purposes only. | ||
| */ | ||
|
|
||
| contract DataProtectorSharingV2Mock is DataProtectorSharing { | ||
| string public newStorage; | ||
|
|
||
| /// @custom:oz-upgrades-unsafe-allow constructor | ||
| constructor() | ||
| DataProtectorSharing( | ||
| address(0), | ||
| IRegistry(address(0)), | ||
| AddOnlyAppWhitelistRegistry(address(0)) | ||
| ) | ||
| {} | ||
|
|
||
| function initializeV2(string calldata foo) public reinitializer(2) { | ||
| newStorage = foo; | ||
| } | ||
| } | ||
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import { loadFixture } from '@nomicfoundation/hardhat-toolbox/network-helpers.js'; | ||
| import { expect } from 'chai'; | ||
| import hardhat from 'hardhat'; | ||
| import { beforeEach } from 'mocha'; | ||
| import { createCollection, deploySCFixture } from './utils/loadFixture.test.js'; | ||
| const { ethers, upgrades } = hardhat; | ||
|
|
||
| // TODO convert to ts. | ||
| // TODO use typechain for factories. | ||
|
|
||
| let dataProtectorSharingContract; | ||
| let contractAddress; | ||
| let owner, addr1; | ||
|
|
||
| describe('DataProtectorSharing', function () { | ||
| beforeEach('Deploy fixture', async function () { | ||
| ({ dataProtectorSharingContract, owner, addr1 } = await loadFixture(deploySCFixture)); | ||
| contractAddress = await dataProtectorSharingContract.getAddress(); | ||
| await dataProtectorSharingContract.createCollection(owner).then((tx) => tx.wait()); | ||
| }); | ||
|
|
||
| describe('Upgrade', function () { | ||
| it('Should upgrade', async function () { | ||
| // Update the state of the original proxy. | ||
| const { collectionTokenId } = await createCollection(); | ||
| // Upgrade the proxy. | ||
| const newImplementationFactory = await ethers.getContractFactory( | ||
| 'DataProtectorSharingV2Mock', | ||
| owner, | ||
| ); | ||
| await upgrades | ||
| .upgradeProxy(contractAddress, newImplementationFactory) | ||
| .then((contract) => contract.waitForDeployment()); | ||
| const dataProtectorSharingContractV2 = await ethers.getContractAt( | ||
| 'DataProtectorSharingV2Mock', | ||
| contractAddress, | ||
| ); | ||
| await dataProtectorSharingContractV2.initializeV2('bar'); | ||
| // Check V1 storage. | ||
| expect(await dataProtectorSharingContractV2.ownerOf(collectionTokenId)).to.equal( | ||
| addr1.address, | ||
| ); | ||
| // Check V2 storage. | ||
| expect(await dataProtectorSharingContractV2.newStorage()).to.equal('bar'); | ||
| // Check address. | ||
| expect(await dataProtectorSharingContractV2.getAddress()).to.equal(contractAddress); | ||
| }); | ||
|
|
||
| it('TODO - Should not upgrade when storage is broken', async function () {}); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.