Skip to content

Commit ed214c5

Browse files
author
francois branciard
committed
Fix #21 remove change ownership in OwnableOZ.sol
1 parent 491ce1b commit ed214c5

File tree

73 files changed

+351
-347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+351
-347
lines changed

ChangeLog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
Features:
55
* [#17](https://github.com/iExecBlockchainComputing/PoCo/issues/17): do not revert bad reveal but store it to a wrong status [POST V2]
66
* [#19](https://github.com/iExecBlockchainComputing/PoCo/issues/19): MarketOrder (Direction & Status) [GO/NOGO]
7-
* [#21](https://github.com/iExecBlockchainComputing/PoCo/issues/21): remove change ownership in OwnableOZ.sol [PLANNED in v1.0.13]
87
* [#22](https://github.com/iExecBlockchainComputing/PoCo/issues/22): allow to deposit on someone else's account [GO/NOGO]
98
* [#23](https://github.com/iExecBlockchainComputing/PoCo/issues/23): rename createMarketOrder => createOrder || createWorkOrder [GO/NOGO]
109

@@ -16,6 +15,7 @@ Bugfixes:
1615

1716
Features:
1817
* [#16](https://github.com/iExecBlockchainComputing/PoCo/issues/16) add counters info in Hub
18+
* [#21](https://github.com/iExecBlockchainComputing/PoCo/issues/21): remove change ownership in OwnableOZ.sol
1919

2020
Bugfixes:
2121
* [#24](https://github.com/iExecBlockchainComputing/PoCo/issues/24) possibly useless RLC address getter

contracts/App.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ contract App is OwnableOZ, IexecHubAccessor
2727
// tx.origin == owner
2828
// msg.sender == DatasetHub
2929
require(tx.origin != msg.sender);
30-
transferOwnership(tx.origin); // owner → tx.origin
30+
setImmutableOwnership(tx.origin); // owner → tx.origin
3131

3232
m_appName = _appName;
3333
m_appPrice = _appPrice;

contracts/Dataset.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ contract Dataset is OwnableOZ, IexecHubAccessor
2727
// tx.origin == owner
2828
// msg.sender == DatasetHub
2929
require(tx.origin != msg.sender);
30-
transferOwnership(tx.origin); // owner → tx.origin
30+
setImmutableOwnership(tx.origin); // owner → tx.origin
3131

3232
m_datasetName = _datasetName;
3333
m_datasetPrice = _datasetPrice;

contracts/OwnableOZ.sol

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ pragma solidity ^0.4.21;
88
contract OwnableOZ
99
{
1010
address public m_owner;
11+
bool public changeable;
1112

1213
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
1314

@@ -27,17 +28,20 @@ contract OwnableOZ
2728
function OwnableOZ() public
2829
{
2930
m_owner = msg.sender;
31+
changeable =true;
3032
}
3133

3234
/**
3335
* @dev Allows the current owner to transfer control of the contract to a newOwner.
3436
* @param _newOwner The address to transfer ownership to.
3537
*/
36-
function transferOwnership(address _newOwner) public onlyOwner
38+
function setImmutableOwnership(address _newOwner) public onlyOwner
3739
{
40+
require(changeable);
3841
require(_newOwner != address(0));
39-
emit OwnershipTransferred(m_owner, _newOwner);
4042
m_owner = _newOwner;
43+
changeable = false;
44+
emit OwnershipTransferred(m_owner, _newOwner);
4145
}
4246

4347
}

contracts/WorkerPool.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ contract WorkerPool is OwnableOZ, IexecHubAccessor, MarketplaceAccessor
8383
// tx.origin == owner
8484
// msg.sender == WorkerPoolHub
8585
require(tx.origin != msg.sender);
86-
transferOwnership(tx.origin); // owner → tx.origin
86+
setImmutableOwnership(tx.origin); // owner → tx.origin
8787

8888
m_description = _description;
8989
m_stakeRatioPolicy = 30; // % of the work order price to stake

migrations/2_deploy_contracts.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,18 @@ module.exports = function(deployer) {
6363
.then(instance => {
6464
aIexecHub = instance;
6565
console.log("IexecHub deployed at address: " + aIexecHub.address);
66-
return aWorkerPoolHubInstance.transferOwnership(aIexecHub.address);
66+
return aWorkerPoolHubInstance.setImmutableOwnership(aIexecHub.address);
6767
})
6868
.then(() => {
69-
console.log("transferOwnership of WorkerPoolHub to IexecHub");
70-
return aAppHubInstance.transferOwnership(aIexecHub.address);
69+
console.log("setImmutableOwnership of WorkerPoolHub to IexecHub");
70+
return aAppHubInstance.setImmutableOwnership(aIexecHub.address);
7171
})
7272
.then(() => {
73-
console.log("transferOwnership of AppHub to IexecHub");
74-
return aDatasetHubInstance.transferOwnership(aIexecHub.address);
73+
console.log("setImmutableOwnership of AppHub to IexecHub");
74+
return aDatasetHubInstance.setImmutableOwnership(aIexecHub.address);
7575
})
7676
.then(() => {
77-
console.log("transferOwnership of DatasetHub to IexecHub");
77+
console.log("setImmutableOwnership of DatasetHub to IexecHub");
7878
return deployer.deploy(Marketplace, aIexecHub.address);
7979
})
8080
.then(() => Marketplace.deployed())
@@ -152,18 +152,18 @@ module.exports = function(deployer) {
152152
.then(instance => {
153153
aIexecHub = instance;
154154
console.log("IexecHub deployed at address: " + aIexecHub.address);
155-
return aWorkerPoolHubInstance.transferOwnership(aIexecHub.address);
155+
return aWorkerPoolHubInstance.setImmutableOwnership(aIexecHub.address);
156156
})
157157
.then(() => {
158-
console.log("transferOwnership of WorkerPoolHub to IexecHub");
159-
return aAppHubInstance.transferOwnership(aIexecHub.address);
158+
console.log("setImmutableOwnership of WorkerPoolHub to IexecHub");
159+
return aAppHubInstance.setImmutableOwnership(aIexecHub.address);
160160
})
161161
.then(() => {
162-
console.log("transferOwnership of AppHub to IexecHub");
163-
return aDatasetHubInstance.transferOwnership(aIexecHub.address);
162+
console.log("setImmutableOwnership of AppHub to IexecHub");
163+
return aDatasetHubInstance.setImmutableOwnership(aIexecHub.address);
164164
})
165165
.then(() => {
166-
console.log("transferOwnership of DatasetHub to IexecHub");
166+
console.log("setImmutableOwnership of DatasetHub to IexecHub");
167167
return deployer.deploy(Marketplace, aIexecHub.address);
168168
})
169169
.then(() => Marketplace.deployed())

test/00_base.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,23 +134,23 @@ contract('IexecHub', function(accounts) {
134134
console.log("aIexecHubInstance.address is ");
135135
console.log(aIexecHubInstance.address);
136136

137-
txMined = await aWorkerPoolHubInstance.transferOwnership(aIexecHubInstance.address, {
137+
txMined = await aWorkerPoolHubInstance.setImmutableOwnership(aIexecHubInstance.address, {
138138
from: marketplaceCreator
139139
});
140140
assert.isBelow(txMined.receipt.gasUsed, constants.AMOUNT_GAS_PROVIDED, "should not use all gas");
141-
console.log("transferOwnership of WorkerPoolHub to IexecHub");
141+
console.log("setImmutableOwnership of WorkerPoolHub to IexecHub");
142142

143-
txMined = await aAppHubInstance.transferOwnership(aIexecHubInstance.address, {
143+
txMined = await aAppHubInstance.setImmutableOwnership(aIexecHubInstance.address, {
144144
from: marketplaceCreator
145145
});
146146
assert.isBelow(txMined.receipt.gasUsed, constants.AMOUNT_GAS_PROVIDED, "should not use all gas");
147-
console.log("transferOwnership of AppHub to IexecHub");
147+
console.log("setImmutableOwnership of AppHub to IexecHub");
148148

149-
txMined = await aDatasetHubInstance.transferOwnership(aIexecHubInstance.address, {
149+
txMined = await aDatasetHubInstance.setImmutableOwnership(aIexecHubInstance.address, {
150150
from: marketplaceCreator
151151
});
152152
assert.isBelow(txMined.receipt.gasUsed, constants.AMOUNT_GAS_PROVIDED, "should not use all gas");
153-
console.log("transferOwnership of DatasetHub to IexecHub");
153+
console.log("setImmutableOwnership of DatasetHub to IexecHub");
154154

155155
aMarketplaceInstance = await Marketplace.new(aIexecHubInstance.address,{
156156
from: marketplaceCreator

test/01_workerPoolCreation.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,23 +130,23 @@ contract('IexecHub', function(accounts) {
130130
console.log("aIexecHubInstance.address is ");
131131
console.log(aIexecHubInstance.address);
132132

133-
txMined = await aWorkerPoolHubInstance.transferOwnership(aIexecHubInstance.address, {
133+
txMined = await aWorkerPoolHubInstance.setImmutableOwnership(aIexecHubInstance.address, {
134134
from: marketplaceCreator
135135
});
136136
assert.isBelow(txMined.receipt.gasUsed, constants.AMOUNT_GAS_PROVIDED, "should not use all gas");
137-
console.log("transferOwnership of WorkerPoolHub to IexecHub");
137+
console.log("setImmutableOwnership of WorkerPoolHub to IexecHub");
138138

139-
txMined = await aAppHubInstance.transferOwnership(aIexecHubInstance.address, {
139+
txMined = await aAppHubInstance.setImmutableOwnership(aIexecHubInstance.address, {
140140
from: marketplaceCreator
141141
});
142142
assert.isBelow(txMined.receipt.gasUsed, constants.AMOUNT_GAS_PROVIDED, "should not use all gas");
143-
console.log("transferOwnership of AppHub to IexecHub");
143+
console.log("setImmutableOwnership of AppHub to IexecHub");
144144

145-
txMined = await aDatasetHubInstance.transferOwnership(aIexecHubInstance.address, {
145+
txMined = await aDatasetHubInstance.setImmutableOwnership(aIexecHubInstance.address, {
146146
from: marketplaceCreator
147147
});
148148
assert.isBelow(txMined.receipt.gasUsed, constants.AMOUNT_GAS_PROVIDED, "should not use all gas");
149-
console.log("transferOwnership of DatasetHub to IexecHub");
149+
console.log("setImmutableOwnership of DatasetHub to IexecHub");
150150

151151
aMarketplaceInstance = await Marketplace.new(aIexecHubInstance.address,{
152152
from: marketplaceCreator

test/02_workerPoolSubscription.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,23 +137,23 @@ contract('IexecHub', function(accounts) {
137137
console.log("aIexecHubInstance.address is ");
138138
console.log(aIexecHubInstance.address);
139139

140-
txMined = await aWorkerPoolHubInstance.transferOwnership(aIexecHubInstance.address, {
140+
txMined = await aWorkerPoolHubInstance.setImmutableOwnership(aIexecHubInstance.address, {
141141
from: marketplaceCreator
142142
});
143143
assert.isBelow(txMined.receipt.gasUsed, constants.AMOUNT_GAS_PROVIDED, "should not use all gas");
144-
console.log("transferOwnership of WorkerPoolHub to IexecHub");
144+
console.log("setImmutableOwnership of WorkerPoolHub to IexecHub");
145145

146-
txMined = await aAppHubInstance.transferOwnership(aIexecHubInstance.address, {
146+
txMined = await aAppHubInstance.setImmutableOwnership(aIexecHubInstance.address, {
147147
from: marketplaceCreator
148148
});
149149
assert.isBelow(txMined.receipt.gasUsed, constants.AMOUNT_GAS_PROVIDED, "should not use all gas");
150-
console.log("transferOwnership of AppHub to IexecHub");
150+
console.log("setImmutableOwnership of AppHub to IexecHub");
151151

152-
txMined = await aDatasetHubInstance.transferOwnership(aIexecHubInstance.address, {
152+
txMined = await aDatasetHubInstance.setImmutableOwnership(aIexecHubInstance.address, {
153153
from: marketplaceCreator
154154
});
155155
assert.isBelow(txMined.receipt.gasUsed, constants.AMOUNT_GAS_PROVIDED, "should not use all gas");
156-
console.log("transferOwnership of DatasetHub to IexecHub");
156+
console.log("setImmutableOwnership of DatasetHub to IexecHub");
157157

158158
aMarketplaceInstance = await Marketplace.new(aIexecHubInstance.address,{
159159
from: marketplaceCreator

test/03_appCreation.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,23 +133,23 @@ contract('IexecHub', function(accounts) {
133133
console.log("aIexecHubInstance.address is ");
134134
console.log(aIexecHubInstance.address);
135135

136-
txMined = await aWorkerPoolHubInstance.transferOwnership(aIexecHubInstance.address, {
136+
txMined = await aWorkerPoolHubInstance.setImmutableOwnership(aIexecHubInstance.address, {
137137
from: marketplaceCreator
138138
});
139139
assert.isBelow(txMined.receipt.gasUsed, constants.AMOUNT_GAS_PROVIDED, "should not use all gas");
140-
console.log("transferOwnership of WorkerPoolHub to IexecHub");
140+
console.log("setImmutableOwnership of WorkerPoolHub to IexecHub");
141141

142-
txMined = await aAppHubInstance.transferOwnership(aIexecHubInstance.address, {
142+
txMined = await aAppHubInstance.setImmutableOwnership(aIexecHubInstance.address, {
143143
from: marketplaceCreator
144144
});
145145
assert.isBelow(txMined.receipt.gasUsed, constants.AMOUNT_GAS_PROVIDED, "should not use all gas");
146-
console.log("transferOwnership of AppHub to IexecHub");
146+
console.log("setImmutableOwnership of AppHub to IexecHub");
147147

148-
txMined = await aDatasetHubInstance.transferOwnership(aIexecHubInstance.address, {
148+
txMined = await aDatasetHubInstance.setImmutableOwnership(aIexecHubInstance.address, {
149149
from: marketplaceCreator
150150
});
151151
assert.isBelow(txMined.receipt.gasUsed, constants.AMOUNT_GAS_PROVIDED, "should not use all gas");
152-
console.log("transferOwnership of DatasetHub to IexecHub");
152+
console.log("setImmutableOwnership of DatasetHub to IexecHub");
153153

154154
aMarketplaceInstance = await Marketplace.new(aIexecHubInstance.address,{
155155
from: marketplaceCreator

0 commit comments

Comments
 (0)