Skip to content

Commit e06f781

Browse files
authored
Merge pull request #998 from JoinColony/maint/version-checks
Fix version check script, bump needed versions
2 parents 5c39155 + cf3e414 commit e06f781

File tree

10 files changed

+38
-15
lines changed

10 files changed

+38
-15
lines changed

contracts/extensions/CoinMachine.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ contract CoinMachine is ColonyExtension, BasicMetaTransaction {
9191

9292
/// @notice Returns the version of the extension
9393
function version() public override pure returns (uint256) {
94-
return 2;
94+
return 3;
9595
}
9696

9797
/// @notice Configures the extension

contracts/extensions/EvaluatedExpenditure.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ contract EvaluatedExpenditure is ColonyExtension, BasicMetaTransaction {
3939

4040
/// @notice Returns the version of the extension
4141
function version() public override pure returns (uint256) {
42-
return 1;
42+
return 2;
4343
}
4444

4545
/// @notice Configures the extension

contracts/extensions/FundingQueue.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ contract FundingQueue is ColonyExtension, PatriciaTreeProofs, BasicMetaTransacti
9090

9191
/// @notice Returns the version of the extension
9292
function version() public override pure returns (uint256) {
93-
return 2;
93+
return 3;
9494
}
9595

9696
/// @notice Configures the extension

contracts/extensions/OneTxPayment.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ contract OneTxPayment is ColonyExtension, BasicMetaTransaction {
4646

4747
/// @notice Returns the version of the extension
4848
function version() public override pure returns (uint256) {
49-
return 2;
49+
return 3;
5050
}
5151

5252
/// @notice Configures the extension

contracts/extensions/TokenSupplier.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ contract TokenSupplier is ColonyExtension, BasicMetaTransaction {
6767

6868
/// @notice Returns the version of the extension
6969
function version() public override pure returns (uint256) {
70-
return 2;
70+
return 3;
7171
}
7272

7373
/// @notice Configures the extension

contracts/extensions/VotingReputation.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ contract VotingReputation is ColonyExtension, PatriciaTreeProofs, BasicMetaTrans
117117
/// @notice Return the version number
118118
/// @return The version number
119119
function version() public pure override returns (uint256) {
120-
return 3;
120+
return 4;
121121
}
122122

123123
/// @notice Install the extension

contracts/extensions/Whitelist.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ contract Whitelist is ColonyExtension, BasicMetaTransaction {
6565

6666
/// @notice Returns the version of the extension
6767
function version() public override pure returns (uint256) {
68-
return 1;
68+
return 2;
6969
}
7070

7171
/// @notice Configures the extension

scripts/versioningCheck.sh

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ version_from_commit() {
1010
echo $VERSION
1111
}
1212

13+
version_from_commit_extensions() {
14+
COMMIT=$1;
15+
FILE=$2;
16+
VERSION="$(git show $COMMIT:$FILE | grep -A1 'function version() public' | tail -n 1 | sed 's/return //g' | sed 's/;//g' )"
17+
echo $VERSION
18+
}
19+
20+
STATUS=0
21+
1322
if [ $N -ne 0 ]; then
1423
# We need to check if we've bumped the version
1524
# What version does the latest release have
@@ -20,25 +29,31 @@ if [ $N -ne 0 ]; then
2029

2130
if [ $newVersion -eq $oldVersion ]; then
2231
echo "Version not bumped for Colony.sol when it should be"
23-
exit 1;
32+
STATUS=1;
2433
fi
2534
fi
2635

2736
# Now the same for the extensions
28-
for file in $(git diff --cached --name-only | grep -E 'contracts/extensions/')
37+
for file in $(git diff --cached --name-only $LATEST_RELEASE | grep -E 'contracts/extensions/')
2938
do
3039
if [ $file = "contracts/extensions/ColonyExtension.sol" ]; then
3140
continue
3241
fi
3342

34-
oldVersion="$(version_from_commit $LATEST_RELEASE $file)"
43+
if [ $file = "contracts/extensions/ColonyExtensionMeta.sol" ]; then
44+
continue
45+
fi
46+
47+
oldVersion="$(version_from_commit_extensions $LATEST_RELEASE $file)"
3548

3649
# What version does the staged version have?
37-
newVersion="$(version_from_commit '' $file)"
50+
newVersion="$(version_from_commit_extensions '' $file)"
3851

3952
if [ $newVersion -eq $oldVersion ]; then
4053
echo "Version not bumped for $file when it should be"
41-
exit 1;
54+
STATUS=1;
4255
fi
4356

44-
done
57+
done
58+
59+
exit $STATUS

test-smoke/colony-storage-consistent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ contract("Contract Storage", (accounts) => {
154154
console.log("miningCycleStateHash:", miningCycleAccount.stateRoot.toString("hex"));
155155
console.log("tokenLockingStateHash:", tokenLockingAccount.stateRoot.toString("hex"));
156156

157-
expect(colonyNetworkAccount.stateRoot.toString("hex")).to.equal("099e984edc5c6d9194d5b26a5ec058f2ba341cf591781fe94f65900f9a72fa7a");
157+
expect(colonyNetworkAccount.stateRoot.toString("hex")).to.equal("2775a8fe0a3e55074fbb08308652279918c69e3048ae61e049ed42dd2dfba1ee");
158158
expect(colonyAccount.stateRoot.toString("hex")).to.equal("ba1042d654baa721eb012da81409c1087a9447b8a36b6d844233826e5055fbfe");
159159
expect(metaColonyAccount.stateRoot.toString("hex")).to.equal("352feafb44e40c6097234df1a675c5cd618fd81c0f88e8c6478c838e788bd77a");
160160
expect(miningCycleAccount.stateRoot.toString("hex")).to.equal("474e00d9b002118dee0c336eaf0902b7719bb7d4a877e2d26f6a2452a5a89a6e");

test/contracts-network/colony-arbitrary-transactions.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,15 @@ contract("Colony Arbitrary Transactions", (accounts) => {
206206

207207
it("should not be able to make arbitrary transactions to the colony's own extensions", async () => {
208208
const COIN_MACHINE = soliditySha3("CoinMachine");
209-
await colony.installExtension(COIN_MACHINE, 2);
209+
210+
const ethersProvider = new ethers.providers.JsonRpcProvider(web3.currentProvider.host);
211+
const ethersColonyNetwork = new ethers.Contract(colonyNetwork.address, colonyNetwork.abi, ethersProvider);
212+
213+
const eventFilter = ethersColonyNetwork.filters.ExtensionAddedToNetwork(COIN_MACHINE);
214+
const events = await ethersColonyNetwork.queryFilter(eventFilter, 0);
215+
const log = await ethersColonyNetwork.interface.parseLog(events[0]);
216+
217+
await colony.installExtension(COIN_MACHINE, log.args.version);
210218

211219
const coinMachineAddress = await colonyNetwork.getExtensionInstallation(COIN_MACHINE, colony.address);
212220
const coinMachine = await CoinMachine.at(coinMachineAddress);

0 commit comments

Comments
 (0)