From ae2be76caa76c80d025131a0b01ec9048915481b Mon Sep 17 00:00:00 2001 From: Tjudice Date: Fri, 23 Jul 2021 11:41:34 -0400 Subject: [PATCH 1/5] Removed getVersion function from multiple libraries --- packages/protocol/contracts/common/Signatures.sol | 8 -------- .../contracts/common/linkedlists/AddressLinkedList.sol | 8 -------- .../common/linkedlists/AddressSortedLinkedList.sol | 8 -------- .../linkedlists/AddressSortedLinkedListWithMedian.sol | 8 -------- .../common/linkedlists/IntegerSortedLinkedList.sol | 8 -------- packages/protocol/contracts/governance/Proposals.sol | 8 -------- 6 files changed, 48 deletions(-) diff --git a/packages/protocol/contracts/common/Signatures.sol b/packages/protocol/contracts/common/Signatures.sol index 16dec10c507..9d80692a335 100644 --- a/packages/protocol/contracts/common/Signatures.sol +++ b/packages/protocol/contracts/common/Signatures.sol @@ -3,14 +3,6 @@ pragma solidity ^0.5.13; import "openzeppelin-solidity/contracts/cryptography/ECDSA.sol"; library Signatures { - /** - * @notice Returns the storage, major, minor, and patch version of the contract. - * @return The storage, major, minor, and patch version of the contract. - */ - function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) { - return (1, 1, 2, 0); - } - /** * @notice Given a signed address, returns the signer of the address. * @param message The address that was signed. diff --git a/packages/protocol/contracts/common/linkedlists/AddressLinkedList.sol b/packages/protocol/contracts/common/linkedlists/AddressLinkedList.sol index bb3f649dfaa..5f5bef0123e 100644 --- a/packages/protocol/contracts/common/linkedlists/AddressLinkedList.sol +++ b/packages/protocol/contracts/common/linkedlists/AddressLinkedList.sol @@ -12,14 +12,6 @@ library AddressLinkedList { using LinkedList for LinkedList.List; using SafeMath for uint256; - /** - * @notice Returns the storage, major, minor, and patch version of the contract. - * @return The storage, major, minor, and patch version of the contract. - */ - function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) { - return (1, 1, 1, 0); - } - function toBytes(address a) public pure returns (bytes32) { return bytes32(uint256(a) << 96); } diff --git a/packages/protocol/contracts/common/linkedlists/AddressSortedLinkedList.sol b/packages/protocol/contracts/common/linkedlists/AddressSortedLinkedList.sol index 401aa79b423..5a74ecdcb48 100644 --- a/packages/protocol/contracts/common/linkedlists/AddressSortedLinkedList.sol +++ b/packages/protocol/contracts/common/linkedlists/AddressSortedLinkedList.sol @@ -12,14 +12,6 @@ library AddressSortedLinkedList { using SafeMath for uint256; using SortedLinkedList for SortedLinkedList.List; - /** - * @notice Returns the storage, major, minor, and patch version of the contract. - * @return The storage, major, minor, and patch version of the contract. - */ - function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) { - return (1, 1, 1, 0); - } - function toBytes(address a) public pure returns (bytes32) { return bytes32(uint256(a) << 96); } diff --git a/packages/protocol/contracts/common/linkedlists/AddressSortedLinkedListWithMedian.sol b/packages/protocol/contracts/common/linkedlists/AddressSortedLinkedListWithMedian.sol index 867f502e26a..2cf62ee1d10 100644 --- a/packages/protocol/contracts/common/linkedlists/AddressSortedLinkedListWithMedian.sol +++ b/packages/protocol/contracts/common/linkedlists/AddressSortedLinkedListWithMedian.sol @@ -11,14 +11,6 @@ library AddressSortedLinkedListWithMedian { using SafeMath for uint256; using SortedLinkedListWithMedian for SortedLinkedListWithMedian.List; - /** - * @notice Returns the storage, major, minor, and patch version of the contract. - * @return The storage, major, minor, and patch version of the contract. - */ - function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) { - return (1, 1, 1, 0); - } - function toBytes(address a) public pure returns (bytes32) { return bytes32(uint256(a) << 96); } diff --git a/packages/protocol/contracts/common/linkedlists/IntegerSortedLinkedList.sol b/packages/protocol/contracts/common/linkedlists/IntegerSortedLinkedList.sol index 74d6cae53cd..70fd1acec6d 100644 --- a/packages/protocol/contracts/common/linkedlists/IntegerSortedLinkedList.sol +++ b/packages/protocol/contracts/common/linkedlists/IntegerSortedLinkedList.sol @@ -11,14 +11,6 @@ library IntegerSortedLinkedList { using SafeMath for uint256; using SortedLinkedList for SortedLinkedList.List; - /** - * @notice Returns the storage, major, minor, and patch version of the contract. - * @return The storage, major, minor, and patch version of the contract. - */ - function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) { - return (1, 1, 1, 0); - } - /** * @notice Inserts an element into a doubly linked list. * @param list A storage pointer to the underlying list. diff --git a/packages/protocol/contracts/governance/Proposals.sol b/packages/protocol/contracts/governance/Proposals.sol index c47a5e183f4..8e1b84a22a0 100644 --- a/packages/protocol/contracts/governance/Proposals.sol +++ b/packages/protocol/contracts/governance/Proposals.sol @@ -47,14 +47,6 @@ library Proposals { string descriptionUrl; } - /** - * @notice Returns the storage, major, minor, and patch version of the contract. - * @return The storage, major, minor, and patch version of the contract. - */ - function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) { - return (1, 1, 1, 0); - } - /** * @notice Constructs a proposal. * @param proposal The proposal struct to be constructed. From 5a5f82de55c9ad71d401092551e8c8776b39ba15 Mon Sep 17 00:00:00 2001 From: Tjudice Date: Fri, 23 Jul 2021 15:29:10 -0400 Subject: [PATCH 2/5] Updated patch version on contracts inheriting from changed libraries --- packages/protocol/contracts/common/Accounts.sol | 2 +- packages/protocol/contracts/common/MetaTransactionWallet.sol | 2 +- packages/protocol/contracts/governance/Election.sol | 2 +- packages/protocol/contracts/governance/Governance.sol | 2 +- packages/protocol/contracts/governance/LockedGold.sol | 2 +- packages/protocol/contracts/identity/Attestations.sol | 2 +- packages/protocol/contracts/identity/Escrow.sol | 2 +- packages/protocol/contracts/stability/SortedOracles.sol | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/protocol/contracts/common/Accounts.sol b/packages/protocol/contracts/common/Accounts.sol index a9ce16f962f..670136bab17 100644 --- a/packages/protocol/contracts/common/Accounts.sol +++ b/packages/protocol/contracts/common/Accounts.sol @@ -108,7 +108,7 @@ contract Accounts is * @return The storage, major, minor, and patch version of the contract. */ function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) { - return (1, 1, 2, 0); + return (1, 1, 2, 1); } /** diff --git a/packages/protocol/contracts/common/MetaTransactionWallet.sol b/packages/protocol/contracts/common/MetaTransactionWallet.sol index f515f12eb8c..9eb7ed16562 100644 --- a/packages/protocol/contracts/common/MetaTransactionWallet.sol +++ b/packages/protocol/contracts/common/MetaTransactionWallet.sol @@ -73,7 +73,7 @@ contract MetaTransactionWallet is * @return The storage, major, minor, and patch version of the contract. */ function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) { - return (1, 1, 1, 0); + return (1, 1, 1, 1); } /** diff --git a/packages/protocol/contracts/governance/Election.sol b/packages/protocol/contracts/governance/Election.sol index 5331b1c702d..218de3b7e69 100644 --- a/packages/protocol/contracts/governance/Election.sol +++ b/packages/protocol/contracts/governance/Election.sol @@ -136,7 +136,7 @@ contract Election is * @return The storage, major, minor, and patch version of the contract. */ function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) { - return (1, 1, 2, 0); + return (1, 1, 2, 1); } /** diff --git a/packages/protocol/contracts/governance/Governance.sol b/packages/protocol/contracts/governance/Governance.sol index 85d54235a68..7f62473ec9a 100644 --- a/packages/protocol/contracts/governance/Governance.sol +++ b/packages/protocol/contracts/governance/Governance.sol @@ -200,7 +200,7 @@ contract Governance is * @return The storage, major, minor, and patch version of the contract. */ function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) { - return (1, 2, 1, 0); + return (1, 2, 1, 1); } /** diff --git a/packages/protocol/contracts/governance/LockedGold.sol b/packages/protocol/contracts/governance/LockedGold.sol index a1724e5b739..a77c9f2ac04 100644 --- a/packages/protocol/contracts/governance/LockedGold.sol +++ b/packages/protocol/contracts/governance/LockedGold.sol @@ -81,7 +81,7 @@ contract LockedGold is * @return The storage, major, minor, and patch version of the contract. */ function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) { - return (1, 1, 1, 1); + return (1, 1, 1, 2); } /** diff --git a/packages/protocol/contracts/identity/Attestations.sol b/packages/protocol/contracts/identity/Attestations.sol index 6a1316e0aef..147b03613c8 100644 --- a/packages/protocol/contracts/identity/Attestations.sol +++ b/packages/protocol/contracts/identity/Attestations.sol @@ -177,7 +177,7 @@ contract Attestations is * @return The storage, major, minor, and patch version of the contract. */ function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) { - return (1, 1, 1, 1); + return (1, 1, 1, 2); } /** diff --git a/packages/protocol/contracts/identity/Escrow.sol b/packages/protocol/contracts/identity/Escrow.sol index 2d63dfe4d4f..285dd5ce55a 100644 --- a/packages/protocol/contracts/identity/Escrow.sol +++ b/packages/protocol/contracts/identity/Escrow.sol @@ -74,7 +74,7 @@ contract Escrow is * @return The storage, major, minor, and patch version of the contract. */ function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) { - return (1, 1, 1, 1); + return (1, 1, 1, 2); } /** diff --git a/packages/protocol/contracts/stability/SortedOracles.sol b/packages/protocol/contracts/stability/SortedOracles.sol index fa361c4008e..137a7851247 100644 --- a/packages/protocol/contracts/stability/SortedOracles.sol +++ b/packages/protocol/contracts/stability/SortedOracles.sol @@ -59,7 +59,7 @@ contract SortedOracles is ISortedOracles, ICeloVersionedContract, Ownable, Initi * @return The storage, major, minor, and patch version of the contract. */ function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) { - return (1, 1, 2, 0); + return (1, 1, 2, 1); } /** From c5e779fc59c6279e218252e8bd5e33c419be300e Mon Sep 17 00:00:00 2001 From: Tjudice Date: Fri, 23 Jul 2021 17:04:00 -0400 Subject: [PATCH 3/5] Fixed excluding linkedlist in compatability tests --- packages/protocol/scripts/bash/release-on-devchain.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/protocol/scripts/bash/release-on-devchain.sh b/packages/protocol/scripts/bash/release-on-devchain.sh index ace4c76dc2a..ca7f00bb85e 100755 --- a/packages/protocol/scripts/bash/release-on-devchain.sh +++ b/packages/protocol/scripts/bash/release-on-devchain.sh @@ -47,8 +47,7 @@ yarn run truffle exec ./scripts/truffle/verify-bytecode.js --network development echo "- Check versions of current branch" # From check-versions.sh -CONTRACT_EXCLUSION_REGEX=".*Test|Mock.*|I[A-Z].*|.*Proxy|.*LinkedList.*|MultiSig.*|ReleaseGold|SlasherUtil|FixidityLib|Signatures|Proposals|UsingPrecompiles" -yarn ts-node scripts/check-backward.ts sem_check --old_contracts $BUILD_DIR/contracts --new_contracts build/contracts --exclude $CONTRACT_EXCLUSION_REGEX --output_file report.json +./scripts/bash/check-versions.sh -a $BRANCH -b $CURR_BRANCH -r "report.json" -l $LOG_FILE # From make-release.sh echo "- Deploy release of current branch" From 3dd85cbfcca353c841c242739338c9f785e64a26 Mon Sep 17 00:00:00 2001 From: Tjudice Date: Fri, 23 Jul 2021 17:48:42 -0400 Subject: [PATCH 4/5] Fixed regex for devchain test --- packages/protocol/scripts/bash/release-on-devchain.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/protocol/scripts/bash/release-on-devchain.sh b/packages/protocol/scripts/bash/release-on-devchain.sh index ca7f00bb85e..0c0f7fb44b5 100755 --- a/packages/protocol/scripts/bash/release-on-devchain.sh +++ b/packages/protocol/scripts/bash/release-on-devchain.sh @@ -47,7 +47,8 @@ yarn run truffle exec ./scripts/truffle/verify-bytecode.js --network development echo "- Check versions of current branch" # From check-versions.sh -./scripts/bash/check-versions.sh -a $BRANCH -b $CURR_BRANCH -r "report.json" -l $LOG_FILE +CONTRACT_EXCLUSION_REGEX=".*Test|Mock.*|I[A-Z].*|.*Proxy|MultiSig.*|ReleaseGold|SlasherUtil|UsingPrecompiles" +yarn ts-node scripts/check-backward.ts sem_check --old_contracts $BUILD_DIR/contracts --new_contracts build/contracts --exclude $CONTRACT_EXCLUSION_REGEX --output_file report.json # From make-release.sh echo "- Deploy release of current branch" From 40ed3110c13f47081a0acc0cc938f838e48eea31 Mon Sep 17 00:00:00 2001 From: Tjudice Date: Mon, 26 Jul 2021 14:39:20 -0400 Subject: [PATCH 5/5] Fixed make_release.ts incorrectly using deployImplementation for libraries --- packages/protocol/scripts/truffle/make-release.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/protocol/scripts/truffle/make-release.ts b/packages/protocol/scripts/truffle/make-release.ts index bfc895f61ce..ce6b2c538eb 100644 --- a/packages/protocol/scripts/truffle/make-release.ts +++ b/packages/protocol/scripts/truffle/make-release.ts @@ -80,7 +80,8 @@ const deployImplementation = async ( contractName: string, Contract: TruffleContract, dryRun: boolean, - from: string + from: string, + requireVersion = true ) => { const testingDeployment = false if (from) { @@ -95,7 +96,7 @@ const deployImplementation = async ( const getVersionNumberAbi = contract.abi.find( (abi: any) => abi.type === 'function' && abi.name === 'getVersionNumber' ) - if (!getVersionNumberAbi) { + if (requireVersion && !getVersionNumberAbi) { throw new Error(`Contract ${contractName} has changes but does not specify a version number`) } return contract @@ -208,7 +209,7 @@ const deployLibrary = async ( isDryRun: boolean, from: string ) => { - const contract = await deployImplementation(contractName, contractArtifact, isDryRun, from) + const contract = await deployImplementation(contractName, contractArtifact, isDryRun, from, false) addresses.set(contractName, contract.address) return }