From e339dedfed0a49afb662b8c7675bd6362ee2907a Mon Sep 17 00:00:00 2001 From: Alex Rea Date: Fri, 3 Nov 2023 10:15:53 +0000 Subject: [PATCH 01/11] WIP removal of deprecated functionality --- .../colony/ColonyArbitraryTransaction.sol | 2 +- contracts/colony/ColonyExpenditure.sol | 52 ------ contracts/colony/ColonyFunding.sol | 33 ---- contracts/colony/ColonyStorage.sol | 29 ++- contracts/colony/IColony.sol | 80 -------- .../colonyNetwork/ColonyNetworkDeployer.sol | 16 -- .../colonyNetwork/ColonyNetworkSkills.sol | 2 +- contracts/colonyNetwork/IColonyNetwork.sol | 24 --- .../common/SetExpenditureSingleValues.sol | 61 ++++++ contracts/extensions/FundingQueue.sol | 2 + contracts/extensions/OneTxPayment.sol | 42 +++-- contracts/extensions/StreamingPayments.sol | 18 +- contracts/tokenLocking/ITokenLocking.sol | 19 -- contracts/tokenLocking/TokenLocking.sol | 10 - docs/interfaces/icolony.md | 111 ----------- docs/interfaces/icolonynetwork.md | 40 ---- docs/interfaces/imetacolony.md | 111 ----------- docs/interfaces/itokenlocking.md | 40 ---- helpers/test-helper.js | 7 + .../MetatransactionBroadcaster.js | 10 +- test-smoke/colony-storage-consistent.js | 175 ++++++++++++++++++ .../colony-arbitrary-transactions.js | 104 ++++++----- test/contracts-network/colony-expenditure.js | 162 +++++++++------- test/contracts-network/colony-funding.js | 21 ++- .../colony-network-extensions.js | 16 ++ .../colony-network-recovery.js | 3 +- test/contracts-network/colony-network.js | 19 -- test/contracts-network/colony-permissions.js | 53 ------ test/contracts-network/colony-recovery.js | 6 - .../colony-reward-payouts.js | 4 +- test/contracts-network/colony-staking.js | 6 +- .../reputation-basic-functionality.js | 5 + test/contracts-network/reputation-update.js | 4 +- test/contracts-network/router-resolver.js | 20 +- test/contracts-network/token-locking.js | 21 --- test/cross-chain/cross-chain.js | 3 +- test/extensions/funding-queue.js | 2 +- test/extensions/one-tx-payment.js | 7 +- test/extensions/voting-rep.js | 22 ++- test/misc/gas-costs.js | 4 +- test/packages/metaTransactionBroadcaster.js | 26 ++- 41 files changed, 575 insertions(+), 817 deletions(-) create mode 100644 contracts/common/SetExpenditureSingleValues.sol create mode 100644 test-smoke/colony-storage-consistent.js diff --git a/contracts/colony/ColonyArbitraryTransaction.sol b/contracts/colony/ColonyArbitraryTransaction.sol index 91d7943d47..33d105551d 100644 --- a/contracts/colony/ColonyArbitraryTransaction.sol +++ b/contracts/colony/ColonyArbitraryTransaction.sol @@ -59,7 +59,7 @@ contract ColonyArbitraryTransaction is ColonyStorage { } emit ArbitraryTransaction(msgSender(), _targets[i], _actions[i], ret); - } catch { + } catch Error(string memory _err) { // We failed in a require, which is only okay if we're not in strict mode if (_strict) { success = false; diff --git a/contracts/colony/ColonyExpenditure.sol b/contracts/colony/ColonyExpenditure.sol index ac9645e098..47d7da4584 100644 --- a/contracts/colony/ColonyExpenditure.sol +++ b/contracts/colony/ColonyExpenditure.sol @@ -74,23 +74,6 @@ contract ColonyExpenditure is ColonyStorage { emit ExpenditureTransferred(msgSender(), _id, _newOwner); } - // Deprecated - function transferExpenditureViaArbitration( - uint256 _permissionDomainId, - uint256 _childSkillIndex, - uint256 _id, - address _newOwner - ) - public - stoppable - expenditureDraftOrLocked(_id) - authDomain(_permissionDomainId, _childSkillIndex, expenditures[_id].domainId) - { - expenditures[_id].owner = _newOwner; - - emit ExpenditureTransferred(msgSender(), _id, _newOwner); - } - function cancelExpenditureViaArbitration( uint256 _permissionDomainId, uint256 _childSkillIndex, @@ -236,41 +219,6 @@ contract ColonyExpenditure is ColonyStorage { } } - // Deprecated - function setExpenditureRecipient( - uint256 _id, - uint256 _slot, - address payable _recipient - ) public stoppable { - uint256[] memory slots = new uint256[](1); - slots[0] = _slot; - address payable[] memory recipients = new address payable[](1); - recipients[0] = _recipient; - setExpenditureRecipients(_id, slots, recipients); - } - - // Deprecated - function setExpenditureSkill(uint256 _id, uint256 _slot, uint256 _skillId) public stoppable { - uint256[] memory slots = new uint256[](1); - slots[0] = _slot; - uint256[] memory skillIds = new uint256[](1); - skillIds[0] = _skillId; - setExpenditureSkills(_id, slots, skillIds); - } - - // Deprecated - function setExpenditureClaimDelay( - uint256 _id, - uint256 _slot, - uint256 _claimDelay - ) public stoppable { - uint256[] memory slots = new uint256[](1); - slots[0] = _slot; - uint256[] memory claimDelays = new uint256[](1); - claimDelays[0] = _claimDelay; - setExpenditureClaimDelays(_id, slots, claimDelays); - } - uint256 constant EXPENDITURES_SLOT = 25; uint256 constant EXPENDITURESLOTS_SLOT = 26; diff --git a/contracts/colony/ColonyFunding.sol b/contracts/colony/ColonyFunding.sol index d4f533980f..8199193d71 100755 --- a/contracts/colony/ColonyFunding.sol +++ b/contracts/colony/ColonyFunding.sol @@ -58,25 +58,6 @@ contract ColonyFunding is moveFundsBetweenPotsFunctionality(_fromPot, _toPot, _amount, _token); } - function moveFundsBetweenPots( - uint256 _permissionDomainId, - uint256 _fromChildSkillIndex, - uint256 _toChildSkillIndex, - uint256 _fromPot, - uint256 _toPot, - uint256 _amount, - address _token - ) - public - stoppable - domainNotDeprecated(getDomainFromFundingPot(_toPot)) - authDomain(_permissionDomainId, _fromChildSkillIndex, getDomainFromFundingPot(_fromPot)) - authDomain(_permissionDomainId, _toChildSkillIndex, getDomainFromFundingPot(_toPot)) - validFundingTransfer(_fromPot, _toPot) - { - moveFundsBetweenPotsFunctionality(_fromPot, _toPot, _amount, _token); - } - function claimColonyFunds(address _token) public stoppable { uint256 toClaim; uint256 feeToPay; @@ -141,20 +122,6 @@ contract ColonyFunding is setExpenditurePayoutsInternal(_id, slots, _token, amounts); } - /// @notice For owners to update payouts with one token and one slot - function setExpenditurePayout( - uint256 _id, - uint256 _slot, - address _token, - uint256 _amount - ) public stoppable expenditureDraft(_id) expenditureOnlyOwner(_id) { - uint256[] memory slots = new uint256[](1); - slots[0] = _slot; - uint256[] memory amounts = new uint256[](1); - amounts[0] = _amount; - setExpenditurePayoutsInternal(_id, slots, _token, amounts); - } - int256 constant MAX_PAYOUT_MODIFIER = int256(WAD); int256 constant MIN_PAYOUT_MODIFIER = -int256(WAD); diff --git a/contracts/colony/ColonyStorage.sol b/contracts/colony/ColonyStorage.sol index 850d8c653e..7e855c1afa 100755 --- a/contracts/colony/ColonyStorage.sol +++ b/contracts/colony/ColonyStorage.sol @@ -333,13 +333,28 @@ contract ColonyStorage is ColonyDataTypes, ColonyNetworkDataTypes, DSMath, Commo uint256 value, bytes memory data ) internal returns (bool success) { - assembly { - // call contract at address a with input mem[in…(in+insize)) - // providing g gas and v wei and output area mem[out…(out+outsize)) - // returning 0 on error (eg. out of gas) and 1 on success - - // call(g, a, v, in, insize, out, outsize) - success := call(gas(), to, value, add(data, 0x20), mload(data), 0, 0) + bytes memory res; + (success, res) = to.call{ value: value }(data); + if (!success) { + // Stolen shamelessly from + // https://ethereum.stackexchange.com/questions/83528/how-can-i-get-the-revert-reason-of-a-call-in-solidity-so-that-i-can-use-it-in-th + // If the _res length is less than 68, then the transaction failed silently (without a revert message) + if (res.length >= 68) { + assembly { + // Slice the sighash. + res := add(res, 0x04) + } + require(false, abi.decode(res, (string))); // All that remains is the revert string + } + require(false, "require-execute-call-reverted-with-no-error"); } + // assembly { + // // call contract at address a with input mem[in…(in+insize)) + // // providing g gas and v wei and output area mem[out…(out+outsize)) + // // returning 0 on error (eg. out of gas) and 1 on success + + // // call(g, a, v, in, insize, out, outsize) + // success := call(gas(), to, value, add(data, 0x20), mload(data), 0, 0) + // } } } diff --git a/contracts/colony/IColony.sol b/contracts/colony/IColony.sol index d2cffee40e..f7d51aa163 100644 --- a/contracts/colony/IColony.sol +++ b/contracts/colony/IColony.sol @@ -51,16 +51,6 @@ interface IColony is IDSAuth, ColonyDataTypes, IRecovery, IBasicMetaTransaction, /// @return tokenAddress Address of the token contract function getToken() external view returns (address tokenAddress); - /// @notice @deprecated - /// @notice Execute arbitrary transaction on behalf of the Colony - /// @param _to Contract to receive the function call (cannot be this contract, network or token locking) - /// @param _action Bytes array encoding the function call and arguments - /// @return success Boolean indicating whether the transaction succeeded - function makeArbitraryTransaction( - address _to, - bytes memory _action - ) external returns (bool success); - /// @notice Execute arbitrary transactions on behalf of the Colony in series /// @param _targets Array of addressed to be targeted /// @param _actions Array of Bytes arrays encoding the function calls and arguments @@ -457,21 +447,6 @@ interface IColony is IDSAuth, ColonyDataTypes, IRecovery, IBasicMetaTransaction, /// @param _newOwner New owner of expenditure function transferExpenditure(uint256 _id, address _newOwner) external; - /// @notice @deprecated - /// @notice Updates the expenditure owner. Can only be called by Arbitration role. - /// @dev This is now deprecated and will be removed in a future version - /// @param _permissionDomainId The domainId in which I have the permission to take this action - /// @param _childSkillIndex The index that the `_domainId` is relative to `_permissionDomainId`, - /// (only used if `_permissionDomainId` is different to `_domainId`) - /// @param _id Expenditure identifier - /// @param _newOwner New owner of expenditure - function transferExpenditureViaArbitration( - uint256 _permissionDomainId, - uint256 _childSkillIndex, - uint256 _id, - address _newOwner - ) external; - /// @notice Cancels the expenditure and prevents further editing. /// @param _permissionDomainId The domainId in which I have the permission to take this action /// @param _childSkillIndex The index that the `_domainId` is relative to `_permissionDomainId`, @@ -523,14 +498,6 @@ interface IColony is IDSAuth, ColonyDataTypes, IRecovery, IBasicMetaTransaction, string memory _metadata ) external; - /// @notice @deprecated - /// @notice Sets the recipient on an expenditure slot. Can only be called by expenditure owner. - /// @dev Can only be called while expenditure is in draft state. - /// @param _id Id of the expenditure - /// @param _slot Slot for the recipient address - /// @param _recipient Address of the recipient - function setExpenditureRecipient(uint256 _id, uint256 _slot, address payable _recipient) external; - /// @notice Sets the recipients in given expenditure slots. Can only be called by expenditure owner. /// @dev Can only be called while expenditure is in draft state. /// @param _id Id of the expenditure @@ -542,20 +509,6 @@ interface IColony is IDSAuth, ColonyDataTypes, IRecovery, IBasicMetaTransaction, address payable[] memory _recipients ) external; - /// @notice @deprecated - /// @notice Set the token payout on an expenditure slot. Can only be called by expenditure owner. - /// @dev Can only be called while expenditure is in draft state. - /// @param _id Id of the expenditure - /// @param _slot Number of the slot - /// @param _token Address of the token, `0x0` value indicates Ether - /// @param _amount Payout amount - function setExpenditurePayout( - uint256 _id, - uint256 _slot, - address _token, - uint256 _amount - ) external; - /// @notice Set the token payouts in given expenditure slots. Can only be called by expenditure owner. /// @dev Can only be called while expenditure is in draft state. /// @param _id Id of the expenditure @@ -585,13 +538,6 @@ interface IColony is IDSAuth, ColonyDataTypes, IRecovery, IBasicMetaTransaction, uint256 _amount ) external; - /// @notice @deprecated - /// @notice Sets the skill on an expenditure slot. Can only be called by expenditure owner. - /// @param _id Expenditure identifier - /// @param _slot Number of the slot - /// @param _skillId Id of the new skill to set - function setExpenditureSkill(uint256 _id, uint256 _slot, uint256 _skillId) external; - /// @notice Sets the skill on an expenditure slot. Can only be called by expenditure owner. /// @param _id Expenditure identifier /// @param _slots Array of slots to set skills @@ -602,13 +548,6 @@ interface IColony is IDSAuth, ColonyDataTypes, IRecovery, IBasicMetaTransaction, uint256[] memory _skillIds ) external; - /// @notice @deprecated - /// @notice Sets the claim delay on an expenditure slot. Can only be called by expenditure owner. - /// @param _id Expenditure identifier - /// @param _slot Number of the slot - /// @param _claimDelay Duration of time (in seconds) to delay - function setExpenditureClaimDelay(uint256 _id, uint256 _slot, uint256 _claimDelay) external; - /// @notice Sets the claim delays in given expenditure slots. Can only be called by expenditure owner. /// @param _id Expenditure identifier /// @param _slots Array of slots to set claim delays @@ -813,25 +752,6 @@ interface IColony is IDSAuth, ColonyDataTypes, IRecovery, IBasicMetaTransaction, address _token ) external; - /// @notice @deprecated - /// @notice Move a given amount: `_amount` of `_token` funds from funding pot with id `_fromPot` to one with id `_toPot`. - /// @param _permissionDomainId The domainId in which I have the permission to take this action - /// @param _fromChildSkillIndex The child index in `_permissionDomainId` where we can find the domain for `_fromPotId` - /// @param _toChildSkillIndex The child index in `_permissionDomainId` where we can find the domain for `_toPotId` - /// @param _fromPot Funding pot id providing the funds - /// @param _toPot Funding pot id receiving the funds - /// @param _amount Amount of funds - /// @param _token Address of the token, `0x0` value indicates Ether - function moveFundsBetweenPots( - uint256 _permissionDomainId, - uint256 _fromChildSkillIndex, - uint256 _toChildSkillIndex, - uint256 _fromPot, - uint256 _toPot, - uint256 _amount, - address _token - ) external; - /// @notice Move any funds received by the colony in `_token` denomination to the top-level domain pot, /// siphoning off a small amount to the reward pot. If called against a colony's own token, no fee is taken. /// @param _token Address of the token, `0x0` value indicates Ether diff --git a/contracts/colonyNetwork/ColonyNetworkDeployer.sol b/contracts/colonyNetwork/ColonyNetworkDeployer.sol index 09e31096c8..4ef74eb3b1 100644 --- a/contracts/colonyNetwork/ColonyNetworkDeployer.sol +++ b/contracts/colonyNetwork/ColonyNetworkDeployer.sol @@ -42,22 +42,6 @@ contract ColonyNetworkDeployer is ColonyNetworkStorage { emit MetaColonyCreated(metaColony, _tokenAddress, skillCount); } - /// @notice @deprecated only deploys version 3 colonies. - function createColony(address _tokenAddress) public stoppable returns (address) { - return createColony(_tokenAddress, 3, "", ""); - } - - /// @notice @deprecated only deploys version 4 colonies. - function createColony( - address _tokenAddress, - uint256 _version, // solhint-disable-line no-unused-vars - string memory _colonyName, - string memory _orbitdb, // solhint-disable-line no-unused-vars - bool _useExtensionManager // solhint-disable-line no-unused-vars - ) public stoppable returns (address) { - return createColony(_tokenAddress, 4, _colonyName, ""); - } - function createColony( address _tokenAddress, uint256 _version, diff --git a/contracts/colonyNetwork/ColonyNetworkSkills.sol b/contracts/colonyNetwork/ColonyNetworkSkills.sol index 17c83c4b5f..68a9e09b16 100644 --- a/contracts/colonyNetwork/ColonyNetworkSkills.sol +++ b/contracts/colonyNetwork/ColonyNetworkSkills.sol @@ -38,7 +38,7 @@ contract ColonyNetworkSkills is ColonyNetworkStorage, Multicall, CallWithGuards return skillCount; } - function deprecateSkill(uint256 _skillId, bool _deprecated) public stoppable { + function deprecateSkill(uint256 _skillId, bool _deprecated) public view stoppable { revert("colony-network-deprecate-skill-disabled"); } diff --git a/contracts/colonyNetwork/IColonyNetwork.sol b/contracts/colonyNetwork/IColonyNetwork.sol index dd4c754399..de74d60a1b 100644 --- a/contracts/colonyNetwork/IColonyNetwork.sol +++ b/contracts/colonyNetwork/IColonyNetwork.sol @@ -136,30 +136,6 @@ interface IColonyNetwork is ColonyNetworkDataTypes, IRecovery, IBasicMetaTransac /// @param _tokenAddress Address of the CLNY token function createMetaColony(address _tokenAddress) external; - /// @notice Creates a new colony in the network, at version 3 - /// @dev This is now deprecated and will be removed in a future version - /// @dev For the colony to mint tokens, token ownership must be transferred to the new colony - /// @param _tokenAddress Address of an ERC20 token to serve as the colony token. - /// @return _colonyAddress Address of the newly created colony - function createColony(address _tokenAddress) external returns (address _colonyAddress); - - /// @notice Overload of the simpler `createColony` -- creates a new colony in the network with a variety of options, at version 4 - /// @dev This is now deprecated and will be removed in a future version - /// @dev For the colony to mint tokens, token ownership must be transferred to the new colony - /// @param _tokenAddress Address of an ERC20 token to serve as the colony token - /// @param _version The version of colony to deploy (pass 0 for the current version) - /// @param _colonyName The label to register (if null, no label is registered) - /// @param _orbitdb DEPRECATED Currently a no-op - /// @param _useExtensionManager DEPRECATED Currently a no-op - /// @return _colonyAddress Address of the newly created colony - function createColony( - address _tokenAddress, - uint256 _version, - string memory _colonyName, - string memory _orbitdb, - bool _useExtensionManager - ) external returns (address _colonyAddress); - /// @notice Creates a new colony in the network, with an optional ENS name /// @dev For the colony to mint tokens, token ownership must be transferred to the new colony /// @param _tokenAddress Address of an ERC20 token to serve as the colony token diff --git a/contracts/common/SetExpenditureSingleValues.sol b/contracts/common/SetExpenditureSingleValues.sol new file mode 100644 index 0000000000..1ebedf0ca5 --- /dev/null +++ b/contracts/common/SetExpenditureSingleValues.sol @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +/* + This file is part of The Colony Network. + + The Colony Network is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + The Colony Network is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with The Colony Network. If not, see . +*/ + +pragma solidity 0.8.27; +pragma experimental ABIEncoderV2; + +import { IColony } from "./../colony/IColony.sol"; + +contract SetExpenditureSingleValues { + struct SetExpenditureValuesCallData { + address payable[] recipients; + uint256[] slots; + uint256[] skills; + uint256[] amounts; + } + + function setExpenditureSingleValues( + address _colony, + uint256 _expenditureId, + uint256 _slot, + address payable _recipient, + uint256 _skillId, + address _token, + uint256 _amount + ) internal { + SetExpenditureValuesCallData memory data = SetExpenditureValuesCallData( + new address payable[](1), + new uint256[](1), + new uint256[](1), + new uint256[](1) + ); + + data.recipients[0] = _recipient; + data.slots[0] = _slot; + data.skills[0] = _skillId; + data.amounts[0] = _amount; + + IColony(_colony).setExpenditureRecipients(_expenditureId, data.slots, data.recipients); + + if (data.skills[0] > 0) { + IColony(_colony).setExpenditureSkills(_expenditureId, data.slots, data.skills); + } + + IColony(_colony).setExpenditurePayouts(_expenditureId, data.slots, _token, data.amounts); + } +} diff --git a/contracts/extensions/FundingQueue.sol b/contracts/extensions/FundingQueue.sol index a082464501..f91c630258 100644 --- a/contracts/extensions/FundingQueue.sol +++ b/contracts/extensions/FundingQueue.sol @@ -352,6 +352,8 @@ contract FundingQueue is ColonyExtension, BasicMetaTransaction { } colony.moveFundsBetweenPots( + proposal.domainId, + UINT256_MAX, proposal.domainId, proposal.fromChildSkillIndex, proposal.toChildSkillIndex, diff --git a/contracts/extensions/OneTxPayment.sol b/contracts/extensions/OneTxPayment.sol index 2cf21895dc..fb851dec2e 100644 --- a/contracts/extensions/OneTxPayment.sol +++ b/contracts/extensions/OneTxPayment.sol @@ -22,10 +22,11 @@ pragma experimental ABIEncoderV2; import { ColonyDataTypes } from "../colony/IColony.sol"; import { ColonyExtension } from "./ColonyExtension.sol"; import { IBasicMetaTransaction, BasicMetaTransaction } from "./../common/BasicMetaTransaction.sol"; +import { SetExpenditureSingleValues } from "./../common/SetExpenditureSingleValues.sol"; // ignore-file-swc-108 -contract OneTxPayment is ColonyExtension, BasicMetaTransaction { +contract OneTxPayment is ColonyExtension, BasicMetaTransaction, SetExpenditureSingleValues { event OneTxPaymentMade(address agent, uint256 fundamentalId, uint256 nPayouts); ColonyDataTypes.ColonyRole constant ADMINISTRATION = ColonyDataTypes.ColonyRole.Administration; @@ -149,16 +150,19 @@ contract OneTxPayment is ColonyExtension, BasicMetaTransaction { require(idx == 0 || _workers[idx] > _workers[idx - 1], "one-tx-payment-bad-worker-order"); slot++; - colony.setExpenditureRecipient(expenditureId, slot, _workers[idx]); - - if (_skillId != 0) { - colony.setExpenditureSkill(expenditureId, slot, _skillId); - } } else { require(_tokens[idx] > _tokens[idx - 1], "one-tx-payment-bad-token-order"); } - colony.setExpenditurePayout(expenditureId, slot, _tokens[idx], _amounts[idx]); + setExpenditureSingleValues( + address(colony), + expenditureId, + slot, + _workers[idx], + _skillId, + _tokens[idx], + _amounts[idx] + ); } finalizeAndClaim(_permissionDomainId, _childSkillIndex, expenditureId, _workers, _tokens); @@ -214,6 +218,7 @@ contract OneTxPayment is ColonyExtension, BasicMetaTransaction { prepareFundingWithinDomain( _permissionDomainId, _childSkillIndex, + _domainId, domainPotId, fundingPotId, _tokens, @@ -228,16 +233,18 @@ contract OneTxPayment is ColonyExtension, BasicMetaTransaction { require(idx == 0 || _workers[idx] > _workers[idx - 1], "one-tx-payment-bad-worker-order"); slot++; - colony.setExpenditureRecipient(expenditureId, slot, _workers[idx]); - - if (_skillId != 0) { - colony.setExpenditureSkill(expenditureId, slot, _skillId); - } } else { require(_tokens[idx] > _tokens[idx - 1], "one-tx-payment-bad-token-order"); } - - colony.setExpenditurePayout(expenditureId, slot, _tokens[idx], _amounts[idx]); + setExpenditureSingleValues( + address(colony), + expenditureId, + slot, + _workers[idx], + _skillId, + _tokens[idx], + _amounts[idx] + ); } finalizeAndClaim(_permissionDomainId, _childSkillIndex, expenditureId, _workers, _tokens); @@ -289,6 +296,8 @@ contract OneTxPayment is ColonyExtension, BasicMetaTransaction { for (uint256 i; i < uniqueTokensIdx; i++) { colony.moveFundsBetweenPots( + 1, + UINT256_MAX, 1, UINT256_MAX, _childSkillIndex, @@ -303,6 +312,7 @@ contract OneTxPayment is ColonyExtension, BasicMetaTransaction { function prepareFundingWithinDomain( uint256 _permissionDomainId, uint256 _childSkillIndex, + uint256 _domainId, uint256 _domainPotId, uint256 _fundingPotId, address[] memory _tokens, @@ -318,7 +328,9 @@ contract OneTxPayment is ColonyExtension, BasicMetaTransaction { colony.moveFundsBetweenPots( _permissionDomainId, _childSkillIndex, - _childSkillIndex, + _domainId, + UINT256_MAX, + UINT256_MAX, _domainPotId, _fundingPotId, uniqueAmounts[i], diff --git a/contracts/extensions/StreamingPayments.sol b/contracts/extensions/StreamingPayments.sol index bf9241c847..52fbd55586 100644 --- a/contracts/extensions/StreamingPayments.sol +++ b/contracts/extensions/StreamingPayments.sol @@ -20,11 +20,12 @@ pragma solidity 0.8.27; pragma experimental ABIEncoderV2; import { ColonyExtensionMeta } from "./ColonyExtensionMeta.sol"; -import { ColonyDataTypes } from "./../colony/IColony.sol"; +import { ColonyDataTypes } from "./../colony/ColonyDataTypes.sol"; +import { SetExpenditureSingleValues } from "./../common/SetExpenditureSingleValues.sol"; // ignore-file-swc-108 -contract StreamingPayments is ColonyExtensionMeta { +contract StreamingPayments is ColonyExtensionMeta, SetExpenditureSingleValues { // Events event StreamingPaymentCreated(address agent, uint256 streamingPaymentId); @@ -547,9 +548,18 @@ contract StreamingPayments is ColonyExtensionMeta { _token ); - colony.setExpenditurePayout(expenditureId, SLOT, _token, _amountToClaim); - colony.setExpenditureRecipient(expenditureId, SLOT, streamingPayments[_id].recipient); + setExpenditureSingleValues( + address(colony), + expenditureId, + SLOT, + streamingPayments[_id].recipient, + 0, + _token, + _amountToClaim + ); + colony.finalizeExpenditure(expenditureId); + return expenditureId; } } diff --git a/contracts/tokenLocking/ITokenLocking.sol b/contracts/tokenLocking/ITokenLocking.sol index b20fe672f4..63708aed57 100644 --- a/contracts/tokenLocking/ITokenLocking.sol +++ b/contracts/tokenLocking/ITokenLocking.sol @@ -49,13 +49,6 @@ interface ITokenLocking is TokenLockingDataTypes, IBasicMetaTransaction { /// @param _lockId Id of the lock user wants to increment to function incrementLockCounterTo(address _token, uint256 _lockId) external; - /// @notice @deprecated - /// @notice Deposit `_amount` of deposited tokens. Can only be called if user tokens are not locked. - /// Before calling this function user has to allow that their tokens can be transferred by token locking contract. - /// @param _token Address of the token to deposit - /// @param _amount Amount to deposit - function deposit(address _token, uint256 _amount) external; - /// @notice Deposit `_amount` of colony tokens. /// Before calling this function user has to allow that their tokens can be transferred by token locking contract. /// @param _token Address of the token to deposit @@ -76,24 +69,12 @@ interface ITokenLocking is TokenLockingDataTypes, IBasicMetaTransaction { /// @param _force Pass true to forcibly unlock the token function transfer(address _token, uint256 _amount, address _recipient, bool _force) external; - /// @notice @deprecated - /// @notice Withdraw `_amount` of deposited tokens. Can only be called if user tokens are not locked. - /// @param _token Address of the token to withdraw from - /// @param _amount Amount to withdraw - function withdraw(address _token, uint256 _amount) external; - /// @notice Withdraw `_amount` of deposited tokens. Set `_force` to `true` to forcibly unlock the token before the withdrawal. /// @param _token Address of the token to withdraw from /// @param _amount Amount to withdraw /// @param _force Pass true to forcibly unlock the token function withdraw(address _token, uint256 _amount, bool _force) external; - /// @notice This function is deprecated and only exists to aid upgrades. - /// @param _recipient The address to receive the reward - /// @param _amount The amount to reward - /// @dev It's a NOOP. You don't need to call this, and if you write a contract that does it will break in the future. - function reward(address _recipient, uint256 _amount) external; - /// @notice Allow the colony to obligate some amount of tokens as a stake. /// @dev Can only be called by a colony or colonyNetwork /// @param _user Address of the user that is allowing their holdings to be staked by the caller diff --git a/contracts/tokenLocking/TokenLocking.sol b/contracts/tokenLocking/TokenLocking.sol index 3868da8feb..00a3798148 100644 --- a/contracts/tokenLocking/TokenLocking.sol +++ b/contracts/tokenLocking/TokenLocking.sol @@ -115,11 +115,6 @@ contract TokenLocking is userLocks[_token][msgSender()].lockCount = _lockId; } - // Deprecated interface - function deposit(address _token, uint256 _amount) public { - deposit(_token, _amount, false); - } - function deposit( address _token, uint256 _amount, @@ -168,11 +163,6 @@ contract TokenLocking is emit UserTokenTransferred(_token, msgSender(), _recipient, _amount); } - // Deprecated interface - function withdraw(address _token, uint256 _amount) public { - withdraw(_token, _amount, false); - } - function withdraw( address _token, uint256 _amount, diff --git a/docs/interfaces/icolony.md b/docs/interfaces/icolony.md index 910059b244..1c880587d5 100644 --- a/docs/interfaces/icolony.md +++ b/docs/interfaces/icolony.md @@ -1049,24 +1049,6 @@ Lock the colony's token. Can only be called by a network-managed extension. |---|---|---| |timesLocked|uint256|The amount of times the token was locked -### ▸ `makeArbitraryTransaction(address _to, bytes memory _action):bool success` - -Execute arbitrary transaction on behalf of the Colony - - -**Parameters** - -|Name|Type|Description| -|---|---|---| -|_to|address|Contract to receive the function call (cannot be this contract, network or token locking) -|_action|bytes|Bytes array encoding the function call and arguments - -**Return Parameters** - -|Name|Type|Description| -|---|---|---| -|success|bool|Boolean indicating whether the transaction succeeded - ### ▸ `makeArbitraryTransactions(address[] memory _targets, bytes[] memory _actions, bool _strict):bool success` Execute arbitrary transactions on behalf of the Colony in series @@ -1169,24 +1151,6 @@ Move a given amount: `_amount` of `_token` funds from funding pot with id `_from |_token|address|Address of the token, `0x0` value indicates Ether -### ▸ `moveFundsBetweenPots(uint256 _permissionDomainId, uint256 _fromChildSkillIndex, uint256 _toChildSkillIndex, uint256 _fromPot, uint256 _toPot, uint256 _amount, address _token)` - -Move a given amount: `_amount` of `_token` funds from funding pot with id `_fromPot` to one with id `_toPot`. - - -**Parameters** - -|Name|Type|Description| -|---|---|---| -|_permissionDomainId|uint256|The domainId in which I have the permission to take this action -|_fromChildSkillIndex|uint256|The child index in `_permissionDomainId` where we can find the domain for `_fromPotId` -|_toChildSkillIndex|uint256|The child index in `_permissionDomainId` where we can find the domain for `_toPotId` -|_fromPot|uint256|Funding pot id providing the funds -|_toPot|uint256|Funding pot id receiving the funds -|_amount|uint256|Amount of funds -|_token|address|Address of the token, `0x0` value indicates Ether - - ### ▸ `multicall(bytes[] calldata data):bytes[] results` Call multiple functions in the current contract and return the data from all of them if they all succeed @@ -1328,20 +1292,6 @@ Update the default global claim delay for expenditures |_globalClaimDelay|uint256|The new default global claim delay -### ▸ `setExpenditureClaimDelay(uint256 _id, uint256 _slot, uint256 _claimDelay)` - -Sets the claim delay on an expenditure slot. Can only be called by expenditure owner. - - -**Parameters** - -|Name|Type|Description| -|---|---|---| -|_id|uint256|Expenditure identifier -|_slot|uint256|Number of the slot -|_claimDelay|uint256|Duration of time (in seconds) to delay - - ### ▸ `setExpenditureClaimDelays(uint256 _id, uint256[] memory _slots, uint256[] memory _claimDelays)` Sets the claim delays in given expenditure slots. Can only be called by expenditure owner. @@ -1385,22 +1335,6 @@ Sets the metadata for an expenditure. Can only be called by Arbitration role. |_metadata|string|IPFS hash of the metadata -### ▸ `setExpenditurePayout(uint256 _id, uint256 _slot, address _token, uint256 _amount)` - -Set the token payout on an expenditure slot. Can only be called by expenditure owner. - -*Note: Can only be called while expenditure is in draft state.* - -**Parameters** - -|Name|Type|Description| -|---|---|---| -|_id|uint256|Id of the expenditure -|_slot|uint256|Number of the slot -|_token|address|Address of the token, `0x0` value indicates Ether -|_amount|uint256|Payout amount - - ### ▸ `setExpenditurePayout(uint256 _permissionDomainId, uint256 _childSkillIndex, uint256 _id, uint256 _slot, address _token, uint256 _amount)` Set the token payout in a given expenditure slot. Can only be called by an Arbitration user. @@ -1448,21 +1382,6 @@ Set the token payouts in given expenditure slots. Can only be called by expendit |_amounts|uint256[]|Payout amounts -### ▸ `setExpenditureRecipient(uint256 _id, uint256 _slot, address _recipient)` - -Sets the recipient on an expenditure slot. Can only be called by expenditure owner. - -*Note: Can only be called while expenditure is in draft state.* - -**Parameters** - -|Name|Type|Description| -|---|---|---| -|_id|uint256|Id of the expenditure -|_slot|uint256|Slot for the recipient address -|_recipient|address|Address of the recipient - - ### ▸ `setExpenditureRecipients(uint256 _id, uint256[] memory _slots, address[] memory _recipients)` Sets the recipients in given expenditure slots. Can only be called by expenditure owner. @@ -1478,20 +1397,6 @@ Sets the recipients in given expenditure slots. Can only be called by expenditur |_recipients|address[]|Addresses of the recipients -### ▸ `setExpenditureSkill(uint256 _id, uint256 _slot, uint256 _skillId)` - -Sets the skill on an expenditure slot. Can only be called by expenditure owner. - - -**Parameters** - -|Name|Type|Description| -|---|---|---| -|_id|uint256|Expenditure identifier -|_slot|uint256|Number of the slot -|_skillId|uint256|Id of the new skill to set - - ### ▸ `setExpenditureSkills(uint256 _id, uint256[] memory _slots, uint256[] memory _skillIds)` Sets the skill on an expenditure slot. Can only be called by expenditure owner. @@ -1648,22 +1553,6 @@ Updates the expenditure owner. Can only be called by expenditure owner. |_newOwner|address|New owner of expenditure -### ▸ `transferExpenditureViaArbitration(uint256 _permissionDomainId, uint256 _childSkillIndex, uint256 _id, address _newOwner)` - -Updates the expenditure owner. Can only be called by Arbitration role. - -*Note: This is now deprecated and will be removed in a future version* - -**Parameters** - -|Name|Type|Description| -|---|---|---| -|_permissionDomainId|uint256|The domainId in which I have the permission to take this action -|_childSkillIndex|uint256|The index that the `_domainId` is relative to `_permissionDomainId`, (only used if `_permissionDomainId` is different to `_domainId`) -|_id|uint256|Expenditure identifier -|_newOwner|address|New owner of expenditure - - ### ▸ `transferStake(uint256 _permissionDomainId, uint256 _childSkillIndex, address _obligator, address _user, uint256 _domainId, uint256 _amount, address _recipient)` Transfer some amount of obligated tokens. Can be called by the arbitration role. diff --git a/docs/interfaces/icolonynetwork.md b/docs/interfaces/icolonynetwork.md index 1e5198f38c..9338ea4244 100644 --- a/docs/interfaces/icolonynetwork.md +++ b/docs/interfaces/icolonynetwork.md @@ -242,24 +242,6 @@ Used by a user to claim any mining rewards due to them. This will place them in |_recipient|address|The user whose rewards to claim -### ▸ `createColony(address _tokenAddress):address _colonyAddress` - -Creates a new colony in the network, at version 3 - -*Note: This is now deprecated and will be removed in a future version* - -**Parameters** - -|Name|Type|Description| -|---|---|---| -|_tokenAddress|address|Address of an ERC20 token to serve as the colony token. - -**Return Parameters** - -|Name|Type|Description| -|---|---|---| -|_colonyAddress|address|Address of the newly created colony - ### ▸ `createColony(address _tokenAddress, uint256 _version, string memory _colonyName):address _colonyAddress` Creates a new colony in the network, with an optional ENS name @@ -301,28 +283,6 @@ Creates a new colony in the network, with an optional ENS name |---|---|---| |_colonyAddress|address|Address of the newly created colony -### ▸ `createColony(address _tokenAddress, uint256 _version, string memory _colonyName, string memory _orbitdb, bool _useExtensionManager):address _colonyAddress` - -Overload of the simpler `createColony` -- creates a new colony in the network with a variety of options, at version 4 - -*Note: This is now deprecated and will be removed in a future version* - -**Parameters** - -|Name|Type|Description| -|---|---|---| -|_tokenAddress|address|Address of an ERC20 token to serve as the colony token -|_version|uint256|The version of colony to deploy (pass 0 for the current version) -|_colonyName|string|The label to register (if null, no label is registered) -|_orbitdb|string|DEPRECATED Currently a no-op -|_useExtensionManager|bool|DEPRECATED Currently a no-op - -**Return Parameters** - -|Name|Type|Description| -|---|---|---| -|_colonyAddress|address|Address of the newly created colony - ### ▸ `createColonyForFrontend(address _tokenAddress, string memory _name, string memory _symbol, uint8 _decimals, uint256 _version, string memory _colonyName, string memory _metadata):address token, address colony` Creates a new colony in the network, possibly with a token and token authority, with an optional ENS name diff --git a/docs/interfaces/imetacolony.md b/docs/interfaces/imetacolony.md index 8146d9f269..01562aadc2 100644 --- a/docs/interfaces/imetacolony.md +++ b/docs/interfaces/imetacolony.md @@ -1087,24 +1087,6 @@ Lock the colony's token. Can only be called by a network-managed extension. |---|---|---| |timesLocked|uint256|The amount of times the token was locked -### ▸ `makeArbitraryTransaction(address _to, bytes memory _action):bool success` - -Execute arbitrary transaction on behalf of the Colony - - -**Parameters** - -|Name|Type|Description| -|---|---|---| -|_to|address|Contract to receive the function call (cannot be this contract, network or token locking) -|_action|bytes|Bytes array encoding the function call and arguments - -**Return Parameters** - -|Name|Type|Description| -|---|---|---| -|success|bool|Boolean indicating whether the transaction succeeded - ### ▸ `makeArbitraryTransactions(address[] memory _targets, bytes[] memory _actions, bool _strict):bool success` Execute arbitrary transactions on behalf of the Colony in series @@ -1207,24 +1189,6 @@ Move a given amount: `_amount` of `_token` funds from funding pot with id `_from |_token|address|Address of the token, `0x0` value indicates Ether -### ▸ `moveFundsBetweenPots(uint256 _permissionDomainId, uint256 _fromChildSkillIndex, uint256 _toChildSkillIndex, uint256 _fromPot, uint256 _toPot, uint256 _amount, address _token)` - -Move a given amount: `_amount` of `_token` funds from funding pot with id `_fromPot` to one with id `_toPot`. - - -**Parameters** - -|Name|Type|Description| -|---|---|---| -|_permissionDomainId|uint256|The domainId in which I have the permission to take this action -|_fromChildSkillIndex|uint256|The child index in `_permissionDomainId` where we can find the domain for `_fromPotId` -|_toChildSkillIndex|uint256|The child index in `_permissionDomainId` where we can find the domain for `_toPotId` -|_fromPot|uint256|Funding pot id providing the funds -|_toPot|uint256|Funding pot id receiving the funds -|_amount|uint256|Amount of funds -|_token|address|Address of the token, `0x0` value indicates Ether - - ### ▸ `multicall(bytes[] calldata data):bytes[] results` Call multiple functions in the current contract and return the data from all of them if they all succeed @@ -1378,20 +1342,6 @@ Update the default global claim delay for expenditures |_globalClaimDelay|uint256|The new default global claim delay -### ▸ `setExpenditureClaimDelay(uint256 _id, uint256 _slot, uint256 _claimDelay)` - -Sets the claim delay on an expenditure slot. Can only be called by expenditure owner. - - -**Parameters** - -|Name|Type|Description| -|---|---|---| -|_id|uint256|Expenditure identifier -|_slot|uint256|Number of the slot -|_claimDelay|uint256|Duration of time (in seconds) to delay - - ### ▸ `setExpenditureClaimDelays(uint256 _id, uint256[] memory _slots, uint256[] memory _claimDelays)` Sets the claim delays in given expenditure slots. Can only be called by expenditure owner. @@ -1435,22 +1385,6 @@ Sets the metadata for an expenditure. Can only be called by Arbitration role. |_metadata|string|IPFS hash of the metadata -### ▸ `setExpenditurePayout(uint256 _id, uint256 _slot, address _token, uint256 _amount)` - -Set the token payout on an expenditure slot. Can only be called by expenditure owner. - -*Note: Can only be called while expenditure is in draft state.* - -**Parameters** - -|Name|Type|Description| -|---|---|---| -|_id|uint256|Id of the expenditure -|_slot|uint256|Number of the slot -|_token|address|Address of the token, `0x0` value indicates Ether -|_amount|uint256|Payout amount - - ### ▸ `setExpenditurePayout(uint256 _permissionDomainId, uint256 _childSkillIndex, uint256 _id, uint256 _slot, address _token, uint256 _amount)` Set the token payout in a given expenditure slot. Can only be called by an Arbitration user. @@ -1498,21 +1432,6 @@ Set the token payouts in given expenditure slots. Can only be called by expendit |_amounts|uint256[]|Payout amounts -### ▸ `setExpenditureRecipient(uint256 _id, uint256 _slot, address _recipient)` - -Sets the recipient on an expenditure slot. Can only be called by expenditure owner. - -*Note: Can only be called while expenditure is in draft state.* - -**Parameters** - -|Name|Type|Description| -|---|---|---| -|_id|uint256|Id of the expenditure -|_slot|uint256|Slot for the recipient address -|_recipient|address|Address of the recipient - - ### ▸ `setExpenditureRecipients(uint256 _id, uint256[] memory _slots, address[] memory _recipients)` Sets the recipients in given expenditure slots. Can only be called by expenditure owner. @@ -1528,20 +1447,6 @@ Sets the recipients in given expenditure slots. Can only be called by expenditur |_recipients|address[]|Addresses of the recipients -### ▸ `setExpenditureSkill(uint256 _id, uint256 _slot, uint256 _skillId)` - -Sets the skill on an expenditure slot. Can only be called by expenditure owner. - - -**Parameters** - -|Name|Type|Description| -|---|---|---| -|_id|uint256|Expenditure identifier -|_slot|uint256|Number of the slot -|_skillId|uint256|Id of the new skill to set - - ### ▸ `setExpenditureSkills(uint256 _id, uint256[] memory _slots, uint256[] memory _skillIds)` Sets the skill on an expenditure slot. Can only be called by expenditure owner. @@ -1737,22 +1642,6 @@ Updates the expenditure owner. Can only be called by expenditure owner. |_newOwner|address|New owner of expenditure -### ▸ `transferExpenditureViaArbitration(uint256 _permissionDomainId, uint256 _childSkillIndex, uint256 _id, address _newOwner)` - -Updates the expenditure owner. Can only be called by Arbitration role. - -*Note: This is now deprecated and will be removed in a future version* - -**Parameters** - -|Name|Type|Description| -|---|---|---| -|_permissionDomainId|uint256|The domainId in which I have the permission to take this action -|_childSkillIndex|uint256|The index that the `_domainId` is relative to `_permissionDomainId`, (only used if `_permissionDomainId` is different to `_domainId`) -|_id|uint256|Expenditure identifier -|_newOwner|address|New owner of expenditure - - ### ▸ `transferStake(uint256 _permissionDomainId, uint256 _childSkillIndex, address _obligator, address _user, uint256 _domainId, uint256 _amount, address _recipient)` Transfer some amount of obligated tokens. Can be called by the arbitration role. diff --git a/docs/interfaces/itokenlocking.md b/docs/interfaces/itokenlocking.md index e2c91d6b88..098a4931c6 100644 --- a/docs/interfaces/itokenlocking.md +++ b/docs/interfaces/itokenlocking.md @@ -39,19 +39,6 @@ Deobligate the user some amount of tokens, releasing the stake. Can only be call |_token|address|The colony's internal token address -### ▸ `deposit(address _token, uint256 _amount)` - -Deposit `_amount` of deposited tokens. Can only be called if user tokens are not locked. Before calling this function user has to allow that their tokens can be transferred by token locking contract. - - -**Parameters** - -|Name|Type|Description| -|---|---|---| -|_token|address|Address of the token to deposit -|_amount|uint256|Amount to deposit - - ### ▸ `deposit(address _token, uint256 _amount, bool _force)` Deposit `_amount` of colony tokens. Before calling this function user has to allow that their tokens can be transferred by token locking contract. @@ -265,20 +252,6 @@ Obligate the user some amount of tokens as a stake. Can only be called by a colo |_token|address|The colony's internal token address -### ▸ `reward(address _recipient, uint256 _amount)` - -This function is deprecated and only exists to aid upgrades. - -*Note: It's a NOOP. You don't need to call this, and if you write a contract that does it will break in the future.* - -**Parameters** - -|Name|Type|Description| -|---|---|---| -|_recipient|address|The address to receive the reward -|_amount|uint256|The amount to reward - - ### ▸ `setColonyNetwork(address _colonyNetwork)` Set the ColonyNetwork contract address. @@ -336,19 +309,6 @@ Increments the lock counter to `_lockId` for the `_user` if user's lock count is |_lockId|uint256|Id of the lock we want to increment to -### ▸ `withdraw(address _token, uint256 _amount)` - -Withdraw `_amount` of deposited tokens. Can only be called if user tokens are not locked. - - -**Parameters** - -|Name|Type|Description| -|---|---|---| -|_token|address|Address of the token to withdraw from -|_amount|uint256|Amount to withdraw - - ### ▸ `withdraw(address _token, uint256 _amount, bool _force)` Withdraw `_amount` of deposited tokens. Set `_force` to `true` to forcibly unlock the token before the withdrawal. diff --git a/helpers/test-helper.js b/helpers/test-helper.js index 0195413646..626474048a 100644 --- a/helpers/test-helper.js +++ b/helpers/test-helper.js @@ -1227,6 +1227,13 @@ exports.encodeTxData = async function encodeTxData(colony, functionName, args) { } }); + if (functionName.indexOf("(") !== -1) { + // Create an Interface with ethers from the function signature + const iFace = new ethers.utils.Interface([`function ${functionName}`]); + return iFace.encodeFunctionData(functionName, convertedArgs); + } + + // Otherwise, it's a function on the truffle contract that was passed to us const txData = await colony.contract.methods[functionName](...convertedArgs).encodeABI(); return txData; }; diff --git a/packages/metatransaction-broadcaster/MetatransactionBroadcaster.js b/packages/metatransaction-broadcaster/MetatransactionBroadcaster.js index 0e2450c053..962652cbb4 100644 --- a/packages/metatransaction-broadcaster/MetatransactionBroadcaster.js +++ b/packages/metatransaction-broadcaster/MetatransactionBroadcaster.js @@ -205,7 +205,15 @@ class MetatransactionBroadcaster { async isColonyFamilyTransactionAllowed(target, txData, userAddress) { const colonyDef = await this.loader.load({ contractDir: "colony", contractName: "IColony" }); - const possibleColony = new ethers.Contract(target, colonyDef.abi, this.wallet); + + // Add the old makeArbitraryTransaction to the abi + const iface = new ethers.utils.Interface(["function makeArbitraryTransaction(address,bytes)"]); + const oldJsonAbi = JSON.parse(iface.format(ethers.utils.FormatTypes.json)); + oldJsonAbi[0].inputs = oldJsonAbi[0].inputs.map((x) => { + return { ...x, internalType: x.type }; + }); + + const possibleColony = new ethers.Contract(target, [...colonyDef.abi, ...oldJsonAbi], this.wallet); try { const tx = possibleColony.interface.parseTransaction({ data: txData }); diff --git a/test-smoke/colony-storage-consistent.js b/test-smoke/colony-storage-consistent.js new file mode 100644 index 0000000000..f07bf7b103 --- /dev/null +++ b/test-smoke/colony-storage-consistent.js @@ -0,0 +1,175 @@ +/* global artifacts */ +const chai = require("chai"); +const bnChai = require("bn-chai"); +const BN = require("bn.js"); + +const { UINT256_MAX, WAD } = require("../helpers/constants"); +const { fundColonyWithTokens, setupColony } = require("../helpers/test-data-generator"); + +const { expect } = chai; +chai.use(bnChai(web3.utils.BN)); + +const EtherRouter = artifacts.require("EtherRouter"); +const IColonyNetwork = artifacts.require("IColonyNetwork"); +const IMetaColony = artifacts.require("IMetaColony"); +const Token = artifacts.require("Token"); +const TokenAuthority = artifacts.require("TokenAuthority"); +const ContractEditing = artifacts.require("ContractEditing"); +const Resolver = artifacts.require("Resolver"); + +contract("Contract Storage", (accounts) => { + const SLOT0 = 0; + + const RECIPIENT = accounts[3]; + const ADMIN = accounts[4]; + const ARBITRATOR = accounts[5]; + + let colony; + let token; + let localSkillId; + let otherToken; + let colonyNetwork; + let metaColony; + let domain1; + let tokenLockingAddress; + + before(async () => { + // We use our own providers for these test(s) so we can really get in to it... + + const etherRouter = await EtherRouter.deployed(); + colonyNetwork = await IColonyNetwork.at(etherRouter.address); + const metaColonyAddress = await colonyNetwork.getMetaColony(); + metaColony = await IMetaColony.at(metaColonyAddress); + + token = await Token.new("name", "symbol", 18); + await token.unlock(); + + colony = await setupColony(colonyNetwork, token.address); + + await colony.addLocalSkill(); + localSkillId = await colonyNetwork.getSkillCount(); + + tokenLockingAddress = await colonyNetwork.getTokenLocking(); + const tokenAuthority = await TokenAuthority.new(token.address, colony.address, [tokenLockingAddress]); + await token.setAuthority(tokenAuthority.address); + + await colony.setRewardInverse(100); + await colony.setAdministrationRole(1, UINT256_MAX, ADMIN, 1, true); + await colony.setArbitrationRole(1, UINT256_MAX, ARBITRATOR, 1, true); + await fundColonyWithTokens(colony, token, UINT256_MAX); + domain1 = await colony.getDomain(1); + + otherToken = await Token.new("otherName", "otherSymbol", 18); + await otherToken.unlock(); + await fundColonyWithTokens(colony, otherToken, UINT256_MAX); + }); + + function getAddressStateHash(address) { + return new Promise((resolve, reject) => { + web3.currentProvider + .request({ method: "eth_getProof", params: [address, [], "latest"] }) + .then((result) => { + return resolve(result.storageHash); + }) + .catch((e) => { + reject(e); + }); + }); + } + + describe("Smoke tests to check our storage layout does not change", () => { + // There are many things you could do that one would expect to change these hashes. If you've made changes that change the contents of storage of a + // contract, then these hashes will change. This could include adding an extra transaction somewhere, which could cause the address a contract is + // deployed to change, which if it is stored somewhere would cause the state hash of the storage to change. + + // If you haven't touched the contracts, however, and this test fails, then something is afoot. + // In theory, the storage slots used by solidity could change in an upgrade, + // which this test was written with in mind to try and detect. They don't guarantee this hasn't happened if they pass, but if they fail without just + // cause then we need to think very carefully about what's going on. + + it("storage contents should be as expected", async () => { + await colony.makeExpenditure(1, UINT256_MAX, 1, { from: ADMIN }); + const expenditureId = await colony.getExpenditureCount(); + + await colony.setExpenditureRecipients(expenditureId, [SLOT0], [RECIPIENT], { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [WAD], { from: ADMIN }); + await colony.setExpenditureSkills(expenditureId, [SLOT0], [localSkillId], { from: ADMIN }); + + const expenditure = await colony.getExpenditure(expenditureId); + await colony.moveFundsBetweenPots( + 1, + UINT256_MAX, + 1, + UINT256_MAX, + UINT256_MAX, + domain1.fundingPotId, + expenditure.fundingPotId, + WAD, + token.address, + ); + await colony.finalizeExpenditure(expenditureId, { from: ADMIN }); + await colony.claimExpenditurePayout(expenditureId, SLOT0, token.address); + + const miningCycleAddress = await colonyNetwork.getReputationMiningCycle(false); + const miningCycleStateHash = await getAddressStateHash(miningCycleAddress); + + // For this test to be reproducible, have to zero timestamps / time depenedent things + // For colonyNetwork, that means the mining staking timestamp + + const contractEditing = await ContractEditing.new(); + const networkAsER = await EtherRouter.at(colonyNetwork.address); + const colonyNetworkResolverAddress = await networkAsER.resolver(); + const colonyNetworkResolver = await Resolver.at(colonyNetworkResolverAddress); + await colonyNetworkResolver.register("setStorageSlot(uint256,bytes32)", contractEditing.address); + const editableNetwork = await ContractEditing.at(colonyNetwork.address); + + // Following + // https://solidity.readthedocs.io/en/v0.6.8/internals/layout_in_storage.html#mappings-and-dynamic-arrays + // This is the hash of the key (the address) and the storage slot containing the mapping (33) + let hashable = `0x000000000000000000000000${accounts[5].slice(2)}${new BN(33).toString(16, 64)}`; + let hashed = web3.utils.soliditySha3(hashable); + let slot = new BN(hashed.slice(2), 16); + // To get the slot containing the timestamp of the miner submission, we add one to where the struct starts + // (see ColonyNetworkDataTypes) + slot = slot.addn(1); + + await editableNetwork.setStorageSlot(slot, "0x0000000000000000000000000000000000000000000000000000000000000000"); + + // Also zero out the slot containing the current colony version + await editableNetwork.setStorageSlot(7, "0x0000000000000000000000000000000000000000000000000000000000000000"); + + const colonyNetworkStateHash = await getAddressStateHash(colonyNetwork.address); + + // We did a whole expenditure above, so let's take out the finalized timestamp + // This is the hash of the expenditure id (1) with the storage slot (25) to find the location of the struct + hashable = `0x${new BN(1).toString(16, 64)}${new BN(25).toString(16, 64)}`; + hashed = web3.utils.soliditySha3(hashable); + slot = new BN(hashed.slice(2), 16); + // To find the slot storing the timestamp, we add three to where the struct starts (see ColonyDataTypes). + slot = slot.addn(3); + + const colonyAsER = await EtherRouter.at(colony.address); + const colonyResolverAddress = await colonyAsER.resolver(); + const colonyResolver = await Resolver.at(colonyResolverAddress); + await colonyResolver.register("setStorageSlot(uint256,bytes32)", contractEditing.address); + const editableColony = await ContractEditing.at(colony.address); + await editableColony.setStorageSlot(slot, "0x0000000000000000000000000000000000000000000000000000000000000000"); + + const colonyStateHash = await getAddressStateHash(colony.address); + const metaColonyStateHash = await getAddressStateHash(metaColony.address); + const tokenLockingStateHash = await getAddressStateHash(tokenLockingAddress); + + console.log("colonyNetworkStateHash:", colonyNetworkStateHash); + console.log("colonyStateHash:", colonyStateHash); + console.log("metaColonyStateHash:", metaColonyStateHash); + console.log("miningCycleStateHash:", miningCycleStateHash); + console.log("tokenLockingStateHash:", tokenLockingStateHash); + + expect(colonyNetworkStateHash).to.equal("0x7c394f57b45ff6fd37a512c33427d9a9bb31bc393dee3316ec9076c1b477100c"); + expect(colonyStateHash).to.equal("0x97af08abf31d5320c2ef7d118ca25ce42b6ea874bfaccc17bee28132314d6a30"); + expect(metaColonyStateHash).to.equal("0x4e2dc36a06a282d10673d50908bfab9e7f56ae28e8a318286426b3c67eced2e9"); + expect(miningCycleStateHash).to.equal("0xff6aae2cdd6dbb74ca9cb2e5fd625d80679538f0f95d35b4616b5e2df82df622"); + expect(tokenLockingStateHash).to.equal("0xf3ba80967cecfdb7d1f6f9d92e3f1484dcb81557911efe5135b0315f915c5294"); + }); + }); +}); diff --git a/test/contracts-network/colony-arbitrary-transactions.js b/test/contracts-network/colony-arbitrary-transactions.js index 26cd844c4f..5ac7bce856 100644 --- a/test/contracts-network/colony-arbitrary-transactions.js +++ b/test/contracts-network/colony-arbitrary-transactions.js @@ -5,15 +5,15 @@ const bnChai = require("bn-chai"); const { ethers } = require("ethers"); const { soliditySha3 } = require("web3-utils"); -const { UINT256_MAX, WAD } = require("../../helpers/constants"); -const { checkErrorRevert, encodeTxData, expectEvent } = require("../../helpers/test-helper"); +const { UINT256_MAX, WAD, ARBITRATION_ROLE, FUNDING_ROLE, ADMINISTRATION_ROLE } = require("../../helpers/constants"); +const { checkErrorRevert, encodeTxData, expectEvent, rolesToBytes32 } = require("../../helpers/test-helper"); const { setupRandomColony, fundColonyWithTokens } = require("../../helpers/test-data-generator"); const { expect } = chai; chai.use(bnChai(web3.utils.BN)); const ADDRESS_ZERO = ethers.constants.AddressZero; -const CoinMachine = artifacts.require("CoinMachine"); +const OneTxPayment = artifacts.require("OneTxPayment"); const EtherRouter = artifacts.require("EtherRouter"); const IColonyNetwork = artifacts.require("IColonyNetwork"); const ITokenLocking = artifacts.require("ITokenLocking"); @@ -41,7 +41,7 @@ contract("Colony Arbitrary Transactions", (accounts) => { const action = await encodeTxData(token, "mint", [WAD]); const balancePre = await token.balanceOf(colony.address); - const tx = await colony.makeArbitraryTransaction(token.address, action); + const tx = await colony.makeArbitraryTransactions([token.address], [action], true); await expectEvent(tx, "ArbitraryTransaction(address,address,bytes,bool)", [accounts[0], token.address, action, true]); @@ -68,10 +68,7 @@ contract("Colony Arbitrary Transactions", (accounts) => { const action2 = await encodeTxData(token, "mint", [WAD.muln(2)]); const balancePre = await token.balanceOf(colony.address); - await checkErrorRevert( - colony.makeArbitraryTransactions([token.address, ADDRESS_ZERO], [action, action2], true), - "colony-arbitrary-transaction-failed", - ); + await checkErrorRevert(colony.makeArbitraryTransactions([token.address, colony.address], [action, action2], true), "colony-cannot-target-self"); const balancePost = await token.balanceOf(colony.address); expect(balancePost).to.eq.BN(balancePre); @@ -102,15 +99,15 @@ contract("Colony Arbitrary Transactions", (accounts) => { it("should not be able to make arbitrary transactions if not root", async () => { const action = await encodeTxData(token, "mint", [WAD]); - await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action, { from: USER1 }), "ds-auth-unauthorized"); + await checkErrorRevert(colony.makeArbitraryTransactions([token.address], [action], true, { from: USER1 }), "ds-auth-unauthorized"); }); it("should not be able to make arbitrary transactions to a colony itself", async () => { - await checkErrorRevert(colony.makeArbitraryTransaction(colony.address, "0x0"), "colony-cannot-target-self"); + await checkErrorRevert(colony.makeArbitraryTransactions([colony.address], ["0x0"], true), "colony-cannot-target-self"); }); it("should not be able to make arbitrary transactions to a user address", async () => { - await checkErrorRevert(colony.makeArbitraryTransaction(accounts[0], "0x0"), "colony-to-must-be-contract"); + await checkErrorRevert(colony.makeArbitraryTransactions([accounts[0]], ["0x0"], true), "colony-to-must-be-contract"); }); it("should not be able to make single arbitrary transactions directly", async () => { @@ -125,14 +122,14 @@ contract("Colony Arbitrary Transactions", (accounts) => { const action1 = await encodeTxData(colonyNetwork, "addSkill", [0]); const action2 = await encodeTxData(tokenLocking, "lockToken", [token.address]); - await checkErrorRevert(colony.makeArbitraryTransaction(colonyNetwork.address, action1), "colony-cannot-target-network"); - await checkErrorRevert(colony.makeArbitraryTransaction(tokenLocking.address, action2), "colony-cannot-target-token-locking"); + await checkErrorRevert(colony.makeArbitraryTransactions([colonyNetwork.address], [action1], true), "colony-cannot-target-network"); + await checkErrorRevert(colony.makeArbitraryTransactions([tokenLocking.address], [action2], true), "colony-cannot-target-token-locking"); }); it("if an arbitrary transaction is made to approve tokens, then tokens needed for approval cannot be moved out of the main pot", async () => { await fundColonyWithTokens(colony, token, 100); const action1 = await encodeTxData(token, "approve", [USER0, 50]); - await colony.makeArbitraryTransaction(token.address, action1); + await colony.makeArbitraryTransactions([token.address], [action1], true); await colony.moveFundsBetweenPots(1, UINT256_MAX, 1, UINT256_MAX, UINT256_MAX, 1, 0, 50, token.address); await checkErrorRevert( colony.moveFundsBetweenPots(1, UINT256_MAX, 1, UINT256_MAX, UINT256_MAX, 1, 0, 50, token.address), @@ -148,7 +145,7 @@ contract("Colony Arbitrary Transactions", (accounts) => { tokens can only be moved from main pot that weren't part of the allowance`, async () => { await fundColonyWithTokens(colony, token, 100); const action1 = await encodeTxData(token, "approve", [USER0, 20]); - await colony.makeArbitraryTransaction(token.address, action1); + await colony.makeArbitraryTransactions([token.address], [action1], true); // Use allowance await token.transferFrom(colony.address, USER0, 20, { from: USER0 }); // Approval tracking still thinks it has to reserve 20 @@ -180,9 +177,9 @@ contract("Colony Arbitrary Transactions", (accounts) => { await fundColonyWithTokens(colony, token, 100); const action1 = await encodeTxData(token, "approve", [USER0, 300]); // Not enough tokens at all - await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action1), "colony-approval-exceeds-balance"); + await checkErrorRevert(colony.makeArbitraryTransactions([token.address], [action1], true), "colony-approval-exceeds-balance"); await fundColonyWithTokens(colony, token, 1000); - await colony.makeArbitraryTransaction(token.address, action1); + await colony.makeArbitraryTransactions([token.address], [action1], true); // They are now approved for 300. let approval = await colony.getTokenApproval(token.address, USER0); expect(approval).to.be.eq.BN(300); @@ -191,14 +188,14 @@ contract("Colony Arbitrary Transactions", (accounts) => { const action2 = await encodeTxData(token, "approve", [USER0, 900]); // User was approved for 300, we now approve them for 900. There are enough tokens to cover this, even though 900 + 300 > 1100, the balance of the pot - await colony.makeArbitraryTransaction(token.address, action2); + await colony.makeArbitraryTransactions([token.address], [action2], true); approval = await colony.getTokenApproval(token.address, USER0); expect(approval).to.be.eq.BN(900); allApprovals = await colony.getTotalTokenApproval(token.address); expect(allApprovals).to.be.eq.BN(900); // Set them back to 300 - await colony.makeArbitraryTransaction(token.address, action1); + await colony.makeArbitraryTransactions([token.address], [action1], true); approval = await colony.getTokenApproval(token.address, USER0); expect(approval).to.be.eq.BN(300); allApprovals = await colony.getTotalTokenApproval(token.address); @@ -206,10 +203,10 @@ contract("Colony Arbitrary Transactions", (accounts) => { // Cannot approve someone else for 900 const action3 = await encodeTxData(token, "approve", [USER1, 900]); - await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action3), "colony-approval-exceeds-balance"); + await checkErrorRevert(colony.makeArbitraryTransactions([token.address], [action3], true), "colony-approval-exceeds-balance"); // But can for 800 const action4 = await encodeTxData(token, "approve", [USER1, 800]); - await colony.makeArbitraryTransaction(token.address, action4); + await colony.makeArbitraryTransactions([token.address], [action4], true); approval = await colony.getTokenApproval(token.address, USER1); expect(approval).to.be.eq.BN(800); allApprovals = await colony.getTotalTokenApproval(token.address); @@ -217,40 +214,63 @@ contract("Colony Arbitrary Transactions", (accounts) => { }); it("should not be able to make arbitrary transactions to the colony's own extensions", async () => { - const COIN_MACHINE = soliditySha3("CoinMachine"); + const ONE_TX_PAYMENT = soliditySha3("OneTxPayment"); + + const ethersProvider = new ethers.providers.JsonRpcProvider(web3.currentProvider.host); + const ethersColonyNetwork = new ethers.Contract(colonyNetwork.address, colonyNetwork.abi, ethersProvider); + + const eventFilter = ethersColonyNetwork.filters.ExtensionAddedToNetwork(ONE_TX_PAYMENT); + const events = await ethersColonyNetwork.queryFilter(eventFilter, 0); + const log = ethersColonyNetwork.interface.parseLog(events[0]); - const extension = await CoinMachine.new(); - const version = await extension.version(); - await colony.installExtension(COIN_MACHINE, version); + await colony.installExtension(ONE_TX_PAYMENT, log.args.version); - const coinMachineAddress = await colonyNetwork.getExtensionInstallation(COIN_MACHINE, colony.address); - const coinMachine = await CoinMachine.at(coinMachineAddress); - await coinMachine.initialise(token.address, ethers.constants.AddressZero, 60 * 60, 10, WAD, WAD, WAD, WAD, ADDRESS_ZERO); - await token.mint(coinMachine.address, WAD); + const oneTxPaymentAddress = await colonyNetwork.getExtensionInstallation(ONE_TX_PAYMENT, colony.address); + const oneTxPayment = await OneTxPayment.at(oneTxPaymentAddress); + const ROLES = rolesToBytes32([ARBITRATION_ROLE, FUNDING_ROLE, ADMINISTRATION_ROLE]); - const action = await encodeTxData(coinMachine, "buyTokens", [WAD]); + // Give extension funding and administration rights + await colony.setUserRoles(1, UINT256_MAX, oneTxPayment.address, 1, ROLES); + await colony.setUserRoles(1, UINT256_MAX, colony.address, 1, ROLES); - await checkErrorRevert(colony.makeArbitraryTransaction(coinMachine.address, action), "colony-cannot-target-extensions"); + await colony.send(10); // NB 10 wei, not ten ether! + await colony.claimColonyFunds(ADDRESS_ZERO); + + const action = await encodeTxData(oneTxPayment, "makePaymentFundedFromDomain", [ + 1, + UINT256_MAX, + 1, + UINT256_MAX, + [USER1], + [ADDRESS_ZERO], + [10], + 1, + 0, + ]); + + await checkErrorRevert(colony.makeArbitraryTransactions([oneTxPayment.address], [action], true), "colony-cannot-target-extensions"); // But other colonies can const { colony: otherColony } = await setupRandomColony(colonyNetwork); - await otherColony.makeArbitraryTransaction(coinMachine.address, action); + await colony.setUserRoles(1, UINT256_MAX, otherColony.address, 1, ROLES); + + await otherColony.makeArbitraryTransactions([oneTxPayment.address], [action], true); }); it("when burning tokens, can burn own tokens with burn(amount) up to the amount unspoken for in root pot", async () => { await fundColonyWithTokens(colony, token, 100); const action1 = await encodeTxData(token, "approve", [USER0, 60]); - await colony.makeArbitraryTransaction(token.address, action1); + await colony.makeArbitraryTransactions([token.address], [action1], true); let potBalance = await colony.getFundingPotBalance(1, token.address); expect(potBalance).to.be.eq.BN(100); const action2 = await encodeTxData(token, "burn", [100]); // Can't burn 100 as 60 are reserved - await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action2), "colony-not-enough-tokens"); + await checkErrorRevert(colony.makeArbitraryTransactions([token.address], [action2], true), "colony-not-enough-tokens"); // Can burn 40 const action3 = await encodeTxData(token, "burn", [40]); - await colony.makeArbitraryTransaction(token.address, action3); + await colony.makeArbitraryTransactions([token.address], [action3], true); potBalance = await colony.getFundingPotBalance(1, token.address); expect(potBalance).to.be.eq.BN(60); }); @@ -258,17 +278,17 @@ contract("Colony Arbitrary Transactions", (accounts) => { it("when transferring tokens, can transfer own tokens with transfer(dst, amount) up to the amount unspoken for in root pot", async () => { await fundColonyWithTokens(colony, token, 100); const action1 = await encodeTxData(token, "approve", [USER0, 60]); - await colony.makeArbitraryTransaction(token.address, action1); + await colony.makeArbitraryTransactions([token.address], [action1], true); let potBalance = await colony.getFundingPotBalance(1, token.address); expect(potBalance).to.be.eq.BN(100); const action2 = await encodeTxData(token, "transfer", [USER0, 100]); // Can't transfer 100 as 60 are reserved - await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action2), "colony-not-enough-tokens"); + await checkErrorRevert(colony.makeArbitraryTransactions([token.address], [action2], true), "colony-not-enough-tokens"); // Can transfer 40 const action3 = await encodeTxData(token, "transfer", [USER0, 40]); - await colony.makeArbitraryTransaction(token.address, action3); + await colony.makeArbitraryTransactions([token.address], [action3], true); potBalance = await colony.getFundingPotBalance(1, token.address); expect(potBalance).to.be.eq.BN(60); const userBalance = await token.balanceOf(USER0); @@ -279,7 +299,7 @@ contract("Colony Arbitrary Transactions", (accounts) => { await token.mint(100); await token.approve(colony.address, 100); const action1 = await encodeTxData(token, "burn", [USER0, 60]); - await colony.makeArbitraryTransaction(token.address, action1); + await colony.makeArbitraryTransactions([token.address], [action1], true); const userBalance = await token.balanceOf(USER0); expect(userBalance).to.be.eq.BN(40); @@ -289,7 +309,7 @@ contract("Colony Arbitrary Transactions", (accounts) => { await token.mint(100); await token.approve(colony.address, 100); const action1 = await encodeTxData(token, "transferFrom", [USER0, colony.address, 60]); - await colony.makeArbitraryTransaction(token.address, action1); + await colony.makeArbitraryTransactions([token.address], [action1], true); const userBalance = await token.balanceOf(USER0); expect(userBalance).to.be.eq.BN(40); @@ -299,11 +319,11 @@ contract("Colony Arbitrary Transactions", (accounts) => { it("cannot burn own tokens with burn(guy, amount)", async () => { const action = await encodeTxData(token, "burn", [colony.address, 60]); - await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action), "colony-cannot-spend-own-allowance"); + await checkErrorRevert(colony.makeArbitraryTransactions([token.address], [action], true), "colony-cannot-spend-own-allowance"); }); it("cannot transfer own tokens with transferFrom(from, to, amount)", async () => { const action = await encodeTxData(token, "transferFrom", [colony.address, USER0, 60]); - await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action), "colony-cannot-spend-own-allowance"); + await checkErrorRevert(colony.makeArbitraryTransactions([token.address], [action], true), "colony-cannot-spend-own-allowance"); }); }); diff --git a/test/contracts-network/colony-expenditure.js b/test/contracts-network/colony-expenditure.js index 913564b02d..59d36ecad5 100644 --- a/test/contracts-network/colony-expenditure.js +++ b/test/contracts-network/colony-expenditure.js @@ -142,20 +142,6 @@ contract("Colony Expenditure", (accounts) => { expect(expenditure.owner).to.equal(USER); }); - it("should allow arbitration users to transfer expenditures", async () => { - await colony.makeExpenditure(1, UINT256_MAX, 1, { from: ADMIN }); - const expenditureId = await colony.getExpenditureCount(); - - let expenditure = await colony.getExpenditure(expenditureId); - expect(expenditure.owner).to.equal(ADMIN); - - await checkErrorRevert(colony.transferExpenditureViaArbitration(1, UINT256_MAX, expenditureId, USER, { from: ADMIN }), "ds-auth-unauthorized"); - await colony.transferExpenditureViaArbitration(1, UINT256_MAX, expenditureId, USER, { from: ARBITRATOR }); - - expenditure = await colony.getExpenditure(expenditureId); - expect(expenditure.owner).to.equal(USER); - }); - it("should allow arbitration users to cancel expenditures", async () => { await colony.makeExpenditure(1, UINT256_MAX, 1, { from: ADMIN }); const expenditureId = await colony.getExpenditureCount(); @@ -203,7 +189,6 @@ contract("Colony Expenditure", (accounts) => { it("should error if the expenditure does not exist", async () => { await checkErrorRevert(colony.setExpenditureSkills(100, [SLOT0], [localSkillId]), "colony-expenditure-does-not-exist"); await checkErrorRevert(colony.transferExpenditure(100, USER), "colony-expenditure-does-not-exist"); - await checkErrorRevert(colony.cancelExpenditure(100, { from: ARBITRATOR }), "colony-expenditure-does-not-exist"); await checkErrorRevert( colony.transferExpenditureViaArbitration(0, UINT256_MAX, 100, USER, { from: ARBITRATOR }), "colony-expenditure-does-not-exist", @@ -247,7 +232,7 @@ contract("Colony Expenditure", (accounts) => { }); it("should allow owners to update a slot recipient", async () => { - await colony.setExpenditureRecipient(expenditureId, SLOT0, USER, { from: ADMIN }); + await colony.setExpenditureRecipients(expenditureId, [SLOT0], [USER], { from: ADMIN }); expenditureSlot = await colony.getExpenditureSlot(expenditureId, SLOT0); expect(expenditureSlot.recipient).to.equal(USER); @@ -299,7 +284,7 @@ contract("Colony Expenditure", (accounts) => { }); it("should allow owners to update a slot skill with a local skill", async () => { - await colony.setExpenditureSkill(expenditureId, SLOT0, localSkillId, { from: ADMIN }); + await colony.setExpenditureSkills(expenditureId, [SLOT0], [localSkillId], { from: ADMIN }); expenditureSlot = await colony.getExpenditureSlot(expenditureId, SLOT0); expect(expenditureSlot.skills[0]).to.eq.BN(localSkillId); @@ -400,14 +385,17 @@ contract("Colony Expenditure", (accounts) => { await colonyNetworkAsEtherRouter.setResolver(latestResolver); await upgradeColonyOnceThenToLatest(metaColony); - await checkErrorRevert(colony.setExpenditureSkill(expenditureId, SLOT0, globalSkillId, { from: ADMIN }), "colony-not-valid-local-skill"); - await checkErrorRevert(colony.setExpenditureSkill(expenditureId, SLOT0, globalSkillId2, { from: ADMIN }), "colony-not-valid-local-skill"); + await checkErrorRevert(colony.setExpenditureSkills(expenditureId, [SLOT0], [globalSkillId], { from: ADMIN }), "colony-not-valid-local-skill"); + await checkErrorRevert(colony.setExpenditureSkills(expenditureId, [SLOT0], [globalSkillId2], { from: ADMIN }), "colony-not-valid-local-skill"); }); it("should allow only owners to update a slot claim delay", async () => { - await checkErrorRevert(colony.setExpenditureClaimDelay(expenditureId, SLOT0, SECONDS_PER_DAY, { from: USER }), "colony-expenditure-not-owner"); + await checkErrorRevert( + colony.setExpenditureClaimDelays(expenditureId, [SLOT0], [SECONDS_PER_DAY], { from: USER }), + "colony-expenditure-not-owner", + ); - await colony.setExpenditureClaimDelay(expenditureId, SLOT0, SECONDS_PER_DAY, { from: ADMIN }); + await colony.setExpenditureClaimDelays(expenditureId, [SLOT0], [SECONDS_PER_DAY], { from: ADMIN }); expenditureSlot = await colony.getExpenditureSlot(expenditureId, SLOT0); expect(expenditureSlot.claimDelay).to.eq.BN(SECONDS_PER_DAY); @@ -476,19 +464,19 @@ contract("Colony Expenditure", (accounts) => { it("should not allow non-owners to update skills or payouts", async () => { await checkErrorRevert(colony.setExpenditureSkills(expenditureId, [SLOT0], [localSkillId]), "colony-expenditure-not-owner"); - await checkErrorRevert(colony.setExpenditurePayout(expenditureId, SLOT0, token.address, WAD), "colony-expenditure-not-owner"); + await checkErrorRevert(colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [WAD]), "colony-expenditure-not-owner"); }); it("should allow owners to add a slot payout", async () => { - await colony.setExpenditurePayout(expenditureId, SLOT0, token.address, WAD, { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [WAD], { from: ADMIN }); const payout = await colony.getExpenditureSlotPayout(expenditureId, SLOT0, token.address); expect(payout).to.eq.BN(WAD); }); it("should be able to add multiple payouts in different tokens", async () => { - await colony.setExpenditurePayout(expenditureId, SLOT0, token.address, 100, { from: ADMIN }); - await colony.setExpenditurePayout(expenditureId, SLOT0, otherToken.address, 200, { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [100], { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], otherToken.address, [200], { from: ADMIN }); const payoutForToken = await colony.getExpenditureSlotPayout(expenditureId, SLOT0, token.address); const payoutForOtherToken = await colony.getExpenditureSlotPayout(expenditureId, SLOT0, otherToken.address); @@ -497,35 +485,35 @@ contract("Colony Expenditure", (accounts) => { }); it("should not allow owners to set a payout above the maximum", async () => { - await colony.setExpenditurePayout(expenditureId, SLOT0, token.address, MAX_PAYOUT, { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [MAX_PAYOUT], { from: ADMIN }); await checkErrorRevert( - colony.setExpenditurePayout(expenditureId, SLOT0, token.address, MAX_PAYOUT.addn(1), { from: ADMIN }), + colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [MAX_PAYOUT.addn(1)], { from: ADMIN }), "colony-payout-too-large", ); }); it("should allow owner to set token payout to zero", async () => { - await colony.setExpenditurePayout(expenditureId, SLOT0, token.address, WAD, { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [WAD], { from: ADMIN }); let payout = await colony.getExpenditureSlotPayout(expenditureId, SLOT0, token.address); expect(payout).to.eq.BN(WAD); - await colony.setExpenditurePayout(expenditureId, SLOT0, token.address, 0, { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [0], { from: ADMIN }); payout = await colony.getExpenditureSlotPayout(expenditureId, SLOT0, token.address); expect(payout).to.be.zero; }); it("should correctly account for multiple payouts in the same token", async () => { - await colony.setExpenditurePayout(expenditureId, SLOT0, token.address, WAD, { from: ADMIN }); - await colony.setExpenditurePayout(expenditureId, SLOT1, token.address, WAD, { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [WAD], { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT1], token.address, [WAD], { from: ADMIN }); const expenditure = await colony.getExpenditure(expenditureId); let totalPayout = await colony.getFundingPotPayout(expenditure.fundingPotId, token.address); expect(totalPayout).to.eq.BN(WAD.muln(2)); - await colony.setExpenditurePayout(expenditureId, SLOT1, token.address, 0, { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT1], token.address, [0], { from: ADMIN }); totalPayout = await colony.getFundingPotPayout(expenditure.fundingPotId, token.address); expect(totalPayout).to.eq.BN(WAD); @@ -534,7 +522,10 @@ contract("Colony Expenditure", (accounts) => { it("should not allow owners to set a payout when out of draft state", async () => { await colony.finalizeExpenditure(expenditureId, { from: ADMIN }); - await checkErrorRevert(colony.setExpenditurePayout(expenditureId, SLOT0, token.address, WAD, { from: ADMIN }), "colony-expenditure-not-draft"); + await checkErrorRevert( + colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [WAD], { from: ADMIN }), + "colony-expenditure-not-draft", + ); }); it("should not allow arbitration to cancel an expenditure that has been finalized", async () => { @@ -547,7 +538,10 @@ contract("Colony Expenditure", (accounts) => { }); it("should not allow non-owners to set a payout", async () => { - await checkErrorRevert(colony.setExpenditurePayout(expenditureId, SLOT0, token.address, WAD, { from: USER }), "colony-expenditure-not-owner"); + await checkErrorRevert( + colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [WAD], { from: USER }), + "colony-expenditure-not-owner", + ); }); }); @@ -660,7 +654,7 @@ contract("Colony Expenditure", (accounts) => { }); it("cannot finalize expenditure if it is not fully funded", async () => { - await colony.setExpenditurePayout(expenditureId, SLOT0, token.address, WAD, { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [WAD], { from: ADMIN }); await checkErrorRevert(colony.finalizeExpenditure(expenditureId, { from: ADMIN }), "colony-expenditure-not-funded"); @@ -706,8 +700,8 @@ contract("Colony Expenditure", (accounts) => { }); it("should allow anyone to claim on behalf of the recipient, with network fee deducted", async () => { - await colony.setExpenditureRecipient(expenditureId, SLOT0, RECIPIENT, { from: ADMIN }); - await colony.setExpenditurePayout(expenditureId, SLOT0, token.address, WAD, { from: ADMIN }); + await colony.setExpenditureRecipients(expenditureId, [SLOT0], [RECIPIENT], { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [WAD], { from: ADMIN }); const expenditure = await colony.getExpenditure(expenditureId); await colony.moveFundsBetweenPots( @@ -734,8 +728,8 @@ contract("Colony Expenditure", (accounts) => { }); it("when claiming a payout, the appropriate events are emitted", async () => { - await colony.setExpenditureRecipient(expenditureId, SLOT0, RECIPIENT, { from: ADMIN }); - await colony.setExpenditurePayout(expenditureId, SLOT0, token.address, WAD, { from: ADMIN }); + await colony.setExpenditureRecipients(expenditureId, [SLOT0], [RECIPIENT], { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [WAD], { from: ADMIN }); const expenditure = await colony.getExpenditure(expenditureId); await colony.moveFundsBetweenPots( @@ -756,9 +750,9 @@ contract("Colony Expenditure", (accounts) => { }); it("should allow anyone to claim on behalf of the slot, in multiple tokens", async () => { - await colony.setExpenditureRecipient(expenditureId, SLOT0, RECIPIENT, { from: ADMIN }); - await colony.setExpenditurePayout(expenditureId, SLOT0, token.address, WAD, { from: ADMIN }); - await colony.setExpenditurePayout(expenditureId, SLOT0, otherToken.address, WAD, { from: ADMIN }); + await colony.setExpenditureRecipients(expenditureId, [SLOT0], [RECIPIENT], { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [WAD], { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], otherToken.address, [WAD], { from: ADMIN }); const expenditure = await colony.getExpenditure(expenditureId); await colony.moveFundsBetweenPots( @@ -797,7 +791,7 @@ contract("Colony Expenditure", (accounts) => { }); it("after expenditure is claimed it should set the payout to 0", async () => { - await colony.setExpenditurePayout(expenditureId, SLOT0, token.address, WAD, { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [WAD], { from: ADMIN }); const expenditure = await colony.getExpenditure(expenditureId); await colony.moveFundsBetweenPots( @@ -819,8 +813,8 @@ contract("Colony Expenditure", (accounts) => { }); it("should automatically reclaim funds for payoutModifiers of -1", async () => { - await colony.setExpenditureRecipient(expenditureId, SLOT0, RECIPIENT, { from: ADMIN }); - await colony.setExpenditurePayout(expenditureId, SLOT0, token.address, WAD, { from: ADMIN }); + await colony.setExpenditureRecipients(expenditureId, [SLOT0], [RECIPIENT], { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [WAD], { from: ADMIN }); const mask = [MAPPING, ARRAY]; const keys = ["0x0", bn2bytes32(new BN(2))]; @@ -853,8 +847,8 @@ contract("Colony Expenditure", (accounts) => { }); it("should automatically reclaim funds for payoutModifiers between -1 and 0", async () => { - await colony.setExpenditureRecipient(expenditureId, SLOT0, RECIPIENT, { from: ADMIN }); - await colony.setExpenditurePayout(expenditureId, SLOT0, token.address, WAD, { from: ADMIN }); + await colony.setExpenditureRecipients(expenditureId, [SLOT0], [RECIPIENT], { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [WAD], { from: ADMIN }); const mask = [MAPPING, ARRAY]; const keys = ["0x0", bn2bytes32(new BN(2))]; @@ -887,8 +881,8 @@ contract("Colony Expenditure", (accounts) => { }); it("should automatically reclaim funds if there is excess funding for a token", async () => { - await colony.setExpenditureRecipient(expenditureId, SLOT0, RECIPIENT, { from: ADMIN }); - await colony.setExpenditurePayout(expenditureId, SLOT0, token.address, WAD, { from: ADMIN }); + await colony.setExpenditureRecipients(expenditureId, [SLOT0], [RECIPIENT], { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [WAD], { from: ADMIN }); const expenditure = await colony.getExpenditure(expenditureId); await colony.moveFundsBetweenPots( @@ -916,8 +910,8 @@ contract("Colony Expenditure", (accounts) => { }); it("should be able to pay out all recipients if setExpenditurePayouts is used to set recipients", async () => { - await colony.setExpenditureRecipient(expenditureId, SLOT0, RECIPIENT, { from: ADMIN }); - await colony.setExpenditureRecipient(expenditureId, SLOT1, RECIPIENT, { from: ADMIN }); + await colony.setExpenditureRecipients(expenditureId, [SLOT0], [RECIPIENT], { from: ADMIN }); + await colony.setExpenditureRecipients(expenditureId, [SLOT1], [RECIPIENT], { from: ADMIN }); await colony.setExpenditurePayouts(expenditureId, [SLOT0, SLOT1], token.address, [10, 20], { from: ADMIN }); @@ -956,8 +950,8 @@ contract("Colony Expenditure", (accounts) => { }); it("if skill is set, should emit two reputation updates", async () => { - await colony.setExpenditureRecipient(expenditureId, SLOT0, RECIPIENT, { from: ADMIN }); - await colony.setExpenditurePayout(expenditureId, SLOT0, token.address, WAD, { from: ADMIN }); + await colony.setExpenditureRecipients(expenditureId, [SLOT0], [RECIPIENT], { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [WAD], { from: ADMIN }); await colony.setExpenditureSkills(expenditureId, [SLOT0], [localSkillId], { from: ADMIN }); const expenditure = await colony.getExpenditure(expenditureId); @@ -991,7 +985,7 @@ contract("Colony Expenditure", (accounts) => { }); it("should delay claims by claimDelay", async () => { - await colony.setExpenditurePayout(expenditureId, SLOT0, token.address, WAD, { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [WAD], { from: ADMIN }); const day32 = bn2bytes32(new BN(SECONDS_PER_DAY)); await colony.setExpenditureState(1, UINT256_MAX, expenditureId, EXPENDITURES_SLOT, [ARRAY], [bn2bytes32(new BN(4))], day32); @@ -1026,7 +1020,7 @@ contract("Colony Expenditure", (accounts) => { }); it("should not overflow if there is a large slot claim delay", async () => { - await colony.setExpenditureClaimDelay(expenditureId, SLOT0, UINT256_MAX, { from: ADMIN }); + await colony.setExpenditureClaimDelays(expenditureId, [SLOT0], [UINT256_MAX], { from: ADMIN }); await colony.finalizeExpenditure(expenditureId, { from: ADMIN }); await checkErrorRevert(colony.claimExpenditurePayout(expenditureId, SLOT0, token.address), "colony-expenditure-cannot-claim"); @@ -1061,8 +1055,8 @@ contract("Colony Expenditure", (accounts) => { }); it("if recipient is own extension, should not award reputation or pay network fee", async () => { - await colony.setExpenditureRecipient(expenditureId, SLOT0, extensionAddress, { from: ADMIN }); - await colony.setExpenditurePayout(expenditureId, SLOT0, token.address, WAD, { from: ADMIN }); + await colony.setExpenditureRecipients(expenditureId, [SLOT0], [extensionAddress], { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [WAD], { from: ADMIN }); await colony.setExpenditureSkills(expenditureId, [SLOT0], [localSkillId], { from: ADMIN }); const expenditure = await colony.getExpenditure(expenditureId); @@ -1101,8 +1095,8 @@ contract("Colony Expenditure", (accounts) => { await otherColony.installExtension(TEST_EXTENSION, 0); const otherExtensionAddress = await colonyNetwork.getExtensionInstallation(TEST_EXTENSION, otherColony.address); - await colony.setExpenditureRecipient(expenditureId, SLOT0, otherExtensionAddress, { from: ADMIN }); - await colony.setExpenditurePayout(expenditureId, SLOT0, token.address, WAD, { from: ADMIN }); + await colony.setExpenditureRecipients(expenditureId, [SLOT0], [otherExtensionAddress], { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [WAD], { from: ADMIN }); await colony.setExpenditureSkills(expenditureId, [SLOT0], [localSkillId], { from: ADMIN }); const expenditure = await colony.getExpenditure(expenditureId); @@ -1150,7 +1144,7 @@ contract("Colony Expenditure", (accounts) => { }); it("should let funds be reclaimed", async () => { - await colony.setExpenditurePayout(expenditureId, SLOT0, token.address, WAD, { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [WAD], { from: ADMIN }); const expenditure = await colony.getExpenditure(expenditureId); await colony.moveFundsBetweenPots( @@ -1404,8 +1398,8 @@ contract("Colony Expenditure", (accounts) => { }); it("should scale down payout by payoutScalar", async () => { - await colony.setExpenditureRecipient(expenditureId, SLOT0, RECIPIENT, { from: ADMIN }); - await colony.setExpenditurePayout(expenditureId, SLOT0, token.address, WAD, { from: ADMIN }); + await colony.setExpenditureRecipients(expenditureId, [SLOT0], [RECIPIENT], { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [WAD], { from: ADMIN }); // Modifier of -0.5 WAD translates to scalar of 0.5 WAD const mask = [MAPPING, ARRAY]; @@ -1414,7 +1408,17 @@ contract("Colony Expenditure", (accounts) => { await colony.setExpenditureState(1, UINT256_MAX, expenditureId, EXPENDITURESLOTS_SLOT, mask, keys, value, { from: ARBITRATOR }); const expenditure = await colony.getExpenditure(expenditureId); - await colony.moveFundsBetweenPots(1, UINT256_MAX, UINT256_MAX, domain1.fundingPotId, expenditure.fundingPotId, WAD, token.address); + await colony.moveFundsBetweenPots( + 1, + UINT256_MAX, + 1, + UINT256_MAX, + UINT256_MAX, + domain1.fundingPotId, + expenditure.fundingPotId, + WAD, + token.address, + ); await colony.finalizeExpenditure(expenditureId, { from: ADMIN }); const recipientBalanceBefore = await token.balanceOf(RECIPIENT); @@ -1434,8 +1438,8 @@ contract("Colony Expenditure", (accounts) => { }); it("should scale up payout by payoutScalar", async () => { - await colony.setExpenditureRecipient(expenditureId, SLOT0, RECIPIENT, { from: ADMIN }); - await colony.setExpenditurePayout(expenditureId, SLOT0, token.address, WAD, { from: ADMIN }); + await colony.setExpenditureRecipients(expenditureId, [SLOT0], [RECIPIENT], { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [WAD], { from: ADMIN }); // Modifier of 1 WAD translates to scalar of 2 WAD const mask = [MAPPING, ARRAY]; @@ -1444,7 +1448,17 @@ contract("Colony Expenditure", (accounts) => { await colony.setExpenditureState(1, UINT256_MAX, expenditureId, EXPENDITURESLOTS_SLOT, mask, keys, value, { from: ARBITRATOR }); const expenditure = await colony.getExpenditure(expenditureId); - await colony.moveFundsBetweenPots(1, UINT256_MAX, UINT256_MAX, domain1.fundingPotId, expenditure.fundingPotId, WAD, token.address); + await colony.moveFundsBetweenPots( + 1, + UINT256_MAX, + 1, + UINT256_MAX, + UINT256_MAX, + domain1.fundingPotId, + expenditure.fundingPotId, + WAD, + token.address, + ); await colony.finalizeExpenditure(expenditureId, { from: ADMIN }); const recipientBalanceBefore = await token.balanceOf(RECIPIENT); @@ -1464,8 +1478,8 @@ contract("Colony Expenditure", (accounts) => { }); it("should not overflow when using the maximum payout * modifier", async () => { - await colony.setExpenditureRecipient(expenditureId, SLOT0, RECIPIENT, { from: ADMIN }); - await colony.setExpenditurePayout(expenditureId, SLOT0, token.address, MAX_PAYOUT, { from: ADMIN }); + await colony.setExpenditureRecipients(expenditureId, [SLOT0], [RECIPIENT], { from: ADMIN }); + await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [MAX_PAYOUT], { from: ADMIN }); const mask = [MAPPING, ARRAY]; const keys = ["0x0", bn2bytes32(new BN(2))]; @@ -1473,7 +1487,17 @@ contract("Colony Expenditure", (accounts) => { await colony.setExpenditureState(1, UINT256_MAX, expenditureId, EXPENDITURESLOTS_SLOT, mask, keys, value, { from: ARBITRATOR }); const expenditure = await colony.getExpenditure(expenditureId); - await colony.moveFundsBetweenPots(1, UINT256_MAX, UINT256_MAX, domain1.fundingPotId, expenditure.fundingPotId, MAX_PAYOUT, token.address); + await colony.moveFundsBetweenPots( + 1, + UINT256_MAX, + 1, + UINT256_MAX, + UINT256_MAX, + domain1.fundingPotId, + expenditure.fundingPotId, + MAX_PAYOUT, + token.address, + ); await colony.finalizeExpenditure(expenditureId, { from: ADMIN }); await colony.claimExpenditurePayout(expenditureId, SLOT0, token.address); diff --git a/test/contracts-network/colony-funding.js b/test/contracts-network/colony-funding.js index a21136406e..9aa220d022 100755 --- a/test/contracts-network/colony-funding.js +++ b/test/contracts-network/colony-funding.js @@ -168,8 +168,8 @@ contract("Colony Funding", (accounts) => { await colony.addDomain(1, UINT256_MAX, 1); await colony.addDomain(1, UINT256_MAX, 1); - await colony.moveFundsBetweenPots(1, UINT256_MAX, 0, 1, 2, 40, otherToken.address); - await checkErrorRevert(colony.moveFundsBetweenPots(1, 0, 1, 2, 3, 50, otherToken.address), "Panic: Arithmetic overflow"); + await colony.moveFundsBetweenPots(1, UINT256_MAX, 1, UINT256_MAX, 0, 1, 2, 40, otherToken.address); + await checkErrorRevert(colony.moveFundsBetweenPots(1, UINT256_MAX, 1, 0, 1, 2, 3, 50, otherToken.address), "Panic: Arithmetic overflow"); const colonyTokenBalance = await otherToken.balanceOf(colony.address); const pot1Balance = await colony.getFundingPotBalance(1, otherToken.address); @@ -371,14 +371,20 @@ contract("Colony Funding", (accounts) => { it("should not allow contributions to nonexistent funding pots", async () => { await fundColonyWithTokens(colony, otherToken, 100); - await checkErrorRevert(colony.moveFundsBetweenPots(1, UINT256_MAX, 3, 1, 5, 40, otherToken.address), "colony-funding-nonexistent-pot"); + await checkErrorRevert( + colony.moveFundsBetweenPots(1, UINT256_MAX, 1, UINT256_MAX, 3, 1, 5, 40, otherToken.address), + "colony-funding-nonexistent-pot", + ); const colonyPotBalance = await colony.getFundingPotBalance(1, otherToken.address); expect(colonyPotBalance).to.eq.BN(99); }); it("should not allow attempts to move funds from nonexistent funding pots", async () => { await fundColonyWithTokens(colony, otherToken, 100); - await checkErrorRevert(colony.moveFundsBetweenPots(1, 3, UINT256_MAX, 5, 1, 40, otherToken.address), "colony-funding-nonexistent-pot"); + await checkErrorRevert( + colony.moveFundsBetweenPots(1, UINT256_MAX, 1, 3, UINT256_MAX, 5, 1, 40, otherToken.address), + "colony-funding-nonexistent-pot", + ); const colonyPotBalance = await colony.getFundingPotBalance(1, otherToken.address); expect(colonyPotBalance).to.eq.BN(99); }); @@ -476,8 +482,11 @@ contract("Colony Funding", (accounts) => { await colony.addDomain(1, UINT256_MAX, 1); await colony.addDomain(1, UINT256_MAX, 1); - await colony.moveFundsBetweenPots(1, UINT256_MAX, 0, 1, 2, 40, ethers.constants.AddressZero); - await checkErrorRevert(colony.moveFundsBetweenPots(1, 0, 1, 2, 3, 50, ethers.constants.AddressZero), "Panic: Arithmetic overflow"); + await colony.moveFundsBetweenPots(1, UINT256_MAX, 1, UINT256_MAX, 0, 1, 2, 40, ethers.constants.AddressZero); + await checkErrorRevert( + colony.moveFundsBetweenPots(1, UINT256_MAX, 1, 0, 1, 2, 3, 50, ethers.constants.AddressZero), + "Panic: Arithmetic overflow", + ); const colonyEtherBalance = await web3GetBalance(colony.address); const pot1Balance = await colony.getFundingPotBalance(1, ethers.constants.AddressZero); diff --git a/test/contracts-network/colony-network-extensions.js b/test/contracts-network/colony-network-extensions.js index 2f0de76756..93190632cb 100644 --- a/test/contracts-network/colony-network-extensions.js +++ b/test/contracts-network/colony-network-extensions.js @@ -148,6 +148,10 @@ contract("Colony Network Extensions", (accounts) => { }); describe("installing extensions", () => { + it("non-colonies cannot call installExtension on ColonyNetwork", async () => { + await checkErrorRevert(colonyNetwork.installExtension(TEST_EXTENSION, 1), "colony-caller-must-be-colony"); + }); + it("allows a root user to install an extension with any version", async () => { await colony.installExtension(TEST_EXTENSION, 2, { from: ROOT }); @@ -209,6 +213,10 @@ contract("Colony Network Extensions", (accounts) => { }); describe("upgrading extensions", () => { + it("non-colonies cannot call upgradeExtension on ColonyNetwork", async () => { + await checkErrorRevert(colonyNetwork.upgradeExtension(TEST_EXTENSION, 1), "colony-caller-must-be-colony"); + }); + it("allows root users to upgrade an extension", async () => { await colony.installExtension(TEST_EXTENSION, 1, { from: ROOT }); @@ -252,6 +260,10 @@ contract("Colony Network Extensions", (accounts) => { }); describe("deprecating extensions", () => { + it("non-colonies cannot call deprecateExtension on ColonyNetwork", async () => { + await checkErrorRevert(colonyNetwork.deprecateExtension(TEST_EXTENSION, true), "colony-caller-must-be-colony"); + }); + it("allows root users to deprecate and undeprecate an extension", async () => { await colony.installExtension(TEST_EXTENSION, 1, { from: ROOT }); @@ -277,6 +289,10 @@ contract("Colony Network Extensions", (accounts) => { }); describe("uninstalling extensions", () => { + it("non-colonies cannot call uninstallExtension on ColonyNetwork", async () => { + await checkErrorRevert(colonyNetwork.uninstallExtension(TEST_EXTENSION), "colony-caller-must-be-colony"); + }); + it("allows root users to uninstall an extension and send ether to the beneficiary", async () => { await colony.installExtension(TEST_EXTENSION, 1, { from: ROOT }); diff --git a/test/contracts-network/colony-network-recovery.js b/test/contracts-network/colony-network-recovery.js index 24208347fe..23a245d0b6 100644 --- a/test/contracts-network/colony-network-recovery.js +++ b/test/contracts-network/colony-network-recovery.js @@ -136,15 +136,14 @@ contract("Colony Network Recovery", (accounts) => { it("should not be able to call normal functions while in recovery", async () => { await colonyNetwork.enterRecoveryMode(); - await checkErrorRevert(colonyNetwork.createColony(clny.address), "colony-in-recovery-mode"); await checkErrorRevert(colonyNetwork.createColonyForFrontend(ADDRESS_ZERO, "", "", 18, 0, "", ""), "colony-in-recovery-mode"); await checkErrorRevert(colonyNetwork.createMetaColony(clny.address), "colony-in-recovery-mode"); await checkErrorRevert(colonyNetwork.setTokenLocking(ADDRESS_ZERO), "colony-in-recovery-mode"); await checkErrorRevert(colonyNetwork.initialiseRootLocalSkill(), "colony-in-recovery-mode"); await checkErrorRevert(colonyNetwork.appendReputationUpdateLog(ADDRESS_ZERO, 0, 0), "colony-in-recovery-mode"); - await checkErrorRevert(colonyNetwork.createColony(clny.address, 4, "", "", true), "colony-in-recovery-mode"); await checkErrorRevert(colonyNetwork.createColony(clny.address, 4, ""), "colony-in-recovery-mode"); await checkErrorRevert(colonyNetwork.createColony(clny.address, 4, "", ""), "colony-in-recovery-mode"); + await checkErrorRevert(colonyNetwork.createColonyForFrontend(clny.address, "", "", 18, 10, "", ""), "colony-in-recovery-mode"); await checkErrorRevert(colonyNetwork.setupRegistrar(clny.address, HASHZERO), "colony-in-recovery-mode"); await checkErrorRevert(colonyNetwork.registerUserLabel("", ""), "colony-in-recovery-mode"); await checkErrorRevertEstimateGas( diff --git a/test/contracts-network/colony-network.js b/test/contracts-network/colony-network.js index 6df1a16654..c2db7ccaaf 100755 --- a/test/contracts-network/colony-network.js +++ b/test/contracts-network/colony-network.js @@ -269,25 +269,6 @@ contract("Colony Network", (accounts) => { await checkErrorRevert(colonyNetwork.createColony(token.address, nonexistentVersion, "", ""), "colony-network-invalid-version"); }); - it("should allow use of the deprecated one-parameter createColony", async () => { - const currentColonyVersion = await colonyNetwork.getCurrentColonyVersion(); - const oldVersion = currentColonyVersion.subn(1); - await metaColony.addNetworkColonyVersion(oldVersion, newResolverAddress); - // Add version 3 if necessary, required to test the deprecated createColony - if (!oldVersion.eq(3)) { - await metaColony.addNetworkColonyVersion(3, newResolverAddress); - } - const token = await Token.new(...getTokenArgs()); - - await colonyNetwork.createColony(token.address); - }); - - it("should allow use of the deprecated five-parameter createColony", async () => { - const token = await Token.new(...getTokenArgs()); - - await colonyNetwork.createColony(token.address, 5, "", "", ""); - }); - it("should allow users to create a colony for the frontend in one transaction with an existing token", async () => { const token = await Token.new(...getTokenArgs()); await colonyNetwork.createColonyForFrontend(token.address, "", "", 0, version, "", ""); diff --git a/test/contracts-network/colony-permissions.js b/test/contracts-network/colony-permissions.js index 0efbbaca22..8c76770314 100644 --- a/test/contracts-network/colony-permissions.js +++ b/test/contracts-network/colony-permissions.js @@ -370,31 +370,6 @@ contract("ColonyPermissions", (accounts) => { await fundColonyWithTokens(colony, token, INITIAL_FUNDING); // Test we can move funds between domain 1 and 2, and also 2 and 3 - // Deprecated version - await colony.methods["moveFundsBetweenPots(uint256,uint256,uint256,uint256,uint256,uint256,address)"]( - 1, - UINT256_MAX, - 0, - domain1.fundingPotId, - domain2.fundingPotId, - WAD, - token.address, - { - from: USER2, - }, - ); - await colony.methods["moveFundsBetweenPots(uint256,uint256,uint256,uint256,uint256,uint256,address)"]( - 1, - 0, - 1, - domain2.fundingPotId, - domain3.fundingPotId, - WAD, - token.address, - { from: USER2 }, - ); - - // Newest version await colony.methods["moveFundsBetweenPots(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,address)"]( 1, UINT256_MAX, @@ -421,34 +396,6 @@ contract("ColonyPermissions", (accounts) => { { from: USER2 }, ); - // But only with valid proofs. Deprecated version of this function - await checkErrorRevert( - colony.methods["moveFundsBetweenPots(uint256,uint256,uint256,uint256,uint256,uint256,address)"]( - 1, - 1, - 1, - domain2.fundingPotId, - domain3.fundingPotId, - WAD, - token.address, - { from: USER2 }, - ), - "ds-auth-invalid-domain-inheritance", - ); - await checkErrorRevert( - colony.methods["moveFundsBetweenPots(uint256,uint256,uint256,uint256,uint256,uint256,address)"]( - 1, - 0, - 0, - domain2.fundingPotId, - domain3.fundingPotId, - WAD, - token.address, - { from: USER2 }, - ), - "ds-auth-invalid-domain-inheritance", - ); - // The newest version await checkErrorRevert( colony.methods["moveFundsBetweenPots(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,address)"]( diff --git a/test/contracts-network/colony-recovery.js b/test/contracts-network/colony-recovery.js index aeb4793e15..9c1fe0c5db 100644 --- a/test/contracts-network/colony-recovery.js +++ b/test/contracts-network/colony-recovery.js @@ -172,7 +172,6 @@ contract("Colony Recovery", (accounts) => { await checkErrorRevert(metaColony.setDefaultGlobalClaimDelay(0), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.makeExpenditure(0, 0, 0), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.transferExpenditure(0, ADDRESS_ZERO), "colony-in-recovery-mode"); - await checkErrorRevert(metaColony.transferExpenditureViaArbitration(0, 0, 0, ADDRESS_ZERO), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.cancelExpenditure(0), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.cancelExpenditureViaArbitration(0, 0, 0), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.lockExpenditure(0), "colony-in-recovery-mode"); @@ -184,8 +183,6 @@ contract("Colony Recovery", (accounts) => { await checkErrorRevert(metaColony.setExpenditureSkills(0, [], []), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.setExpenditureClaimDelays(0, [], []), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.setExpenditurePayoutModifiers(0, [], []), "colony-in-recovery-mode"); - await checkErrorRevert(metaColony.setExpenditureRecipient(0, 0, ADDRESS_ZERO), "colony-in-recovery-mode"); - await checkErrorRevert(metaColony.setExpenditureClaimDelay(0, 0, 0), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.setExpenditureState(0, 0, 0, 0, [], [], HASHZERO), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.setArbitrationRole(0, 0, ADDRESS_ZERO, 0, true), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.setArchitectureRole(0, 0, ADDRESS_ZERO, 0, true), "colony-in-recovery-mode"); @@ -196,19 +193,16 @@ contract("Colony Recovery", (accounts) => { await checkErrorRevert(metaColony.unlockTokenForUser(ADDRESS_ZERO, 0), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.claimExpenditurePayout(0, 0, ADDRESS_ZERO), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.moveFundsBetweenPots(0, 0, 0, 0, 0, 0, 0, 0, ADDRESS_ZERO), "colony-in-recovery-mode"); - await checkErrorRevert(metaColony.moveFundsBetweenPots(0, 0, 0, 0, 0, 0, ADDRESS_ZERO), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.claimColonyFunds(ADDRESS_ZERO), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.startNextRewardPayout(ADDRESS_ZERO, HASHZERO, HASHZERO, 0, []), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.claimRewardPayout(0, [0, 0, 0, 0, 0, 0, 0], HASHZERO, HASHZERO, 0, []), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.setRewardInverse(0), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.setExpenditurePayouts(0, [], ADDRESS_ZERO, []), "colony-in-recovery-mode"); - await checkErrorRevert(metaColony.setExpenditurePayout(0, 0, ADDRESS_ZERO, 0), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.setExpenditurePayout(1, UINT256_MAX, 0, 0, ADDRESS_ZERO, 0), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.enterRecoveryMode(), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.burnTokens(ADDRESS_ZERO, 0), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.registerColonyLabel("", ""), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.updateColonyOrbitDB(""), "colony-in-recovery-mode"); - await checkErrorRevert(metaColony.makeArbitraryTransaction(ADDRESS_ZERO, HASHZERO), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.makeArbitraryTransactions([], [], true), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.makeSingleArbitraryTransaction(ADDRESS_ZERO, HASHZERO), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.updateApprovalAmount(ADDRESS_ZERO, ADDRESS_ZERO), "colony-in-recovery-mode"); diff --git a/test/contracts-network/colony-reward-payouts.js b/test/contracts-network/colony-reward-payouts.js index 2e37b5b856..4adae68457 100644 --- a/test/contracts-network/colony-reward-payouts.js +++ b/test/contracts-network/colony-reward-payouts.js @@ -778,8 +778,8 @@ contract("Colony Reward Payouts", (accounts) => { await newToken.approve(tokenLocking.address, userReputation, { from: userAddress1 }); await tokenLocking.methods["deposit(address,uint256,bool)"](newToken.address, userReputation, true, { from: userAddress1 }); - await colony1.moveFundsBetweenPots(1, UINT256_MAX, UINT256_MAX, 1, 0, 100, otherToken.address); - await colony2.moveFundsBetweenPots(1, UINT256_MAX, UINT256_MAX, 1, 0, 100, otherToken.address); + await colony1.moveFundsBetweenPots(1, UINT256_MAX, 1, UINT256_MAX, UINT256_MAX, 1, 0, 100, otherToken.address); + await colony2.moveFundsBetweenPots(1, UINT256_MAX, 1, UINT256_MAX, UINT256_MAX, 1, 0, 100, otherToken.address); ({ logs } = await colony1.startNextRewardPayout(otherToken.address, ...colonyWideReputationProof1)); const payoutId1 = logs[0].args.rewardPayoutId; diff --git a/test/contracts-network/colony-staking.js b/test/contracts-network/colony-staking.js index f02dbba970..f3e94939b7 100644 --- a/test/contracts-network/colony-staking.js +++ b/test/contracts-network/colony-staking.js @@ -40,13 +40,11 @@ contract("Colony Staking", (accounts) => { await colony.setArbitrationRole(1, UINT256_MAX, USER2, 1, true); await colony.makeExpenditure(1, UINT256_MAX, 1); - await colony.setExpenditureRecipient(1, SLOT0, USER0); - await colony.setExpenditureRecipient(1, SLOT1, USER1); + await colony.setExpenditureRecipients(1, [SLOT0, SLOT1], [USER0, USER1]); await fundColonyWithTokens(colony, token, INITIAL_FUNDING); await colony.moveFundsBetweenPots(1, UINT256_MAX, 1, UINT256_MAX, UINT256_MAX, 1, 3, WAD.muln(200), token.address); - await colony.setExpenditurePayout(1, SLOT0, token.address, WAD.muln(100)); - await colony.setExpenditurePayout(1, SLOT1, token.address, WAD.muln(100)); + await colony.setExpenditurePayouts(1, [SLOT0, SLOT1], token.address, [WAD.muln(100), WAD.muln(100)]); await colony.finalizeExpenditure(1); await colony.claimExpenditurePayout(1, SLOT0, token.address); diff --git a/test/contracts-network/reputation-basic-functionality.js b/test/contracts-network/reputation-basic-functionality.js index bed0d2bd07..442468dc54 100644 --- a/test/contracts-network/reputation-basic-functionality.js +++ b/test/contracts-network/reputation-basic-functionality.js @@ -258,6 +258,11 @@ contract("Reputation mining - basic functionality", (accounts) => { await checkErrorRevert(inactiveRepCycle.initialise(MINER1, MINER2), "colony-reputation-mining-cycle-already-initialised"); }); + + it("should not allow mining-only functions to network to be called by someone not reputationMiningCycle", async () => { + await checkErrorRevert(colonyNetwork.burnUnneededRewards(0), "colony-reputation-mining-sender-not-active-reputation-cycle"); + await checkErrorRevert(colonyNetwork.reward(colonyNetwork.address, 1), "colony-reputation-mining-sender-not-active-reputation-cycle"); + }); }); describe("when reading reputation mining constant properties", async () => { diff --git a/test/contracts-network/reputation-update.js b/test/contracts-network/reputation-update.js index 956036db3c..68a61047b1 100755 --- a/test/contracts-network/reputation-update.js +++ b/test/contracts-network/reputation-update.js @@ -182,8 +182,8 @@ contract("Reputation Updates", (accounts) => { const SLOT0 = 0; - await metaColony.setExpenditureRecipient(expenditureId, SLOT0, RECIPIENT); - await metaColony.setExpenditurePayout(expenditureId, SLOT0, clnyToken.address, WAD); + await metaColony.setExpenditureRecipients(expenditureId, [SLOT0], [RECIPIENT]); + await metaColony.setExpenditurePayouts(expenditureId, [SLOT0], clnyToken.address, [WAD]); const domain1 = await metaColony.getDomain(1); diff --git a/test/contracts-network/router-resolver.js b/test/contracts-network/router-resolver.js index 844f0d1bf1..d6ac8358e9 100644 --- a/test/contracts-network/router-resolver.js +++ b/test/contracts-network/router-resolver.js @@ -4,6 +4,7 @@ const bnChai = require("bn-chai"); const { ethers } = require("ethers"); const { checkErrorRevert } = require("../../helpers/test-helper"); +const { CURR_VERSION } = require("../../helpers/constants"); const { expect } = chai; chai.use(bnChai(web3.utils.BN)); @@ -11,7 +12,7 @@ chai.use(bnChai(web3.utils.BN)); const MultiSigWallet = artifacts.require("gnosis/MultiSigWallet"); const EtherRouter = artifacts.require("EtherRouter"); const Resolver = artifacts.require("Resolver"); -const ColonyNetworkDeployer = artifacts.require("ColonyNetworkDeployer"); +const IColonyNetwork = artifacts.require("IColonyNetwork"); contract("EtherRouter / Resolver", (accounts) => { const COINBASE_ACCOUNT = accounts[0]; @@ -68,12 +69,17 @@ contract("EtherRouter / Resolver", (accounts) => { describe("Resolver", () => { it("should return correct destination for given function, including overloads", async () => { - const deployedColonyNetwork = await ColonyNetworkDeployer.deployed(); - const signature = await resolver.stringToSig("createColony(address)"); - const overloadedSignature = await resolver.stringToSig("createColony(address,uint256,string,string)"); - const destination = await resolver.lookup(signature); - const overloadedDestination = await resolver.lookup(overloadedSignature); - expect(destination).to.equal(deployedColonyNetwork.address); + const networkEtherRouter = await EtherRouter.deployed(); + const colonyNetwork = await IColonyNetwork.at(networkEtherRouter.address); + const colonyResolverAddress = await colonyNetwork.getColonyVersionResolver(CURR_VERSION); + const colonyResolver = await Resolver.at(colonyResolverAddress); + // This function is not overloaded, and exists on same contract + const colonyDomainsAddress = await colonyResolver.lookup(web3.utils.soliditySha3("getDomain(uint256)").slice(0, 10)); + const signature = await resolver.stringToSig("addDomain(uint256,uint256,uint256)"); + const overloadedSignature = await colonyResolver.stringToSig("addDomain(uint256,uint256,uint256,string)"); + const destination = await colonyResolver.lookup(signature); + const overloadedDestination = await colonyResolver.lookup(overloadedSignature); + expect(destination).to.equal(colonyDomainsAddress); expect(destination).to.equal(overloadedDestination); }); diff --git a/test/contracts-network/token-locking.js b/test/contracts-network/token-locking.js index 587158a7dd..bb276d1ba7 100644 --- a/test/contracts-network/token-locking.js +++ b/test/contracts-network/token-locking.js @@ -118,16 +118,6 @@ contract("Token Locking", (addresses) => { expect(tokenLockingContractBalance).to.eq.BN(usersTokens); }); - it("should correctly deposit tokens using the deprecated interface", async () => { - await token.approve(tokenLocking.address, usersTokens, { from: userAddress }); - await tokenLocking.methods["deposit(address,uint256)"](token.address, usersTokens, { from: userAddress }); - const info = await tokenLocking.getUserLock(token.address, userAddress); - expect(info.balance).to.eq.BN(usersTokens); - - const tokenLockingContractBalance = await token.balanceOf(tokenLocking.address); - expect(tokenLockingContractBalance).to.eq.BN(usersTokens); - }); - it("should correctly deposit large amounts of tokens", async () => { await otherToken.mint(userAddress, UINT256_MAX); await otherToken.approve(tokenLocking.address, UINT256_MAX, { from: userAddress }); @@ -240,17 +230,6 @@ contract("Token Locking", (addresses) => { expect(userBalance).to.eq.BN(usersTokens); }); - it("should correctly withdraw tokens via the deprecated interface", async () => { - await token.approve(tokenLocking.address, usersTokens, { from: userAddress }); - await tokenLocking.methods["deposit(address,uint256,bool)"](token.address, usersTokens, true, { from: userAddress }); - await tokenLocking.methods["withdraw(address,uint256)"](token.address, usersTokens, { from: userAddress }); - - const info = await tokenLocking.getUserLock(token.address, userAddress); - expect(info.balance).to.be.zero; - const userBalance = await token.balanceOf(userAddress); - expect(userBalance).to.eq.BN(usersTokens); - }); - it("should not be able to withdraw tokens while they are locked", async () => { await token.approve(tokenLocking.address, usersTokens, { from: userAddress }); await tokenLocking.methods["deposit(address,uint256,bool)"](token.address, usersTokens, true, { from: userAddress }); diff --git a/test/cross-chain/cross-chain.js b/test/cross-chain/cross-chain.js index 60ee03649c..98b6145edd 100644 --- a/test/cross-chain/cross-chain.js +++ b/test/cross-chain/cross-chain.js @@ -439,7 +439,8 @@ contract("Cross-chain", (accounts) => { // So 'just' call that on the colony... console.log("tx to home bridge address:", homeBridge.address); - const tx = await homeColony.makeArbitraryTransaction(homeBridge.address, txDataToBeSentToAMB); + + const tx = await homeColony.makeArbitraryTransactions([homeBridge.address], [txDataToBeSentToAMB], true); await tx.wait(); await p; // Check balances diff --git a/test/extensions/funding-queue.js b/test/extensions/funding-queue.js index bf61fa08c5..cfbc192fe3 100644 --- a/test/extensions/funding-queue.js +++ b/test/extensions/funding-queue.js @@ -876,7 +876,7 @@ contract("Funding Queues", (accounts) => { await colony.setFundingRole(1, 0, fundingQueue.address, 2, true); await colony.addDomain(1, 0, 2); - await colony.moveFundsBetweenPots(1, UINT256_MAX, 0, 1, 2, WAD, token.address); + await colony.moveFundsBetweenPots(1, UINT256_MAX, 1, UINT256_MAX, 0, 1, 2, WAD, token.address); await fundingQueue.createProposal(2, UINT256_MAX, 0, 2, 4, WAD, token.address, { from: USER0 }); proposalId = await fundingQueue.getProposalCount(); diff --git a/test/extensions/one-tx-payment.js b/test/extensions/one-tx-payment.js index 45b5a1a25e..8dca3a5d78 100644 --- a/test/extensions/one-tx-payment.js +++ b/test/extensions/one-tx-payment.js @@ -189,7 +189,8 @@ contract("One transaction payments", (accounts) => { const d2 = await colony.getDomain(2); await fundColonyWithTokens(colony, token, INITIAL_FUNDING); - await colony.moveFundsBetweenPots(1, UINT256_MAX, 0, d1.fundingPotId, d2.fundingPotId, WAD, token.address); + + await colony.moveFundsBetweenPots(1, UINT256_MAX, 1, UINT256_MAX, 0, d1.fundingPotId, d2.fundingPotId, WAD, token.address); await oneTxPayment.makePaymentFundedFromDomain(1, 0, 1, 0, [USER1], [token.address], [10], 2, localSkillId); }); @@ -237,7 +238,7 @@ contract("One transaction payments", (accounts) => { const d2 = await colony.getDomain(2); await fundColonyWithTokens(colony, token, INITIAL_FUNDING); - await colony.moveFundsBetweenPots(1, UINT256_MAX, 0, d1.fundingPotId, d2.fundingPotId, WAD, token.address); + await colony.moveFundsBetweenPots(1, UINT256_MAX, 1, UINT256_MAX, 0, d1.fundingPotId, d2.fundingPotId, WAD, token.address); await colony.setAdministrationRole(1, 0, USER1, 2, true); await colony.setFundingRole(1, 0, USER1, 2, true); @@ -551,7 +552,7 @@ contract("One transaction payments", (accounts) => { const d1 = await colony.getDomain(1); const d2 = await colony.getDomain(2); - await colony.moveFundsBetweenPots(1, UINT256_MAX, 0, d1.fundingPotId, d2.fundingPotId, WAD, token.address); + await colony.moveFundsBetweenPots(1, UINT256_MAX, 1, UINT256_MAX, 0, d1.fundingPotId, d2.fundingPotId, WAD, token.address); await oneTxPayment.makePaymentFundedFromDomain(2, UINT256_MAX, 1, 0, [USER1], [token.address], [10], 2, localSkillId); diff --git a/test/extensions/voting-rep.js b/test/extensions/voting-rep.js index ffa57c8eb8..d73735aff2 100644 --- a/test/extensions/voting-rep.js +++ b/test/extensions/voting-rep.js @@ -530,7 +530,15 @@ contract("Voting Reputation", (accounts) => { // Move funds between domain 2 and domain 3 pots using the old deprecated function // This should not be allowed - it doesn't conform to the standard permission proofs, and so can't // be checked - let action = await encodeTxData(colony, "moveFundsBetweenPots", [1, 0, 1, domain2.fundingPotId, domain3.fundingPotId, WAD, token.address]); + let action = await encodeTxData(colony, "moveFundsBetweenPots(uint256,uint256,uint256,uint256,uint256,uint256,address)", [ + 1, + 0, + 1, + domain2.fundingPotId, + domain3.fundingPotId, + WAD, + token.address, + ]); const key = makeReputationKey(colony.address, domain2.skillId); const value = makeReputationValue(WAD, 6); const [mask, siblings] = reputationTree.getProof(key); @@ -2113,7 +2121,7 @@ contract("Voting Reputation", (accounts) => { }); it("transactions that try to execute a forbidden method on Reputation Voting extension are rejected by the MTX broadcaster", async function () { - const action = await encodeTxData(colony, "makeArbitraryTransaction", [colony.address, "0x00"]); + const action = await encodeTxData(colony, "makeArbitraryTransactions", [[colony.address], ["0x00"], true]); await voting.createMotion(1, UINT256_MAX, ADDRESS_ZERO, action, domain1Key, domain1Value, domain1Mask, domain1Siblings); motionId = await voting.getMotionCount(); @@ -3114,7 +3122,15 @@ contract("Voting Reputation", (accounts) => { }); it("cannot let an invalid motion involving multicalling OLD_MOVE_FUNDS be finalized", async () => { - const action1 = await encodeTxData(colony, "moveFundsBetweenPots", [1, 0, 2, 0, 0, 0, ADDRESS_ZERO]); + const action1 = await encodeTxData(colony, "moveFundsBetweenPots(uint256,uint256,uint256,uint256,uint256,uint256,address)", [ + 1, + 0, + 2, + 0, + 0, + 0, + ADDRESS_ZERO, + ]); const multicall = await encodeTxData(colony, "multicall", [[action1]]); await voting.createMotion(1, UINT256_MAX, ADDRESS_ZERO, multicall, domain1Key, domain1Value, domain1Mask, domain1Siblings); diff --git a/test/misc/gas-costs.js b/test/misc/gas-costs.js index f6d90d31ff..ff9e80eb05 100644 --- a/test/misc/gas-costs.js +++ b/test/misc/gas-costs.js @@ -247,7 +247,7 @@ contract("All", function (accounts) { await fundColonyWithTokens(newColony, otherToken, 300); - await newColony.moveFundsBetweenPots(1, UINT256_MAX, UINT256_MAX, 1, 0, 100, otherToken.address); + await newColony.moveFundsBetweenPots(1, UINT256_MAX, 1, UINT256_MAX, UINT256_MAX, 1, 0, 100, otherToken.address); const tx = await newColony.startNextRewardPayout(otherToken.address, ...colonyWideReputationProof); const payoutId = tx.logs[0].args.rewardPayoutId; @@ -281,7 +281,7 @@ contract("All", function (accounts) { await forwardTime(5184001); await newColony.finalizeRewardPayout(payoutId); - await newColony.moveFundsBetweenPots(1, UINT256_MAX, UINT256_MAX, 1, 0, 100, otherToken.address); + await newColony.moveFundsBetweenPots(1, UINT256_MAX, 1, UINT256_MAX, UINT256_MAX, 1, 0, 100, otherToken.address); const tx2 = await newColony.startNextRewardPayout(otherToken.address, ...colonyWideReputationProof); const payoutId2 = tx2.logs[0].args.rewardPayoutId; diff --git a/test/packages/metaTransactionBroadcaster.js b/test/packages/metaTransactionBroadcaster.js index f1ad25ea41..f1d292b15a 100644 --- a/test/packages/metaTransactionBroadcaster.js +++ b/test/packages/metaTransactionBroadcaster.js @@ -9,7 +9,7 @@ const axios = require("axios"); const { TruffleLoader, RetryProvider } = require("../../packages/package-utils"); const { setupEtherRouter } = require("../../helpers/upgradable-contracts"); const { UINT256_MAX, CURR_VERSION } = require("../../helpers/constants"); -const { web3GetTransaction, currentBlockTime } = require("../../helpers/test-helper"); +const { web3GetTransaction, currentBlockTime, encodeTxData } = require("../../helpers/test-helper"); const MetatransactionBroadcaster = require("../../packages/metatransaction-broadcaster/MetatransactionBroadcaster"); const { getMetaTransactionParameters, getPermitParameters, setupColony } = require("../../helpers/test-data-generator"); @@ -120,7 +120,8 @@ contract("Metatransaction broadcaster", (accounts) => { }); it("transactions that try to execute a forbidden method on a Colony are rejected", async function () { - let txData = await colony.contract.methods.makeArbitraryTransaction(colony.address, "0x00000000").encodeABI(); + // let txData = await colony.contract.methods.makeArbitraryTransaction(colony.address, "0x00000000").encodeABI(); + let txData = await encodeTxData(colony, "makeArbitraryTransaction(address,bytes)", [colony.address, "0x00000000"]); let valid = await broadcaster.isColonyFamilyTransactionAllowed(colony.address, txData); expect(valid).to.be.equal(false); @@ -143,7 +144,7 @@ contract("Metatransaction broadcaster", (accounts) => { const ambCall = AMBInterface.encodeFunctionData("requireToPassMessage", ["0x75Df5AF045d91108662D8080fD1FEFAd6aA0bb59", "0x00000000", 1000000]); - let txData = await colony.contract.methods.makeArbitraryTransaction(ETHEREUM_BRIDGE_ADDRESS, ambCall).encodeABI(); + let txData = await encodeTxData(colony, "makeArbitraryTransaction(address,bytes)", [ETHEREUM_BRIDGE_ADDRESS, ambCall]); let valid = await broadcaster.isColonyFamilyTransactionAllowed(colony.address, txData); expect(valid).to.be.equal(true); @@ -638,9 +639,14 @@ contract("Metatransaction broadcaster", (accounts) => { // The invalid transaction is this one, which uses makeArbitraryTransaction to try and call owner() on the // colony itself. - const txData2 = await colony.contract.methods - .makeArbitraryTransaction(resolverAddress, web3.utils.soliditySha3("owner()").slice(0, 10)) - .encodeABI(); + const txData2 = await encodeTxData(colony, "makeArbitraryTransaction(address,bytes)", [ + resolverAddress, + web3.utils.soliditySha3("owner()").slice(0, 10), + ]); + + // const txData2 = await colony.contract.methods + // .makeArbitraryTransaction(resolverAddress, web3.utils.soliditySha3("owner()").slice(0, 10)) + // .encodeABI(); const txData = await colony.contract.methods.multicall([txData1, txData2]).encodeABI(); const { r, s, v } = await getMetaTransactionParameters(txData, USER0, colony.address); // Send to endpoint @@ -672,9 +678,11 @@ contract("Metatransaction broadcaster", (accounts) => { const colonyAsEtherRouter = await EtherRouter.at(colony.address); const resolverAddress = await colonyAsEtherRouter.resolver(); - const txData2 = await colony.contract.methods - .makeArbitraryTransaction(resolverAddress, web3.utils.soliditySha3("owner()").slice(0, 10)) - .encodeABI(); + const txData2 = await encodeTxData(colony, "makeArbitraryTransaction(address,bytes)", [ + resolverAddress, + web3.utils.soliditySha3("owner()").slice(0, 10), + ]); + const txDataCombined = await colony.contract.methods.multicall([txData1, txData2]).encodeABI(); const txData = await colony.contract.methods.multicall([txData1, txDataCombined]).encodeABI(); From 0c3c1a131e4c327ceea772703ac5849dc5894512 Mon Sep 17 00:00:00 2001 From: Alex Rea Date: Fri, 24 Nov 2023 17:57:45 +0000 Subject: [PATCH 02/11] Rework makeArbitraryTransaction to avoid reentrancy risk --- .../colony/ColonyArbitraryTransaction.sol | 40 +++++++++++++------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/contracts/colony/ColonyArbitraryTransaction.sol b/contracts/colony/ColonyArbitraryTransaction.sol index 33d105551d..3786c35c9f 100644 --- a/contracts/colony/ColonyArbitraryTransaction.sol +++ b/contracts/colony/ColonyArbitraryTransaction.sol @@ -109,28 +109,46 @@ contract ColonyArbitraryTransaction is ColonyStorage { } catch {} bool res = executeCall(_to, 0, _action); - + assert(res); if (sig == APPROVE_SIG) { - approveTransactionCleanup(_to, _action); + approveTransactionCheck(_to, _action); } return res; } - function approveTransactionPreparation(address _to, bytes memory _action) internal { + function approveTransactionPreparation(address _token, bytes memory _action) internal { address spender; + uint256 amount; assembly { spender := mload(add(_action, 0x24)) + amount := mload(add(_action, 0x44)) } - updateApprovalAmountInternal(_to, spender, false); + updateApprovalAmountInternal(_token, spender); + + // Calculate and set the approval we expect to have after the approve is made + tokenApprovalTotals[_token] = + (tokenApprovalTotals[_token] - tokenApprovals[_token][spender]) + + amount; + require( + fundingPots[1].balance[_token] >= tokenApprovalTotals[_token], + "colony-approval-exceeds-balance" + ); + + tokenApprovals[_token][spender] = amount; } - function approveTransactionCleanup(address _to, bytes memory _action) internal { + function approveTransactionCheck(address _token, bytes memory _action) internal view { address spender; + uint256 amount; assembly { spender := mload(add(_action, 0x24)) + amount := mload(add(_action, 0x44)) } - updateApprovalAmountInternal(_to, spender, true); + + uint256 recordedApproval = tokenApprovals[_token][spender]; + uint256 actualApproval = ERC20Extended(_token).allowance(address(this), spender); + require(recordedApproval == actualApproval, "colony-approval-amount-mismatch"); } function burnTransactionPreparation(address _to, bytes memory _action) internal { @@ -160,21 +178,17 @@ contract ColonyArbitraryTransaction is ColonyStorage { } function updateApprovalAmount(address _token, address _spender) public stoppable { - updateApprovalAmountInternal(_token, _spender, false); + updateApprovalAmountInternal(_token, _spender); } - function updateApprovalAmountInternal( - address _token, - address _spender, - bool _postApproval - ) internal { + function updateApprovalAmountInternal(address _token, address _spender) internal { uint256 recordedApproval = tokenApprovals[_token][_spender]; uint256 actualApproval = ERC20Extended(_token).allowance(address(this), _spender); if (recordedApproval == actualApproval) { return; } - if (recordedApproval > actualApproval && !_postApproval) { + if (recordedApproval > actualApproval) { // They've spend some tokens out of root. Adjust balances accordingly // If we are post approval, then they have not spent tokens fundingPots[1].balance[_token] = From c509d72d880ca450de1a07a89ebbf733055fabc8 Mon Sep 17 00:00:00 2001 From: Daniel Kronovet Date: Fri, 11 Oct 2024 12:04:11 -0400 Subject: [PATCH 03/11] Correctly implement SetExpenditureSingleValues --- contracts/extensions/StreamingPayments.sol | 1 - 1 file changed, 1 deletion(-) diff --git a/contracts/extensions/StreamingPayments.sol b/contracts/extensions/StreamingPayments.sol index 52fbd55586..c3f4bd03a9 100644 --- a/contracts/extensions/StreamingPayments.sol +++ b/contracts/extensions/StreamingPayments.sol @@ -22,7 +22,6 @@ pragma experimental ABIEncoderV2; import { ColonyExtensionMeta } from "./ColonyExtensionMeta.sol"; import { ColonyDataTypes } from "./../colony/ColonyDataTypes.sol"; import { SetExpenditureSingleValues } from "./../common/SetExpenditureSingleValues.sol"; - // ignore-file-swc-108 contract StreamingPayments is ColonyExtensionMeta, SetExpenditureSingleValues { From b6bc40bbc3afa11d673d59902298b568f68fd219 Mon Sep 17 00:00:00 2001 From: Daniel Kronovet Date: Fri, 11 Oct 2024 12:40:00 -0400 Subject: [PATCH 04/11] Remove deprecated moveFundsBetweenPots transactions --- test/contracts-network/colony-expenditure.js | 5 +-- test/extensions/multisig-permissions.js | 7 +--- test/extensions/voting-rep.js | 37 -------------------- 3 files changed, 2 insertions(+), 47 deletions(-) diff --git a/test/contracts-network/colony-expenditure.js b/test/contracts-network/colony-expenditure.js index 59d36ecad5..3ee3958d7d 100644 --- a/test/contracts-network/colony-expenditure.js +++ b/test/contracts-network/colony-expenditure.js @@ -189,10 +189,7 @@ contract("Colony Expenditure", (accounts) => { it("should error if the expenditure does not exist", async () => { await checkErrorRevert(colony.setExpenditureSkills(100, [SLOT0], [localSkillId]), "colony-expenditure-does-not-exist"); await checkErrorRevert(colony.transferExpenditure(100, USER), "colony-expenditure-does-not-exist"); - await checkErrorRevert( - colony.transferExpenditureViaArbitration(0, UINT256_MAX, 100, USER, { from: ARBITRATOR }), - "colony-expenditure-does-not-exist", - ); + await checkErrorRevert(colony.cancelExpenditureViaArbitration(0, UINT256_MAX, 100, { from: ARBITRATOR }), "colony-expenditure-does-not-exist"); await checkErrorRevert(colony.cancelExpenditure(100), "colony-expenditure-does-not-exist"); await checkErrorRevert(colony.lockExpenditure(100), "colony-expenditure-does-not-exist"); await checkErrorRevert(colony.finalizeExpenditure(100), "colony-expenditure-does-not-exist"); diff --git a/test/extensions/multisig-permissions.js b/test/extensions/multisig-permissions.js index 72b2218b02..cfb58b1ad6 100644 --- a/test/extensions/multisig-permissions.js +++ b/test/extensions/multisig-permissions.js @@ -252,11 +252,6 @@ contract("Multisig Permissions", (accounts) => { ); }); - it("can't propose an action that summarises to a forbidden action", async () => { - const action = await encodeTxData(colony, "moveFundsBetweenPots", [1, 2, 3, 4, 5, 6, ADDRESS_ZERO]); - await checkErrorRevert(multisigPermissions.createMotion(1, UINT256_MAX, [ADDRESS_ZERO], [action]), "colony-action-summary-forbidden-sig"); - }); - it("can propose an action requiring the same permissions for multiple actions in the same domain", async () => { await setRootRoles(multisigPermissions, USER2, rolesToBytes32([ARCHITECTURE_ROLE])); @@ -865,7 +860,7 @@ contract("Multisig Permissions", (accounts) => { const d1 = await colony.getDomain(1); const d2 = await colony.getDomain(2); - await colony.moveFundsBetweenPots(1, UINT256_MAX, 0, d1.fundingPotId, d2.fundingPotId, WAD, token.address); + await colony.moveFundsBetweenPots(1, UINT256_MAX, 1, UINT256_MAX, 0, d1.fundingPotId, d2.fundingPotId, WAD, token.address); await colony.installExtension(ONE_TX_PAYMENT, oneTxPaymentVersion); const oneTxPaymentAddress = await colonyNetwork.getExtensionInstallation(ONE_TX_PAYMENT, colony.address); diff --git a/test/extensions/voting-rep.js b/test/extensions/voting-rep.js index d73735aff2..dd5835fbef 100644 --- a/test/extensions/voting-rep.js +++ b/test/extensions/voting-rep.js @@ -1822,9 +1822,6 @@ contract("Voting Reputation", (accounts) => { }); it("can correctly summarize a multicall action", async () => { - const OLD_MOVE_FUNDS_SIG = soliditySha3("moveFundsBetweenPots(uint256,uint256,uint256,uint256,uint256,uint256,address)").slice(0, 10); - // NB This is still not a full call, but it's long enough that it has a permissions signature - const OLD_MOVE_FUNDS_CALL = `${OLD_MOVE_FUNDS_SIG}${"0".repeat(63)}1${bn2bytes32(UINT256_MAX).slice(2)}`; const SET_EXPENDITURE_STATE = soliditySha3("setExpenditureState(uint256,uint256,uint256,uint256,bool[],bytes32[],bytes32)").slice(0, 10); const SET_EXPENDITURE_PAYOUT = soliditySha3("setExpenditurePayout(uint256,uint256,uint256,uint256,address,uint256)").slice(0, 10); @@ -1857,8 +1854,6 @@ contract("Voting Reputation", (accounts) => { const action12 = await encodeTxData(tokenLocking, "obligateStake", [USER0, WAD, token.address]); const action13 = await encodeTxData(tokenLocking, "obligateStake", [USER1, WAD, token.address]); - const action14 = await encodeTxData(colony, "moveFundsBetweenPots", [1, UINT256_MAX, 1, 1, 1, 1, 1, UINT256_MAX, token.address]); - let multicall; let summary; @@ -1869,11 +1864,6 @@ contract("Voting Reputation", (accounts) => { expect(summary.expenditureId).to.eq.BN(expenditure2Id); expect(summary.domainSkillId).to.eq.BN(domain3.skillId); - // Blacklisted function - multicall = await encodeTxData(colony, "multicall", [[OLD_MOVE_FUNDS_CALL, action14]]); - summary = await voting.getActionSummary(multicall, ADDRESS_ZERO); - await checkErrorRevertEstimateGas(voting.getActionSummary.estimateGas(multicall, ADDRESS_ZERO), "colony-action-summary-forbidden-sig"); - // Special NO_ACTION multicall = await encodeTxData(colony, "multicall", [[action9, NO_ACTION]]); summary = await voting.getActionSummary(multicall, ADDRESS_ZERO); @@ -3121,33 +3111,6 @@ contract("Voting Reputation", (accounts) => { expect(await voting.getMotionState(motionId)).to.eq.BN(FINALIZED); }); - it("cannot let an invalid motion involving multicalling OLD_MOVE_FUNDS be finalized", async () => { - const action1 = await encodeTxData(colony, "moveFundsBetweenPots(uint256,uint256,uint256,uint256,uint256,uint256,address)", [ - 1, - 0, - 2, - 0, - 0, - 0, - ADDRESS_ZERO, - ]); - const multicall = await encodeTxData(colony, "multicall", [[action1]]); - - await voting.createMotion(1, UINT256_MAX, ADDRESS_ZERO, multicall, domain1Key, domain1Value, domain1Mask, domain1Siblings); - const motionId = await voting.getMotionCount(); - - await colony.approveStake(voting.address, 1, WAD, { from: USER0 }); - await voting.stakeMotion(motionId, 1, UINT256_MAX, YAY, REQUIRED_STAKE, user0Key, user0Value, user0Mask, user0Siblings, { from: USER0 }); - - await forwardTime(STAKE_PERIOD, this); - - expect(await voting.getMotionState(motionId)).to.eq.BN(FINALIZABLE); - - await upgradeFromV9ToLatest(colony); - - expect(await voting.getMotionState(motionId)).to.eq.BN(FINALIZED); - }); - it("cannot let an invalid motion involving multicalling NO_ACTION be finalized", async () => { const multicall = await encodeTxData(colony, "multicall", [[NO_ACTION]]); From 01eef11d8df7de0f046fdfa5c5436ef42a2d4a23 Mon Sep 17 00:00:00 2001 From: Daniel Kronovet Date: Mon, 14 Oct 2024 13:38:54 -0400 Subject: [PATCH 05/11] Update storage slots --- .../contracts/colony/Colony.sol:Colony.json | 60 +------------------ ...action.sol:ColonyArbitraryTransaction.json | 60 +------------------ .../ColonyDomains.sol:ColonyDomains.json | 60 +------------------ ...lonyExpenditure.sol:ColonyExpenditure.json | 60 +------------------ .../ColonyFunding.sol:ColonyFunding.json | 60 +------------------ .../ColonyRewards.sol:ColonyRewards.json | 60 +------------------ .../colony/ColonyRoles.sol:ColonyRoles.json | 60 +------------------ .../ColonyStorage.sol:ColonyStorage.json | 60 +------------------ .../ColonyNetwork.sol:ColonyNetwork.json | 2 +- ...tworkAuction.sol:ColonyNetworkAuction.json | 2 +- ...orkDeployer.sol:ColonyNetworkDeployer.json | 2 +- ...ColonyNetworkENS.sol:ColonyNetworkENS.json | 2 +- ...xtensions.sol:ColonyNetworkExtensions.json | 2 +- ...NetworkMining.sol:ColonyNetworkMining.json | 2 +- ...NetworkSkills.sol:ColonyNetworkSkills.json | 2 +- ...tworkStorage.sol:ColonyNetworkStorage.json | 2 +- ...Values.sol:SetExpenditureSingleValues.json | 3 + ...ony.sol:FunctionsNotAvailableOnColony.json | 60 +------------------ ...LimitSubdomains.sol:NoLimitSubdomains.json | 60 +------------------ 19 files changed, 31 insertions(+), 588 deletions(-) create mode 100644 .storage-layouts-normalized/contracts/common/SetExpenditureSingleValues.sol:SetExpenditureSingleValues.json diff --git a/.storage-layouts-normalized/contracts/colony/Colony.sol:Colony.json b/.storage-layouts-normalized/contracts/colony/Colony.sol:Colony.json index b22d40a278..48766fa83c 100644 --- a/.storage-layouts-normalized/contracts/colony/Colony.sol:Colony.json +++ b/.storage-layouts-normalized/contracts/colony/Colony.sol:Colony.json @@ -770,20 +770,9 @@ "label": "uint256", "numberOfBytes": "32" } - }, - { - "contract": "contracts/colony/Colony.sol:Colony", - "label": "deprecated", - "offset": 0, - "slot": "2", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } } ], - "numberOfBytes": "96" + "numberOfBytes": "64" } } }, @@ -1346,7 +1335,7 @@ }, { "contract": "contracts/colony/Colony.sol:Colony", - "label": "DEPRECATED_localSkills", + "label": "localSkills", "offset": 0, "slot": "37", "type": { @@ -1364,51 +1353,6 @@ "numberOfBytes": "1" } } - }, - { - "contract": "contracts/colony/Colony.sol:Colony", - "label": "localSkills", - "offset": 0, - "slot": "38", - "type": { - "encoding": "mapping", - "key": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "label": "mapping(uint256 => struct ColonyDataTypes.LocalSkill)", - "numberOfBytes": "32", - "value": { - "encoding": "inplace", - "label": "struct ColonyDataTypes.LocalSkill", - "members": [ - { - "contract": "contracts/colony/Colony.sol:Colony", - "label": "exists", - "offset": 0, - "slot": "0", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } - }, - { - "contract": "contracts/colony/Colony.sol:Colony", - "label": "deprecated", - "offset": 1, - "slot": "0", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } - } - ], - "numberOfBytes": "32" - } - } } ] } \ No newline at end of file diff --git a/.storage-layouts-normalized/contracts/colony/ColonyArbitraryTransaction.sol:ColonyArbitraryTransaction.json b/.storage-layouts-normalized/contracts/colony/ColonyArbitraryTransaction.sol:ColonyArbitraryTransaction.json index 4ff8a22299..cecaf0fb53 100644 --- a/.storage-layouts-normalized/contracts/colony/ColonyArbitraryTransaction.sol:ColonyArbitraryTransaction.json +++ b/.storage-layouts-normalized/contracts/colony/ColonyArbitraryTransaction.sol:ColonyArbitraryTransaction.json @@ -770,20 +770,9 @@ "label": "uint256", "numberOfBytes": "32" } - }, - { - "contract": "contracts/colony/ColonyArbitraryTransaction.sol:ColonyArbitraryTransaction", - "label": "deprecated", - "offset": 0, - "slot": "2", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } } ], - "numberOfBytes": "96" + "numberOfBytes": "64" } } }, @@ -1346,7 +1335,7 @@ }, { "contract": "contracts/colony/ColonyArbitraryTransaction.sol:ColonyArbitraryTransaction", - "label": "DEPRECATED_localSkills", + "label": "localSkills", "offset": 0, "slot": "37", "type": { @@ -1364,51 +1353,6 @@ "numberOfBytes": "1" } } - }, - { - "contract": "contracts/colony/ColonyArbitraryTransaction.sol:ColonyArbitraryTransaction", - "label": "localSkills", - "offset": 0, - "slot": "38", - "type": { - "encoding": "mapping", - "key": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "label": "mapping(uint256 => struct ColonyDataTypes.LocalSkill)", - "numberOfBytes": "32", - "value": { - "encoding": "inplace", - "label": "struct ColonyDataTypes.LocalSkill", - "members": [ - { - "contract": "contracts/colony/ColonyArbitraryTransaction.sol:ColonyArbitraryTransaction", - "label": "exists", - "offset": 0, - "slot": "0", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } - }, - { - "contract": "contracts/colony/ColonyArbitraryTransaction.sol:ColonyArbitraryTransaction", - "label": "deprecated", - "offset": 1, - "slot": "0", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } - } - ], - "numberOfBytes": "32" - } - } } ] } \ No newline at end of file diff --git a/.storage-layouts-normalized/contracts/colony/ColonyDomains.sol:ColonyDomains.json b/.storage-layouts-normalized/contracts/colony/ColonyDomains.sol:ColonyDomains.json index d3bf27e9dc..b4810fb556 100644 --- a/.storage-layouts-normalized/contracts/colony/ColonyDomains.sol:ColonyDomains.json +++ b/.storage-layouts-normalized/contracts/colony/ColonyDomains.sol:ColonyDomains.json @@ -770,20 +770,9 @@ "label": "uint256", "numberOfBytes": "32" } - }, - { - "contract": "contracts/colony/ColonyDomains.sol:ColonyDomains", - "label": "deprecated", - "offset": 0, - "slot": "2", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } } ], - "numberOfBytes": "96" + "numberOfBytes": "64" } } }, @@ -1346,7 +1335,7 @@ }, { "contract": "contracts/colony/ColonyDomains.sol:ColonyDomains", - "label": "DEPRECATED_localSkills", + "label": "localSkills", "offset": 0, "slot": "37", "type": { @@ -1364,51 +1353,6 @@ "numberOfBytes": "1" } } - }, - { - "contract": "contracts/colony/ColonyDomains.sol:ColonyDomains", - "label": "localSkills", - "offset": 0, - "slot": "38", - "type": { - "encoding": "mapping", - "key": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "label": "mapping(uint256 => struct ColonyDataTypes.LocalSkill)", - "numberOfBytes": "32", - "value": { - "encoding": "inplace", - "label": "struct ColonyDataTypes.LocalSkill", - "members": [ - { - "contract": "contracts/colony/ColonyDomains.sol:ColonyDomains", - "label": "exists", - "offset": 0, - "slot": "0", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } - }, - { - "contract": "contracts/colony/ColonyDomains.sol:ColonyDomains", - "label": "deprecated", - "offset": 1, - "slot": "0", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } - } - ], - "numberOfBytes": "32" - } - } } ] } \ No newline at end of file diff --git a/.storage-layouts-normalized/contracts/colony/ColonyExpenditure.sol:ColonyExpenditure.json b/.storage-layouts-normalized/contracts/colony/ColonyExpenditure.sol:ColonyExpenditure.json index 8dee3d7dd0..e67c83a8db 100644 --- a/.storage-layouts-normalized/contracts/colony/ColonyExpenditure.sol:ColonyExpenditure.json +++ b/.storage-layouts-normalized/contracts/colony/ColonyExpenditure.sol:ColonyExpenditure.json @@ -770,20 +770,9 @@ "label": "uint256", "numberOfBytes": "32" } - }, - { - "contract": "contracts/colony/ColonyExpenditure.sol:ColonyExpenditure", - "label": "deprecated", - "offset": 0, - "slot": "2", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } } ], - "numberOfBytes": "96" + "numberOfBytes": "64" } } }, @@ -1346,7 +1335,7 @@ }, { "contract": "contracts/colony/ColonyExpenditure.sol:ColonyExpenditure", - "label": "DEPRECATED_localSkills", + "label": "localSkills", "offset": 0, "slot": "37", "type": { @@ -1364,51 +1353,6 @@ "numberOfBytes": "1" } } - }, - { - "contract": "contracts/colony/ColonyExpenditure.sol:ColonyExpenditure", - "label": "localSkills", - "offset": 0, - "slot": "38", - "type": { - "encoding": "mapping", - "key": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "label": "mapping(uint256 => struct ColonyDataTypes.LocalSkill)", - "numberOfBytes": "32", - "value": { - "encoding": "inplace", - "label": "struct ColonyDataTypes.LocalSkill", - "members": [ - { - "contract": "contracts/colony/ColonyExpenditure.sol:ColonyExpenditure", - "label": "exists", - "offset": 0, - "slot": "0", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } - }, - { - "contract": "contracts/colony/ColonyExpenditure.sol:ColonyExpenditure", - "label": "deprecated", - "offset": 1, - "slot": "0", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } - } - ], - "numberOfBytes": "32" - } - } } ] } \ No newline at end of file diff --git a/.storage-layouts-normalized/contracts/colony/ColonyFunding.sol:ColonyFunding.json b/.storage-layouts-normalized/contracts/colony/ColonyFunding.sol:ColonyFunding.json index 2ba1c31e74..0124a6e3d4 100644 --- a/.storage-layouts-normalized/contracts/colony/ColonyFunding.sol:ColonyFunding.json +++ b/.storage-layouts-normalized/contracts/colony/ColonyFunding.sol:ColonyFunding.json @@ -770,20 +770,9 @@ "label": "uint256", "numberOfBytes": "32" } - }, - { - "contract": "contracts/colony/ColonyFunding.sol:ColonyFunding", - "label": "deprecated", - "offset": 0, - "slot": "2", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } } ], - "numberOfBytes": "96" + "numberOfBytes": "64" } } }, @@ -1346,7 +1335,7 @@ }, { "contract": "contracts/colony/ColonyFunding.sol:ColonyFunding", - "label": "DEPRECATED_localSkills", + "label": "localSkills", "offset": 0, "slot": "37", "type": { @@ -1364,51 +1353,6 @@ "numberOfBytes": "1" } } - }, - { - "contract": "contracts/colony/ColonyFunding.sol:ColonyFunding", - "label": "localSkills", - "offset": 0, - "slot": "38", - "type": { - "encoding": "mapping", - "key": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "label": "mapping(uint256 => struct ColonyDataTypes.LocalSkill)", - "numberOfBytes": "32", - "value": { - "encoding": "inplace", - "label": "struct ColonyDataTypes.LocalSkill", - "members": [ - { - "contract": "contracts/colony/ColonyFunding.sol:ColonyFunding", - "label": "exists", - "offset": 0, - "slot": "0", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } - }, - { - "contract": "contracts/colony/ColonyFunding.sol:ColonyFunding", - "label": "deprecated", - "offset": 1, - "slot": "0", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } - } - ], - "numberOfBytes": "32" - } - } } ] } \ No newline at end of file diff --git a/.storage-layouts-normalized/contracts/colony/ColonyRewards.sol:ColonyRewards.json b/.storage-layouts-normalized/contracts/colony/ColonyRewards.sol:ColonyRewards.json index bc29e4ae55..8ea84d7908 100644 --- a/.storage-layouts-normalized/contracts/colony/ColonyRewards.sol:ColonyRewards.json +++ b/.storage-layouts-normalized/contracts/colony/ColonyRewards.sol:ColonyRewards.json @@ -770,20 +770,9 @@ "label": "uint256", "numberOfBytes": "32" } - }, - { - "contract": "contracts/colony/ColonyRewards.sol:ColonyRewards", - "label": "deprecated", - "offset": 0, - "slot": "2", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } } ], - "numberOfBytes": "96" + "numberOfBytes": "64" } } }, @@ -1346,7 +1335,7 @@ }, { "contract": "contracts/colony/ColonyRewards.sol:ColonyRewards", - "label": "DEPRECATED_localSkills", + "label": "localSkills", "offset": 0, "slot": "37", "type": { @@ -1364,51 +1353,6 @@ "numberOfBytes": "1" } } - }, - { - "contract": "contracts/colony/ColonyRewards.sol:ColonyRewards", - "label": "localSkills", - "offset": 0, - "slot": "38", - "type": { - "encoding": "mapping", - "key": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "label": "mapping(uint256 => struct ColonyDataTypes.LocalSkill)", - "numberOfBytes": "32", - "value": { - "encoding": "inplace", - "label": "struct ColonyDataTypes.LocalSkill", - "members": [ - { - "contract": "contracts/colony/ColonyRewards.sol:ColonyRewards", - "label": "exists", - "offset": 0, - "slot": "0", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } - }, - { - "contract": "contracts/colony/ColonyRewards.sol:ColonyRewards", - "label": "deprecated", - "offset": 1, - "slot": "0", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } - } - ], - "numberOfBytes": "32" - } - } } ] } \ No newline at end of file diff --git a/.storage-layouts-normalized/contracts/colony/ColonyRoles.sol:ColonyRoles.json b/.storage-layouts-normalized/contracts/colony/ColonyRoles.sol:ColonyRoles.json index 1704317f0d..5aa0104c12 100644 --- a/.storage-layouts-normalized/contracts/colony/ColonyRoles.sol:ColonyRoles.json +++ b/.storage-layouts-normalized/contracts/colony/ColonyRoles.sol:ColonyRoles.json @@ -770,20 +770,9 @@ "label": "uint256", "numberOfBytes": "32" } - }, - { - "contract": "contracts/colony/ColonyRoles.sol:ColonyRoles", - "label": "deprecated", - "offset": 0, - "slot": "2", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } } ], - "numberOfBytes": "96" + "numberOfBytes": "64" } } }, @@ -1346,7 +1335,7 @@ }, { "contract": "contracts/colony/ColonyRoles.sol:ColonyRoles", - "label": "DEPRECATED_localSkills", + "label": "localSkills", "offset": 0, "slot": "37", "type": { @@ -1364,51 +1353,6 @@ "numberOfBytes": "1" } } - }, - { - "contract": "contracts/colony/ColonyRoles.sol:ColonyRoles", - "label": "localSkills", - "offset": 0, - "slot": "38", - "type": { - "encoding": "mapping", - "key": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "label": "mapping(uint256 => struct ColonyDataTypes.LocalSkill)", - "numberOfBytes": "32", - "value": { - "encoding": "inplace", - "label": "struct ColonyDataTypes.LocalSkill", - "members": [ - { - "contract": "contracts/colony/ColonyRoles.sol:ColonyRoles", - "label": "exists", - "offset": 0, - "slot": "0", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } - }, - { - "contract": "contracts/colony/ColonyRoles.sol:ColonyRoles", - "label": "deprecated", - "offset": 1, - "slot": "0", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } - } - ], - "numberOfBytes": "32" - } - } } ] } \ No newline at end of file diff --git a/.storage-layouts-normalized/contracts/colony/ColonyStorage.sol:ColonyStorage.json b/.storage-layouts-normalized/contracts/colony/ColonyStorage.sol:ColonyStorage.json index 0e353b88a3..2fad267b5a 100644 --- a/.storage-layouts-normalized/contracts/colony/ColonyStorage.sol:ColonyStorage.json +++ b/.storage-layouts-normalized/contracts/colony/ColonyStorage.sol:ColonyStorage.json @@ -770,20 +770,9 @@ "label": "uint256", "numberOfBytes": "32" } - }, - { - "contract": "contracts/colony/ColonyStorage.sol:ColonyStorage", - "label": "deprecated", - "offset": 0, - "slot": "2", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } } ], - "numberOfBytes": "96" + "numberOfBytes": "64" } } }, @@ -1346,7 +1335,7 @@ }, { "contract": "contracts/colony/ColonyStorage.sol:ColonyStorage", - "label": "DEPRECATED_localSkills", + "label": "localSkills", "offset": 0, "slot": "37", "type": { @@ -1364,51 +1353,6 @@ "numberOfBytes": "1" } } - }, - { - "contract": "contracts/colony/ColonyStorage.sol:ColonyStorage", - "label": "localSkills", - "offset": 0, - "slot": "38", - "type": { - "encoding": "mapping", - "key": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "label": "mapping(uint256 => struct ColonyDataTypes.LocalSkill)", - "numberOfBytes": "32", - "value": { - "encoding": "inplace", - "label": "struct ColonyDataTypes.LocalSkill", - "members": [ - { - "contract": "contracts/colony/ColonyStorage.sol:ColonyStorage", - "label": "exists", - "offset": 0, - "slot": "0", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } - }, - { - "contract": "contracts/colony/ColonyStorage.sol:ColonyStorage", - "label": "deprecated", - "offset": 1, - "slot": "0", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } - } - ], - "numberOfBytes": "32" - } - } } ] } \ No newline at end of file diff --git a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetwork.sol:ColonyNetwork.json b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetwork.sol:ColonyNetwork.json index 43c45f5651..dcca4403a8 100644 --- a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetwork.sol:ColonyNetwork.json +++ b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetwork.sol:ColonyNetwork.json @@ -378,7 +378,7 @@ }, { "contract": "contracts/colonyNetwork/ColonyNetwork.sol:ColonyNetwork", - "label": "DEPRECATED_deprecated", + "label": "deprecated", "offset": 1, "slot": "3", "type": { diff --git a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkAuction.sol:ColonyNetworkAuction.json b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkAuction.sol:ColonyNetworkAuction.json index 1812851e6c..0881a97e7c 100644 --- a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkAuction.sol:ColonyNetworkAuction.json +++ b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkAuction.sol:ColonyNetworkAuction.json @@ -378,7 +378,7 @@ }, { "contract": "contracts/colonyNetwork/ColonyNetworkAuction.sol:ColonyNetworkAuction", - "label": "DEPRECATED_deprecated", + "label": "deprecated", "offset": 1, "slot": "3", "type": { diff --git a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkDeployer.sol:ColonyNetworkDeployer.json b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkDeployer.sol:ColonyNetworkDeployer.json index 7fb79ad881..914f22f94d 100644 --- a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkDeployer.sol:ColonyNetworkDeployer.json +++ b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkDeployer.sol:ColonyNetworkDeployer.json @@ -378,7 +378,7 @@ }, { "contract": "contracts/colonyNetwork/ColonyNetworkDeployer.sol:ColonyNetworkDeployer", - "label": "DEPRECATED_deprecated", + "label": "deprecated", "offset": 1, "slot": "3", "type": { diff --git a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkENS.sol:ColonyNetworkENS.json b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkENS.sol:ColonyNetworkENS.json index 75279a954a..a8fc4c27d2 100644 --- a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkENS.sol:ColonyNetworkENS.json +++ b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkENS.sol:ColonyNetworkENS.json @@ -378,7 +378,7 @@ }, { "contract": "contracts/colonyNetwork/ColonyNetworkENS.sol:ColonyNetworkENS", - "label": "DEPRECATED_deprecated", + "label": "deprecated", "offset": 1, "slot": "3", "type": { diff --git a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkExtensions.sol:ColonyNetworkExtensions.json b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkExtensions.sol:ColonyNetworkExtensions.json index ee28e7b452..8fa7c942d5 100644 --- a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkExtensions.sol:ColonyNetworkExtensions.json +++ b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkExtensions.sol:ColonyNetworkExtensions.json @@ -378,7 +378,7 @@ }, { "contract": "contracts/colonyNetwork/ColonyNetworkExtensions.sol:ColonyNetworkExtensions", - "label": "DEPRECATED_deprecated", + "label": "deprecated", "offset": 1, "slot": "3", "type": { diff --git a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkMining.sol:ColonyNetworkMining.json b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkMining.sol:ColonyNetworkMining.json index 5b54957cde..dca38f681a 100644 --- a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkMining.sol:ColonyNetworkMining.json +++ b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkMining.sol:ColonyNetworkMining.json @@ -378,7 +378,7 @@ }, { "contract": "contracts/colonyNetwork/ColonyNetworkMining.sol:ColonyNetworkMining", - "label": "DEPRECATED_deprecated", + "label": "deprecated", "offset": 1, "slot": "3", "type": { diff --git a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkSkills.sol:ColonyNetworkSkills.json b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkSkills.sol:ColonyNetworkSkills.json index 50f4099485..64564306dd 100644 --- a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkSkills.sol:ColonyNetworkSkills.json +++ b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkSkills.sol:ColonyNetworkSkills.json @@ -378,7 +378,7 @@ }, { "contract": "contracts/colonyNetwork/ColonyNetworkSkills.sol:ColonyNetworkSkills", - "label": "DEPRECATED_deprecated", + "label": "deprecated", "offset": 1, "slot": "3", "type": { diff --git a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkStorage.sol:ColonyNetworkStorage.json b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkStorage.sol:ColonyNetworkStorage.json index 3a616e1cf4..d1f183ad6a 100644 --- a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkStorage.sol:ColonyNetworkStorage.json +++ b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkStorage.sol:ColonyNetworkStorage.json @@ -378,7 +378,7 @@ }, { "contract": "contracts/colonyNetwork/ColonyNetworkStorage.sol:ColonyNetworkStorage", - "label": "DEPRECATED_deprecated", + "label": "deprecated", "offset": 1, "slot": "3", "type": { diff --git a/.storage-layouts-normalized/contracts/common/SetExpenditureSingleValues.sol:SetExpenditureSingleValues.json b/.storage-layouts-normalized/contracts/common/SetExpenditureSingleValues.sol:SetExpenditureSingleValues.json new file mode 100644 index 0000000000..82b695cebb --- /dev/null +++ b/.storage-layouts-normalized/contracts/common/SetExpenditureSingleValues.sol:SetExpenditureSingleValues.json @@ -0,0 +1,3 @@ +{ + "storage": [] +} \ No newline at end of file diff --git a/.storage-layouts-normalized/contracts/testHelpers/FunctionsNotAvailableOnColony.sol:FunctionsNotAvailableOnColony.json b/.storage-layouts-normalized/contracts/testHelpers/FunctionsNotAvailableOnColony.sol:FunctionsNotAvailableOnColony.json index 24a785490f..c9857d8439 100644 --- a/.storage-layouts-normalized/contracts/testHelpers/FunctionsNotAvailableOnColony.sol:FunctionsNotAvailableOnColony.json +++ b/.storage-layouts-normalized/contracts/testHelpers/FunctionsNotAvailableOnColony.sol:FunctionsNotAvailableOnColony.json @@ -770,20 +770,9 @@ "label": "uint256", "numberOfBytes": "32" } - }, - { - "contract": "contracts/testHelpers/FunctionsNotAvailableOnColony.sol:FunctionsNotAvailableOnColony", - "label": "deprecated", - "offset": 0, - "slot": "2", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } } ], - "numberOfBytes": "96" + "numberOfBytes": "64" } } }, @@ -1346,7 +1335,7 @@ }, { "contract": "contracts/testHelpers/FunctionsNotAvailableOnColony.sol:FunctionsNotAvailableOnColony", - "label": "DEPRECATED_localSkills", + "label": "localSkills", "offset": 0, "slot": "37", "type": { @@ -1364,51 +1353,6 @@ "numberOfBytes": "1" } } - }, - { - "contract": "contracts/testHelpers/FunctionsNotAvailableOnColony.sol:FunctionsNotAvailableOnColony", - "label": "localSkills", - "offset": 0, - "slot": "38", - "type": { - "encoding": "mapping", - "key": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "label": "mapping(uint256 => struct ColonyDataTypes.LocalSkill)", - "numberOfBytes": "32", - "value": { - "encoding": "inplace", - "label": "struct ColonyDataTypes.LocalSkill", - "members": [ - { - "contract": "contracts/testHelpers/FunctionsNotAvailableOnColony.sol:FunctionsNotAvailableOnColony", - "label": "exists", - "offset": 0, - "slot": "0", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } - }, - { - "contract": "contracts/testHelpers/FunctionsNotAvailableOnColony.sol:FunctionsNotAvailableOnColony", - "label": "deprecated", - "offset": 1, - "slot": "0", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } - } - ], - "numberOfBytes": "32" - } - } } ] } \ No newline at end of file diff --git a/.storage-layouts-normalized/contracts/testHelpers/NoLimitSubdomains.sol:NoLimitSubdomains.json b/.storage-layouts-normalized/contracts/testHelpers/NoLimitSubdomains.sol:NoLimitSubdomains.json index 6b1c66e44e..a5d491b66e 100644 --- a/.storage-layouts-normalized/contracts/testHelpers/NoLimitSubdomains.sol:NoLimitSubdomains.json +++ b/.storage-layouts-normalized/contracts/testHelpers/NoLimitSubdomains.sol:NoLimitSubdomains.json @@ -770,20 +770,9 @@ "label": "uint256", "numberOfBytes": "32" } - }, - { - "contract": "contracts/testHelpers/NoLimitSubdomains.sol:NoLimitSubdomains", - "label": "deprecated", - "offset": 0, - "slot": "2", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } } ], - "numberOfBytes": "96" + "numberOfBytes": "64" } } }, @@ -1346,7 +1335,7 @@ }, { "contract": "contracts/testHelpers/NoLimitSubdomains.sol:NoLimitSubdomains", - "label": "DEPRECATED_localSkills", + "label": "localSkills", "offset": 0, "slot": "37", "type": { @@ -1364,51 +1353,6 @@ "numberOfBytes": "1" } } - }, - { - "contract": "contracts/testHelpers/NoLimitSubdomains.sol:NoLimitSubdomains", - "label": "localSkills", - "offset": 0, - "slot": "38", - "type": { - "encoding": "mapping", - "key": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "label": "mapping(uint256 => struct ColonyDataTypes.LocalSkill)", - "numberOfBytes": "32", - "value": { - "encoding": "inplace", - "label": "struct ColonyDataTypes.LocalSkill", - "members": [ - { - "contract": "contracts/testHelpers/NoLimitSubdomains.sol:NoLimitSubdomains", - "label": "exists", - "offset": 0, - "slot": "0", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } - }, - { - "contract": "contracts/testHelpers/NoLimitSubdomains.sol:NoLimitSubdomains", - "label": "deprecated", - "offset": 1, - "slot": "0", - "type": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - } - } - ], - "numberOfBytes": "32" - } - } } ] } \ No newline at end of file From a17cd3abc3641952752c44362a5250ccc54e6772 Mon Sep 17 00:00:00 2001 From: Daniel Kronovet Date: Tue, 15 Oct 2024 14:54:50 -0400 Subject: [PATCH 06/11] Fix getDomain() test --- test/extensions/one-tx-payment.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/extensions/one-tx-payment.js b/test/extensions/one-tx-payment.js index 8dca3a5d78..a1b5519c50 100644 --- a/test/extensions/one-tx-payment.js +++ b/test/extensions/one-tx-payment.js @@ -628,7 +628,7 @@ contract("One transaction payments", (accounts) => { it("can call getDomain() without an error", async () => { await colony.uninstallExtension(ONE_TX_PAYMENT); - await colony.installExtension(ONE_TX_PAYMENT, 6); + await colony.installExtension(ONE_TX_PAYMENT, 9); const oneTxPaymentAddress = await colonyNetwork.getExtensionInstallation(ONE_TX_PAYMENT, colony.address); oneTxPayment = await OneTxPayment.at(oneTxPaymentAddress); @@ -637,15 +637,18 @@ contract("One transaction payments", (accounts) => { await colony.claimColonyFunds(token.address); await upgradeColonyOnceThenToLatest(colony); + // Confirm this colony has the new domain structure const domain = await colony.getDomain(1); expect(domain.deprecated).to.be.false; + + // Test deprecation and undeprecation await colony.deprecateDomain(1, UINT256_MAX, 1, true); const deprecatedDomain = await colony.getDomain(1); expect(deprecatedDomain.deprecated).to.be.true; - - // Undeprecate await colony.deprecateDomain(1, UINT256_MAX, 1, false); + + // This calls getDomain() internally await oneTxPayment.makePaymentFundedFromDomain(1, UINT256_MAX, 1, UINT256_MAX, [USER1], [token.address], [10], 1, 0); }); }); From d72715757226fcb6e5fcccb205bf138d96e80041 Mon Sep 17 00:00:00 2001 From: Daniel Kronovet Date: Tue, 15 Oct 2024 17:04:57 -0400 Subject: [PATCH 07/11] Update pnpm-lock --- pnpm-lock.yaml | 345 ++++++------------------------------------------- 1 file changed, 43 insertions(+), 302 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c84748106c..8090379b85 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -22,7 +22,7 @@ importers: devDependencies: '@certusone/wormhole-sdk': specifier: ^0.10.18 - version: 0.10.18(fastestsmallesttextencoderdecoder@1.0.22)(google-protobuf@3.21.4)(typescript@5.6.2) + version: 0.10.18(fastestsmallesttextencoderdecoder@1.0.22)(google-protobuf@3.21.4) '@codechecks/client': specifier: ^0.1.12 version: 0.1.12(typescript@5.6.2) @@ -452,7 +452,7 @@ importers: version: 0.10.17(fastestsmallesttextencoderdecoder@1.0.22)(google-protobuf@3.21.4) '@wormhole-foundation/relayer-engine': specifier: ^0.3.2 - version: 0.3.2(@bull-board/ui@5.21.0)(@improbable-eng/grpc-web@0.15.0)(@types/node@22.7.4)(fastestsmallesttextencoderdecoder@1.0.22)(google-protobuf@3.21.4)(typescript@5.6.2) + version: 0.3.2(@bull-board/ui@5.21.0)(@improbable-eng/grpc-web@0.15.0)(@types/node@20.16.10)(fastestsmallesttextencoderdecoder@1.0.22)(google-protobuf@3.21.4)(typescript@5.6.2) ethers: specifier: '5' version: 5.7.2 @@ -779,7 +779,7 @@ packages: - utf-8-validate dev: false - /@certusone/wormhole-sdk@0.10.18(fastestsmallesttextencoderdecoder@1.0.22)(google-protobuf@3.21.4)(typescript@5.6.2): + /@certusone/wormhole-sdk@0.10.18(fastestsmallesttextencoderdecoder@1.0.22)(google-protobuf@3.21.4): resolution: {integrity: sha512-VuN4AGB018ELkzTT/jN+yWgE6TWqXsHilxxCVWqGctzow2hKSFd8ADUhxhHigies436rS0vPvrgXi6m0J1+Ecw==} dependencies: '@certusone/wormhole-sdk-proto-web': 0.0.7(google-protobuf@3.21.4) @@ -787,7 +787,7 @@ packages: '@coral-xyz/borsh': 0.2.6(@solana/web3.js@1.95.3) '@mysten/sui.js': 0.32.2 '@project-serum/anchor': 0.25.0 - '@solana/spl-token': 0.3.11(@solana/web3.js@1.95.3)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.6.2) + '@solana/spl-token': 0.3.11(@solana/web3.js@1.95.3)(fastestsmallesttextencoderdecoder@1.0.22) '@solana/web3.js': 1.95.3 '@terra-money/terra.js': 3.1.9 '@xpla/xpla.js': 0.2.3 @@ -815,7 +815,6 @@ packages: - react - react-dom - subscriptions-transport-ws - - typescript - utf-8-validate dev: true @@ -1221,7 +1220,7 @@ packages: '@cosmjs/socket': 0.28.13 '@cosmjs/stream': 0.28.13 '@cosmjs/utils': 0.28.13 - axios: 0.21.4(debug@4.3.5) + axios: 0.21.4 readonly-date: 1.0.0 xstream: 11.14.0 transitivePeerDependencies: @@ -1239,7 +1238,7 @@ packages: '@cosmjs/socket': 0.29.5 '@cosmjs/stream': 0.29.5 '@cosmjs/utils': 0.29.5 - axios: 0.21.4(debug@4.3.5) + axios: 0.21.4 readonly-date: 1.0.0 xstream: 11.14.0 transitivePeerDependencies: @@ -1258,7 +1257,7 @@ packages: '@cosmjs/socket': 0.30.1 '@cosmjs/stream': 0.30.1 '@cosmjs/utils': 0.30.1 - axios: 0.21.4(debug@4.3.5) + axios: 0.21.4 readonly-date: 1.0.0 xstream: 11.14.0 transitivePeerDependencies: @@ -2174,8 +2173,8 @@ packages: resolution: {integrity: sha512-NZWlgBzgVrXow9IknFQHvcYKX4QkUD25taRigoNYQK8PDn4+VXd9xM5WFUDRhzm2smTCguyl/+MghpEp4oTPWw==} requiresBuild: true dependencies: - '@injectivelabs/grpc-web': 0.0.1(google-protobuf@3.21.2) - google-protobuf: 3.21.2 + '@injectivelabs/grpc-web': 0.0.1(google-protobuf@3.21.4) + google-protobuf: 3.21.4 protobufjs: 7.4.0 rxjs: 7.8.1 optional: true @@ -2211,16 +2210,6 @@ packages: '@injectivelabs/grpc-web': 0.0.1(google-protobuf@3.21.4) optional: true - /@injectivelabs/grpc-web@0.0.1(google-protobuf@3.21.2): - resolution: {integrity: sha512-Pu5YgaZp+OvR5UWfqbrPdHer3+gDf+b5fQoY+t2VZx1IAVHX8bzbN9EreYTvTYtFeDpYRWM8P7app2u4EX5wTw==} - requiresBuild: true - peerDependencies: - google-protobuf: ^3.14.0 - dependencies: - browser-headers: 0.4.1 - google-protobuf: 3.21.2 - optional: true - /@injectivelabs/grpc-web@0.0.1(google-protobuf@3.21.4): resolution: {integrity: sha512-Pu5YgaZp+OvR5UWfqbrPdHer3+gDf+b5fQoY+t2VZx1IAVHX8bzbN9EreYTvTYtFeDpYRWM8P7app2u4EX5wTw==} requiresBuild: true @@ -2235,8 +2224,8 @@ packages: resolution: {integrity: sha512-IwbepTfsHHAv3Z36As6yH/+HIplOEpUu6SFHBCVgdSIaQ8GuvTib4HETiVnV4mjYqoyVgWs+zLSAfih46rdMJQ==} requiresBuild: true dependencies: - '@injectivelabs/grpc-web': 0.0.1(google-protobuf@3.21.2) - google-protobuf: 3.21.2 + '@injectivelabs/grpc-web': 0.0.1(google-protobuf@3.21.4) + google-protobuf: 3.21.4 protobufjs: 7.4.0 rxjs: 7.8.1 optional: true @@ -2245,8 +2234,8 @@ packages: resolution: {integrity: sha512-+TZMvJ4SHwcn6SFPdqaiQFZdNhjH7hyRFozY15nOTC2utdGij9jEsjz1NsyOejfYDA0s1z5Wm1SgrMYKaVpAmQ==} requiresBuild: true dependencies: - '@injectivelabs/grpc-web': 0.0.1(google-protobuf@3.21.2) - google-protobuf: 3.21.2 + '@injectivelabs/grpc-web': 0.0.1(google-protobuf@3.21.4) + google-protobuf: 3.21.4 protobufjs: 7.4.0 rxjs: 7.8.1 optional: true @@ -2378,7 +2367,7 @@ packages: dependencies: '@injectivelabs/exceptions': 1.14.13(google-protobuf@3.21.4) '@injectivelabs/ts-types': 1.14.13 - axios: 0.21.4(debug@4.3.5) + axios: 0.21.4 bignumber.js: 9.1.2 http-status-codes: 2.3.0 link-module-alias: 1.2.0 @@ -2495,7 +2484,7 @@ packages: dependencies: '@ledgerhq/cryptoassets': 5.53.0 '@ledgerhq/errors': 5.50.0 - '@ledgerhq/hw-transport': 5.26.0 + '@ledgerhq/hw-transport': 5.51.1 bignumber.js: 9.1.2 rlp: 2.2.7 dev: true @@ -2545,7 +2534,7 @@ packages: dependencies: '@ledgerhq/devices': 5.51.1 '@ledgerhq/errors': 5.50.0 - '@ledgerhq/hw-transport': 5.26.0 + '@ledgerhq/hw-transport': 5.51.1 '@ledgerhq/hw-transport-node-hid-noevents': 5.51.1 '@ledgerhq/logs': 5.50.0 lodash: 4.17.21 @@ -2571,7 +2560,7 @@ packages: deprecated: '@ledgerhq/hw-transport-u2f is deprecated. Please use @ledgerhq/hw-transport-webusb or @ledgerhq/hw-transport-webhid. https://github.com/LedgerHQ/ledgerjs/blob/master/docs/migrate_webusb.md' dependencies: '@ledgerhq/errors': 5.50.0 - '@ledgerhq/hw-transport': 5.26.0 + '@ledgerhq/hw-transport': 5.51.1 '@ledgerhq/logs': 5.50.0 u2f-api: 0.2.7 dev: true @@ -2602,7 +2591,6 @@ packages: '@ledgerhq/errors': 5.50.0 events: 3.3.0 dev: true - optional: true /@ledgerhq/logs@4.72.0: resolution: {integrity: sha512-o+TYF8vBcyySRsb2kqBDv/KMeme8a2nwWoG+lAWzbDmWfb2/MrVWYCVYDYvjXdSoI/Cujqy1i0gIDrkdxa9chA==} @@ -3480,15 +3468,6 @@ packages: resolution: {integrity: sha512-gLhCJXieSCrAU7acUJjbXl+IbGnqovvxQLlimztPoGgfLQ1wFYu+XJswrEVQqknZYK1pgxpxH3rZ+OKFs0ndQg==} dependencies: '@solana/errors': 2.0.0-preview.2 - dev: false - - /@solana/codecs-core@2.0.0-rc.1(typescript@5.6.2): - resolution: {integrity: sha512-bauxqMfSs8EHD0JKESaNmNuNvkvHSuN3bbWAF5RjOfDu2PugxHrvRebmYauvSumZ3cTfQ4HJJX6PG5rN852qyQ==} - peerDependencies: - typescript: '>=5' - dependencies: - '@solana/errors': 2.0.0-rc.1(typescript@5.6.2) - typescript: 5.6.2 /@solana/codecs-data-structures@2.0.0-preview.2: resolution: {integrity: sha512-Xf5vIfromOZo94Q8HbR04TbgTwzigqrKII0GjYr21K7rb3nba4hUW2ir8kguY7HWFBcjHGlU5x3MevKBOLp3Zg==} @@ -3496,33 +3475,12 @@ packages: '@solana/codecs-core': 2.0.0-preview.2 '@solana/codecs-numbers': 2.0.0-preview.2 '@solana/errors': 2.0.0-preview.2 - dev: false - - /@solana/codecs-data-structures@2.0.0-rc.1(typescript@5.6.2): - resolution: {integrity: sha512-rinCv0RrAVJ9rE/rmaibWJQxMwC5lSaORSZuwjopSUE6T0nb/MVg6Z1siNCXhh/HFTOg0l8bNvZHgBcN/yvXog==} - peerDependencies: - typescript: '>=5' - dependencies: - '@solana/codecs-core': 2.0.0-rc.1(typescript@5.6.2) - '@solana/codecs-numbers': 2.0.0-rc.1(typescript@5.6.2) - '@solana/errors': 2.0.0-rc.1(typescript@5.6.2) - typescript: 5.6.2 /@solana/codecs-numbers@2.0.0-preview.2: resolution: {integrity: sha512-aLZnDTf43z4qOnpTcDsUVy1Ci9im1Md8thWipSWbE+WM9ojZAx528oAql+Cv8M8N+6ALKwgVRhPZkto6E59ARw==} dependencies: '@solana/codecs-core': 2.0.0-preview.2 '@solana/errors': 2.0.0-preview.2 - dev: false - - /@solana/codecs-numbers@2.0.0-rc.1(typescript@5.6.2): - resolution: {integrity: sha512-J5i5mOkvukXn8E3Z7sGIPxsThRCgSdgTWJDQeZvucQ9PT6Y3HiVXJ0pcWiOWAoQ3RX8e/f4I3IC+wE6pZiJzDQ==} - peerDependencies: - typescript: '>=5' - dependencies: - '@solana/codecs-core': 2.0.0-rc.1(typescript@5.6.2) - '@solana/errors': 2.0.0-rc.1(typescript@5.6.2) - typescript: 5.6.2 /@solana/codecs-strings@2.0.0-preview.2(fastestsmallesttextencoderdecoder@1.0.22): resolution: {integrity: sha512-EgBwY+lIaHHgMJIqVOGHfIfpdmmUDNoNO/GAUGeFPf+q0dF+DtwhJPEMShhzh64X2MeCZcmSO6Kinx0Bvmmz2g==} @@ -3533,19 +3491,6 @@ packages: '@solana/codecs-numbers': 2.0.0-preview.2 '@solana/errors': 2.0.0-preview.2 fastestsmallesttextencoderdecoder: 1.0.22 - dev: false - - /@solana/codecs-strings@2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.6.2): - resolution: {integrity: sha512-9/wPhw8TbGRTt6mHC4Zz1RqOnuPTqq1Nb4EyuvpZ39GW6O2t2Q7Q0XxiB3+BdoEjwA2XgPw6e2iRfvYgqty44g==} - peerDependencies: - fastestsmallesttextencoderdecoder: ^1.0.22 - typescript: '>=5' - dependencies: - '@solana/codecs-core': 2.0.0-rc.1(typescript@5.6.2) - '@solana/codecs-numbers': 2.0.0-rc.1(typescript@5.6.2) - '@solana/errors': 2.0.0-rc.1(typescript@5.6.2) - fastestsmallesttextencoderdecoder: 1.0.22 - typescript: 5.6.2 /@solana/codecs@2.0.0-preview.2(fastestsmallesttextencoderdecoder@1.0.22): resolution: {integrity: sha512-4HHzCD5+pOSmSB71X6w9ptweV48Zj1Vqhe732+pcAQ2cMNnN0gMPMdDq7j3YwaZDZ7yrILVV/3+HTnfT77t2yA==} @@ -3557,21 +3502,6 @@ packages: '@solana/options': 2.0.0-preview.2 transitivePeerDependencies: - fastestsmallesttextencoderdecoder - dev: false - - /@solana/codecs@2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.6.2): - resolution: {integrity: sha512-qxoR7VybNJixV51L0G1RD2boZTcxmwUWnKCaJJExQ5qNKwbpSyDdWfFJfM5JhGyKe9DnPVOZB+JHWXnpbZBqrQ==} - peerDependencies: - typescript: '>=5' - dependencies: - '@solana/codecs-core': 2.0.0-rc.1(typescript@5.6.2) - '@solana/codecs-data-structures': 2.0.0-rc.1(typescript@5.6.2) - '@solana/codecs-numbers': 2.0.0-rc.1(typescript@5.6.2) - '@solana/codecs-strings': 2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.6.2) - '@solana/options': 2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.6.2) - typescript: 5.6.2 - transitivePeerDependencies: - - fastestsmallesttextencoderdecoder /@solana/errors@2.0.0-preview.2: resolution: {integrity: sha512-H2DZ1l3iYF5Rp5pPbJpmmtCauWeQXRJapkDg8epQ8BJ7cA2Ut/QEtC3CMmw/iMTcuS6uemFNLcWvlOfoQhvQuA==} @@ -3579,38 +3509,12 @@ packages: dependencies: chalk: 5.3.0 commander: 12.1.0 - dev: false - - /@solana/errors@2.0.0-rc.1(typescript@5.6.2): - resolution: {integrity: sha512-ejNvQ2oJ7+bcFAYWj225lyRkHnixuAeb7RQCixm+5mH4n1IA4Qya/9Bmfy5RAAHQzxK43clu3kZmL5eF9VGtYQ==} - hasBin: true - peerDependencies: - typescript: '>=5' - dependencies: - chalk: 5.3.0 - commander: 12.1.0 - typescript: 5.6.2 /@solana/options@2.0.0-preview.2: resolution: {integrity: sha512-FAHqEeH0cVsUOTzjl5OfUBw2cyT8d5Oekx4xcn5hn+NyPAfQJgM3CEThzgRD6Q/4mM5pVUnND3oK/Mt1RzSE/w==} dependencies: '@solana/codecs-core': 2.0.0-preview.2 '@solana/codecs-numbers': 2.0.0-preview.2 - dev: false - - /@solana/options@2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.6.2): - resolution: {integrity: sha512-mLUcR9mZ3qfHlmMnREdIFPf9dpMc/Bl66tLSOOWxw4ml5xMT2ohFn7WGqoKcu/UHkT9CrC6+amEdqCNvUqI7AA==} - peerDependencies: - typescript: '>=5' - dependencies: - '@solana/codecs-core': 2.0.0-rc.1(typescript@5.6.2) - '@solana/codecs-data-structures': 2.0.0-rc.1(typescript@5.6.2) - '@solana/codecs-numbers': 2.0.0-rc.1(typescript@5.6.2) - '@solana/codecs-strings': 2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.6.2) - '@solana/errors': 2.0.0-rc.1(typescript@5.6.2) - typescript: 5.6.2 - transitivePeerDependencies: - - fastestsmallesttextencoderdecoder /@solana/spl-token-metadata@0.1.4(@solana/web3.js@1.95.0)(fastestsmallesttextencoderdecoder@1.0.22): resolution: {integrity: sha512-N3gZ8DlW6NWDV28+vCCDJoTqaCZiF/jDUnk3o8GRkAFzHObiR60Bs1gXHBa8zCPdvOwiG6Z3dg5pg7+RW6XNsQ==} @@ -3623,34 +3527,18 @@ packages: '@solana/web3.js': 1.95.0 transitivePeerDependencies: - fastestsmallesttextencoderdecoder - dev: false - - /@solana/spl-token-metadata@0.1.5(@solana/web3.js@1.95.0)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.6.2): - resolution: {integrity: sha512-DSBlo7vjuLe/xvNn75OKKndDBkFxlqjLdWlq6rf40StnrhRn7TDntHGLZpry1cf3uzQFShqeLROGNPAJwvkPnA==} - engines: {node: '>=16'} - peerDependencies: - '@solana/web3.js': ^1.95.3 - dependencies: - '@solana/codecs': 2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.6.2) - '@solana/spl-type-length-value': 0.1.0 - '@solana/web3.js': 1.95.0 - transitivePeerDependencies: - - fastestsmallesttextencoderdecoder - - typescript - dev: false - /@solana/spl-token-metadata@0.1.5(@solana/web3.js@1.95.3)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.6.2): - resolution: {integrity: sha512-DSBlo7vjuLe/xvNn75OKKndDBkFxlqjLdWlq6rf40StnrhRn7TDntHGLZpry1cf3uzQFShqeLROGNPAJwvkPnA==} + /@solana/spl-token-metadata@0.1.4(@solana/web3.js@1.95.3)(fastestsmallesttextencoderdecoder@1.0.22): + resolution: {integrity: sha512-N3gZ8DlW6NWDV28+vCCDJoTqaCZiF/jDUnk3o8GRkAFzHObiR60Bs1gXHBa8zCPdvOwiG6Z3dg5pg7+RW6XNsQ==} engines: {node: '>=16'} peerDependencies: - '@solana/web3.js': ^1.95.3 + '@solana/web3.js': ^1.91.6 dependencies: - '@solana/codecs': 2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.6.2) + '@solana/codecs': 2.0.0-preview.2(fastestsmallesttextencoderdecoder@1.0.22) '@solana/spl-type-length-value': 0.1.0 '@solana/web3.js': 1.95.3 transitivePeerDependencies: - fastestsmallesttextencoderdecoder - - typescript dev: true /@solana/spl-token@0.3.11(@solana/web3.js@1.95.0)(fastestsmallesttextencoderdecoder@1.0.22): @@ -3669,28 +3557,8 @@ packages: - encoding - fastestsmallesttextencoderdecoder - utf-8-validate - dev: false - - /@solana/spl-token@0.3.11(@solana/web3.js@1.95.0)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.6.2): - resolution: {integrity: sha512-bvohO3rIMSVL24Pb+I4EYTJ6cL82eFpInEXD/I8K8upOGjpqHsKUoAempR/RnUlI1qSFNyFlWJfu6MNUgfbCQQ==} - engines: {node: '>=16'} - peerDependencies: - '@solana/web3.js': ^1.88.0 - dependencies: - '@solana/buffer-layout': 4.0.1 - '@solana/buffer-layout-utils': 0.2.0 - '@solana/spl-token-metadata': 0.1.5(@solana/web3.js@1.95.0)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.6.2) - '@solana/web3.js': 1.95.0 - buffer: 6.0.3 - transitivePeerDependencies: - - bufferutil - - encoding - - fastestsmallesttextencoderdecoder - - typescript - - utf-8-validate - dev: false - /@solana/spl-token@0.3.11(@solana/web3.js@1.95.3)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.6.2): + /@solana/spl-token@0.3.11(@solana/web3.js@1.95.3)(fastestsmallesttextencoderdecoder@1.0.22): resolution: {integrity: sha512-bvohO3rIMSVL24Pb+I4EYTJ6cL82eFpInEXD/I8K8upOGjpqHsKUoAempR/RnUlI1qSFNyFlWJfu6MNUgfbCQQ==} engines: {node: '>=16'} peerDependencies: @@ -3698,14 +3566,13 @@ packages: dependencies: '@solana/buffer-layout': 4.0.1 '@solana/buffer-layout-utils': 0.2.0 - '@solana/spl-token-metadata': 0.1.5(@solana/web3.js@1.95.3)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.6.2) + '@solana/spl-token-metadata': 0.1.4(@solana/web3.js@1.95.3)(fastestsmallesttextencoderdecoder@1.0.22) '@solana/web3.js': 1.95.3 buffer: 6.0.3 transitivePeerDependencies: - bufferutil - encoding - fastestsmallesttextencoderdecoder - - typescript - utf-8-validate dev: true @@ -3737,7 +3604,6 @@ packages: - bufferutil - encoding - utf-8-validate - dev: false /@solana/web3.js@1.95.3: resolution: {integrity: sha512-O6rPUN0w2fkNqx/Z3QJMB9L225Ex10PRDH8bTaIUPZXMPV0QP8ZpPvjQnXK+upUczlRgzHzd6SjKIha1p+I6og==} @@ -3800,7 +3666,6 @@ packages: resolution: {integrity: sha512-YNlnKRWF2sVojTpIyzwou9XoTNbzbzONwRhOoniEioF1AtaitTvVZblaQRrAzChWQ1bLYyYSWzM18y4WwgzJ+A==} dependencies: tslib: 2.7.0 - dev: false /@swc/helpers@0.5.13: resolution: {integrity: sha512-UoKGxQ3r5kYI9dALKJapMmuK+1zWM/H17Z1+iwnNmzcJRnfFuevZs375TA5rW31pu4BS4NoSy1fRsexDXfWn5w==} @@ -4279,7 +4144,6 @@ packages: resolution: {integrity: sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==} dependencies: '@types/node': 22.7.4 - dev: false /@types/ws@8.5.12: resolution: {integrity: sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==} @@ -4600,7 +4464,7 @@ packages: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} dev: true - /@wormhole-foundation/relayer-engine@0.3.2(@bull-board/ui@5.21.0)(@improbable-eng/grpc-web@0.15.0)(@types/node@22.7.4)(fastestsmallesttextencoderdecoder@1.0.22)(google-protobuf@3.21.4)(typescript@5.6.2): + /@wormhole-foundation/relayer-engine@0.3.2(@bull-board/ui@5.21.0)(@improbable-eng/grpc-web@0.15.0)(@types/node@20.16.10)(fastestsmallesttextencoderdecoder@1.0.22)(google-protobuf@3.21.4)(typescript@5.6.2): resolution: {integrity: sha512-6CAGZdxDpPZph+Gx1Tob5wEarEzvD27G7khoGhB9sc8KiOhRz8zDiBspFfLetzfBEHMiTyvAOibETV5G0ULilA==} dependencies: '@bull-board/api': 5.21.0(@bull-board/ui@5.21.0) @@ -4611,7 +4475,7 @@ packages: '@improbable-eng/grpc-web-node-http-transport': 0.15.0(@improbable-eng/grpc-web@0.15.0) '@mysten/sui.js': 0.32.2 '@sei-js/core': 1.5.0 - '@xlabs-xyz/wallet-monitor': 0.2.16(@types/node@22.7.4)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.6.2) + '@xlabs-xyz/wallet-monitor': 0.2.16(@types/node@20.16.10)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.6.2) bech32: 2.0.0 bullmq: 3.15.8 ethers: 5.7.2 @@ -4698,7 +4562,7 @@ packages: dependencies: '@bull-board/api': 5.23.0(@bull-board/ui@5.23.0) '@bull-board/koa': 5.23.0 - '@certusone/wormhole-sdk': 0.10.18(fastestsmallesttextencoderdecoder@1.0.22)(google-protobuf@3.21.4)(typescript@5.6.2) + '@certusone/wormhole-sdk': 0.10.18(fastestsmallesttextencoderdecoder@1.0.22)(google-protobuf@3.21.4) '@certusone/wormhole-spydk': 0.0.1 '@datastructures-js/queue': 4.2.3 '@improbable-eng/grpc-web-node-http-transport': 0.15.0(@improbable-eng/grpc-web@0.15.0) @@ -4831,48 +4695,17 @@ packages: dependencies: '@ethersproject/bignumber': 5.7.0 '@mysten/sui.js': 0.32.2 - '@solana/spl-token': 0.3.11(@solana/web3.js@1.95.3)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.6.2) - '@solana/web3.js': 1.95.3 - bluebird: 3.7.2 - bs58: 5.0.0 - ethers: 5.7.2 - google-protobuf: 3.21.4 - koa: 2.15.3 - koa-router: 12.0.1 - nice-grpc: 2.1.10 - prom-client: 14.2.0 - ts-node: 10.9.2(@types/node@20.16.10)(typescript@5.6.2) - ts-proto: 1.181.2 - winston: 3.14.2 - zod: 3.23.8 - transitivePeerDependencies: - - '@swc/core' - - '@swc/wasm' - - '@types/node' - - bufferutil - - encoding - - fastestsmallesttextencoderdecoder - - supports-color - - typescript - - utf-8-validate - dev: true - - /@xlabs-xyz/wallet-monitor@0.2.16(@types/node@22.7.4)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.6.2): - resolution: {integrity: sha512-Fup24DcONFy3o5lrJP3i5gc5XXj7675gWhco3JkweWTFj86c17UrXYQOhZF1Z09b7WYt4rnXZx+wQ4W19HzOoQ==} - dependencies: - '@ethersproject/bignumber': 5.7.0 - '@mysten/sui.js': 0.32.2 - '@solana/spl-token': 0.3.11(@solana/web3.js@1.95.0)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.6.2) + '@solana/spl-token': 0.3.11(@solana/web3.js@1.95.0)(fastestsmallesttextencoderdecoder@1.0.22) '@solana/web3.js': 1.95.0 bluebird: 3.7.2 bs58: 5.0.0 ethers: 5.7.2 - google-protobuf: 3.21.2 + google-protobuf: 3.21.4 koa: 2.15.3 koa-router: 12.0.1 nice-grpc: 2.1.9 prom-client: 14.2.0 - ts-node: 10.9.2(@types/node@22.7.4)(typescript@5.6.2) + ts-node: 10.9.2(@types/node@20.16.10)(typescript@5.6.2) ts-proto: 1.181.0 winston: 3.13.1 zod: 3.23.8 @@ -4886,7 +4719,6 @@ packages: - supports-color - typescript - utf-8-validate - dev: false /@xpla/xpla.js@0.2.3: resolution: {integrity: sha512-Tfk7hCGWXtwr08reY3Pi6dmzIqFbzri9jcyzJdfNmdo4cN0PMwpRJuZZcPmtxiIUnNef3AN1E/6nJUD5MKniuA==} @@ -5229,11 +5061,6 @@ packages: resolution: {integrity: sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg==} dev: true - /antlr4@4.13.1: - resolution: {integrity: sha512-kiXTspaRYvnIArgE97z5YVVf/cDVQABr3abFRR6mE7yesLMkgu4ujuyV/sgxafQ8wgve0DJQUJ38Z8tkgA2izA==} - engines: {node: '>=16'} - dev: true - /antlr4@4.13.2: resolution: {integrity: sha512-QiVbZhyy4xAZ17UPEuG3YTOt8ZaoeOR1CvEAqrEsDBsOqINslaB147i9xqljZqoyf5S+EUlGStaj+t22LT9MOg==} engines: {node: '>=16'} @@ -5576,12 +5403,20 @@ packages: resolution: {integrity: sha512-3AungXC4I8kKsS9PuS4JH2nc+0bVY/mjgrephHTIi8fpEeGsTHBUJeosp0Wc1myYMElmD0B3Oc4XL/HVJ4PV2g==} dev: true + /axios@0.21.4: + resolution: {integrity: sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==} + dependencies: + follow-redirects: 1.15.6(debug@4.3.7) + transitivePeerDependencies: + - debug + /axios@0.21.4(debug@4.3.5): resolution: {integrity: sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==} dependencies: follow-redirects: 1.15.6(debug@4.3.5) transitivePeerDependencies: - debug + dev: true /axios@0.24.0: resolution: {integrity: sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==} @@ -6941,23 +6776,6 @@ packages: whatwg-mimetype: 4.0.0 dev: true - /chokidar@1.6.1: - resolution: {integrity: sha512-/6SIsjBGK5mzf1i1L8ccsH0jZuzWvMump0iJ6LD3jYxhwiLjvJ+5GrpJNxay9MGRvTAoYmzLU/z19wyxEjfv1w==} - dependencies: - anymatch: 1.3.2 - async-each: 1.0.6 - glob-parent: 2.0.0 - inherits: 2.0.4 - is-binary-path: 1.0.1 - is-glob: 2.0.1 - path-is-absolute: 1.0.1 - readdirp: 2.2.1 - optionalDependencies: - fsevents: 1.2.13 - transitivePeerDependencies: - - supports-color - dev: true - /chokidar@1.7.0: resolution: {integrity: sha512-mk8fAWcRUOxY7btlLtitj3A45jOwSAxH4tOFOoEGbVsl6cL6pPMWUy7dwZ/canfj3QEdP6FHSnf/l1c6/WkzVg==} deprecated: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies. @@ -10214,6 +10032,7 @@ packages: optional: true dependencies: debug: 4.3.5 + dev: true /follow-redirects@1.15.6(debug@4.3.7): resolution: {integrity: sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==} @@ -10225,7 +10044,6 @@ packages: optional: true dependencies: debug: 4.3.7(supports-color@8.1.1) - dev: true /follow-redirects@1.15.9: resolution: {integrity: sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==} @@ -10802,9 +10620,6 @@ packages: slash: 3.0.0 dev: true - /google-protobuf@3.21.2: - resolution: {integrity: sha512-3MSOYFO5U9mPGikIYCzK0SaThypfGgS6bHqrUGXG3DPHCrb+txNqeEcns1W0lkGfk0rCyNXm7xB9rMxnCiZOoA==} - /google-protobuf@3.21.4: resolution: {integrity: sha512-MnG7N936zcKTco4Jd2PX2U96Kf9PxygAPKBug+74LHzmHXmceN16MmRcdgZv+DGef/S9YvQAfRsNCn4cjf9yyQ==} @@ -12147,7 +11962,6 @@ packages: transitivePeerDependencies: - bufferutil - utf-8-validate - dev: false /jayson@4.1.2: resolution: {integrity: sha512-5nzMWDHy6f+koZOuYsArh2AXs73NfWYVlFyJJuCedr93GpY+Ku8qq10ropSXVfHK+H0T6paA88ww+/dV+1fBNA==} @@ -13792,21 +13606,12 @@ packages: dependencies: ts-error: 1.0.6 - /nice-grpc@2.1.10: - resolution: {integrity: sha512-Nujs/4wWJvE5OSxWPp3M5H+zHJAgsWMo38bMNfKQP1VDeCChp7MiKTkhJBV5JZvrBIkPhYQCLIbfvVqEoSuTuA==} - dependencies: - '@grpc/grpc-js': 1.11.3 - abort-controller-x: 0.4.3 - nice-grpc-common: 2.0.2 - dev: true - /nice-grpc@2.1.9: resolution: {integrity: sha512-shJlg1t4Wn3qTVE31gxofbTrgCX/p4tS1xRnk4bNskCYKvXNEUpJQZpjModsVk1aau69YZDViyC18K9nC7QHYA==} dependencies: '@grpc/grpc-js': 1.11.3 abort-controller-x: 0.4.3 nice-grpc-common: 2.0.2 - dev: false /nice-try@1.0.5: resolution: {integrity: sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==} @@ -14970,24 +14775,6 @@ packages: '@types/node': 22.7.4 long: 4.0.0 - /protobufjs@7.3.2: - resolution: {integrity: sha512-RXyHaACeqXeqAKGLDl68rQKbmObRsTIn4TYVUUug1KfS47YWCo5MacGITEryugIgZqORCvJWEk4l449POg5Txg==} - engines: {node: '>=12.0.0'} - requiresBuild: true - dependencies: - '@protobufjs/aspromise': 1.1.2 - '@protobufjs/base64': 1.1.2 - '@protobufjs/codegen': 2.0.4 - '@protobufjs/eventemitter': 1.1.0 - '@protobufjs/fetch': 1.1.0 - '@protobufjs/float': 1.0.2 - '@protobufjs/inquire': 1.1.0 - '@protobufjs/path': 1.1.2 - '@protobufjs/pool': 1.1.0 - '@protobufjs/utf8': 1.1.0 - '@types/node': 22.7.4 - long: 5.2.3 - /protobufjs@7.4.0: resolution: {integrity: sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw==} engines: {node: '>=12.0.0'} @@ -15673,7 +15460,6 @@ packages: optionalDependencies: bufferutil: 4.0.8 utf-8-validate: 5.0.10 - dev: false /rpc-websockets@9.0.4: resolution: {integrity: sha512-yWZWN0M+bivtoNLnaDbtny4XchdAIF5Q4g/ZsC5UC61Ckbp0QczwO8fg44rV3uYmY4WHd+EZQbn90W1d8ojzqQ==} @@ -16347,18 +16133,18 @@ packages: dependencies: '@solidity-parser/parser': 0.16.2 ajv: 6.12.6 - antlr4: 4.13.1 + antlr4: 4.13.2 ast-parents: 0.0.1 chalk: 4.1.2 commander: 10.0.1 cosmiconfig: 8.3.6(typescript@4.9.5) fast-diff: 1.3.0 glob: 8.1.0 - ignore: 5.3.1 + ignore: 5.3.2 js-yaml: 4.1.0 lodash: 4.17.21 pluralize: 8.0.0 - semver: 7.6.2 + semver: 7.6.3 strip-ansi: 6.0.1 table: 6.8.2 text-table: 0.2.0 @@ -16481,7 +16267,7 @@ packages: hasBin: true dependencies: ajv: 5.5.2 - chokidar: 1.6.1 + chokidar: 1.7.0 colors: 1.4.0 commander: 2.20.3 diff: 3.5.0 @@ -17317,38 +17103,6 @@ packages: typescript: 5.6.2 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 - dev: true - - /ts-node@10.9.2(@types/node@22.7.4)(typescript@5.6.2): - resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} - hasBin: true - peerDependencies: - '@swc/core': '>=1.2.50' - '@swc/wasm': '>=1.2.50' - '@types/node': '*' - typescript: '>=2.7' - peerDependenciesMeta: - '@swc/core': - optional: true - '@swc/wasm': - optional: true - dependencies: - '@cspotcode/source-map-support': 0.8.1 - '@tsconfig/node10': 1.0.11 - '@tsconfig/node12': 1.0.11 - '@tsconfig/node14': 1.0.3 - '@tsconfig/node16': 1.0.4 - '@types/node': 22.7.4 - acorn: 8.12.1 - acorn-walk: 8.3.3 - arg: 4.1.3 - create-require: 1.1.1 - diff: 4.0.2 - make-error: 1.3.6 - typescript: 5.6.2 - v8-compile-cache-lib: 3.0.1 - yn: 3.1.1 - dev: false /ts-node@8.10.2(typescript@5.6.2): resolution: {integrity: sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==} @@ -17390,27 +17144,16 @@ packages: resolution: {integrity: sha512-3yKuzMLpltdpcyQji1PJZRfoo4OJjNieKTYkQY8pF7xGKsYz/RHe3aEe4KiRxcinoBmnEhmuI+yJTxLb922ULA==} dependencies: long: 5.2.3 - protobufjs: 7.3.2 + protobufjs: 7.4.0 /ts-proto@1.181.0: resolution: {integrity: sha512-5+ZnxOgPsSn/lU93x8ApEFQPHE9G8kZubCSF1/EUjyeKImbGRp27iPXHilelQLOdClYHLUgr3hJwqtVqfsjNYQ==} hasBin: true - dependencies: - case-anything: 2.1.13 - protobufjs: 7.3.2 - ts-poet: 6.9.0 - ts-proto-descriptors: 1.16.0 - dev: false - - /ts-proto@1.181.2: - resolution: {integrity: sha512-knJ8dtjn2Pd0c5ZGZG8z9DMiD4PUY8iGI9T9tb8DvGdWRMkLpf0WcPO7G+7cmbZyxvNTAG6ci3fybEaFgMZIvg==} - hasBin: true dependencies: case-anything: 2.1.13 protobufjs: 7.4.0 ts-poet: 6.9.0 ts-proto-descriptors: 1.16.0 - dev: true /tsconfig-paths@3.15.0: resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==} @@ -19260,7 +19003,6 @@ packages: logform: 2.6.1 readable-stream: 3.6.2 triple-beam: 1.4.1 - dev: false /winston-transport@4.8.0: resolution: {integrity: sha512-qxSTKswC6llEMZKgCQdaWgDuMJQnhuvF5f2Nk3SNXc4byfQ+voo2mX1Px9dkNOuR8p0KAjfPG29PuYUSIb+vSA==} @@ -19286,7 +19028,6 @@ packages: stack-trace: 0.0.10 triple-beam: 1.4.1 winston-transport: 4.7.1 - dev: false /winston@3.14.2: resolution: {integrity: sha512-CO8cdpBB2yqzEf8v895L+GNKYJiEq8eKlHU38af3snQBQ+sdAIUepjMSguOIJC7ICbzm0ZI+Af2If4vIJrtmOg==} From 83f96e2c13fcee5ca5300688b81c86dbb8775a1d Mon Sep 17 00:00:00 2001 From: Daniel Kronovet Date: Mon, 21 Oct 2024 12:10:39 -0400 Subject: [PATCH 08/11] Update storage layout files --- .../contracts/colony/Colony.sol:Colony.json | 60 ++++++++++++++++++- ...action.sol:ColonyArbitraryTransaction.json | 60 ++++++++++++++++++- .../ColonyDomains.sol:ColonyDomains.json | 60 ++++++++++++++++++- ...lonyExpenditure.sol:ColonyExpenditure.json | 60 ++++++++++++++++++- .../ColonyFunding.sol:ColonyFunding.json | 60 ++++++++++++++++++- .../ColonyRewards.sol:ColonyRewards.json | 60 ++++++++++++++++++- .../colony/ColonyRoles.sol:ColonyRoles.json | 60 ++++++++++++++++++- .../ColonyStorage.sol:ColonyStorage.json | 60 ++++++++++++++++++- .../ColonyNetwork.sol:ColonyNetwork.json | 2 +- ...tworkAuction.sol:ColonyNetworkAuction.json | 2 +- ...orkDeployer.sol:ColonyNetworkDeployer.json | 2 +- ...ColonyNetworkENS.sol:ColonyNetworkENS.json | 2 +- ...xtensions.sol:ColonyNetworkExtensions.json | 2 +- ...NetworkMining.sol:ColonyNetworkMining.json | 2 +- ...NetworkSkills.sol:ColonyNetworkSkills.json | 2 +- ...tworkStorage.sol:ColonyNetworkStorage.json | 2 +- ...ony.sol:FunctionsNotAvailableOnColony.json | 60 ++++++++++++++++++- ...LimitSubdomains.sol:NoLimitSubdomains.json | 60 ++++++++++++++++++- 18 files changed, 588 insertions(+), 28 deletions(-) diff --git a/.storage-layouts-normalized/contracts/colony/Colony.sol:Colony.json b/.storage-layouts-normalized/contracts/colony/Colony.sol:Colony.json index 48766fa83c..b22d40a278 100644 --- a/.storage-layouts-normalized/contracts/colony/Colony.sol:Colony.json +++ b/.storage-layouts-normalized/contracts/colony/Colony.sol:Colony.json @@ -770,9 +770,20 @@ "label": "uint256", "numberOfBytes": "32" } + }, + { + "contract": "contracts/colony/Colony.sol:Colony", + "label": "deprecated", + "offset": 0, + "slot": "2", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } } ], - "numberOfBytes": "64" + "numberOfBytes": "96" } } }, @@ -1335,7 +1346,7 @@ }, { "contract": "contracts/colony/Colony.sol:Colony", - "label": "localSkills", + "label": "DEPRECATED_localSkills", "offset": 0, "slot": "37", "type": { @@ -1353,6 +1364,51 @@ "numberOfBytes": "1" } } + }, + { + "contract": "contracts/colony/Colony.sol:Colony", + "label": "localSkills", + "offset": 0, + "slot": "38", + "type": { + "encoding": "mapping", + "key": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "label": "mapping(uint256 => struct ColonyDataTypes.LocalSkill)", + "numberOfBytes": "32", + "value": { + "encoding": "inplace", + "label": "struct ColonyDataTypes.LocalSkill", + "members": [ + { + "contract": "contracts/colony/Colony.sol:Colony", + "label": "exists", + "offset": 0, + "slot": "0", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } + }, + { + "contract": "contracts/colony/Colony.sol:Colony", + "label": "deprecated", + "offset": 1, + "slot": "0", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } + } + ], + "numberOfBytes": "32" + } + } } ] } \ No newline at end of file diff --git a/.storage-layouts-normalized/contracts/colony/ColonyArbitraryTransaction.sol:ColonyArbitraryTransaction.json b/.storage-layouts-normalized/contracts/colony/ColonyArbitraryTransaction.sol:ColonyArbitraryTransaction.json index cecaf0fb53..4ff8a22299 100644 --- a/.storage-layouts-normalized/contracts/colony/ColonyArbitraryTransaction.sol:ColonyArbitraryTransaction.json +++ b/.storage-layouts-normalized/contracts/colony/ColonyArbitraryTransaction.sol:ColonyArbitraryTransaction.json @@ -770,9 +770,20 @@ "label": "uint256", "numberOfBytes": "32" } + }, + { + "contract": "contracts/colony/ColonyArbitraryTransaction.sol:ColonyArbitraryTransaction", + "label": "deprecated", + "offset": 0, + "slot": "2", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } } ], - "numberOfBytes": "64" + "numberOfBytes": "96" } } }, @@ -1335,7 +1346,7 @@ }, { "contract": "contracts/colony/ColonyArbitraryTransaction.sol:ColonyArbitraryTransaction", - "label": "localSkills", + "label": "DEPRECATED_localSkills", "offset": 0, "slot": "37", "type": { @@ -1353,6 +1364,51 @@ "numberOfBytes": "1" } } + }, + { + "contract": "contracts/colony/ColonyArbitraryTransaction.sol:ColonyArbitraryTransaction", + "label": "localSkills", + "offset": 0, + "slot": "38", + "type": { + "encoding": "mapping", + "key": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "label": "mapping(uint256 => struct ColonyDataTypes.LocalSkill)", + "numberOfBytes": "32", + "value": { + "encoding": "inplace", + "label": "struct ColonyDataTypes.LocalSkill", + "members": [ + { + "contract": "contracts/colony/ColonyArbitraryTransaction.sol:ColonyArbitraryTransaction", + "label": "exists", + "offset": 0, + "slot": "0", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } + }, + { + "contract": "contracts/colony/ColonyArbitraryTransaction.sol:ColonyArbitraryTransaction", + "label": "deprecated", + "offset": 1, + "slot": "0", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } + } + ], + "numberOfBytes": "32" + } + } } ] } \ No newline at end of file diff --git a/.storage-layouts-normalized/contracts/colony/ColonyDomains.sol:ColonyDomains.json b/.storage-layouts-normalized/contracts/colony/ColonyDomains.sol:ColonyDomains.json index b4810fb556..d3bf27e9dc 100644 --- a/.storage-layouts-normalized/contracts/colony/ColonyDomains.sol:ColonyDomains.json +++ b/.storage-layouts-normalized/contracts/colony/ColonyDomains.sol:ColonyDomains.json @@ -770,9 +770,20 @@ "label": "uint256", "numberOfBytes": "32" } + }, + { + "contract": "contracts/colony/ColonyDomains.sol:ColonyDomains", + "label": "deprecated", + "offset": 0, + "slot": "2", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } } ], - "numberOfBytes": "64" + "numberOfBytes": "96" } } }, @@ -1335,7 +1346,7 @@ }, { "contract": "contracts/colony/ColonyDomains.sol:ColonyDomains", - "label": "localSkills", + "label": "DEPRECATED_localSkills", "offset": 0, "slot": "37", "type": { @@ -1353,6 +1364,51 @@ "numberOfBytes": "1" } } + }, + { + "contract": "contracts/colony/ColonyDomains.sol:ColonyDomains", + "label": "localSkills", + "offset": 0, + "slot": "38", + "type": { + "encoding": "mapping", + "key": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "label": "mapping(uint256 => struct ColonyDataTypes.LocalSkill)", + "numberOfBytes": "32", + "value": { + "encoding": "inplace", + "label": "struct ColonyDataTypes.LocalSkill", + "members": [ + { + "contract": "contracts/colony/ColonyDomains.sol:ColonyDomains", + "label": "exists", + "offset": 0, + "slot": "0", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } + }, + { + "contract": "contracts/colony/ColonyDomains.sol:ColonyDomains", + "label": "deprecated", + "offset": 1, + "slot": "0", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } + } + ], + "numberOfBytes": "32" + } + } } ] } \ No newline at end of file diff --git a/.storage-layouts-normalized/contracts/colony/ColonyExpenditure.sol:ColonyExpenditure.json b/.storage-layouts-normalized/contracts/colony/ColonyExpenditure.sol:ColonyExpenditure.json index e67c83a8db..8dee3d7dd0 100644 --- a/.storage-layouts-normalized/contracts/colony/ColonyExpenditure.sol:ColonyExpenditure.json +++ b/.storage-layouts-normalized/contracts/colony/ColonyExpenditure.sol:ColonyExpenditure.json @@ -770,9 +770,20 @@ "label": "uint256", "numberOfBytes": "32" } + }, + { + "contract": "contracts/colony/ColonyExpenditure.sol:ColonyExpenditure", + "label": "deprecated", + "offset": 0, + "slot": "2", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } } ], - "numberOfBytes": "64" + "numberOfBytes": "96" } } }, @@ -1335,7 +1346,7 @@ }, { "contract": "contracts/colony/ColonyExpenditure.sol:ColonyExpenditure", - "label": "localSkills", + "label": "DEPRECATED_localSkills", "offset": 0, "slot": "37", "type": { @@ -1353,6 +1364,51 @@ "numberOfBytes": "1" } } + }, + { + "contract": "contracts/colony/ColonyExpenditure.sol:ColonyExpenditure", + "label": "localSkills", + "offset": 0, + "slot": "38", + "type": { + "encoding": "mapping", + "key": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "label": "mapping(uint256 => struct ColonyDataTypes.LocalSkill)", + "numberOfBytes": "32", + "value": { + "encoding": "inplace", + "label": "struct ColonyDataTypes.LocalSkill", + "members": [ + { + "contract": "contracts/colony/ColonyExpenditure.sol:ColonyExpenditure", + "label": "exists", + "offset": 0, + "slot": "0", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } + }, + { + "contract": "contracts/colony/ColonyExpenditure.sol:ColonyExpenditure", + "label": "deprecated", + "offset": 1, + "slot": "0", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } + } + ], + "numberOfBytes": "32" + } + } } ] } \ No newline at end of file diff --git a/.storage-layouts-normalized/contracts/colony/ColonyFunding.sol:ColonyFunding.json b/.storage-layouts-normalized/contracts/colony/ColonyFunding.sol:ColonyFunding.json index 0124a6e3d4..2ba1c31e74 100644 --- a/.storage-layouts-normalized/contracts/colony/ColonyFunding.sol:ColonyFunding.json +++ b/.storage-layouts-normalized/contracts/colony/ColonyFunding.sol:ColonyFunding.json @@ -770,9 +770,20 @@ "label": "uint256", "numberOfBytes": "32" } + }, + { + "contract": "contracts/colony/ColonyFunding.sol:ColonyFunding", + "label": "deprecated", + "offset": 0, + "slot": "2", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } } ], - "numberOfBytes": "64" + "numberOfBytes": "96" } } }, @@ -1335,7 +1346,7 @@ }, { "contract": "contracts/colony/ColonyFunding.sol:ColonyFunding", - "label": "localSkills", + "label": "DEPRECATED_localSkills", "offset": 0, "slot": "37", "type": { @@ -1353,6 +1364,51 @@ "numberOfBytes": "1" } } + }, + { + "contract": "contracts/colony/ColonyFunding.sol:ColonyFunding", + "label": "localSkills", + "offset": 0, + "slot": "38", + "type": { + "encoding": "mapping", + "key": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "label": "mapping(uint256 => struct ColonyDataTypes.LocalSkill)", + "numberOfBytes": "32", + "value": { + "encoding": "inplace", + "label": "struct ColonyDataTypes.LocalSkill", + "members": [ + { + "contract": "contracts/colony/ColonyFunding.sol:ColonyFunding", + "label": "exists", + "offset": 0, + "slot": "0", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } + }, + { + "contract": "contracts/colony/ColonyFunding.sol:ColonyFunding", + "label": "deprecated", + "offset": 1, + "slot": "0", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } + } + ], + "numberOfBytes": "32" + } + } } ] } \ No newline at end of file diff --git a/.storage-layouts-normalized/contracts/colony/ColonyRewards.sol:ColonyRewards.json b/.storage-layouts-normalized/contracts/colony/ColonyRewards.sol:ColonyRewards.json index 8ea84d7908..bc29e4ae55 100644 --- a/.storage-layouts-normalized/contracts/colony/ColonyRewards.sol:ColonyRewards.json +++ b/.storage-layouts-normalized/contracts/colony/ColonyRewards.sol:ColonyRewards.json @@ -770,9 +770,20 @@ "label": "uint256", "numberOfBytes": "32" } + }, + { + "contract": "contracts/colony/ColonyRewards.sol:ColonyRewards", + "label": "deprecated", + "offset": 0, + "slot": "2", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } } ], - "numberOfBytes": "64" + "numberOfBytes": "96" } } }, @@ -1335,7 +1346,7 @@ }, { "contract": "contracts/colony/ColonyRewards.sol:ColonyRewards", - "label": "localSkills", + "label": "DEPRECATED_localSkills", "offset": 0, "slot": "37", "type": { @@ -1353,6 +1364,51 @@ "numberOfBytes": "1" } } + }, + { + "contract": "contracts/colony/ColonyRewards.sol:ColonyRewards", + "label": "localSkills", + "offset": 0, + "slot": "38", + "type": { + "encoding": "mapping", + "key": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "label": "mapping(uint256 => struct ColonyDataTypes.LocalSkill)", + "numberOfBytes": "32", + "value": { + "encoding": "inplace", + "label": "struct ColonyDataTypes.LocalSkill", + "members": [ + { + "contract": "contracts/colony/ColonyRewards.sol:ColonyRewards", + "label": "exists", + "offset": 0, + "slot": "0", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } + }, + { + "contract": "contracts/colony/ColonyRewards.sol:ColonyRewards", + "label": "deprecated", + "offset": 1, + "slot": "0", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } + } + ], + "numberOfBytes": "32" + } + } } ] } \ No newline at end of file diff --git a/.storage-layouts-normalized/contracts/colony/ColonyRoles.sol:ColonyRoles.json b/.storage-layouts-normalized/contracts/colony/ColonyRoles.sol:ColonyRoles.json index 5aa0104c12..1704317f0d 100644 --- a/.storage-layouts-normalized/contracts/colony/ColonyRoles.sol:ColonyRoles.json +++ b/.storage-layouts-normalized/contracts/colony/ColonyRoles.sol:ColonyRoles.json @@ -770,9 +770,20 @@ "label": "uint256", "numberOfBytes": "32" } + }, + { + "contract": "contracts/colony/ColonyRoles.sol:ColonyRoles", + "label": "deprecated", + "offset": 0, + "slot": "2", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } } ], - "numberOfBytes": "64" + "numberOfBytes": "96" } } }, @@ -1335,7 +1346,7 @@ }, { "contract": "contracts/colony/ColonyRoles.sol:ColonyRoles", - "label": "localSkills", + "label": "DEPRECATED_localSkills", "offset": 0, "slot": "37", "type": { @@ -1353,6 +1364,51 @@ "numberOfBytes": "1" } } + }, + { + "contract": "contracts/colony/ColonyRoles.sol:ColonyRoles", + "label": "localSkills", + "offset": 0, + "slot": "38", + "type": { + "encoding": "mapping", + "key": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "label": "mapping(uint256 => struct ColonyDataTypes.LocalSkill)", + "numberOfBytes": "32", + "value": { + "encoding": "inplace", + "label": "struct ColonyDataTypes.LocalSkill", + "members": [ + { + "contract": "contracts/colony/ColonyRoles.sol:ColonyRoles", + "label": "exists", + "offset": 0, + "slot": "0", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } + }, + { + "contract": "contracts/colony/ColonyRoles.sol:ColonyRoles", + "label": "deprecated", + "offset": 1, + "slot": "0", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } + } + ], + "numberOfBytes": "32" + } + } } ] } \ No newline at end of file diff --git a/.storage-layouts-normalized/contracts/colony/ColonyStorage.sol:ColonyStorage.json b/.storage-layouts-normalized/contracts/colony/ColonyStorage.sol:ColonyStorage.json index 2fad267b5a..0e353b88a3 100644 --- a/.storage-layouts-normalized/contracts/colony/ColonyStorage.sol:ColonyStorage.json +++ b/.storage-layouts-normalized/contracts/colony/ColonyStorage.sol:ColonyStorage.json @@ -770,9 +770,20 @@ "label": "uint256", "numberOfBytes": "32" } + }, + { + "contract": "contracts/colony/ColonyStorage.sol:ColonyStorage", + "label": "deprecated", + "offset": 0, + "slot": "2", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } } ], - "numberOfBytes": "64" + "numberOfBytes": "96" } } }, @@ -1335,7 +1346,7 @@ }, { "contract": "contracts/colony/ColonyStorage.sol:ColonyStorage", - "label": "localSkills", + "label": "DEPRECATED_localSkills", "offset": 0, "slot": "37", "type": { @@ -1353,6 +1364,51 @@ "numberOfBytes": "1" } } + }, + { + "contract": "contracts/colony/ColonyStorage.sol:ColonyStorage", + "label": "localSkills", + "offset": 0, + "slot": "38", + "type": { + "encoding": "mapping", + "key": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "label": "mapping(uint256 => struct ColonyDataTypes.LocalSkill)", + "numberOfBytes": "32", + "value": { + "encoding": "inplace", + "label": "struct ColonyDataTypes.LocalSkill", + "members": [ + { + "contract": "contracts/colony/ColonyStorage.sol:ColonyStorage", + "label": "exists", + "offset": 0, + "slot": "0", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } + }, + { + "contract": "contracts/colony/ColonyStorage.sol:ColonyStorage", + "label": "deprecated", + "offset": 1, + "slot": "0", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } + } + ], + "numberOfBytes": "32" + } + } } ] } \ No newline at end of file diff --git a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetwork.sol:ColonyNetwork.json b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetwork.sol:ColonyNetwork.json index dcca4403a8..43c45f5651 100644 --- a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetwork.sol:ColonyNetwork.json +++ b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetwork.sol:ColonyNetwork.json @@ -378,7 +378,7 @@ }, { "contract": "contracts/colonyNetwork/ColonyNetwork.sol:ColonyNetwork", - "label": "deprecated", + "label": "DEPRECATED_deprecated", "offset": 1, "slot": "3", "type": { diff --git a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkAuction.sol:ColonyNetworkAuction.json b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkAuction.sol:ColonyNetworkAuction.json index 0881a97e7c..1812851e6c 100644 --- a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkAuction.sol:ColonyNetworkAuction.json +++ b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkAuction.sol:ColonyNetworkAuction.json @@ -378,7 +378,7 @@ }, { "contract": "contracts/colonyNetwork/ColonyNetworkAuction.sol:ColonyNetworkAuction", - "label": "deprecated", + "label": "DEPRECATED_deprecated", "offset": 1, "slot": "3", "type": { diff --git a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkDeployer.sol:ColonyNetworkDeployer.json b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkDeployer.sol:ColonyNetworkDeployer.json index 914f22f94d..7fb79ad881 100644 --- a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkDeployer.sol:ColonyNetworkDeployer.json +++ b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkDeployer.sol:ColonyNetworkDeployer.json @@ -378,7 +378,7 @@ }, { "contract": "contracts/colonyNetwork/ColonyNetworkDeployer.sol:ColonyNetworkDeployer", - "label": "deprecated", + "label": "DEPRECATED_deprecated", "offset": 1, "slot": "3", "type": { diff --git a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkENS.sol:ColonyNetworkENS.json b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkENS.sol:ColonyNetworkENS.json index a8fc4c27d2..75279a954a 100644 --- a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkENS.sol:ColonyNetworkENS.json +++ b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkENS.sol:ColonyNetworkENS.json @@ -378,7 +378,7 @@ }, { "contract": "contracts/colonyNetwork/ColonyNetworkENS.sol:ColonyNetworkENS", - "label": "deprecated", + "label": "DEPRECATED_deprecated", "offset": 1, "slot": "3", "type": { diff --git a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkExtensions.sol:ColonyNetworkExtensions.json b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkExtensions.sol:ColonyNetworkExtensions.json index 8fa7c942d5..ee28e7b452 100644 --- a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkExtensions.sol:ColonyNetworkExtensions.json +++ b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkExtensions.sol:ColonyNetworkExtensions.json @@ -378,7 +378,7 @@ }, { "contract": "contracts/colonyNetwork/ColonyNetworkExtensions.sol:ColonyNetworkExtensions", - "label": "deprecated", + "label": "DEPRECATED_deprecated", "offset": 1, "slot": "3", "type": { diff --git a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkMining.sol:ColonyNetworkMining.json b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkMining.sol:ColonyNetworkMining.json index dca38f681a..5b54957cde 100644 --- a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkMining.sol:ColonyNetworkMining.json +++ b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkMining.sol:ColonyNetworkMining.json @@ -378,7 +378,7 @@ }, { "contract": "contracts/colonyNetwork/ColonyNetworkMining.sol:ColonyNetworkMining", - "label": "deprecated", + "label": "DEPRECATED_deprecated", "offset": 1, "slot": "3", "type": { diff --git a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkSkills.sol:ColonyNetworkSkills.json b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkSkills.sol:ColonyNetworkSkills.json index 64564306dd..50f4099485 100644 --- a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkSkills.sol:ColonyNetworkSkills.json +++ b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkSkills.sol:ColonyNetworkSkills.json @@ -378,7 +378,7 @@ }, { "contract": "contracts/colonyNetwork/ColonyNetworkSkills.sol:ColonyNetworkSkills", - "label": "deprecated", + "label": "DEPRECATED_deprecated", "offset": 1, "slot": "3", "type": { diff --git a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkStorage.sol:ColonyNetworkStorage.json b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkStorage.sol:ColonyNetworkStorage.json index d1f183ad6a..3a616e1cf4 100644 --- a/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkStorage.sol:ColonyNetworkStorage.json +++ b/.storage-layouts-normalized/contracts/colonyNetwork/ColonyNetworkStorage.sol:ColonyNetworkStorage.json @@ -378,7 +378,7 @@ }, { "contract": "contracts/colonyNetwork/ColonyNetworkStorage.sol:ColonyNetworkStorage", - "label": "deprecated", + "label": "DEPRECATED_deprecated", "offset": 1, "slot": "3", "type": { diff --git a/.storage-layouts-normalized/contracts/testHelpers/FunctionsNotAvailableOnColony.sol:FunctionsNotAvailableOnColony.json b/.storage-layouts-normalized/contracts/testHelpers/FunctionsNotAvailableOnColony.sol:FunctionsNotAvailableOnColony.json index c9857d8439..24a785490f 100644 --- a/.storage-layouts-normalized/contracts/testHelpers/FunctionsNotAvailableOnColony.sol:FunctionsNotAvailableOnColony.json +++ b/.storage-layouts-normalized/contracts/testHelpers/FunctionsNotAvailableOnColony.sol:FunctionsNotAvailableOnColony.json @@ -770,9 +770,20 @@ "label": "uint256", "numberOfBytes": "32" } + }, + { + "contract": "contracts/testHelpers/FunctionsNotAvailableOnColony.sol:FunctionsNotAvailableOnColony", + "label": "deprecated", + "offset": 0, + "slot": "2", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } } ], - "numberOfBytes": "64" + "numberOfBytes": "96" } } }, @@ -1335,7 +1346,7 @@ }, { "contract": "contracts/testHelpers/FunctionsNotAvailableOnColony.sol:FunctionsNotAvailableOnColony", - "label": "localSkills", + "label": "DEPRECATED_localSkills", "offset": 0, "slot": "37", "type": { @@ -1353,6 +1364,51 @@ "numberOfBytes": "1" } } + }, + { + "contract": "contracts/testHelpers/FunctionsNotAvailableOnColony.sol:FunctionsNotAvailableOnColony", + "label": "localSkills", + "offset": 0, + "slot": "38", + "type": { + "encoding": "mapping", + "key": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "label": "mapping(uint256 => struct ColonyDataTypes.LocalSkill)", + "numberOfBytes": "32", + "value": { + "encoding": "inplace", + "label": "struct ColonyDataTypes.LocalSkill", + "members": [ + { + "contract": "contracts/testHelpers/FunctionsNotAvailableOnColony.sol:FunctionsNotAvailableOnColony", + "label": "exists", + "offset": 0, + "slot": "0", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } + }, + { + "contract": "contracts/testHelpers/FunctionsNotAvailableOnColony.sol:FunctionsNotAvailableOnColony", + "label": "deprecated", + "offset": 1, + "slot": "0", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } + } + ], + "numberOfBytes": "32" + } + } } ] } \ No newline at end of file diff --git a/.storage-layouts-normalized/contracts/testHelpers/NoLimitSubdomains.sol:NoLimitSubdomains.json b/.storage-layouts-normalized/contracts/testHelpers/NoLimitSubdomains.sol:NoLimitSubdomains.json index a5d491b66e..6b1c66e44e 100644 --- a/.storage-layouts-normalized/contracts/testHelpers/NoLimitSubdomains.sol:NoLimitSubdomains.json +++ b/.storage-layouts-normalized/contracts/testHelpers/NoLimitSubdomains.sol:NoLimitSubdomains.json @@ -770,9 +770,20 @@ "label": "uint256", "numberOfBytes": "32" } + }, + { + "contract": "contracts/testHelpers/NoLimitSubdomains.sol:NoLimitSubdomains", + "label": "deprecated", + "offset": 0, + "slot": "2", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } } ], - "numberOfBytes": "64" + "numberOfBytes": "96" } } }, @@ -1335,7 +1346,7 @@ }, { "contract": "contracts/testHelpers/NoLimitSubdomains.sol:NoLimitSubdomains", - "label": "localSkills", + "label": "DEPRECATED_localSkills", "offset": 0, "slot": "37", "type": { @@ -1353,6 +1364,51 @@ "numberOfBytes": "1" } } + }, + { + "contract": "contracts/testHelpers/NoLimitSubdomains.sol:NoLimitSubdomains", + "label": "localSkills", + "offset": 0, + "slot": "38", + "type": { + "encoding": "mapping", + "key": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "label": "mapping(uint256 => struct ColonyDataTypes.LocalSkill)", + "numberOfBytes": "32", + "value": { + "encoding": "inplace", + "label": "struct ColonyDataTypes.LocalSkill", + "members": [ + { + "contract": "contracts/testHelpers/NoLimitSubdomains.sol:NoLimitSubdomains", + "label": "exists", + "offset": 0, + "slot": "0", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } + }, + { + "contract": "contracts/testHelpers/NoLimitSubdomains.sol:NoLimitSubdomains", + "label": "deprecated", + "offset": 1, + "slot": "0", + "type": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + } + } + ], + "numberOfBytes": "32" + } + } } ] } \ No newline at end of file From d981b4bc5f7f69a9aa62e5b3a06bdc85afa27a1d Mon Sep 17 00:00:00 2001 From: Daniel Kronovet Date: Fri, 25 Oct 2024 14:57:46 -0400 Subject: [PATCH 09/11] Clean up deprecation --- contracts/colony/ColonyAuthority.sol | 10 +- contracts/colony/ColonyStorage.sol | 8 - contracts/tokenLocking/TokenLocking.sol | 4 - test-smoke/colony-storage-consistent.js | 175 -------------------- test/packages/metaTransactionBroadcaster.js | 4 - 5 files changed, 5 insertions(+), 196 deletions(-) delete mode 100644 test-smoke/colony-storage-consistent.js diff --git a/contracts/colony/ColonyAuthority.sol b/contracts/colony/ColonyAuthority.sol index 0af8c8b6a8..51977070d2 100644 --- a/contracts/colony/ColonyAuthority.sol +++ b/contracts/colony/ColonyAuthority.sol @@ -47,7 +47,7 @@ contract ColonyAuthority is CommonAuthority { addRoleCapability(ADMINISTRATION_ROLE, "finalizePayment(uint256,uint256,uint256)"); // Only for versions < 14 // Add permissions for the Funding role - addRoleCapability(FUNDING_ROLE, "moveFundsBetweenPots(uint256,uint256,uint256,uint256,uint256,uint256,address)"); + addRoleCapability(FUNDING_ROLE, "moveFundsBetweenPots(uint256,uint256,uint256,uint256,uint256,uint256,address)"); // Deprecated // Add permissions for the Architecture role addRoleCapability(ARCHITECTURE_ROLE, "addDomain(uint256,uint256,uint256)"); @@ -84,9 +84,9 @@ contract ColonyAuthority is CommonAuthority { // Added in colony v4 (burgundy-glider) addRoleCapability(ADMINISTRATION_ROLE, "makeExpenditure(uint256,uint256,uint256)"); - addRoleCapability(ARBITRATION_ROLE, "transferExpenditureViaArbitration(uint256,uint256,uint256,address)"); - addRoleCapability(ARBITRATION_ROLE, "setExpenditurePayoutModifier(uint256,uint256,uint256,uint256,int256)"); - addRoleCapability(ARBITRATION_ROLE, "setExpenditureClaimDelay(uint256,uint256,uint256,uint256,uint256)"); + addRoleCapability(ARBITRATION_ROLE, "transferExpenditureViaArbitration(uint256,uint256,uint256,address)"); // Deprecated + addRoleCapability(ARBITRATION_ROLE, "setExpenditurePayoutModifier(uint256,uint256,uint256,uint256,int256)"); // Deprecated + addRoleCapability(ARBITRATION_ROLE, "setExpenditureClaimDelay(uint256,uint256,uint256,uint256,uint256)"); // Deprecated // Added in colony v5 (cerulean-lwss) addRoleCapability(ROOT_ROLE, "setPayoutWhitelist(address,bool)"); @@ -98,7 +98,7 @@ contract ColonyAuthority is CommonAuthority { addRoleCapability(ROOT_ROLE, "upgradeExtension(bytes32,uint256)"); addRoleCapability(ROOT_ROLE, "deprecateExtension(bytes32,bool)"); addRoleCapability(ROOT_ROLE, "uninstallExtension(bytes32)"); - addRoleCapability(ROOT_ROLE, "makeArbitraryTransaction(address,bytes)"); + addRoleCapability(ROOT_ROLE, "makeArbitraryTransaction(address,bytes)"); // Deprecated addRoleCapability(ROOT_ROLE, "emitDomainReputationReward(uint256,address,int256)"); addRoleCapability(ROOT_ROLE, "emitSkillReputationReward(uint256,address,int256)"); addRoleCapability(ARBITRATION_ROLE, "transferStake(uint256,uint256,address,address,uint256,uint256,address)"); diff --git a/contracts/colony/ColonyStorage.sol b/contracts/colony/ColonyStorage.sol index 7e855c1afa..6a06d1c87d 100755 --- a/contracts/colony/ColonyStorage.sol +++ b/contracts/colony/ColonyStorage.sol @@ -348,13 +348,5 @@ contract ColonyStorage is ColonyDataTypes, ColonyNetworkDataTypes, DSMath, Commo } require(false, "require-execute-call-reverted-with-no-error"); } - // assembly { - // // call contract at address a with input mem[in…(in+insize)) - // // providing g gas and v wei and output area mem[out…(out+outsize)) - // // returning 0 on error (eg. out of gas) and 1 on success - - // // call(g, a, v, in, insize, out, outsize) - // success := call(gas(), to, value, add(data, 0x20), mload(data), 0, 0) - // } } } diff --git a/contracts/tokenLocking/TokenLocking.sol b/contracts/tokenLocking/TokenLocking.sol index 00a3798148..1bc87bdf60 100644 --- a/contracts/tokenLocking/TokenLocking.sol +++ b/contracts/tokenLocking/TokenLocking.sol @@ -235,10 +235,6 @@ contract TokenLocking is emit StakeTransferred(_token, msgSender(), _user, _recipient, _amount); } - function reward(address _recipient, uint256 _amount) public pure { - // solhint-disable-line no-empty-blocks - } - function getTotalLockCount(address _token) public view returns (uint256) { return totalLockCount[_token]; } diff --git a/test-smoke/colony-storage-consistent.js b/test-smoke/colony-storage-consistent.js deleted file mode 100644 index f07bf7b103..0000000000 --- a/test-smoke/colony-storage-consistent.js +++ /dev/null @@ -1,175 +0,0 @@ -/* global artifacts */ -const chai = require("chai"); -const bnChai = require("bn-chai"); -const BN = require("bn.js"); - -const { UINT256_MAX, WAD } = require("../helpers/constants"); -const { fundColonyWithTokens, setupColony } = require("../helpers/test-data-generator"); - -const { expect } = chai; -chai.use(bnChai(web3.utils.BN)); - -const EtherRouter = artifacts.require("EtherRouter"); -const IColonyNetwork = artifacts.require("IColonyNetwork"); -const IMetaColony = artifacts.require("IMetaColony"); -const Token = artifacts.require("Token"); -const TokenAuthority = artifacts.require("TokenAuthority"); -const ContractEditing = artifacts.require("ContractEditing"); -const Resolver = artifacts.require("Resolver"); - -contract("Contract Storage", (accounts) => { - const SLOT0 = 0; - - const RECIPIENT = accounts[3]; - const ADMIN = accounts[4]; - const ARBITRATOR = accounts[5]; - - let colony; - let token; - let localSkillId; - let otherToken; - let colonyNetwork; - let metaColony; - let domain1; - let tokenLockingAddress; - - before(async () => { - // We use our own providers for these test(s) so we can really get in to it... - - const etherRouter = await EtherRouter.deployed(); - colonyNetwork = await IColonyNetwork.at(etherRouter.address); - const metaColonyAddress = await colonyNetwork.getMetaColony(); - metaColony = await IMetaColony.at(metaColonyAddress); - - token = await Token.new("name", "symbol", 18); - await token.unlock(); - - colony = await setupColony(colonyNetwork, token.address); - - await colony.addLocalSkill(); - localSkillId = await colonyNetwork.getSkillCount(); - - tokenLockingAddress = await colonyNetwork.getTokenLocking(); - const tokenAuthority = await TokenAuthority.new(token.address, colony.address, [tokenLockingAddress]); - await token.setAuthority(tokenAuthority.address); - - await colony.setRewardInverse(100); - await colony.setAdministrationRole(1, UINT256_MAX, ADMIN, 1, true); - await colony.setArbitrationRole(1, UINT256_MAX, ARBITRATOR, 1, true); - await fundColonyWithTokens(colony, token, UINT256_MAX); - domain1 = await colony.getDomain(1); - - otherToken = await Token.new("otherName", "otherSymbol", 18); - await otherToken.unlock(); - await fundColonyWithTokens(colony, otherToken, UINT256_MAX); - }); - - function getAddressStateHash(address) { - return new Promise((resolve, reject) => { - web3.currentProvider - .request({ method: "eth_getProof", params: [address, [], "latest"] }) - .then((result) => { - return resolve(result.storageHash); - }) - .catch((e) => { - reject(e); - }); - }); - } - - describe("Smoke tests to check our storage layout does not change", () => { - // There are many things you could do that one would expect to change these hashes. If you've made changes that change the contents of storage of a - // contract, then these hashes will change. This could include adding an extra transaction somewhere, which could cause the address a contract is - // deployed to change, which if it is stored somewhere would cause the state hash of the storage to change. - - // If you haven't touched the contracts, however, and this test fails, then something is afoot. - // In theory, the storage slots used by solidity could change in an upgrade, - // which this test was written with in mind to try and detect. They don't guarantee this hasn't happened if they pass, but if they fail without just - // cause then we need to think very carefully about what's going on. - - it("storage contents should be as expected", async () => { - await colony.makeExpenditure(1, UINT256_MAX, 1, { from: ADMIN }); - const expenditureId = await colony.getExpenditureCount(); - - await colony.setExpenditureRecipients(expenditureId, [SLOT0], [RECIPIENT], { from: ADMIN }); - await colony.setExpenditurePayouts(expenditureId, [SLOT0], token.address, [WAD], { from: ADMIN }); - await colony.setExpenditureSkills(expenditureId, [SLOT0], [localSkillId], { from: ADMIN }); - - const expenditure = await colony.getExpenditure(expenditureId); - await colony.moveFundsBetweenPots( - 1, - UINT256_MAX, - 1, - UINT256_MAX, - UINT256_MAX, - domain1.fundingPotId, - expenditure.fundingPotId, - WAD, - token.address, - ); - await colony.finalizeExpenditure(expenditureId, { from: ADMIN }); - await colony.claimExpenditurePayout(expenditureId, SLOT0, token.address); - - const miningCycleAddress = await colonyNetwork.getReputationMiningCycle(false); - const miningCycleStateHash = await getAddressStateHash(miningCycleAddress); - - // For this test to be reproducible, have to zero timestamps / time depenedent things - // For colonyNetwork, that means the mining staking timestamp - - const contractEditing = await ContractEditing.new(); - const networkAsER = await EtherRouter.at(colonyNetwork.address); - const colonyNetworkResolverAddress = await networkAsER.resolver(); - const colonyNetworkResolver = await Resolver.at(colonyNetworkResolverAddress); - await colonyNetworkResolver.register("setStorageSlot(uint256,bytes32)", contractEditing.address); - const editableNetwork = await ContractEditing.at(colonyNetwork.address); - - // Following - // https://solidity.readthedocs.io/en/v0.6.8/internals/layout_in_storage.html#mappings-and-dynamic-arrays - // This is the hash of the key (the address) and the storage slot containing the mapping (33) - let hashable = `0x000000000000000000000000${accounts[5].slice(2)}${new BN(33).toString(16, 64)}`; - let hashed = web3.utils.soliditySha3(hashable); - let slot = new BN(hashed.slice(2), 16); - // To get the slot containing the timestamp of the miner submission, we add one to where the struct starts - // (see ColonyNetworkDataTypes) - slot = slot.addn(1); - - await editableNetwork.setStorageSlot(slot, "0x0000000000000000000000000000000000000000000000000000000000000000"); - - // Also zero out the slot containing the current colony version - await editableNetwork.setStorageSlot(7, "0x0000000000000000000000000000000000000000000000000000000000000000"); - - const colonyNetworkStateHash = await getAddressStateHash(colonyNetwork.address); - - // We did a whole expenditure above, so let's take out the finalized timestamp - // This is the hash of the expenditure id (1) with the storage slot (25) to find the location of the struct - hashable = `0x${new BN(1).toString(16, 64)}${new BN(25).toString(16, 64)}`; - hashed = web3.utils.soliditySha3(hashable); - slot = new BN(hashed.slice(2), 16); - // To find the slot storing the timestamp, we add three to where the struct starts (see ColonyDataTypes). - slot = slot.addn(3); - - const colonyAsER = await EtherRouter.at(colony.address); - const colonyResolverAddress = await colonyAsER.resolver(); - const colonyResolver = await Resolver.at(colonyResolverAddress); - await colonyResolver.register("setStorageSlot(uint256,bytes32)", contractEditing.address); - const editableColony = await ContractEditing.at(colony.address); - await editableColony.setStorageSlot(slot, "0x0000000000000000000000000000000000000000000000000000000000000000"); - - const colonyStateHash = await getAddressStateHash(colony.address); - const metaColonyStateHash = await getAddressStateHash(metaColony.address); - const tokenLockingStateHash = await getAddressStateHash(tokenLockingAddress); - - console.log("colonyNetworkStateHash:", colonyNetworkStateHash); - console.log("colonyStateHash:", colonyStateHash); - console.log("metaColonyStateHash:", metaColonyStateHash); - console.log("miningCycleStateHash:", miningCycleStateHash); - console.log("tokenLockingStateHash:", tokenLockingStateHash); - - expect(colonyNetworkStateHash).to.equal("0x7c394f57b45ff6fd37a512c33427d9a9bb31bc393dee3316ec9076c1b477100c"); - expect(colonyStateHash).to.equal("0x97af08abf31d5320c2ef7d118ca25ce42b6ea874bfaccc17bee28132314d6a30"); - expect(metaColonyStateHash).to.equal("0x4e2dc36a06a282d10673d50908bfab9e7f56ae28e8a318286426b3c67eced2e9"); - expect(miningCycleStateHash).to.equal("0xff6aae2cdd6dbb74ca9cb2e5fd625d80679538f0f95d35b4616b5e2df82df622"); - expect(tokenLockingStateHash).to.equal("0xf3ba80967cecfdb7d1f6f9d92e3f1484dcb81557911efe5135b0315f915c5294"); - }); - }); -}); diff --git a/test/packages/metaTransactionBroadcaster.js b/test/packages/metaTransactionBroadcaster.js index f1d292b15a..bd1f948a8b 100644 --- a/test/packages/metaTransactionBroadcaster.js +++ b/test/packages/metaTransactionBroadcaster.js @@ -120,7 +120,6 @@ contract("Metatransaction broadcaster", (accounts) => { }); it("transactions that try to execute a forbidden method on a Colony are rejected", async function () { - // let txData = await colony.contract.methods.makeArbitraryTransaction(colony.address, "0x00000000").encodeABI(); let txData = await encodeTxData(colony, "makeArbitraryTransaction(address,bytes)", [colony.address, "0x00000000"]); let valid = await broadcaster.isColonyFamilyTransactionAllowed(colony.address, txData); expect(valid).to.be.equal(false); @@ -644,9 +643,6 @@ contract("Metatransaction broadcaster", (accounts) => { web3.utils.soliditySha3("owner()").slice(0, 10), ]); - // const txData2 = await colony.contract.methods - // .makeArbitraryTransaction(resolverAddress, web3.utils.soliditySha3("owner()").slice(0, 10)) - // .encodeABI(); const txData = await colony.contract.methods.multicall([txData1, txData2]).encodeABI(); const { r, s, v } = await getMetaTransactionParameters(txData, USER0, colony.address); // Send to endpoint From 905caa5929d7a6b133e45a1761f86b4fb236d639 Mon Sep 17 00:00:00 2001 From: Daniel Kronovet Date: Wed, 30 Oct 2024 17:41:14 -0700 Subject: [PATCH 10/11] Deprecate makeArbitraryTransactions --- .../colony/ColonyArbitraryTransaction.sol | 38 -------- contracts/colony/ColonyAuthority.sol | 4 +- contracts/colony/IColony.sol | 17 +--- docs/interfaces/icolony.md | 28 +----- docs/interfaces/imetacolony.md | 28 +----- .../MetatransactionBroadcaster.js | 8 +- .../colony-arbitrary-transactions.js | 96 ++++++------------- test/contracts-network/colony-permissions.js | 2 +- test/contracts-network/colony-recovery.js | 3 +- test/cross-chain/cross-chain.js | 2 +- test/packages/metaTransactionBroadcaster.js | 16 ++-- 11 files changed, 59 insertions(+), 183 deletions(-) diff --git a/contracts/colony/ColonyArbitraryTransaction.sol b/contracts/colony/ColonyArbitraryTransaction.sol index 3786c35c9f..50d388e30f 100644 --- a/contracts/colony/ColonyArbitraryTransaction.sol +++ b/contracts/colony/ColonyArbitraryTransaction.sol @@ -38,44 +38,6 @@ contract ColonyArbitraryTransaction is ColonyStorage { address _to, bytes memory _action ) public stoppable auth returns (bool) { - bool res = this.makeSingleArbitraryTransaction(_to, _action); - - emit ArbitraryTransaction(msgSender(), _to, _action, res); - return res; - } - - function makeArbitraryTransactions( - address[] memory _targets, - bytes[] memory _actions, - bool _strict - ) public stoppable auth returns (bool) { - require(_targets.length == _actions.length, "colony-targets-and-actions-length-mismatch"); - for (uint256 i; i < _targets.length; i += 1) { - bool success = true; - // slither-disable-next-line unused-return - try this.makeSingleArbitraryTransaction(_targets[i], _actions[i]) returns (bool ret) { - if (_strict) { - success = ret; - } - - emit ArbitraryTransaction(msgSender(), _targets[i], _actions[i], ret); - } catch Error(string memory _err) { - // We failed in a require, which is only okay if we're not in strict mode - if (_strict) { - success = false; - } - - emit ArbitraryTransaction(msgSender(), _targets[i], _actions[i], false); - } - require(success, "colony-arbitrary-transaction-failed"); - } - return true; - } - - function makeSingleArbitraryTransaction( - address _to, - bytes memory _action - ) external stoppable self returns (bool) { // Prevent transactions to network contracts require(_to != address(this), "colony-cannot-target-self"); require(_to != colonyNetworkAddress, "colony-cannot-target-network"); diff --git a/contracts/colony/ColonyAuthority.sol b/contracts/colony/ColonyAuthority.sol index 51977070d2..2323e50363 100644 --- a/contracts/colony/ColonyAuthority.sol +++ b/contracts/colony/ColonyAuthority.sol @@ -98,7 +98,7 @@ contract ColonyAuthority is CommonAuthority { addRoleCapability(ROOT_ROLE, "upgradeExtension(bytes32,uint256)"); addRoleCapability(ROOT_ROLE, "deprecateExtension(bytes32,bool)"); addRoleCapability(ROOT_ROLE, "uninstallExtension(bytes32)"); - addRoleCapability(ROOT_ROLE, "makeArbitraryTransaction(address,bytes)"); // Deprecated + addRoleCapability(ROOT_ROLE, "makeArbitraryTransaction(address,bytes)"); addRoleCapability(ROOT_ROLE, "emitDomainReputationReward(uint256,address,int256)"); addRoleCapability(ROOT_ROLE, "emitSkillReputationReward(uint256,address,int256)"); addRoleCapability(ARBITRATION_ROLE, "transferStake(uint256,uint256,address,address,uint256,uint256,address)"); @@ -116,7 +116,7 @@ contract ColonyAuthority is CommonAuthority { addRoleCapability(FUNDING_ROLE, "moveFundsBetweenPots(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,address)"); // Added in colony v8 (ebony-lwss) - addRoleCapability(ROOT_ROLE, "makeArbitraryTransactions(address[],bytes[],bool)"); + addRoleCapability(ROOT_ROLE, "makeArbitraryTransactions(address[],bytes[],bool)"); // Deprecated addRoleCapability(ROOT_ROLE, "setDefaultGlobalClaimDelay(uint256)"); addRoleCapability(ARBITRATION_ROLE, "setExpenditureMetadata(uint256,uint256,uint256,string)"); diff --git a/contracts/colony/IColony.sol b/contracts/colony/IColony.sol index f7d51aa163..5bb51fd3ea 100644 --- a/contracts/colony/IColony.sol +++ b/contracts/colony/IColony.sol @@ -51,24 +51,11 @@ interface IColony is IDSAuth, ColonyDataTypes, IRecovery, IBasicMetaTransaction, /// @return tokenAddress Address of the token contract function getToken() external view returns (address tokenAddress); - /// @notice Execute arbitrary transactions on behalf of the Colony in series - /// @param _targets Array of addressed to be targeted - /// @param _actions Array of Bytes arrays encoding the function calls and arguments - /// @param _strict Boolean indicating whether if one transaction fails, the whole call to this function should fail. - /// @return success Boolean indicating whether the transactions succeeded - function makeArbitraryTransactions( - address[] memory _targets, - bytes[] memory _actions, - bool _strict - ) external returns (bool success); - - /// @notice Executes a single arbitrary transaction - /// @dev Only callable by the colony itself. If you wish to use this functionality, you should - /// use the makeAbitraryTransactions function + /// @notice Executes an arbitrary transaction /// @param _target Contract to receive the function call /// @param _action Bytes array encoding the function call and arguments /// @return success Boolean indicating whether the transactions succeeded - function makeSingleArbitraryTransaction( + function makeArbitraryTransaction( address _target, bytes memory _action ) external returns (bool success); diff --git a/docs/interfaces/icolony.md b/docs/interfaces/icolony.md index 1c880587d5..692efa6b09 100644 --- a/docs/interfaces/icolony.md +++ b/docs/interfaces/icolony.md @@ -1049,18 +1049,17 @@ Lock the colony's token. Can only be called by a network-managed extension. |---|---|---| |timesLocked|uint256|The amount of times the token was locked -### ▸ `makeArbitraryTransactions(address[] memory _targets, bytes[] memory _actions, bool _strict):bool success` +### ▸ `makeArbitraryTransaction(address _target, bytes memory _action):bool success` -Execute arbitrary transactions on behalf of the Colony in series +Executes an arbitrary transaction **Parameters** |Name|Type|Description| |---|---|---| -|_targets|address[]|Array of addressed to be targeted -|_actions|bytes[]|Array of Bytes arrays encoding the function calls and arguments -|_strict|bool|Boolean indicating whether if one transaction fails, the whole call to this function should fail. +|_target|address|Contract to receive the function call +|_action|bytes|Bytes array encoding the function call and arguments **Return Parameters** @@ -1087,25 +1086,6 @@ Add a new expenditure in the colony. Secured function to authorised members. |---|---|---| |expenditureId|uint256|Identifier of the newly created expenditure -### ▸ `makeSingleArbitraryTransaction(address _target, bytes memory _action):bool success` - -Executes a single arbitrary transaction - -*Note: Only callable by the colony itself. If you wish to use this functionality, you should use the makeAbitraryTransactions function* - -**Parameters** - -|Name|Type|Description| -|---|---|---| -|_target|address|Contract to receive the function call -|_action|bytes|Bytes array encoding the function call and arguments - -**Return Parameters** - -|Name|Type|Description| -|---|---|---| -|success|bool|Boolean indicating whether the transactions succeeded - ### ▸ `mintTokens(uint256 _wad)` Mint `_wad` amount of colony tokens. Secured function to authorised members. diff --git a/docs/interfaces/imetacolony.md b/docs/interfaces/imetacolony.md index 01562aadc2..1fe35efde5 100644 --- a/docs/interfaces/imetacolony.md +++ b/docs/interfaces/imetacolony.md @@ -1087,18 +1087,17 @@ Lock the colony's token. Can only be called by a network-managed extension. |---|---|---| |timesLocked|uint256|The amount of times the token was locked -### ▸ `makeArbitraryTransactions(address[] memory _targets, bytes[] memory _actions, bool _strict):bool success` +### ▸ `makeArbitraryTransaction(address _target, bytes memory _action):bool success` -Execute arbitrary transactions on behalf of the Colony in series +Executes an arbitrary transaction **Parameters** |Name|Type|Description| |---|---|---| -|_targets|address[]|Array of addressed to be targeted -|_actions|bytes[]|Array of Bytes arrays encoding the function calls and arguments -|_strict|bool|Boolean indicating whether if one transaction fails, the whole call to this function should fail. +|_target|address|Contract to receive the function call +|_action|bytes|Bytes array encoding the function call and arguments **Return Parameters** @@ -1125,25 +1124,6 @@ Add a new expenditure in the colony. Secured function to authorised members. |---|---|---| |expenditureId|uint256|Identifier of the newly created expenditure -### ▸ `makeSingleArbitraryTransaction(address _target, bytes memory _action):bool success` - -Executes a single arbitrary transaction - -*Note: Only callable by the colony itself. If you wish to use this functionality, you should use the makeAbitraryTransactions function* - -**Parameters** - -|Name|Type|Description| -|---|---|---| -|_target|address|Contract to receive the function call -|_action|bytes|Bytes array encoding the function call and arguments - -**Return Parameters** - -|Name|Type|Description| -|---|---|---| -|success|bool|Boolean indicating whether the transactions succeeded - ### ▸ `mintTokens(uint256 _wad)` Mint `_wad` amount of colony tokens. Secured function to authorised members. diff --git a/packages/metatransaction-broadcaster/MetatransactionBroadcaster.js b/packages/metatransaction-broadcaster/MetatransactionBroadcaster.js index 962652cbb4..2ad764d48c 100644 --- a/packages/metatransaction-broadcaster/MetatransactionBroadcaster.js +++ b/packages/metatransaction-broadcaster/MetatransactionBroadcaster.js @@ -206,8 +206,12 @@ class MetatransactionBroadcaster { async isColonyFamilyTransactionAllowed(target, txData, userAddress) { const colonyDef = await this.loader.load({ contractDir: "colony", contractName: "IColony" }); - // Add the old makeArbitraryTransaction to the abi - const iface = new ethers.utils.Interface(["function makeArbitraryTransaction(address,bytes)"]); + // Add the old makeSingleArbitraryTransaction and makeArbitraryTransactions to the abi + const iface = new ethers.utils.Interface([ + "function makeSingleArbitraryTransaction(address,bytes)", + "function makeArbitraryTransactions(address[],bytes[],bool)", + ]); + const oldJsonAbi = JSON.parse(iface.format(ethers.utils.FormatTypes.json)); oldJsonAbi[0].inputs = oldJsonAbi[0].inputs.map((x) => { return { ...x, internalType: x.type }; diff --git a/test/contracts-network/colony-arbitrary-transactions.js b/test/contracts-network/colony-arbitrary-transactions.js index 5ac7bce856..d1dd383d50 100644 --- a/test/contracts-network/colony-arbitrary-transactions.js +++ b/test/contracts-network/colony-arbitrary-transactions.js @@ -17,7 +17,6 @@ const OneTxPayment = artifacts.require("OneTxPayment"); const EtherRouter = artifacts.require("EtherRouter"); const IColonyNetwork = artifacts.require("IColonyNetwork"); const ITokenLocking = artifacts.require("ITokenLocking"); -const ColonyArbitraryTransaction = artifacts.require("ColonyArbitraryTransaction"); contract("Colony Arbitrary Transactions", (accounts) => { let colony; @@ -41,7 +40,7 @@ contract("Colony Arbitrary Transactions", (accounts) => { const action = await encodeTxData(token, "mint", [WAD]); const balancePre = await token.balanceOf(colony.address); - const tx = await colony.makeArbitraryTransactions([token.address], [action], true); + const tx = await colony.makeArbitraryTransaction(token.address, action); await expectEvent(tx, "ArbitraryTransaction(address,address,bytes,bool)", [accounts[0], token.address, action, true]); @@ -54,7 +53,10 @@ contract("Colony Arbitrary Transactions", (accounts) => { const action2 = await encodeTxData(token, "mint", [WAD.muln(2)]); const balancePre = await token.balanceOf(colony.address); - const tx = await colony.makeArbitraryTransactions([token.address, token.address], [action, action2], true); + const arbitraryAction = await encodeTxData(colony, "makeArbitraryTransaction", [token.address, action]); + const arbitraryAction2 = await encodeTxData(colony, "makeArbitraryTransaction", [token.address, action2]); + + const tx = await colony.multicall([arbitraryAction, arbitraryAction2]); await expectEvent(tx, "ArbitraryTransaction(address,address,bytes,bool)", [USER0, token.address, action, true]); await expectEvent(tx, "ArbitraryTransaction(address,address,bytes,bool)", [USER0, token.address, action2, true]); @@ -63,56 +65,18 @@ contract("Colony Arbitrary Transactions", (accounts) => { expect(balancePost.sub(balancePre)).to.eq.BN(WAD.muln(3)); }); - it("should be able to make multiple arbitrary transactions and revert if one fails in strict mode", async () => { - const action = await encodeTxData(token, "mint", [WAD]); - const action2 = await encodeTxData(token, "mint", [WAD.muln(2)]); - const balancePre = await token.balanceOf(colony.address); - - await checkErrorRevert(colony.makeArbitraryTransactions([token.address, colony.address], [action, action2], true), "colony-cannot-target-self"); - - const balancePost = await token.balanceOf(colony.address); - expect(balancePost).to.eq.BN(balancePre); - }); - - it("should be able to make multiple arbitrary transactions and not revert if one fails not in strict mode", async () => { - const action = await encodeTxData(token, "mint", [WAD]); - const action2 = await encodeTxData(token, "mint", [WAD.muln(2)]); - const balancePre = await token.balanceOf(colony.address); - - await colony.makeArbitraryTransactions([token.address, ADDRESS_ZERO], [action, action2], false); - - const balancePost = await token.balanceOf(colony.address); - expect(balancePost.sub(balancePre)).to.eq.BN(WAD); - }); - - it("should be able to make multiple arbitrary transactions", async () => { - const action = await encodeTxData(token, "mint", [WAD]); - const action2 = await encodeTxData(token, "mint", [WAD.muln(2)]); - const balancePre = await token.balanceOf(colony.address); - - await colony.makeArbitraryTransactions([token.address, token.address], [action, action2], true); - - const balancePost = await token.balanceOf(colony.address); - expect(balancePost.sub(balancePre)).to.eq.BN(WAD.muln(3)); - }); - it("should not be able to make arbitrary transactions if not root", async () => { const action = await encodeTxData(token, "mint", [WAD]); - await checkErrorRevert(colony.makeArbitraryTransactions([token.address], [action], true, { from: USER1 }), "ds-auth-unauthorized"); + await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action, { from: USER1 }), "ds-auth-unauthorized"); }); it("should not be able to make arbitrary transactions to a colony itself", async () => { - await checkErrorRevert(colony.makeArbitraryTransactions([colony.address], ["0x0"], true), "colony-cannot-target-self"); + await checkErrorRevert(colony.makeArbitraryTransaction(colony.address, "0x0"), "colony-cannot-target-self"); }); it("should not be able to make arbitrary transactions to a user address", async () => { - await checkErrorRevert(colony.makeArbitraryTransactions([accounts[0]], ["0x0"], true), "colony-to-must-be-contract"); - }); - - it("should not be able to make single arbitrary transactions directly", async () => { - const colonyArbitraryTransactions = await ColonyArbitraryTransaction.at(colony.address); - await checkErrorRevert(colonyArbitraryTransactions.makeSingleArbitraryTransaction(colony.address, "0x0"), "colony-not-self"); + await checkErrorRevert(colony.makeArbitraryTransaction(accounts[0], "0x0"), "colony-to-must-be-contract"); }); it("should not be able to make arbitrary transactions to network or token locking", async () => { @@ -122,14 +86,14 @@ contract("Colony Arbitrary Transactions", (accounts) => { const action1 = await encodeTxData(colonyNetwork, "addSkill", [0]); const action2 = await encodeTxData(tokenLocking, "lockToken", [token.address]); - await checkErrorRevert(colony.makeArbitraryTransactions([colonyNetwork.address], [action1], true), "colony-cannot-target-network"); - await checkErrorRevert(colony.makeArbitraryTransactions([tokenLocking.address], [action2], true), "colony-cannot-target-token-locking"); + await checkErrorRevert(colony.makeArbitraryTransaction(colonyNetwork.address, action1), "colony-cannot-target-network"); + await checkErrorRevert(colony.makeArbitraryTransaction(tokenLocking.address, action2), "colony-cannot-target-token-locking"); }); it("if an arbitrary transaction is made to approve tokens, then tokens needed for approval cannot be moved out of the main pot", async () => { await fundColonyWithTokens(colony, token, 100); const action1 = await encodeTxData(token, "approve", [USER0, 50]); - await colony.makeArbitraryTransactions([token.address], [action1], true); + await colony.makeArbitraryTransaction(token.address, action1); await colony.moveFundsBetweenPots(1, UINT256_MAX, 1, UINT256_MAX, UINT256_MAX, 1, 0, 50, token.address); await checkErrorRevert( colony.moveFundsBetweenPots(1, UINT256_MAX, 1, UINT256_MAX, UINT256_MAX, 1, 0, 50, token.address), @@ -145,7 +109,7 @@ contract("Colony Arbitrary Transactions", (accounts) => { tokens can only be moved from main pot that weren't part of the allowance`, async () => { await fundColonyWithTokens(colony, token, 100); const action1 = await encodeTxData(token, "approve", [USER0, 20]); - await colony.makeArbitraryTransactions([token.address], [action1], true); + await colony.makeArbitraryTransaction(token.address, action1); // Use allowance await token.transferFrom(colony.address, USER0, 20, { from: USER0 }); // Approval tracking still thinks it has to reserve 20 @@ -177,9 +141,9 @@ contract("Colony Arbitrary Transactions", (accounts) => { await fundColonyWithTokens(colony, token, 100); const action1 = await encodeTxData(token, "approve", [USER0, 300]); // Not enough tokens at all - await checkErrorRevert(colony.makeArbitraryTransactions([token.address], [action1], true), "colony-approval-exceeds-balance"); + await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action1), "colony-approval-exceeds-balance"); await fundColonyWithTokens(colony, token, 1000); - await colony.makeArbitraryTransactions([token.address], [action1], true); + await colony.makeArbitraryTransaction(token.address, action1); // They are now approved for 300. let approval = await colony.getTokenApproval(token.address, USER0); expect(approval).to.be.eq.BN(300); @@ -188,14 +152,14 @@ contract("Colony Arbitrary Transactions", (accounts) => { const action2 = await encodeTxData(token, "approve", [USER0, 900]); // User was approved for 300, we now approve them for 900. There are enough tokens to cover this, even though 900 + 300 > 1100, the balance of the pot - await colony.makeArbitraryTransactions([token.address], [action2], true); + await colony.makeArbitraryTransaction(token.address, action2); approval = await colony.getTokenApproval(token.address, USER0); expect(approval).to.be.eq.BN(900); allApprovals = await colony.getTotalTokenApproval(token.address); expect(allApprovals).to.be.eq.BN(900); // Set them back to 300 - await colony.makeArbitraryTransactions([token.address], [action1], true); + await colony.makeArbitraryTransaction(token.address, action1); approval = await colony.getTokenApproval(token.address, USER0); expect(approval).to.be.eq.BN(300); allApprovals = await colony.getTotalTokenApproval(token.address); @@ -203,10 +167,10 @@ contract("Colony Arbitrary Transactions", (accounts) => { // Cannot approve someone else for 900 const action3 = await encodeTxData(token, "approve", [USER1, 900]); - await checkErrorRevert(colony.makeArbitraryTransactions([token.address], [action3], true), "colony-approval-exceeds-balance"); + await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action3), "colony-approval-exceeds-balance"); // But can for 800 const action4 = await encodeTxData(token, "approve", [USER1, 800]); - await colony.makeArbitraryTransactions([token.address], [action4], true); + await colony.makeArbitraryTransaction(token.address, action4); approval = await colony.getTokenApproval(token.address, USER1); expect(approval).to.be.eq.BN(800); allApprovals = await colony.getTotalTokenApproval(token.address); @@ -248,29 +212,29 @@ contract("Colony Arbitrary Transactions", (accounts) => { 0, ]); - await checkErrorRevert(colony.makeArbitraryTransactions([oneTxPayment.address], [action], true), "colony-cannot-target-extensions"); + await checkErrorRevert(colony.makeArbitraryTransaction(oneTxPayment.address, action), "colony-cannot-target-extensions"); // But other colonies can const { colony: otherColony } = await setupRandomColony(colonyNetwork); await colony.setUserRoles(1, UINT256_MAX, otherColony.address, 1, ROLES); - await otherColony.makeArbitraryTransactions([oneTxPayment.address], [action], true); + await otherColony.makeArbitraryTransaction(oneTxPayment.address, action); }); it("when burning tokens, can burn own tokens with burn(amount) up to the amount unspoken for in root pot", async () => { await fundColonyWithTokens(colony, token, 100); const action1 = await encodeTxData(token, "approve", [USER0, 60]); - await colony.makeArbitraryTransactions([token.address], [action1], true); + await colony.makeArbitraryTransaction(token.address, action1); let potBalance = await colony.getFundingPotBalance(1, token.address); expect(potBalance).to.be.eq.BN(100); const action2 = await encodeTxData(token, "burn", [100]); // Can't burn 100 as 60 are reserved - await checkErrorRevert(colony.makeArbitraryTransactions([token.address], [action2], true), "colony-not-enough-tokens"); + await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action2), "colony-not-enough-tokens"); // Can burn 40 const action3 = await encodeTxData(token, "burn", [40]); - await colony.makeArbitraryTransactions([token.address], [action3], true); + await colony.makeArbitraryTransaction(token.address, action3); potBalance = await colony.getFundingPotBalance(1, token.address); expect(potBalance).to.be.eq.BN(60); }); @@ -278,17 +242,17 @@ contract("Colony Arbitrary Transactions", (accounts) => { it("when transferring tokens, can transfer own tokens with transfer(dst, amount) up to the amount unspoken for in root pot", async () => { await fundColonyWithTokens(colony, token, 100); const action1 = await encodeTxData(token, "approve", [USER0, 60]); - await colony.makeArbitraryTransactions([token.address], [action1], true); + await colony.makeArbitraryTransaction(token.address, action1); let potBalance = await colony.getFundingPotBalance(1, token.address); expect(potBalance).to.be.eq.BN(100); const action2 = await encodeTxData(token, "transfer", [USER0, 100]); // Can't transfer 100 as 60 are reserved - await checkErrorRevert(colony.makeArbitraryTransactions([token.address], [action2], true), "colony-not-enough-tokens"); + await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action2), "colony-not-enough-tokens"); // Can transfer 40 const action3 = await encodeTxData(token, "transfer", [USER0, 40]); - await colony.makeArbitraryTransactions([token.address], [action3], true); + await colony.makeArbitraryTransaction(token.address, action3); potBalance = await colony.getFundingPotBalance(1, token.address); expect(potBalance).to.be.eq.BN(60); const userBalance = await token.balanceOf(USER0); @@ -299,7 +263,7 @@ contract("Colony Arbitrary Transactions", (accounts) => { await token.mint(100); await token.approve(colony.address, 100); const action1 = await encodeTxData(token, "burn", [USER0, 60]); - await colony.makeArbitraryTransactions([token.address], [action1], true); + await colony.makeArbitraryTransaction(token.address, action1); const userBalance = await token.balanceOf(USER0); expect(userBalance).to.be.eq.BN(40); @@ -309,7 +273,7 @@ contract("Colony Arbitrary Transactions", (accounts) => { await token.mint(100); await token.approve(colony.address, 100); const action1 = await encodeTxData(token, "transferFrom", [USER0, colony.address, 60]); - await colony.makeArbitraryTransactions([token.address], [action1], true); + await colony.makeArbitraryTransaction(token.address, action1); const userBalance = await token.balanceOf(USER0); expect(userBalance).to.be.eq.BN(40); @@ -319,11 +283,11 @@ contract("Colony Arbitrary Transactions", (accounts) => { it("cannot burn own tokens with burn(guy, amount)", async () => { const action = await encodeTxData(token, "burn", [colony.address, 60]); - await checkErrorRevert(colony.makeArbitraryTransactions([token.address], [action], true), "colony-cannot-spend-own-allowance"); + await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action), "colony-cannot-spend-own-allowance"); }); it("cannot transfer own tokens with transferFrom(from, to, amount)", async () => { const action = await encodeTxData(token, "transferFrom", [colony.address, USER0, 60]); - await checkErrorRevert(colony.makeArbitraryTransactions([token.address], [action], true), "colony-cannot-spend-own-allowance"); + await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action), "colony-cannot-spend-own-allowance"); }); }); diff --git a/test/contracts-network/colony-permissions.js b/test/contracts-network/colony-permissions.js index 8c76770314..165cb7991a 100644 --- a/test/contracts-network/colony-permissions.js +++ b/test/contracts-network/colony-permissions.js @@ -287,7 +287,7 @@ contract("ColonyPermissions", (accounts) => { await checkErrorRevert(colony.installExtension(HASHZERO, ADDRESS_ZERO, { from: USER1 }), "ds-auth-unauthorized"); await checkErrorRevert(colony.addLocalSkill({ from: USER1 }), "ds-auth-unauthorized"); await checkErrorRevert(colony.deprecateLocalSkill(0, true, { from: USER2 }), "ds-auth-unauthorized"); - await checkErrorRevert(colony.makeArbitraryTransactions([], [], true, { from: USER1 }), "ds-auth-unauthorized"); + await checkErrorRevert(colony.makeArbitraryTransaction(ADDRESS_ZERO, HASHZERO, { from: USER1 }), "ds-auth-unauthorized"); await checkErrorRevert(colony.startNextRewardPayout(ADDRESS_ZERO, HASHZERO, HASHZERO, 0, [HASHZERO], { from: USER1 }), "ds-auth-unauthorized"); }); diff --git a/test/contracts-network/colony-recovery.js b/test/contracts-network/colony-recovery.js index 9c1fe0c5db..810ad0b888 100644 --- a/test/contracts-network/colony-recovery.js +++ b/test/contracts-network/colony-recovery.js @@ -203,8 +203,7 @@ contract("Colony Recovery", (accounts) => { await checkErrorRevert(metaColony.burnTokens(ADDRESS_ZERO, 0), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.registerColonyLabel("", ""), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.updateColonyOrbitDB(""), "colony-in-recovery-mode"); - await checkErrorRevert(metaColony.makeArbitraryTransactions([], [], true), "colony-in-recovery-mode"); - await checkErrorRevert(metaColony.makeSingleArbitraryTransaction(ADDRESS_ZERO, HASHZERO), "colony-in-recovery-mode"); + await checkErrorRevert(metaColony.makeArbitraryTransaction(ADDRESS_ZERO, HASHZERO), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.updateApprovalAmount(ADDRESS_ZERO, ADDRESS_ZERO), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.finalizeRewardPayout(1), "colony-in-recovery-mode"); }); diff --git a/test/cross-chain/cross-chain.js b/test/cross-chain/cross-chain.js index 98b6145edd..7331573a88 100644 --- a/test/cross-chain/cross-chain.js +++ b/test/cross-chain/cross-chain.js @@ -440,7 +440,7 @@ contract("Cross-chain", (accounts) => { console.log("tx to home bridge address:", homeBridge.address); - const tx = await homeColony.makeArbitraryTransactions([homeBridge.address], [txDataToBeSentToAMB], true); + const tx = await homeColony.makeArbitraryTransaction(homeBridge.address, txDataToBeSentToAMB); await tx.wait(); await p; // Check balances diff --git a/test/packages/metaTransactionBroadcaster.js b/test/packages/metaTransactionBroadcaster.js index bd1f948a8b..df1decfce7 100644 --- a/test/packages/metaTransactionBroadcaster.js +++ b/test/packages/metaTransactionBroadcaster.js @@ -120,20 +120,20 @@ contract("Metatransaction broadcaster", (accounts) => { }); it("transactions that try to execute a forbidden method on a Colony are rejected", async function () { - let txData = await encodeTxData(colony, "makeArbitraryTransaction(address,bytes)", [colony.address, "0x00000000"]); + let txData = await encodeTxData(colony, "makeArbitraryTransactions(address[],bytes[],bool)", [[colony.address], ["0x00000000"], false]); let valid = await broadcaster.isColonyFamilyTransactionAllowed(colony.address, txData); expect(valid).to.be.equal(false); - txData = await colony.contract.methods.makeArbitraryTransactions([colony.address], ["0x00000000"], false).encodeABI(); + txData = await colony.contract.methods.makeArbitraryTransaction(colony.address, "0x00000000").encodeABI(); valid = await broadcaster.isColonyFamilyTransactionAllowed(colony.address, txData); expect(valid).to.be.equal(false); - txData = await colony.contract.methods.makeSingleArbitraryTransaction(colony.address, "0x00000000").encodeABI(); + txData = await encodeTxData(colony, "makeSingleArbitraryTransaction(address,bytes)", [colony.address, "0x00000000"]); valid = await broadcaster.isColonyFamilyTransactionAllowed(colony.address, txData); expect(valid).to.be.equal(false); }); - it(`transactions to the forbidden arbitrary transaction methods are allowed only if + it.skip(`transactions to the forbidden arbitrary transaction methods are allowed only if going to a bridge calling the right function`, async function () { const ETHEREUM_BRIDGE_ADDRESS = "0x75Df5AF045d91108662D8080fD1FEFAd6aA0bb59"; const BINANCE_BRIDGE_ADDRESS = "0x162E898bD0aacB578C8D5F8d6ca588c13d2A383F"; @@ -143,20 +143,20 @@ contract("Metatransaction broadcaster", (accounts) => { const ambCall = AMBInterface.encodeFunctionData("requireToPassMessage", ["0x75Df5AF045d91108662D8080fD1FEFAd6aA0bb59", "0x00000000", 1000000]); - let txData = await encodeTxData(colony, "makeArbitraryTransaction(address,bytes)", [ETHEREUM_BRIDGE_ADDRESS, ambCall]); + let txData = await encodeTxData(colony, "makeArbitraryTransactions(address[],bytes[],bool)", [[ETHEREUM_BRIDGE_ADDRESS], [ambCall], false]); let valid = await broadcaster.isColonyFamilyTransactionAllowed(colony.address, txData); expect(valid).to.be.equal(true); - txData = await colony.contract.methods.makeArbitraryTransactions([BINANCE_BRIDGE_ADDRESS], [ambCall], false).encodeABI(); + txData = await colony.contract.methods.makeArbitraryTransaction(BINANCE_BRIDGE_ADDRESS, ambCall).encodeABI(); valid = await broadcaster.isColonyFamilyTransactionAllowed(colony.address, txData); expect(valid).to.be.equal(true); - txData = await colony.contract.methods.makeSingleArbitraryTransaction(BINANCE_BRIDGE_ADDRESS, ambCall).encodeABI(); + txData = await encodeTxData(colony, "makeSingleArbitraryTransaction(address,bytes)", [BINANCE_BRIDGE_ADDRESS, ambCall]); valid = await broadcaster.isColonyFamilyTransactionAllowed(colony.address, txData); expect(valid).to.be.equal(false); // Correct bridge, but makeSingleArbitraryTransaction is never allowed // Going to a bridge, but not the right function call - txData = await colony.contract.methods.makeArbitraryTransaction(BINANCE_BRIDGE_ADDRESS, "0x00000000").encodeABI(); + txData = await encodeTxData(colony, "makeSingleArbitraryTransaction(address,bytes)", [BINANCE_BRIDGE_ADDRESS, "0x00000000"]); valid = await broadcaster.isColonyFamilyTransactionAllowed(colony.address, txData); expect(valid).to.be.equal(false); }); From 2cc3dbaf6824490941b990ffd59453edbbcff13a Mon Sep 17 00:00:00 2001 From: Daniel Kronovet Date: Thu, 31 Oct 2024 13:18:34 -0700 Subject: [PATCH 11/11] Add _strict flag to makeArbitraryTransaction --- .../colony/ColonyArbitraryTransaction.sol | 8 ++- contracts/colony/ColonyAuthority.sol | 5 +- contracts/colony/IColony.sol | 4 +- docs/interfaces/icolony.md | 3 +- docs/interfaces/imetacolony.md | 3 +- .../MetatransactionBroadcaster.js | 7 ++- .../colony-arbitrary-transactions.js | 56 +++++++++---------- test/contracts-network/colony-permissions.js | 2 +- test/contracts-network/colony-recovery.js | 2 +- test/cross-chain/cross-chain.js | 2 +- test/extensions/voting-rep.js | 2 +- test/packages/metaTransactionBroadcaster.js | 12 +++- 12 files changed, 65 insertions(+), 41 deletions(-) diff --git a/contracts/colony/ColonyArbitraryTransaction.sol b/contracts/colony/ColonyArbitraryTransaction.sol index 50d388e30f..4a1a6a10c1 100644 --- a/contracts/colony/ColonyArbitraryTransaction.sol +++ b/contracts/colony/ColonyArbitraryTransaction.sol @@ -36,7 +36,8 @@ contract ColonyArbitraryTransaction is ColonyStorage { function makeArbitraryTransaction( address _to, - bytes memory _action + bytes memory _action, + bool _strict ) public stoppable auth returns (bool) { // Prevent transactions to network contracts require(_to != address(this), "colony-cannot-target-self"); @@ -71,11 +72,14 @@ contract ColonyArbitraryTransaction is ColonyStorage { } catch {} bool res = executeCall(_to, 0, _action); - assert(res); + if (sig == APPROVE_SIG) { approveTransactionCheck(_to, _action); } + emit ArbitraryTransaction(msgSender(), _to, _action, res); + + require(res || !_strict, "colony-arbitrary-transaction-failed"); return res; } diff --git a/contracts/colony/ColonyAuthority.sol b/contracts/colony/ColonyAuthority.sol index 2323e50363..c7f97b3f99 100644 --- a/contracts/colony/ColonyAuthority.sol +++ b/contracts/colony/ColonyAuthority.sol @@ -98,7 +98,7 @@ contract ColonyAuthority is CommonAuthority { addRoleCapability(ROOT_ROLE, "upgradeExtension(bytes32,uint256)"); addRoleCapability(ROOT_ROLE, "deprecateExtension(bytes32,bool)"); addRoleCapability(ROOT_ROLE, "uninstallExtension(bytes32)"); - addRoleCapability(ROOT_ROLE, "makeArbitraryTransaction(address,bytes)"); + addRoleCapability(ROOT_ROLE, "makeArbitraryTransaction(address,bytes)"); // Deprecated addRoleCapability(ROOT_ROLE, "emitDomainReputationReward(uint256,address,int256)"); addRoleCapability(ROOT_ROLE, "emitSkillReputationReward(uint256,address,int256)"); addRoleCapability(ARBITRATION_ROLE, "transferStake(uint256,uint256,address,address,uint256,uint256,address)"); @@ -134,6 +134,9 @@ contract ColonyAuthority is CommonAuthority { addRoleCapability(ARBITRATION_ROLE, "finalizeExpenditureViaArbitration(uint256,uint256,uint256)"); addRoleCapability(ROOT_ROLE, "setColonyBridgeAddress(address)"); addRoleCapability(ROOT_ROLE, "initialiseReputationMining(uint256,bytes32,uint256)"); + + // Added in colony v17 (jade-lwss) + addRoleCapability(ROOT_ROLE, "makeArbitraryTransaction(address,bytes,bool)"); } function addRoleCapability(uint8 role, bytes memory sig) private { diff --git a/contracts/colony/IColony.sol b/contracts/colony/IColony.sol index 5bb51fd3ea..bd15c09177 100644 --- a/contracts/colony/IColony.sol +++ b/contracts/colony/IColony.sol @@ -54,10 +54,12 @@ interface IColony is IDSAuth, ColonyDataTypes, IRecovery, IBasicMetaTransaction, /// @notice Executes an arbitrary transaction /// @param _target Contract to receive the function call /// @param _action Bytes array encoding the function call and arguments + /// @param _strict Boolean indicating whether the transaction must succeed /// @return success Boolean indicating whether the transactions succeeded function makeArbitraryTransaction( address _target, - bytes memory _action + bytes memory _action, + bool _strict ) external returns (bool success); /// @notice Emit a metadata string for a transaction diff --git a/docs/interfaces/icolony.md b/docs/interfaces/icolony.md index 692efa6b09..160bf0096f 100644 --- a/docs/interfaces/icolony.md +++ b/docs/interfaces/icolony.md @@ -1049,7 +1049,7 @@ Lock the colony's token. Can only be called by a network-managed extension. |---|---|---| |timesLocked|uint256|The amount of times the token was locked -### ▸ `makeArbitraryTransaction(address _target, bytes memory _action):bool success` +### ▸ `makeArbitraryTransaction(address _target, bytes memory _action, bool _strict):bool success` Executes an arbitrary transaction @@ -1060,6 +1060,7 @@ Executes an arbitrary transaction |---|---|---| |_target|address|Contract to receive the function call |_action|bytes|Bytes array encoding the function call and arguments +|_strict|bool|Boolean indicating whether the transaction must succeed **Return Parameters** diff --git a/docs/interfaces/imetacolony.md b/docs/interfaces/imetacolony.md index 1fe35efde5..6ffb4f39bb 100644 --- a/docs/interfaces/imetacolony.md +++ b/docs/interfaces/imetacolony.md @@ -1087,7 +1087,7 @@ Lock the colony's token. Can only be called by a network-managed extension. |---|---|---| |timesLocked|uint256|The amount of times the token was locked -### ▸ `makeArbitraryTransaction(address _target, bytes memory _action):bool success` +### ▸ `makeArbitraryTransaction(address _target, bytes memory _action, bool _strict):bool success` Executes an arbitrary transaction @@ -1098,6 +1098,7 @@ Executes an arbitrary transaction |---|---|---| |_target|address|Contract to receive the function call |_action|bytes|Bytes array encoding the function call and arguments +|_strict|bool|Boolean indicating whether the transaction must succeed **Return Parameters** diff --git a/packages/metatransaction-broadcaster/MetatransactionBroadcaster.js b/packages/metatransaction-broadcaster/MetatransactionBroadcaster.js index 2ad764d48c..c30d931c39 100644 --- a/packages/metatransaction-broadcaster/MetatransactionBroadcaster.js +++ b/packages/metatransaction-broadcaster/MetatransactionBroadcaster.js @@ -208,6 +208,7 @@ class MetatransactionBroadcaster { // Add the old makeSingleArbitraryTransaction and makeArbitraryTransactions to the abi const iface = new ethers.utils.Interface([ + "function makeArbitraryTransaction(address,bytes)", "function makeSingleArbitraryTransaction(address,bytes)", "function makeArbitraryTransactions(address[],bytes[],bool)", ]); @@ -227,7 +228,11 @@ class MetatransactionBroadcaster { } // If it's an arbitrary transaction... - if (tx.signature === "makeArbitraryTransaction(address,bytes)" || tx.signature === "makeArbitraryTransactions(address[],bytes[],bool)") { + if ( + tx.signature === "makeArbitraryTransaction(address,bytes)" || + tx.signature === "makeArbitraryTransaction(address,bytes,bool)" || + tx.signature === "makeArbitraryTransactions(address[],bytes[],bool)" + ) { // We allow it if these transactions are going only to known bridges. let addresses = tx.args[0]; let calls = tx.args[1]; diff --git a/test/contracts-network/colony-arbitrary-transactions.js b/test/contracts-network/colony-arbitrary-transactions.js index d1dd383d50..07ab05b181 100644 --- a/test/contracts-network/colony-arbitrary-transactions.js +++ b/test/contracts-network/colony-arbitrary-transactions.js @@ -40,7 +40,7 @@ contract("Colony Arbitrary Transactions", (accounts) => { const action = await encodeTxData(token, "mint", [WAD]); const balancePre = await token.balanceOf(colony.address); - const tx = await colony.makeArbitraryTransaction(token.address, action); + const tx = await colony.makeArbitraryTransaction(token.address, action, false); await expectEvent(tx, "ArbitraryTransaction(address,address,bytes,bool)", [accounts[0], token.address, action, true]); @@ -53,8 +53,8 @@ contract("Colony Arbitrary Transactions", (accounts) => { const action2 = await encodeTxData(token, "mint", [WAD.muln(2)]); const balancePre = await token.balanceOf(colony.address); - const arbitraryAction = await encodeTxData(colony, "makeArbitraryTransaction", [token.address, action]); - const arbitraryAction2 = await encodeTxData(colony, "makeArbitraryTransaction", [token.address, action2]); + const arbitraryAction = await encodeTxData(colony, "makeArbitraryTransaction", [token.address, action, false]); + const arbitraryAction2 = await encodeTxData(colony, "makeArbitraryTransaction", [token.address, action2, false]); const tx = await colony.multicall([arbitraryAction, arbitraryAction2]); @@ -68,15 +68,15 @@ contract("Colony Arbitrary Transactions", (accounts) => { it("should not be able to make arbitrary transactions if not root", async () => { const action = await encodeTxData(token, "mint", [WAD]); - await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action, { from: USER1 }), "ds-auth-unauthorized"); + await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action, false, { from: USER1 }), "ds-auth-unauthorized"); }); it("should not be able to make arbitrary transactions to a colony itself", async () => { - await checkErrorRevert(colony.makeArbitraryTransaction(colony.address, "0x0"), "colony-cannot-target-self"); + await checkErrorRevert(colony.makeArbitraryTransaction(colony.address, 0x0, false), "colony-cannot-target-self"); }); it("should not be able to make arbitrary transactions to a user address", async () => { - await checkErrorRevert(colony.makeArbitraryTransaction(accounts[0], "0x0"), "colony-to-must-be-contract"); + await checkErrorRevert(colony.makeArbitraryTransaction(accounts[0], 0x0, false), "colony-to-must-be-contract"); }); it("should not be able to make arbitrary transactions to network or token locking", async () => { @@ -86,14 +86,14 @@ contract("Colony Arbitrary Transactions", (accounts) => { const action1 = await encodeTxData(colonyNetwork, "addSkill", [0]); const action2 = await encodeTxData(tokenLocking, "lockToken", [token.address]); - await checkErrorRevert(colony.makeArbitraryTransaction(colonyNetwork.address, action1), "colony-cannot-target-network"); - await checkErrorRevert(colony.makeArbitraryTransaction(tokenLocking.address, action2), "colony-cannot-target-token-locking"); + await checkErrorRevert(colony.makeArbitraryTransaction(colonyNetwork.address, action1, false), "colony-cannot-target-network"); + await checkErrorRevert(colony.makeArbitraryTransaction(tokenLocking.address, action2, false), "colony-cannot-target-token-locking"); }); it("if an arbitrary transaction is made to approve tokens, then tokens needed for approval cannot be moved out of the main pot", async () => { await fundColonyWithTokens(colony, token, 100); const action1 = await encodeTxData(token, "approve", [USER0, 50]); - await colony.makeArbitraryTransaction(token.address, action1); + await colony.makeArbitraryTransaction(token.address, action1, false); await colony.moveFundsBetweenPots(1, UINT256_MAX, 1, UINT256_MAX, UINT256_MAX, 1, 0, 50, token.address); await checkErrorRevert( colony.moveFundsBetweenPots(1, UINT256_MAX, 1, UINT256_MAX, UINT256_MAX, 1, 0, 50, token.address), @@ -109,7 +109,7 @@ contract("Colony Arbitrary Transactions", (accounts) => { tokens can only be moved from main pot that weren't part of the allowance`, async () => { await fundColonyWithTokens(colony, token, 100); const action1 = await encodeTxData(token, "approve", [USER0, 20]); - await colony.makeArbitraryTransaction(token.address, action1); + await colony.makeArbitraryTransaction(token.address, action1, false); // Use allowance await token.transferFrom(colony.address, USER0, 20, { from: USER0 }); // Approval tracking still thinks it has to reserve 20 @@ -141,9 +141,9 @@ contract("Colony Arbitrary Transactions", (accounts) => { await fundColonyWithTokens(colony, token, 100); const action1 = await encodeTxData(token, "approve", [USER0, 300]); // Not enough tokens at all - await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action1), "colony-approval-exceeds-balance"); + await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action1, false), "colony-approval-exceeds-balance"); await fundColonyWithTokens(colony, token, 1000); - await colony.makeArbitraryTransaction(token.address, action1); + await colony.makeArbitraryTransaction(token.address, action1, false); // They are now approved for 300. let approval = await colony.getTokenApproval(token.address, USER0); expect(approval).to.be.eq.BN(300); @@ -152,14 +152,14 @@ contract("Colony Arbitrary Transactions", (accounts) => { const action2 = await encodeTxData(token, "approve", [USER0, 900]); // User was approved for 300, we now approve them for 900. There are enough tokens to cover this, even though 900 + 300 > 1100, the balance of the pot - await colony.makeArbitraryTransaction(token.address, action2); + await colony.makeArbitraryTransaction(token.address, action2, false); approval = await colony.getTokenApproval(token.address, USER0); expect(approval).to.be.eq.BN(900); allApprovals = await colony.getTotalTokenApproval(token.address); expect(allApprovals).to.be.eq.BN(900); // Set them back to 300 - await colony.makeArbitraryTransaction(token.address, action1); + await colony.makeArbitraryTransaction(token.address, action1, false); approval = await colony.getTokenApproval(token.address, USER0); expect(approval).to.be.eq.BN(300); allApprovals = await colony.getTotalTokenApproval(token.address); @@ -167,10 +167,10 @@ contract("Colony Arbitrary Transactions", (accounts) => { // Cannot approve someone else for 900 const action3 = await encodeTxData(token, "approve", [USER1, 900]); - await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action3), "colony-approval-exceeds-balance"); + await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action3, false), "colony-approval-exceeds-balance"); // But can for 800 const action4 = await encodeTxData(token, "approve", [USER1, 800]); - await colony.makeArbitraryTransaction(token.address, action4); + await colony.makeArbitraryTransaction(token.address, action4, false); approval = await colony.getTokenApproval(token.address, USER1); expect(approval).to.be.eq.BN(800); allApprovals = await colony.getTotalTokenApproval(token.address); @@ -212,29 +212,29 @@ contract("Colony Arbitrary Transactions", (accounts) => { 0, ]); - await checkErrorRevert(colony.makeArbitraryTransaction(oneTxPayment.address, action), "colony-cannot-target-extensions"); + await checkErrorRevert(colony.makeArbitraryTransaction(oneTxPayment.address, action, false), "colony-cannot-target-extensions"); // But other colonies can const { colony: otherColony } = await setupRandomColony(colonyNetwork); await colony.setUserRoles(1, UINT256_MAX, otherColony.address, 1, ROLES); - await otherColony.makeArbitraryTransaction(oneTxPayment.address, action); + await otherColony.makeArbitraryTransaction(oneTxPayment.address, action, false); }); it("when burning tokens, can burn own tokens with burn(amount) up to the amount unspoken for in root pot", async () => { await fundColonyWithTokens(colony, token, 100); const action1 = await encodeTxData(token, "approve", [USER0, 60]); - await colony.makeArbitraryTransaction(token.address, action1); + await colony.makeArbitraryTransaction(token.address, action1, false); let potBalance = await colony.getFundingPotBalance(1, token.address); expect(potBalance).to.be.eq.BN(100); const action2 = await encodeTxData(token, "burn", [100]); // Can't burn 100 as 60 are reserved - await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action2), "colony-not-enough-tokens"); + await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action2, false), "colony-not-enough-tokens"); // Can burn 40 const action3 = await encodeTxData(token, "burn", [40]); - await colony.makeArbitraryTransaction(token.address, action3); + await colony.makeArbitraryTransaction(token.address, action3, false); potBalance = await colony.getFundingPotBalance(1, token.address); expect(potBalance).to.be.eq.BN(60); }); @@ -242,17 +242,17 @@ contract("Colony Arbitrary Transactions", (accounts) => { it("when transferring tokens, can transfer own tokens with transfer(dst, amount) up to the amount unspoken for in root pot", async () => { await fundColonyWithTokens(colony, token, 100); const action1 = await encodeTxData(token, "approve", [USER0, 60]); - await colony.makeArbitraryTransaction(token.address, action1); + await colony.makeArbitraryTransaction(token.address, action1, false); let potBalance = await colony.getFundingPotBalance(1, token.address); expect(potBalance).to.be.eq.BN(100); const action2 = await encodeTxData(token, "transfer", [USER0, 100]); // Can't transfer 100 as 60 are reserved - await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action2), "colony-not-enough-tokens"); + await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action2, false), "colony-not-enough-tokens"); // Can transfer 40 const action3 = await encodeTxData(token, "transfer", [USER0, 40]); - await colony.makeArbitraryTransaction(token.address, action3); + await colony.makeArbitraryTransaction(token.address, action3, false); potBalance = await colony.getFundingPotBalance(1, token.address); expect(potBalance).to.be.eq.BN(60); const userBalance = await token.balanceOf(USER0); @@ -263,7 +263,7 @@ contract("Colony Arbitrary Transactions", (accounts) => { await token.mint(100); await token.approve(colony.address, 100); const action1 = await encodeTxData(token, "burn", [USER0, 60]); - await colony.makeArbitraryTransaction(token.address, action1); + await colony.makeArbitraryTransaction(token.address, action1, false); const userBalance = await token.balanceOf(USER0); expect(userBalance).to.be.eq.BN(40); @@ -273,7 +273,7 @@ contract("Colony Arbitrary Transactions", (accounts) => { await token.mint(100); await token.approve(colony.address, 100); const action1 = await encodeTxData(token, "transferFrom", [USER0, colony.address, 60]); - await colony.makeArbitraryTransaction(token.address, action1); + await colony.makeArbitraryTransaction(token.address, action1, false); const userBalance = await token.balanceOf(USER0); expect(userBalance).to.be.eq.BN(40); @@ -283,11 +283,11 @@ contract("Colony Arbitrary Transactions", (accounts) => { it("cannot burn own tokens with burn(guy, amount)", async () => { const action = await encodeTxData(token, "burn", [colony.address, 60]); - await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action), "colony-cannot-spend-own-allowance"); + await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action, false), "colony-cannot-spend-own-allowance"); }); it("cannot transfer own tokens with transferFrom(from, to, amount)", async () => { const action = await encodeTxData(token, "transferFrom", [colony.address, USER0, 60]); - await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action), "colony-cannot-spend-own-allowance"); + await checkErrorRevert(colony.makeArbitraryTransaction(token.address, action, false), "colony-cannot-spend-own-allowance"); }); }); diff --git a/test/contracts-network/colony-permissions.js b/test/contracts-network/colony-permissions.js index 165cb7991a..a094fd0d8e 100644 --- a/test/contracts-network/colony-permissions.js +++ b/test/contracts-network/colony-permissions.js @@ -287,7 +287,7 @@ contract("ColonyPermissions", (accounts) => { await checkErrorRevert(colony.installExtension(HASHZERO, ADDRESS_ZERO, { from: USER1 }), "ds-auth-unauthorized"); await checkErrorRevert(colony.addLocalSkill({ from: USER1 }), "ds-auth-unauthorized"); await checkErrorRevert(colony.deprecateLocalSkill(0, true, { from: USER2 }), "ds-auth-unauthorized"); - await checkErrorRevert(colony.makeArbitraryTransaction(ADDRESS_ZERO, HASHZERO, { from: USER1 }), "ds-auth-unauthorized"); + await checkErrorRevert(colony.makeArbitraryTransaction(ADDRESS_ZERO, HASHZERO, false, { from: USER1 }), "ds-auth-unauthorized"); await checkErrorRevert(colony.startNextRewardPayout(ADDRESS_ZERO, HASHZERO, HASHZERO, 0, [HASHZERO], { from: USER1 }), "ds-auth-unauthorized"); }); diff --git a/test/contracts-network/colony-recovery.js b/test/contracts-network/colony-recovery.js index 810ad0b888..9b045ae4a6 100644 --- a/test/contracts-network/colony-recovery.js +++ b/test/contracts-network/colony-recovery.js @@ -203,7 +203,7 @@ contract("Colony Recovery", (accounts) => { await checkErrorRevert(metaColony.burnTokens(ADDRESS_ZERO, 0), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.registerColonyLabel("", ""), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.updateColonyOrbitDB(""), "colony-in-recovery-mode"); - await checkErrorRevert(metaColony.makeArbitraryTransaction(ADDRESS_ZERO, HASHZERO), "colony-in-recovery-mode"); + await checkErrorRevert(metaColony.makeArbitraryTransaction(ADDRESS_ZERO, HASHZERO, false), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.updateApprovalAmount(ADDRESS_ZERO, ADDRESS_ZERO), "colony-in-recovery-mode"); await checkErrorRevert(metaColony.finalizeRewardPayout(1), "colony-in-recovery-mode"); }); diff --git a/test/cross-chain/cross-chain.js b/test/cross-chain/cross-chain.js index 7331573a88..2db9f0e69a 100644 --- a/test/cross-chain/cross-chain.js +++ b/test/cross-chain/cross-chain.js @@ -440,7 +440,7 @@ contract("Cross-chain", (accounts) => { console.log("tx to home bridge address:", homeBridge.address); - const tx = await homeColony.makeArbitraryTransaction(homeBridge.address, txDataToBeSentToAMB); + const tx = await homeColony.makeArbitraryTransaction(homeBridge.address, txDataToBeSentToAMB, true); await tx.wait(); await p; // Check balances diff --git a/test/extensions/voting-rep.js b/test/extensions/voting-rep.js index dd5835fbef..92326574ce 100644 --- a/test/extensions/voting-rep.js +++ b/test/extensions/voting-rep.js @@ -2111,7 +2111,7 @@ contract("Voting Reputation", (accounts) => { }); it("transactions that try to execute a forbidden method on Reputation Voting extension are rejected by the MTX broadcaster", async function () { - const action = await encodeTxData(colony, "makeArbitraryTransactions", [[colony.address], ["0x00"], true]); + const action = await encodeTxData(colony, "makeArbitraryTransactions(address[],bytes[],bool)", [[colony.address], ["0x00"], true]); await voting.createMotion(1, UINT256_MAX, ADDRESS_ZERO, action, domain1Key, domain1Value, domain1Mask, domain1Siblings); motionId = await voting.getMotionCount(); diff --git a/test/packages/metaTransactionBroadcaster.js b/test/packages/metaTransactionBroadcaster.js index df1decfce7..2dae1c4166 100644 --- a/test/packages/metaTransactionBroadcaster.js +++ b/test/packages/metaTransactionBroadcaster.js @@ -124,13 +124,17 @@ contract("Metatransaction broadcaster", (accounts) => { let valid = await broadcaster.isColonyFamilyTransactionAllowed(colony.address, txData); expect(valid).to.be.equal(false); - txData = await colony.contract.methods.makeArbitraryTransaction(colony.address, "0x00000000").encodeABI(); + txData = await encodeTxData(colony, "makeArbitraryTransaction(address,bytes)", [colony.address, "0x00000000"]); valid = await broadcaster.isColonyFamilyTransactionAllowed(colony.address, txData); expect(valid).to.be.equal(false); txData = await encodeTxData(colony, "makeSingleArbitraryTransaction(address,bytes)", [colony.address, "0x00000000"]); valid = await broadcaster.isColonyFamilyTransactionAllowed(colony.address, txData); expect(valid).to.be.equal(false); + + txData = await colony.contract.methods.makeArbitraryTransaction(colony.address, "0x00000000", false).encodeABI(); + valid = await broadcaster.isColonyFamilyTransactionAllowed(colony.address, txData); + expect(valid).to.be.equal(false); }); it.skip(`transactions to the forbidden arbitrary transaction methods are allowed only if @@ -147,7 +151,7 @@ contract("Metatransaction broadcaster", (accounts) => { let valid = await broadcaster.isColonyFamilyTransactionAllowed(colony.address, txData); expect(valid).to.be.equal(true); - txData = await colony.contract.methods.makeArbitraryTransaction(BINANCE_BRIDGE_ADDRESS, ambCall).encodeABI(); + txData = await encodeTxData(colony, "makeArbitraryTransaction(address,bytes)", [ETHEREUM_BRIDGE_ADDRESS, ambCall]); valid = await broadcaster.isColonyFamilyTransactionAllowed(colony.address, txData); expect(valid).to.be.equal(true); @@ -155,6 +159,10 @@ contract("Metatransaction broadcaster", (accounts) => { valid = await broadcaster.isColonyFamilyTransactionAllowed(colony.address, txData); expect(valid).to.be.equal(false); // Correct bridge, but makeSingleArbitraryTransaction is never allowed + txData = await colony.contract.methods.makeArbitraryTransaction(BINANCE_BRIDGE_ADDRESS, ambCall, false).encodeABI(); + valid = await broadcaster.isColonyFamilyTransactionAllowed(colony.address, txData); + expect(valid).to.be.equal(true); + // Going to a bridge, but not the right function call txData = await encodeTxData(colony, "makeSingleArbitraryTransaction(address,bytes)", [BINANCE_BRIDGE_ADDRESS, "0x00000000"]); valid = await broadcaster.isColonyFamilyTransactionAllowed(colony.address, txData);