diff --git a/contracts/gateway/Anchor.sol b/contracts/gateway/Anchor.sol index 8f844460..01228d1c 100644 --- a/contracts/gateway/Anchor.sol +++ b/contracts/gateway/Anchor.sol @@ -177,7 +177,7 @@ contract Anchor is StateRootInterface, Organized, CircularBufferUint { bytes32 _stateRoot ) external - onlyWorker + onlyOrganization returns (bool success_) { // State root should be valid diff --git a/contracts/gateway/GatewayBase.sol b/contracts/gateway/GatewayBase.sol index ae1ec195..b27068ef 100644 --- a/contracts/gateway/GatewayBase.sol +++ b/contracts/gateway/GatewayBase.sol @@ -15,7 +15,6 @@ pragma solidity ^0.5.0; // limitations under the License. // // ---------------------------------------------------------------------------- -// Origin Chain: Gateway Contract // // http://www.simpletoken.org/ // diff --git a/test/gateway/anchor/anchor_state_root.js b/test/gateway/anchor/anchor_state_root.js index fceec881..5b3dbc23 100644 --- a/test/gateway/anchor/anchor_state_root.js +++ b/test/gateway/anchor/anchor_state_root.js @@ -70,7 +70,7 @@ contract('Anchor.anchorStateRoot()', function (accounts) { anchor.anchorStateRoot( blockHeight, stateRoot, - {from: worker}, + {from: owner}, ), 'State root must not be zero.', ); @@ -86,7 +86,7 @@ contract('Anchor.anchorStateRoot()', function (accounts) { anchor.anchorStateRoot( blockHeight, stateRoot, - {from: worker}, + {from: owner}, ), 'Given block height is lower or equal to highest anchored state root block height.', ); @@ -100,24 +100,25 @@ contract('Anchor.anchorStateRoot()', function (accounts) { anchor.anchorStateRoot( blockHeight, stateRoot, - {from: worker}, + {from: owner}, ), 'Given block height is lower or equal to highest anchored state root block height.', ); }); - it('should fail when caller is not worker address', async () => { + it('should fail when caller is not owner address', async () => { blockHeight = blockHeight.addn(1); + let nonOwner = accounts[6]; await Utils.expectRevert( anchor.anchorStateRoot( blockHeight, stateRoot, - {from: accounts[6]}, + {from: nonOwner}, ), - 'Only whitelisted workers are allowed to call this method.', + 'Only the organization is allowed to call this method.', ); }); @@ -129,7 +130,7 @@ contract('Anchor.anchorStateRoot()', function (accounts) { let result = await anchor.anchorStateRoot.call( blockHeight, stateRoot, - {from: worker}, + {from: owner}, ); assert.strictEqual( @@ -141,7 +142,7 @@ contract('Anchor.anchorStateRoot()', function (accounts) { await anchor.anchorStateRoot( blockHeight, stateRoot, - {from: worker}, + {from: owner}, ); let latestBlockHeight = await anchor.getLatestStateRootBlockHeight.call(); @@ -167,7 +168,7 @@ contract('Anchor.anchorStateRoot()', function (accounts) { let tx = await anchor.anchorStateRoot( blockHeight, stateRoot, - {from: worker}, + {from: owner}, ); let event = EventDecoder.getEvents(tx, anchor); @@ -206,7 +207,7 @@ contract('Anchor.anchorStateRoot()', function (accounts) { await anchor.anchorStateRoot( blockHeight, stateRoot, - {from: worker}, + {from: owner}, ); // Check that the older state root has been deleted when i > max state roots. diff --git a/test/gateway/anchor/get_latest_state_root_block_height.js b/test/gateway/anchor/get_latest_state_root_block_height.js index 311c7394..d72dd9d0 100644 --- a/test/gateway/anchor/get_latest_state_root_block_height.js +++ b/test/gateway/anchor/get_latest_state_root_block_height.js @@ -72,7 +72,7 @@ contract('Anchor.getLatestStateRootBlockHeight()', function (accounts) { await anchor.anchorStateRoot( blockHeight, stateRoot, - {from: worker}, + {from: owner}, ); let latestBlockHeight = await anchor.getLatestStateRootBlockHeight.call(); diff --git a/test/gateway/anchor/get_state_root.js b/test/gateway/anchor/get_state_root.js index 9abec0c7..de271b13 100644 --- a/test/gateway/anchor/get_state_root.js +++ b/test/gateway/anchor/get_state_root.js @@ -90,7 +90,7 @@ contract('Anchor.getStateRoot()', function (accounts) { await anchor.anchorStateRoot( blockHeight, stateRoot, - {from: worker}, + {from: owner}, ); let latestStateRoot = await anchor.getStateRoot.call(blockHeight);