diff --git a/.solcover.js b/.solcover.js index 66c92e47..f7c21b44 100644 --- a/.solcover.js +++ b/.solcover.js @@ -1,5 +1,5 @@ module.exports = { port: 8555, testrpcOptions: '--port 8555 --account="0x8fbbbaceff30d4eea3e2ffa2dfedc3c053f78c1f53103e4ddc31309e6b1d5ea0,10000000000000000000000000000000000" --account="0x8fbbbaceff30d4eea3e2ffa2dfedc3c053f78c1f53103e4ddc31309e6b1d5ea1,10000000000000000000000000000000000" --account="0x8fbbbaceff30d4eea3e2ffa2dfedc3c053f78c1f53103e4ddc31309e6b1d5ea2,10000000000000000000000000000000000" --account="0x8fbbbaceff30d4eea3e2ffa2dfedc3c053f78c1f53103e4ddc31309e6b1d5ea3,10000000000000000000000000000000000" --account="0x8fbbbaceff30d4eea3e2ffa2dfedc3c053f78c1f53103e4ddc31309e6b1d5ea4,10000000000000000000000000000000000" --account="0x8fbbbaceff30d4eea3e2ffa2dfedc3c053f78c1f53103e4ddc31309e6b1d5ea5,10000000000000000000000000000000000" --account="0x8fbbbaceff30d4eea3e2ffa2dfedc3c053f78c1f53103e4ddc31309e6b1d5ea6,10000000000000000000000000000000000" --account="0x8fbbbaceff30d4eea3e2ffa2dfedc3c053f78c1f53103e4ddc31309e6b1d5ea7,10000000000000000000000000000000000" --account="0x8fbbbaceff30d4eea3e2ffa2dfedc3c053f78c1f53103e4ddc31309e6b1d5ea8,10000000000000000000000000000000000" --account="0x8fbbbaceff30d4eea3e2ffa2dfedc3c053f78c1f53103e4ddc31309e6b1d5ea9,0" --account="0x8fbbbaceff30d4eea3e2ffa2dfedc3c053f78c1f53103e4ddc31309e6b1d5eb0,10000000000000000000000000000000000" --account="0x8fbbbaceff30d4eea3e2ffa2dfedc3c053f78c1f53103e4ddc31309e6b1d5eb1,10000000000000000000000000000000000" --account="0x8fbbbaceff30d4eea3e2ffa2dfedc3c053f78c1f53103e4ddc31309e6b1d5eb2,10000000000000000000000000000000000" --account="0x8fbbbaceff30d4eea3e2ffa2dfedc3c053f78c1f53103e4ddc31309e6b1d5eb3,10000000000000000000000000000000000" --account="0x8fbbbaceff30d4eea3e2ffa2dfedc3c053f78c1f53103e4ddc31309e6b1d5eb4,10000000000000000000000000000000000" --account="0x8fbbbaceff30d4eea3e2ffa2dfedc3c053f78c1f53103e4ddc31309e6b1d5eb5,10000000000000000000000000000000000" --account="0x8fbbbaceff30d4eea3e2ffa2dfedc3c053f78c1f53103e4ddc31309e6b1d5eb6,10000000000000000000000000000000000" --account="0x8fbbbaceff30d4eea3e2ffa2dfedc3c053f78c1f53103e4ddc31309e6b1d5eb7,10000000000000000000000000000000000" --account="0x8fbbbaceff30d4eea3e2ffa2dfedc3c053f78c1f53103e4ddc31309e6b1d5eb8,10000000000000000000000000000000000" --account="0x8fbbbaceff30d4eea3e2ffa2dfedc3c053f78c1f53103e4ddc31309e6b1d5eb9,0"', - skipFiles: ['gateway/MockCore.sol','gateway/EIP20TokenMock.sol','gateway/OpenSTUtilityMock.sol','gateway/OpenSTValueMock.sol','gateway/ProtocolVersionedMock.sol','gateway/SafeMathMock.sol','gateway/UtilityTokenAbstractMock.sol','truffle/Migrations.sol'] + skipFiles: ['gateway/MockSafeCore.sol','gateway/EIP20TokenMock.sol','gateway/OpenSTUtilityMock.sol','gateway/OpenSTValueMock.sol','gateway/ProtocolVersionedMock.sol','gateway/SafeMathMock.sol','gateway/UtilityTokenAbstractMock.sol','truffle/Migrations.sol'] }; \ No newline at end of file diff --git a/contracts/core/KernelGateway.sol b/contracts/core/KernelGateway.sol index 5057de46..5dc61499 100644 --- a/contracts/core/KernelGateway.sol +++ b/contracts/core/KernelGateway.sol @@ -29,7 +29,7 @@ contract KernelGateway is KernelGatewayInterface { /* Events */ - /** Emit event when open kernel in origin core is proven. */ + /** Emit event when open kernel in mosaic core is proven. */ event OpenKernelProven( bytes20 _originCoreIdentifier, bytes20 _auxiliaryCoreIdentifier, @@ -47,21 +47,21 @@ contract KernelGateway is KernelGatewayInterface { uint256 _currentDynasty ); - /** Emit event origin core account is proven. */ - event OriginCoreProven( - address _originCore, + /** Emit event mosaic core account is proven. */ + event MosaicCoreProven( + address _mosaicCore, uint256 _blockHeight, bytes32 _storageRoot, bool _wasAlreadyProved ); - /** Index of kernel hash storage location in origin core. */ + /** Index of kernel hash storage location in mosaic core. */ uint8 public constant KERNEL_HASH_INDEX = 5; /* Variables */ - /** Address of origin core. */ - address public originCore; + /** Address of mosaic core. */ + address public mosaicCore; /** Address of the origin block store. */ BlockStoreInterface public originBlockStore; @@ -69,8 +69,8 @@ contract KernelGateway is KernelGatewayInterface { /** Address of the auxiliary block store. */ BlockStoreInterface public auxiliaryBlockStore; - /** path to prove merkle account proof for OriginCore contract. */ - bytes public encodedOriginCorePath; + /** path to prove merkle account proof for MosaicCore contract. */ + bytes public encodedMosaicCorePath; /** Storage path. */ bytes public storagePath; @@ -78,7 +78,7 @@ contract KernelGateway is KernelGatewayInterface { /** A mapping of kernel hash to the kernel object. */ mapping(bytes32 => MetaBlock.Kernel) public kernels; - /** A mapping of origin block height to the storage root of origin core. */ + /** A mapping of origin block height to the storage root of mosaic core. */ mapping(uint256 => bytes32) public storageRoots; /** The hash of the currently active kernel. */ @@ -90,7 +90,7 @@ contract KernelGateway is KernelGatewayInterface { /** The auxiliary dynasty height at which the open kernel will be active. */ uint256 public openKernelActivationHeight; - /** The origin core identifier. */ + /** The mosaic core identifier. */ bytes20 public originCoreIdentifier; /** The auxiliary core identifier. */ @@ -116,14 +116,14 @@ contract KernelGateway is KernelGatewayInterface { * @notice Initializes the contract with origin and auxiliary block store * addresses. * - * @param _originCore The address of OriginCore contract. + * @param _mosaicCore The address of MosaicCore contract. * @param _originBlockStore The block store that stores the origin chain. * @param _auxiliaryBlockStore The block store that stores the auxiliary * chain. * @param _kernelHash Initial kernel hash. */ constructor ( - address _originCore, + address _mosaicCore, BlockStoreInterface _originBlockStore, BlockStoreInterface _auxiliaryBlockStore, bytes32 _kernelHash @@ -131,8 +131,8 @@ contract KernelGateway is KernelGatewayInterface { public { require( - _originCore != address(0), - "The address of the origin core must not be zero." + _mosaicCore != address(0), + "The address of the mosaic core must not be zero." ); require( @@ -152,7 +152,7 @@ contract KernelGateway is KernelGatewayInterface { originBlockStore = _originBlockStore; auxiliaryBlockStore = _auxiliaryBlockStore; - originCore = _originCore; + mosaicCore = _mosaicCore; activeKernelHash = _kernelHash; originCoreIdentifier = originBlockStore.getCoreIdentifier(); auxiliaryCoreIdentifier = auxiliaryBlockStore.getCoreIdentifier(); @@ -175,14 +175,14 @@ contract KernelGateway is KernelGatewayInterface { keccak256(abi.encodePacked(indexBytes)) ); - encodedOriginCorePath = BytesLib.bytes32ToBytes( - keccak256(abi.encodePacked(_originCore)) + encodedMosaicCorePath = BytesLib.bytes32ToBytes( + keccak256(abi.encodePacked(_mosaicCore)) ); } /** - * @notice Prove origin core account and update the latest storage root of - * origin core. This function will validate the proof against the + * @notice Prove mosaic core account and update the latest storage root of + * mosaic core. This function will validate the proof against the * state root from the OriginBlockStore * * @param _accountRlp RLP encoded account data. @@ -194,7 +194,7 @@ contract KernelGateway is KernelGatewayInterface { * * @return success_ `true` if the proof is successful. */ - function proveOriginCore( + function proveMosaicCore( bytes calldata _accountRlp, bytes calldata _accountBranchRlp, uint256 _originBlockHeight @@ -235,14 +235,14 @@ contract KernelGateway is KernelGatewayInterface { storageRoot = updateStorageRoot( _accountRlp, _accountBranchRlp, - encodedOriginCorePath, + encodedMosaicCorePath, stateRoot, _originBlockHeight ); } - emit OriginCoreProven( - originCore, + emit MosaicCoreProven( + mosaicCore, _originBlockHeight, storageRoot, isAlreadyProven @@ -519,7 +519,7 @@ contract KernelGateway is KernelGatewayInterface { /* Internal functions */ /** - * @notice Get storage root for the OriginCore contract. + * @notice Get storage root for the MosaicCore contract. * * @dev The existence of storage root is proved with merkle proof. * @@ -555,7 +555,7 @@ contract KernelGateway is KernelGatewayInterface { ); /* - * Verify the remote origin core contract against the committed state + * Verify the remote mosaic core contract against the committed state * root with the state trie Merkle proof. */ require( diff --git a/contracts/core/KernelGatewayInterface.sol b/contracts/core/KernelGatewayInterface.sol index 0742296b..b6ab51fa 100644 --- a/contracts/core/KernelGatewayInterface.sol +++ b/contracts/core/KernelGatewayInterface.sol @@ -18,8 +18,8 @@ pragma solidity ^0.5.0; interface KernelGatewayInterface { /** - * @notice Prove origin core account and update the latest storage root of - * origin core. This function will validate the proof against the + * @notice Prove mosaic core account and update the latest storage root of + * mosaic core. This function will validate the proof against the * state root from the OriginBlockStore * * @param _accountRlp RLP encoded account data. @@ -31,7 +31,7 @@ interface KernelGatewayInterface { * * @return success_ `true` if the proof is successful. */ - function proveOriginCore( + function proveMosaicCore( bytes calldata _accountRlp, bytes calldata _accountBranchRlp, uint256 _originBlockHeight diff --git a/contracts/core/OriginCore.sol b/contracts/core/MosaicCore.sol similarity index 98% rename from contracts/core/OriginCore.sol rename to contracts/core/MosaicCore.sol index 7b2b5643..3355ab6e 100644 --- a/contracts/core/OriginCore.sol +++ b/contracts/core/MosaicCore.sol @@ -15,20 +15,21 @@ pragma solidity ^0.5.0; // limitations under the License. import "../OstInterface.sol"; -import "./OriginCoreConfig.sol"; -import "./OriginCoreInterface.sol"; +import "./MosaicCoreConfig.sol"; +import "./MosaicCoreInterface.sol"; import "./Stake.sol"; import "../lib/MetaBlock.sol"; import "../lib/SafeMath.sol"; import "../StateRootInterface.sol"; /** - * @title OriginCore is a meta-blockchain with staked validators on Ethereum. + * @title MosaicCore is a meta-blockchain with staked validators on Ethereum. */ -contract OriginCore is - OriginCoreInterface, - OriginCoreConfig, - StateRootInterface { +contract MosaicCore is + MosaicCoreInterface, + MosaicCoreConfig, + StateRootInterface +{ using SafeMath for uint256; /* Events */ @@ -131,7 +132,7 @@ contract OriginCore is /* Constructor */ /** - * The OriginCore constructor initializes the OriginCore and deploys an + * The MosaicCore constructor initializes the MosaicCore and deploys an * instance of the Stake contract. * * @param _auxiliaryCoreIdentifier The core identifier of the auxiliary diff --git a/contracts/core/OriginCoreConfig.sol b/contracts/core/MosaicCoreConfig.sol similarity index 90% rename from contracts/core/OriginCoreConfig.sol rename to contracts/core/MosaicCoreConfig.sol index fa3d8c78..662fdc8a 100644 --- a/contracts/core/OriginCoreConfig.sol +++ b/contracts/core/MosaicCoreConfig.sol @@ -14,8 +14,8 @@ pragma solidity ^0.5.0; // See the License for the specific language governing permissions and // limitations under the License. -/** @title Configuration constants of the OriginCore contract. */ -contract OriginCoreConfig { +/** @title Configuration constants of the MosaicCore contract. */ +contract MosaicCoreConfig { /** The number of decimals of the base token. */ uint256 public constant DECIMALSFACTOR = 10 ** uint256(18); diff --git a/contracts/core/OriginCoreInterface.sol b/contracts/core/MosaicCoreInterface.sol similarity index 98% rename from contracts/core/OriginCoreInterface.sol rename to contracts/core/MosaicCoreInterface.sol index bf3c7faa..ec4175d8 100644 --- a/contracts/core/OriginCoreInterface.sol +++ b/contracts/core/MosaicCoreInterface.sol @@ -14,8 +14,8 @@ pragma solidity ^0.5.0; // See the License for the specific language governing permissions and // limitations under the License. -/** @title Interface for the origin core contract on origin. */ -interface OriginCoreInterface { +/** @title Interface for the mosaic core contract on origin. */ +interface MosaicCoreInterface { /** * @notice Proposes a new meta-block. The block is stored if the proposal diff --git a/contracts/core/Stake.sol b/contracts/core/Stake.sol index 1d35e06f..fcee2e7a 100644 --- a/contracts/core/Stake.sol +++ b/contracts/core/Stake.sol @@ -91,8 +91,8 @@ contract Stake is StakeInterface { /** The token that is used as staking currency. */ EIP20Interface public stakingToken; - /** Address of the origin core. */ - address public originCore; + /** Address of the mosaic core. */ + address public mosaicCore; /** * The minimum weight that is required for this meta-blockchain to function. @@ -135,12 +135,12 @@ contract Stake is StakeInterface { /* Modifiers */ /** - * Verifies that the message was sent by the origin core. + * Verifies that the message was sent by the mosaic core. */ - modifier onlyOriginCore() { + modifier onlyMosaicCore() { require( - msg.sender == originCore, - "Caller must be the registered Origin Core." + msg.sender == mosaicCore, + "Caller must be the registered mosaic Core." ); _; @@ -172,13 +172,13 @@ contract Stake is StakeInterface { * before it becomes functional, the initial set of validators must * be set by calling `initialize()`. * !!! You probably don't want to deploy the Stake contract - * !!! yourself. Instead, it should be deployed from the OriginCore + * !!! yourself. Instead, it should be deployed from the MosaicCore * !!! constructor. * * @param _stakingToken The address of the ERC-20 token that is used to * deposit stakes. - * @param _originCore Address of the origin core. Some methods may only be - * called from the origin core. + * @param _mosaicCore Address of the mosaic core. Some methods may only be + * called from the mosaic core. * @param _minimumWeight The minimum total weight that all active validators * must have so that the meta-blockchain is not * considered halted. See also the modifier @@ -186,7 +186,7 @@ contract Stake is StakeInterface { */ constructor( address _stakingToken, - address _originCore, + address _mosaicCore, uint256 _minimumWeight ) public @@ -196,8 +196,8 @@ contract Stake is StakeInterface { "The address of the staking token must not be zero." ); require( - _originCore != address(0), - "The address of the origin core must not be zero." + _mosaicCore != address(0), + "The address of the mosaic core must not be zero." ); require( _minimumWeight > 0, @@ -205,7 +205,7 @@ contract Stake is StakeInterface { ); stakingToken = EIP20Interface(_stakingToken); - originCore = _originCore; + mosaicCore = _mosaicCore; minimumWeight = _minimumWeight; /* @@ -391,7 +391,7 @@ contract Stake is StakeInterface { /** * @notice Notifies the contract about a closing meta-block in order to * handle any changes in the set of validators. - * Can only be called from OriginCore. + * Can only be called from MosaicCore. * * @dev The height is given to `assert` that the call is in sync with the * contract. @@ -405,7 +405,7 @@ contract Stake is StakeInterface { uint256 _closingHeight ) external - onlyOriginCore() + onlyMosaicCore() aboveMinimumWeight() returns ( address[] memory updatedValidators_, @@ -446,7 +446,7 @@ contract Stake is StakeInterface { * @notice Returns the weight of a validator at a specific meta-block height, * based on the auxiliary address of the validator. * - * @dev The OriginCore can use this method to track the verified weight by + * @dev The MosaicCore can use this method to track the verified weight by * the verified votes and notice when a supermajority has been * reached, therefore committing the meta-block. * The height is given to `assert` that the call is in sync with the diff --git a/contracts/core/StakeInterface.sol b/contracts/core/StakeInterface.sol index d61c1799..87555705 100644 --- a/contracts/core/StakeInterface.sol +++ b/contracts/core/StakeInterface.sol @@ -94,7 +94,7 @@ interface StakeInterface { /** * @notice Notifies the contract about a closing meta-block in order to * handle any changes in the set of validators. - * Can only be called from OriginCore. + * Can only be called from MosaicCore. * * @dev The height is given to `assert` that the call is in sync with the * contract. @@ -145,7 +145,7 @@ interface StakeInterface { * @notice Returns the weight of a validator at a specific meta-block * height, based on the auxiliary address of the validator. * - * @dev The OriginCore can use this method to track the verified weight by + * @dev The MosaicCore can use this method to track the verified weight by * the verified votes and notice when a supermajority has been * reached, therefore committing the meta-block. * The height is given to `assert` that the call is in sync with the diff --git a/contracts/gateway/EIP20CoGateway.sol b/contracts/gateway/EIP20CoGateway.sol index 16ae893d..ca2b74ed 100644 --- a/contracts/gateway/EIP20CoGateway.sol +++ b/contracts/gateway/EIP20CoGateway.sol @@ -211,7 +211,7 @@ contract EIP20CoGateway is GatewayBase { constructor( address _valueToken, address _utilityToken, - CoreInterface _core, + StateRootInterface _core, uint256 _bounty, IsMemberInterface _membersManager, address _gateway diff --git a/contracts/gateway/EIP20Gateway.sol b/contracts/gateway/EIP20Gateway.sol index 91beab05..d2f2d5bb 100644 --- a/contracts/gateway/EIP20Gateway.sol +++ b/contracts/gateway/EIP20Gateway.sol @@ -234,7 +234,7 @@ contract EIP20Gateway is GatewayBase { constructor( EIP20Interface _token, EIP20Interface _baseToken, - CoreInterface _core, + StateRootInterface _core, uint256 _bounty, IsMemberInterface _membersManager ) diff --git a/contracts/gateway/GatewayBase.sol b/contracts/gateway/GatewayBase.sol index 1d542a34..abc2d01b 100644 --- a/contracts/gateway/GatewayBase.sol +++ b/contracts/gateway/GatewayBase.sol @@ -75,8 +75,8 @@ contract GatewayBase is Organized { */ MessageBus.MessageBox messageBox; - /** address of core contract. */ - CoreInterface public core; + /** Address of core contract. */ + StateRootInterface public core; /** Path to make Merkle account proof for Gateway/CoGateway contract. */ bytes public encodedGatewayPath; @@ -135,7 +135,7 @@ contract GatewayBase is Organized { * @param _membersManager Address of a contract that manages workers. */ constructor( - CoreInterface _core, + StateRootInterface _core, uint256 _bounty, IsMemberInterface _membersManager ) @@ -193,7 +193,7 @@ contract GatewayBase is Organized { "Length of RLP parent nodes is 0" ); - bytes32 stateRoot = StateRootInterface(address(core)).getStateRoot(_blockHeight); + bytes32 stateRoot = core.getStateRoot(_blockHeight); // State root should be present for the block height require( diff --git a/contracts/gateway/Core.sol b/contracts/gateway/SafeCore.sol similarity index 99% rename from contracts/gateway/Core.sol rename to contracts/gateway/SafeCore.sol index 1fb0e4d7..deed1980 100644 --- a/contracts/gateway/Core.sol +++ b/contracts/gateway/SafeCore.sol @@ -34,7 +34,7 @@ import "../StateRootInterface.sol"; * @notice Core is a minimal stub that will become the anchoring and consensus point for * the utility chain to validate itself against. */ -contract Core is CoreInterface, StateRootInterface { +contract SafeCore is CoreInterface, StateRootInterface { using SafeMath for uint256; /** Events */ diff --git a/contracts/test/TestEIP20Gateway.sol b/contracts/test/TestEIP20Gateway.sol index 4cc29db7..65aa78b8 100644 --- a/contracts/test/TestEIP20Gateway.sol +++ b/contracts/test/TestEIP20Gateway.sol @@ -42,7 +42,7 @@ contract TestEIP20Gateway is EIP20Gateway { constructor( EIP20Interface _token, EIP20Interface _baseToken, - CoreInterface _core, + StateRootInterface _core, uint256 _bounty, IsMemberInterface _membersManager ) diff --git a/contracts/test/core/MockCore.sol b/contracts/test/core/MockSafeCore.sol similarity index 92% rename from contracts/test/core/MockCore.sol rename to contracts/test/core/MockSafeCore.sol index 089db440..2d8c49e2 100644 --- a/contracts/test/core/MockCore.sol +++ b/contracts/test/core/MockSafeCore.sol @@ -1,14 +1,14 @@ pragma solidity ^0.5.0; import "../../gateway/WorkersInterface.sol"; -import "../../gateway/Core.sol"; +import "../../gateway/SafeCore.sol"; /** - * @title CoreMock contract + * @title MockSafeCore contract * * @notice Used for test only */ -contract MockCore is Core { +contract MockSafeCore is SafeCore { /* Public functions */ @@ -29,7 +29,7 @@ contract MockCore is Core { bytes32 _stateRoot, WorkersInterface _workers ) - Core( + SafeCore( _chainIdOrigin, _chainIdRemote, _blockHeight, diff --git a/contracts/test/core/TestKernelGateway.sol b/contracts/test/core/TestKernelGateway.sol index aff919a9..d3fe1219 100644 --- a/contracts/test/core/TestKernelGateway.sol +++ b/contracts/test/core/TestKernelGateway.sol @@ -25,20 +25,20 @@ contract TestKernelGateway is KernelGateway{ * @notice Initializes the contract with origin and auxiliary block store * addresses. * - * @param _originCore The address of OriginCore contract. + * @param _mosaicCore The address of MosaicCore contract. * @param _originBlockStore The block store that stores the origin chain. * @param _auxiliaryBlockStore The block store that stores the auxiliary * chain. * @param _kernelHash Initial kernel hash. */ constructor ( - address _originCore, + address _mosaicCore, BlockStoreInterface _originBlockStore, BlockStoreInterface _auxiliaryBlockStore, bytes32 _kernelHash ) KernelGateway( - _originCore, + _mosaicCore, _originBlockStore, _auxiliaryBlockStore, _kernelHash diff --git a/contracts/test/core/TestKernelGatewayFail.sol b/contracts/test/core/TestKernelGatewayFail.sol index 2dc806cb..ebc4052d 100644 --- a/contracts/test/core/TestKernelGatewayFail.sol +++ b/contracts/test/core/TestKernelGatewayFail.sol @@ -25,20 +25,20 @@ contract TestKernelGatewayFail is TestKernelGateway{ * @notice Initializes the contract with origin and auxiliary block store * addresses. * - * @param _originCore The address of OriginCore contract. + * @param _mosaicCore The address of MosaicCore contract. * @param _originBlockStore The block store that stores the origin chain. * @param _auxiliaryBlockStore The block store that stores the auxiliary * chain. * @param _kernelHash Initial kernel hash. */ constructor ( - address _originCore, + address _mosaicCore, BlockStoreInterface _originBlockStore, BlockStoreInterface _auxiliaryBlockStore, bytes32 _kernelHash ) TestKernelGateway( - _originCore, + _mosaicCore, _originBlockStore, _auxiliaryBlockStore, _kernelHash diff --git a/contracts/test/core/TestOriginCore.sol b/contracts/test/core/TestMosaicCore.sol similarity index 94% rename from contracts/test/core/TestOriginCore.sol rename to contracts/test/core/TestMosaicCore.sol index 33bd59df..f3fd411d 100644 --- a/contracts/test/core/TestOriginCore.sol +++ b/contracts/test/core/TestMosaicCore.sol @@ -14,10 +14,10 @@ pragma solidity ^0.5.0; // See the License for the specific language governing permissions and // limitations under the License. -import "../../core/OriginCore.sol"; +import "../../core/MosaicCore.sol"; -/** @title The TestOriginCore is used to test few functions of OriginCore. */ -contract TestOriginCore is OriginCore { +/** @title The TestMosaicCore is used to test few functions of MosaicCore. */ +contract TestMosaicCore is MosaicCore { /* Constructor */ @@ -46,7 +46,7 @@ contract TestOriginCore is OriginCore { uint256 _minimumWeight, uint256 _maxAccumulateGasLimit ) - OriginCore( + MosaicCore( _auxiliaryCoreIdentifier, _ost, _initialAuxiliaryGas, diff --git a/contracts/test/gateway/MockGatewayBase.sol b/contracts/test/gateway/MockGatewayBase.sol index 3ec855b8..f974fe58 100644 --- a/contracts/test/gateway/MockGatewayBase.sol +++ b/contracts/test/gateway/MockGatewayBase.sol @@ -12,7 +12,7 @@ import "../../lib/IsMemberInterface.sol"; contract MockGatewayBase is GatewayBase { constructor( - CoreInterface _core, + StateRootInterface _core, uint256 _bounty, IsMemberInterface _membersManager ) diff --git a/test/core/kernel_gateway/constructor.js b/test/core/kernel_gateway/constructor.js index 93a06c1e..54457f69 100644 --- a/test/core/kernel_gateway/constructor.js +++ b/test/core/kernel_gateway/constructor.js @@ -33,11 +33,11 @@ contract('KernelGateway.constructor()', async (accounts) => { const auxiliaryCoreIdentifier = '0x0000000000000000000000000000000000000002'; const kernelHashIndex = 5; - let originCore, + let mosaicCore, originBlockStore, auxiliaryBlockStore, kernelHash, - encodedOriginCorePath, + encodedMosaicCorePath, storagePath; beforeEach(async function() { @@ -48,9 +48,9 @@ contract('KernelGateway.constructor()', async (accounts) => { await originBlockStore.setCoreIdentifier(originCoreIdentifier); await auxiliaryBlockStore.setCoreIdentifier(auxiliaryCoreIdentifier); - originCore = accounts[1]; + mosaicCore = accounts[1]; kernelHash = web3.utils.sha3('kernelHash'); - encodedOriginCorePath = web3.utils.sha3(originCore); + encodedMosaicCorePath = web3.utils.sha3(mosaicCore); storagePath = web3.utils.sha3( '0x0000000000000000000000000000000000000000000000000000000000000005' ); @@ -60,24 +60,24 @@ contract('KernelGateway.constructor()', async (accounts) => { it('should accept a valid construction', async () => { let kernelGateway = await KernelGateway.new( - originCore, + mosaicCore, originBlockStore.address, auxiliaryBlockStore.address, kernelHash, ); - let originCoreAddress = await kernelGateway.originCore.call(); + let mosaicCoreAddress = await kernelGateway.mosaicCore.call(); assert.strictEqual( - originCore, - originCoreAddress, - 'The contract did not store the correct origin core address.', + mosaicCore, + mosaicCoreAddress, + 'The contract did not store the correct mosaic core address.', ); let originBlockStoreAddress = await kernelGateway.originBlockStore.call(); assert.strictEqual( originBlockStore.address, originBlockStoreAddress, - 'The contract did not store the correct origin block store address.', + 'The contract did not store the correct mosaic block store address.', ); let auxiliaryBlockStoreAddress = @@ -117,11 +117,11 @@ contract('KernelGateway.constructor()', async (accounts) => { 'The contract did not return correct kernel hash index 5.', ); - let cEncodedOriginCorePath = await kernelGateway.encodedOriginCorePath.call(); + let cEncodedMosaicCorePath = await kernelGateway.encodedMosaicCorePath.call(); assert.strictEqual( - encodedOriginCorePath, - cEncodedOriginCorePath, - 'The contract did not return correct encoded origin core path.', + encodedMosaicCorePath, + cEncodedMosaicCorePath, + 'The contract did not return correct encoded mosaic core path.', ); @@ -134,7 +134,7 @@ contract('KernelGateway.constructor()', async (accounts) => { }); - it('should fail when origin core address is zero', async () => { + it('should fail when mosaic core address is zero', async () => { await Utils.expectRevert( KernelGateway.new( @@ -143,7 +143,7 @@ contract('KernelGateway.constructor()', async (accounts) => { auxiliaryBlockStore.address, kernelHash, ), - "The address of the origin core must not be zero.", + "The address of the mosaic core must not be zero.", ); }); @@ -152,7 +152,7 @@ contract('KernelGateway.constructor()', async (accounts) => { await Utils.expectRevert( KernelGateway.new( - originCore, + mosaicCore, zeroAddress, auxiliaryBlockStore.address, kernelHash, @@ -166,7 +166,7 @@ contract('KernelGateway.constructor()', async (accounts) => { await Utils.expectRevert( KernelGateway.new( - originCore, + mosaicCore, originBlockStore.address, zeroAddress, kernelHash, @@ -180,7 +180,7 @@ contract('KernelGateway.constructor()', async (accounts) => { await Utils.expectRevert( KernelGateway.new( - originCore, + mosaicCore, originBlockStore.address, auxiliaryBlockStore.address, zeroBytes, diff --git a/test/core/kernel_gateway/prove_block_opening.js b/test/core/kernel_gateway/prove_block_opening.js index c6d4e2d4..8b8ddc37 100644 --- a/test/core/kernel_gateway/prove_block_opening.js +++ b/test/core/kernel_gateway/prove_block_opening.js @@ -30,7 +30,7 @@ const BlockStore = artifacts.require('BlockStoreMock'); contract('KernelGateway.proveBlockOpening()', async (accounts) => { const zeroBytes = "0x0000000000000000000000000000000000000000000000000000000000000000"; - let originCore, kernelGateway, originBlockStore, auxiliaryBlockStore, genesisKernelHash; + let mosaicCore, kernelGateway, originBlockStore, auxiliaryBlockStore, genesisKernelHash; let height, parent, @@ -46,13 +46,13 @@ contract('KernelGateway.proveBlockOpening()', async (accounts) => { async function deploy(KernelGateway) { // deploy the kernel gateway - originCore = accounts[1]; + mosaicCore = accounts[1]; originBlockStore = await BlockStore.new(); auxiliaryBlockStore = await BlockStore.new(); genesisKernelHash = "0xc5d856a8246e84f5c3c715e2a5571961ebe8a02eeba28eb007cd8331fc2c613e"; kernelGateway = await KernelGateway.new( - originCore, + mosaicCore, originBlockStore.address, auxiliaryBlockStore.address, genesisKernelHash, diff --git a/test/core/kernel_gateway/prove_origin_core.js b/test/core/kernel_gateway/prove_origin_core.js index 1dc85bbc..93b97b01 100644 --- a/test/core/kernel_gateway/prove_origin_core.js +++ b/test/core/kernel_gateway/prove_origin_core.js @@ -27,11 +27,11 @@ const BN = require('bn.js'); const EventDecoder = require('../../test_lib/event_decoder.js'); const Utils = require('../../test_lib/utils.js'); -contract('KernelGateway.proveOriginCore()', async (accounts) => { +contract('KernelGateway.proveMosaicCore()', async (accounts) => { const zeroBytes = "0x0000000000000000000000000000000000000000000000000000000000000000"; - let originCore, kernelGateway, originBlockStore, auxiliaryBlockStore; + let mosaicCore, kernelGateway, originBlockStore, auxiliaryBlockStore; let accountRlp = testData.account.rlpAccount; let accountBranchRlp = testData.account.rlpParentNodes; @@ -40,12 +40,12 @@ contract('KernelGateway.proveOriginCore()', async (accounts) => { async function deploy(KernelGateway) { // deploy the kernel gateway - originCore = accounts[1]; + mosaicCore = accounts[1]; originBlockStore = await BlockStore.new(); auxiliaryBlockStore = await BlockStore.new(); kernelGateway = await KernelGateway.new( - originCore, + mosaicCore, originBlockStore.address, auxiliaryBlockStore.address, web3.utils.sha3('genesisKernelHash'), @@ -61,7 +61,7 @@ contract('KernelGateway.proveOriginCore()', async (accounts) => { it('should fail when rlp account is zero', async () => { await Utils.expectRevert( - kernelGateway.proveOriginCore.call( + kernelGateway.proveMosaicCore.call( "0x", accountBranchRlp, originBlockHeight, @@ -73,7 +73,7 @@ contract('KernelGateway.proveOriginCore()', async (accounts) => { it('should fail when rlp account branch nodes is zero', async () => { await Utils.expectRevert( - kernelGateway.proveOriginCore.call( + kernelGateway.proveMosaicCore.call( accountRlp, "0x", originBlockHeight, @@ -87,7 +87,7 @@ contract('KernelGateway.proveOriginCore()', async (accounts) => { await originBlockStore.setStateRoot(zeroBytes); await Utils.expectRevert( - kernelGateway.proveOriginCore.call( + kernelGateway.proveMosaicCore.call( accountRlp, accountBranchRlp, originBlockHeight, @@ -101,7 +101,7 @@ contract('KernelGateway.proveOriginCore()', async (accounts) => { await deploy(KernelGatewayFail); await Utils.expectRevert( - kernelGateway.proveOriginCore.call( + kernelGateway.proveMosaicCore.call( accountRlp, accountBranchRlp, originBlockHeight, @@ -113,7 +113,7 @@ contract('KernelGateway.proveOriginCore()', async (accounts) => { it('should fail when account RLP is not valid RLP encoded data', async () => { await Utils.expectRevert( - kernelGateway.proveOriginCore.call( + kernelGateway.proveMosaicCore.call( web3.utils.sha3('random'), accountBranchRlp, originBlockHeight, @@ -124,7 +124,7 @@ contract('KernelGateway.proveOriginCore()', async (accounts) => { it('should pass with valid data', async () => { - let result = await kernelGateway.proveOriginCore.call( + let result = await kernelGateway.proveMosaicCore.call( accountRlp, accountBranchRlp, originBlockHeight, @@ -132,7 +132,7 @@ contract('KernelGateway.proveOriginCore()', async (accounts) => { assert(result, "Account proof must pass for valid data"); - let tx = await kernelGateway.proveOriginCore( + let tx = await kernelGateway.proveMosaicCore( accountRlp, accountBranchRlp, originBlockHeight, @@ -141,16 +141,16 @@ contract('KernelGateway.proveOriginCore()', async (accounts) => { let event = EventDecoder.getEvents(tx, kernelGateway); assert( - event.OriginCoreProven !== undefined, - "Event `OriginCoreProven` must be emitted.", + event.MosaicCoreProven !== undefined, + "Event `MosaicCoreProven` must be emitted.", ); - let eventData = event.OriginCoreProven; + let eventData = event.MosaicCoreProven; assert.strictEqual( - web3.utils.toChecksumAddress(eventData._originCore), - originCore, - `Origin core address from event must be equal to ${originCore}`, + web3.utils.toChecksumAddress(eventData._mosaicCore), + mosaicCore, + `Mosaic core address from event must be equal to ${mosaicCore}`, ); assert( @@ -185,13 +185,13 @@ contract('KernelGateway.proveOriginCore()', async (accounts) => { let originBlockHeight = new BN(100); - await kernelGateway.proveOriginCore( + await kernelGateway.proveMosaicCore( accountRlp, accountBranchRlp, originBlockHeight, ); - let tx = await kernelGateway.proveOriginCore( + let tx = await kernelGateway.proveMosaicCore( accountRlp, accountBranchRlp, originBlockHeight, @@ -200,16 +200,16 @@ contract('KernelGateway.proveOriginCore()', async (accounts) => { let event = EventDecoder.getEvents(tx, kernelGateway); assert( - event.OriginCoreProven !== undefined, - "Event `OriginCoreProven` must be emitted.", + event.MosaicCoreProven !== undefined, + "Event `MosaicCoreProven` must be emitted.", ); - let eventData = event.OriginCoreProven; + let eventData = event.MosaicCoreProven; assert.strictEqual( - web3.utils.toChecksumAddress(eventData._originCore), - originCore, - `Origin core address from event must be equal to ${originCore}`, + web3.utils.toChecksumAddress(eventData._mosaicCore), + mosaicCore, + `Mosaic core address from event must be equal to ${mosaicCore}`, ); assert( diff --git a/test/core/origin_core/constructor.js b/test/core/mosaic_core/constructor.js similarity index 74% rename from test/core/origin_core/constructor.js rename to test/core/mosaic_core/constructor.js index 3caa01f5..21cb1ed0 100644 --- a/test/core/origin_core/constructor.js +++ b/test/core/mosaic_core/constructor.js @@ -24,12 +24,12 @@ const web3 = require('../../test_lib/web3.js'); const BN = require('bn.js'); const Utils = require('../../test_lib/utils.js'); -const OriginCore = artifacts.require('OriginCore'); +const MosaicCore = artifacts.require('MosaicCore'); -contract('OriginCore.constructor()', async (accounts) => { +contract('MosaicCore.constructor()', async (accounts) => { - let originCore, gas, transactionRoot, ost, maxAccumulateGasLimit; + let mosaicCore, gas, transactionRoot, ost, maxAccumulateGasLimit; let auxiliaryCoreIdentifier = web3.utils.sha3("1"); let minimumWeight = new BN('1'); @@ -40,9 +40,9 @@ contract('OriginCore.constructor()', async (accounts) => { maxAccumulateGasLimit = new BN(105000); }); - it('should be able to deploy Origin core', async function () { + it('should be able to deploy mosaic core', async function () { - originCore = await OriginCore.new( + mosaicCore = await MosaicCore.new( auxiliaryCoreIdentifier, ost, gas, @@ -51,12 +51,12 @@ contract('OriginCore.constructor()', async (accounts) => { maxAccumulateGasLimit ); - assert(web3.utils.isAddress(originCore.address)); + assert(web3.utils.isAddress(mosaicCore.address)); }); - it('should deploy stake contract on Origin core deployment', async function () { + it('should deploy stake contract on mosaic core deployment', async function () { - originCore = await OriginCore.new( + mosaicCore = await MosaicCore.new( auxiliaryCoreIdentifier, ost, gas, @@ -65,16 +65,16 @@ contract('OriginCore.constructor()', async (accounts) => { maxAccumulateGasLimit ); - assert(web3.utils.isAddress(originCore.address)); + assert(web3.utils.isAddress(mosaicCore.address)); - let stakeAddress = await originCore.stake.call(); + let stakeAddress = await mosaicCore.stake.call(); assert(web3.utils.isAddress(stakeAddress)); }); - it('should report genesis block on Origin core deployment', async function () { + it('should report genesis block on mosaic core deployment', async function () { - originCore = await OriginCore.new( + mosaicCore = await MosaicCore.new( auxiliaryCoreIdentifier, ost, gas, @@ -83,18 +83,18 @@ contract('OriginCore.constructor()', async (accounts) => { maxAccumulateGasLimit ); - assert(web3.utils.isAddress(originCore.address)); + assert(web3.utils.isAddress(mosaicCore.address)); - let head = await originCore.head.call(); + let head = await mosaicCore.head.call(); assert(head !== '0x0000000000000000000000000000000000000000000000000000000000000000'); }); - it('should not deploy origin core if transaction root is zero', async function () { + it('should not deploy mosaic core if transaction root is zero', async function () { transactionRoot = "0x0000000000000000000000000000000000000000000000000000000000000000"; await Utils.expectThrow( - OriginCore.new( + MosaicCore.new( auxiliaryCoreIdentifier, ost, gas, @@ -105,12 +105,12 @@ contract('OriginCore.constructor()', async (accounts) => { ); }); - it('should not deploy origin core if ost token root is zero', async function () { + it('should not deploy mosaic core if ost token root is zero', async function () { ost = 0; await Utils.expectThrow( - OriginCore.new( + MosaicCore.new( auxiliaryCoreIdentifier, ost, gas, @@ -121,13 +121,13 @@ contract('OriginCore.constructor()', async (accounts) => { ); }); - it('should not deploy origin core if max accumulated gas limit is zero', + it('should not deploy mosaic core if max accumulated gas limit is zero', async function () { maxAccumulateGasLimit = new BN(0); await Utils.expectThrow( - OriginCore.new( + MosaicCore.new( auxiliaryCoreIdentifier, ost, gas, diff --git a/test/core/origin_core/get_accumulated_gas_target.js b/test/core/mosaic_core/get_accumulated_gas_target.js similarity index 86% rename from test/core/origin_core/get_accumulated_gas_target.js rename to test/core/mosaic_core/get_accumulated_gas_target.js index 9b624a98..e0bfd61d 100644 --- a/test/core/origin_core/get_accumulated_gas_target.js +++ b/test/core/mosaic_core/get_accumulated_gas_target.js @@ -19,9 +19,9 @@ // ---------------------------------------------------------------------------- const web3 = require('../../test_lib/web3.js'); const BN = require('bn.js'); -const OriginCore = artifacts.require('OriginCore'); +const MosaicCore = artifacts.require('MosaicCore'); -contract('OriginCore.getAccumulatedGasTarget()', async (accounts) => { +contract('MosaicCore.getAccumulatedGasTarget()', async (accounts) => { /** * @dev while writing this test commitMetaBlock function is not @@ -30,7 +30,7 @@ contract('OriginCore.getAccumulatedGasTarget()', async (accounts) => { * meta block for testing */ - let originCore, + let mosaicCore, maxAccumulateGasLimit, gas, auxiliaryCoreIdentifier, @@ -39,9 +39,9 @@ contract('OriginCore.getAccumulatedGasTarget()', async (accounts) => { minimumWeight ; - /** Deploys the origin core contract */ - async function deployOriginCore(){ - originCore = await OriginCore.new( + /** Deploys the mosaic core contract */ + async function deployMosaicCore(){ + mosaicCore = await MosaicCore.new( auxiliaryCoreIdentifier, ost, gas, @@ -53,8 +53,8 @@ contract('OriginCore.getAccumulatedGasTarget()', async (accounts) => { /** Asserts the accumulated gas target */ async function testAccumulatedGasTarget(){ - await deployOriginCore(); - let accumulatedGasTarget = await originCore.getAccumulatedGasTarget.call(); + await deployMosaicCore(); + let accumulatedGasTarget = await mosaicCore.getAccumulatedGasTarget.call(); assert( accumulatedGasTarget.eq(gas.add(maxAccumulateGasLimit)), `Accumulated gas target should` + diff --git a/test/core/origin_core/get_latest_state_root_block_height.js b/test/core/mosaic_core/get_latest_state_root_block_height.js similarity index 81% rename from test/core/origin_core/get_latest_state_root_block_height.js rename to test/core/mosaic_core/get_latest_state_root_block_height.js index 9c9cea84..d364fbac 100644 --- a/test/core/origin_core/get_latest_state_root_block_height.js +++ b/test/core/mosaic_core/get_latest_state_root_block_height.js @@ -19,7 +19,7 @@ // ---------------------------------------------------------------------------- const web3 = require('../../test_lib/web3.js'); const BN = require('bn.js'); -const OriginCore = artifacts.require('TestOriginCore'); +const MosaicCore = artifacts.require('TestMosaicCore'); /** * @dev This test just verifies the value of variable is @@ -27,7 +27,7 @@ const OriginCore = artifacts.require('TestOriginCore'); * `getLatestStateRootBlockHeight()`. */ -contract('OriginCore.getLatestStateRootBlockHeight()', async (accounts) => { +contract('MosaicCore.getLatestStateRootBlockHeight()', async (accounts) => { const coreIdentifier = '0x0000000000000000000000000000000000000001'; @@ -36,11 +36,11 @@ contract('OriginCore.getLatestStateRootBlockHeight()', async (accounts) => { let transactionRoot= web3.utils.sha3("1"); let minimumWeight = new BN('1'); - let originCore, ost; + let mosaicCore, ost; - /** Deploys the origin core contract */ - async function deployOriginCore(){ - originCore = await OriginCore.new( + /** Deploys the mosaic core contract */ + async function deployMosaicCore(){ + mosaicCore = await MosaicCore.new( coreIdentifier, ost, gas, @@ -52,13 +52,13 @@ contract('OriginCore.getLatestStateRootBlockHeight()', async (accounts) => { beforeEach(async () => { ost = accounts[0]; - await deployOriginCore(); + await deployMosaicCore(); }); it('should return zero.', async function () { let latestStateRootBlockHeight = - await originCore.getLatestStateRootBlockHeight.call(); + await mosaicCore.getLatestStateRootBlockHeight.call(); assert( latestStateRootBlockHeight.eq(new BN(0)), @@ -70,10 +70,10 @@ contract('OriginCore.getLatestStateRootBlockHeight()', async (accounts) => { it('should return latestStateRootBlockHeight variable value.', async function () { let height = new BN(1234); - await originCore.setLatestStateRootBlockHeight(height); + await mosaicCore.setLatestStateRootBlockHeight(height); let latestStateRootBlockHeight = - await originCore.getLatestStateRootBlockHeight.call(); + await mosaicCore.getLatestStateRootBlockHeight.call(); assert( latestStateRootBlockHeight.eq(height), diff --git a/test/core/origin_core/get_storage_root.js b/test/core/mosaic_core/get_storage_root.js similarity index 82% rename from test/core/origin_core/get_storage_root.js rename to test/core/mosaic_core/get_storage_root.js index 96a6f3ff..03f5dc16 100644 --- a/test/core/origin_core/get_storage_root.js +++ b/test/core/mosaic_core/get_storage_root.js @@ -19,14 +19,14 @@ // ---------------------------------------------------------------------------- const web3 = require('../../test_lib/web3.js'); const BN = require('bn.js'); -const OriginCore = artifacts.require('TestOriginCore'); +const MosaicCore = artifacts.require('TestMosaicCore'); /** * @dev This test just verifies the value returned by function * `getStateRoot()` is from `stateRoots` variable. */ -contract('OriginCore.getStorageRoot()', async (accounts) => { +contract('MosaicCore.getStorageRoot()', async (accounts) => { const coreIdentifier = '0x0000000000000000000000000000000000000001'; const zeroBytes = @@ -37,11 +37,11 @@ contract('OriginCore.getStorageRoot()', async (accounts) => { let transactionRoot= web3.utils.sha3("1"); let minimumWeight = new BN('1'); - let originCore, ost; + let mosaicCore, ost; - /** Deploys the origin core contract */ - async function deployOriginCore(){ - originCore = await OriginCore.new( + /** Deploys the mosaic core contract */ + async function deployMosaicCore(){ + mosaicCore = await MosaicCore.new( coreIdentifier, ost, gas, @@ -53,13 +53,13 @@ contract('OriginCore.getStorageRoot()', async (accounts) => { beforeEach(async () => { ost = accounts[0]; - await deployOriginCore(); + await deployMosaicCore(); }); it('should return zero bytes when the data does not exists.', async function () { let height = new BN(1); - let stateRoot = await originCore.getStateRoot.call(height); + let stateRoot = await mosaicCore.getStateRoot.call(height); assert.strictEqual( stateRoot, @@ -73,9 +73,9 @@ contract('OriginCore.getStorageRoot()', async (accounts) => { async function () { let height = new BN(1); let stateRoot = web3.utils.sha3("stateRoot"); - await originCore.setStateRoot(height, stateRoot); + await mosaicCore.setStateRoot(height, stateRoot); - let cStateRoot = await originCore.getStateRoot.call(height); + let cStateRoot = await mosaicCore.getStateRoot.call(height); assert.strictEqual( cStateRoot, diff --git a/test/core/origin_core/helpers/utils.js b/test/core/mosaic_core/helpers/utils.js similarity index 96% rename from test/core/origin_core/helpers/utils.js rename to test/core/mosaic_core/helpers/utils.js index 8479ae4b..e7c66759 100644 --- a/test/core/origin_core/helpers/utils.js +++ b/test/core/mosaic_core/helpers/utils.js @@ -15,7 +15,7 @@ Utils.prototype = { stakeAmount, validator, vote, - originCore, + mosaicCore, kernelHash, expectedVerifiedWeight, requiredWeight @@ -25,7 +25,7 @@ Utils.prototype = { let sig = await MetaBlockUtils.signVote(validator, vote); - let tx = await originCore.verifyVote( + let tx = await mosaicCore.verifyVote( kernelHash, vote.coreIdentifier, vote.transitionHash, @@ -38,7 +38,7 @@ Utils.prototype = { sig.s ); - let events = EventsDecoder.perform(tx.receipt, originCore.address, originCore.abi); + let events = EventsDecoder.perform(tx.receipt, mosaicCore.address, mosaicCore.abi); assert.equal( web3.utils.toChecksumAddress(events.VoteVerified.validator), diff --git a/test/core/origin_core/propose_block.js b/test/core/mosaic_core/propose_block.js similarity index 91% rename from test/core/origin_core/propose_block.js rename to test/core/mosaic_core/propose_block.js index 69ebe8b2..690a4d0c 100644 --- a/test/core/origin_core/propose_block.js +++ b/test/core/mosaic_core/propose_block.js @@ -24,11 +24,11 @@ const BN = require('bn.js'); const EventsDecoder = require('../../test_lib/event_decoder.js'); const Utils = require('../../test_lib/utils.js'); -const OriginCore = artifacts.require('OriginCore'); +const MosaicCore = artifacts.require('MosaicCore'); -contract('OriginCore.proposeBlock()', async (accounts) => { +contract('MosaicCore.proposeBlock()', async (accounts) => { - let originCore; + let mosaicCore; let minimumWeight = new BN('1'); let auxiliaryCoreIdentifier = web3.utils.sha3("1"); @@ -49,7 +49,7 @@ contract('OriginCore.proposeBlock()', async (accounts) => { let ost = accounts[0]; - originCore = await OriginCore.new( + mosaicCore = await MosaicCore.new( auxiliaryCoreIdentifier, ost, 0, @@ -61,7 +61,7 @@ contract('OriginCore.proposeBlock()', async (accounts) => { it('should be able to propose meta-block', async function () { - let tx = await originCore.proposeBlock( + let tx = await mosaicCore.proposeBlock( height, auxiliaryCoreIdentifier, kernelHash, @@ -73,7 +73,7 @@ contract('OriginCore.proposeBlock()', async (accounts) => { transactionRoot ); - let events = EventsDecoder.perform(tx.receipt, originCore.address, originCore.abi); + let events = EventsDecoder.perform(tx.receipt, mosaicCore.address, mosaicCore.abi); assert.equal( events.BlockProposed.height, @@ -89,7 +89,7 @@ contract('OriginCore.proposeBlock()', async (accounts) => { height = 0; await Utils.expectThrow( - originCore.proposeBlock( + mosaicCore.proposeBlock( height, auxiliaryCoreIdentifier, kernelHash, @@ -110,7 +110,7 @@ contract('OriginCore.proposeBlock()', async (accounts) => { gas = 0; await Utils.expectThrow( - originCore.proposeBlock( + mosaicCore.proposeBlock( height, auxiliaryCoreIdentifier, kernelHash, @@ -129,7 +129,7 @@ contract('OriginCore.proposeBlock()', async (accounts) => { it('should not be able to propose meta-block for same height and same' + ' transition object which is already proposed', async function () { - let tx = await originCore.proposeBlock( + let tx = await mosaicCore.proposeBlock( height, auxiliaryCoreIdentifier, kernelHash, @@ -141,7 +141,7 @@ contract('OriginCore.proposeBlock()', async (accounts) => { transactionRoot ); - let events = EventsDecoder.perform(tx.receipt, originCore.address, originCore.abi); + let events = EventsDecoder.perform(tx.receipt, mosaicCore.address, mosaicCore.abi); assert.equal( events.BlockProposed.height, @@ -150,7 +150,7 @@ contract('OriginCore.proposeBlock()', async (accounts) => { ); await Utils.expectThrow( - originCore.proposeBlock( + mosaicCore.proposeBlock( height, auxiliaryCoreIdentifier, kernelHash, @@ -172,7 +172,7 @@ contract('OriginCore.proposeBlock()', async (accounts) => { auxiliaryDynasty = 0; await Utils.expectThrow( - originCore.proposeBlock( + mosaicCore.proposeBlock( height, auxiliaryCoreIdentifier, kernelHash, @@ -194,7 +194,7 @@ contract('OriginCore.proposeBlock()', async (accounts) => { auxiliaryCoreIdentifier = web3.utils.sha3("2"); await Utils.expectThrow( - originCore.proposeBlock( + mosaicCore.proposeBlock( height, auxiliaryCoreIdentifier, kernelHash, @@ -218,7 +218,7 @@ contract('OriginCore.proposeBlock()', async (accounts) => { transactionRoot = "0x0000000000000000000000000000000000000000000000000000000000000000"; await Utils.expectThrow( - originCore.proposeBlock( + mosaicCore.proposeBlock( height, auxiliaryCoreIdentifier, kernelHash, @@ -239,7 +239,7 @@ contract('OriginCore.proposeBlock()', async (accounts) => { originBlockHash = "0x0000000000000000000000000000000000000000000000000000000000000000"; await Utils.expectThrow( - originCore.proposeBlock( + mosaicCore.proposeBlock( height, auxiliaryCoreIdentifier, kernelHash, @@ -259,7 +259,7 @@ contract('OriginCore.proposeBlock()', async (accounts) => { originDynasty = 0; await Utils.expectThrow( - originCore.proposeBlock( + mosaicCore.proposeBlock( height, auxiliaryCoreIdentifier, kernelHash, @@ -280,7 +280,7 @@ contract('OriginCore.proposeBlock()', async (accounts) => { kernelHash = "0x0000000000000000000000000000000000000000000000000000000000000000"; await Utils.expectThrow( - originCore.proposeBlock( + mosaicCore.proposeBlock( height, auxiliaryCoreIdentifier, kernelHash, diff --git a/test/core/origin_core/verify_vote.js b/test/core/mosaic_core/verify_vote.js similarity index 87% rename from test/core/origin_core/verify_vote.js rename to test/core/mosaic_core/verify_vote.js index 18eea87e..38ae1c29 100644 --- a/test/core/origin_core/verify_vote.js +++ b/test/core/mosaic_core/verify_vote.js @@ -24,12 +24,12 @@ const BN = require('bn.js'); const EventsDecoder = require('../../test_lib/event_decoder.js'); const Utils = require('../../test_lib/utils.js'); const MetaBlockUtils = require('../../test_lib/meta_block.js'); -const OriginCoreUtils = require('./helpers/utils'); +const MosaicCoreUtils = require('./helpers/utils'); -const OriginCore = artifacts.require('OriginCore'); +const MosaicCore = artifacts.require('MosaicCore'); const MockToken = artifacts.require('MockToken'); -let originCore; +let mosaicCore; let transitionHash; let vote; let minimumWeight = new BN('1'); @@ -46,7 +46,7 @@ let requiredWeight; let stakeAddress; let tokenDeployer; -contract('OriginCore.verifyVote()', async (accounts) => { +contract('MosaicCore.verifyVote()', async (accounts) => { beforeEach(async () => { @@ -72,7 +72,7 @@ contract('OriginCore.verifyVote()', async (accounts) => { let tokenDeployer = accounts[0]; erc20 = await MockToken.new({from: tokenDeployer}); - originCore = await OriginCore.new( + mosaicCore = await MosaicCore.new( auxiliaryCoreIdentifier, erc20.address, initialGas, @@ -80,9 +80,9 @@ contract('OriginCore.verifyVote()', async (accounts) => { minimumWeight, maxAccumulateGasLimit ); - let stakeAddress = await originCore.stake.call(); + let stakeAddress = await mosaicCore.stake.call(); - await OriginCoreUtils.initializeStakeContract( + await MosaicCoreUtils.initializeStakeContract( stakeAddress, erc20, tokenDeployer, @@ -107,11 +107,11 @@ contract('OriginCore.verifyVote()', async (accounts) => { let expectedVerifiedWeight = new BN(initialStakes[0]); - await OriginCoreUtils.verifyVote( + await MosaicCoreUtils.verifyVote( initialStakes[0], initialValidators[0], vote, - originCore, + mosaicCore, kernelHash, expectedVerifiedWeight, requiredWeight @@ -127,18 +127,18 @@ contract('OriginCore.verifyVote()', async (accounts) => { let expectedVerifiedWeight = new BN(initialStakes[0]); - await OriginCoreUtils.verifyVote( + await MosaicCoreUtils.verifyVote( initialStakes[0], validator, vote, - originCore, + mosaicCore, kernelHash, expectedVerifiedWeight, requiredWeight ); await Utils.expectThrow( - originCore.verifyVote( + mosaicCore.verifyVote( kernelHash, vote.coreIdentifier, vote.transitionHash, @@ -162,7 +162,7 @@ contract('OriginCore.verifyVote()', async (accounts) => { let sig = await MetaBlockUtils.signVote(validator, vote); await Utils.expectThrow( - originCore.verifyVote( + mosaicCore.verifyVote( kernelHash, vote.coreIdentifier, vote.transitionHash, @@ -183,11 +183,11 @@ contract('OriginCore.verifyVote()', async (accounts) => { let expectedVerifiedWeight = new BN(initialStakes[0]); - await OriginCoreUtils.verifyVote( + await MosaicCoreUtils.verifyVote( initialStakes[0], initialValidators[0], vote, - originCore, + mosaicCore, kernelHash, expectedVerifiedWeight, requiredWeight @@ -195,11 +195,11 @@ contract('OriginCore.verifyVote()', async (accounts) => { expectedVerifiedWeight = expectedVerifiedWeight.add(new BN(initialStakes[1])); - await OriginCoreUtils.verifyVote( + await MosaicCoreUtils.verifyVote( initialStakes[1], initialValidators[1], vote, - originCore, + mosaicCore, kernelHash, expectedVerifiedWeight, requiredWeight @@ -215,7 +215,7 @@ contract('OriginCore.verifyVote()', async (accounts) => { }; await Utils.expectThrow( - originCore.verifyVote( + mosaicCore.verifyVote( kernelHash, vote.coreIdentifier, vote.transitionHash, @@ -241,7 +241,7 @@ contract('OriginCore.verifyVote()', async (accounts) => { let wrongTransitionHash = web3.utils.sha3("wrong transition hash"); await Utils.expectThrow( - originCore.verifyVote( + mosaicCore.verifyVote( kernelHash, vote.coreIdentifier, wrongTransitionHash, @@ -266,7 +266,7 @@ contract('OriginCore.verifyVote()', async (accounts) => { kernelHash = web3.utils.sha3("wrong kernel hash"); await Utils.expectThrow( - originCore.verifyVote( + mosaicCore.verifyVote( kernelHash, vote.coreIdentifier, vote.transitionHash, @@ -291,7 +291,7 @@ contract('OriginCore.verifyVote()', async (accounts) => { let wrongCoreIdentifier = accounts[8]; await Utils.expectThrow( - originCore.verifyVote( + mosaicCore.verifyVote( kernelHash, wrongCoreIdentifier, vote.transitionHash, @@ -308,7 +308,7 @@ contract('OriginCore.verifyVote()', async (accounts) => { }); }); -contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { +contract('MosaicCore.verifyVote() [commit meta-block]', async (accounts) => { beforeEach(async () => { @@ -316,7 +316,7 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { tokenDeployer = accounts[0]; erc20 = await MockToken.new({from: tokenDeployer}); - originCore = await OriginCore.new( + mosaicCore = await MosaicCore.new( auxiliaryCoreIdentifier, erc20.address, initialGas, @@ -325,7 +325,7 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { maxAccumulateGasLimit ); - kernelHash = await originCore.openKernelHash.call(); + kernelHash = await mosaicCore.openKernelHash.call(); await proposeMetaBlock(); vote = { @@ -337,7 +337,7 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { targetHeight: new BN('2'), }; - stakeAddress = await originCore.stake.call(); + stakeAddress = await mosaicCore.stake.call(); }); it('should commit a meta-block if 2/3 super majority is' + @@ -359,7 +359,7 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { new BN('100'), ]; - await OriginCoreUtils.initializeStakeContract( + await MosaicCoreUtils.initializeStakeContract( stakeAddress, erc20, tokenDeployer, @@ -371,11 +371,11 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { let expectedVerifiedWeight = new BN(initialStakes[0]); let expectedRequiredWeight = new BN(200); - await OriginCoreUtils.verifyVote( + await MosaicCoreUtils.verifyVote( initialStakes[0], initialValidators[0], vote, - originCore, + mosaicCore, kernelHash, expectedVerifiedWeight, expectedRequiredWeight @@ -383,11 +383,11 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { expectedVerifiedWeight = expectedVerifiedWeight.add(new BN(initialStakes[1])); - let events = await OriginCoreUtils.verifyVote( + let events = await MosaicCoreUtils.verifyVote( initialStakes[1], initialValidators[1], vote, - originCore, + mosaicCore, kernelHash, expectedVerifiedWeight, expectedRequiredWeight @@ -395,9 +395,9 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { let expectedHeight = 1; - let head = await originCore.head.call(); + let head = await mosaicCore.head.call(); - OriginCoreUtils.assertCommitMetaBlock( + MosaicCoreUtils.assertCommitMetaBlock( events, expectedHeight, kernelHash, @@ -427,7 +427,7 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { new BN('100'), ]; - await OriginCoreUtils.initializeStakeContract( + await MosaicCoreUtils.initializeStakeContract( stakeAddress, erc20, tokenDeployer, @@ -439,11 +439,11 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { let expectedVerifiedWeight = new BN(initialStakes[0]); let expectedRequiredWeight = new BN(200); - let events = await OriginCoreUtils.verifyVote( + let events = await MosaicCoreUtils.verifyVote( initialStakes[0], initialValidators[0], vote, - originCore, + mosaicCore, kernelHash, expectedVerifiedWeight, expectedRequiredWeight @@ -473,7 +473,7 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { new BN(1) ]; - await OriginCoreUtils.initializeStakeContract( + await MosaicCoreUtils.initializeStakeContract( stakeAddress, erc20, tokenDeployer, @@ -485,11 +485,11 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { let expectedVerifiedWeight = new BN(initialStakes[0]); let expectedRequiredWeight = new BN(3); - let events = await OriginCoreUtils.verifyVote( + let events = await MosaicCoreUtils.verifyVote( initialStakes[0], initialValidators[0], vote, - originCore, + mosaicCore, kernelHash, expectedVerifiedWeight, expectedRequiredWeight @@ -520,7 +520,7 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { new BN('100'), ]; - await OriginCoreUtils.initializeStakeContract( + await MosaicCoreUtils.initializeStakeContract( stakeAddress, erc20, tokenDeployer, @@ -532,11 +532,11 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { let expectedVerifiedWeight = new BN(initialStakes[0]); let expectedRequiredWeight = new BN(200); - await OriginCoreUtils.verifyVote( + await MosaicCoreUtils.verifyVote( initialStakes[0], initialValidators[0], vote, - originCore, + mosaicCore, kernelHash, expectedVerifiedWeight, expectedRequiredWeight @@ -544,11 +544,11 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { expectedVerifiedWeight = expectedVerifiedWeight.add(new BN(initialStakes[1])); - let events = await OriginCoreUtils.verifyVote( + let events = await MosaicCoreUtils.verifyVote( initialStakes[1], initialValidators[1], vote, - originCore, + mosaicCore, kernelHash, expectedVerifiedWeight, expectedRequiredWeight @@ -556,9 +556,9 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { let expectedHeight = 1; - let head = await originCore.head.call(); + let head = await mosaicCore.head.call(); - OriginCoreUtils.assertCommitMetaBlock( + MosaicCoreUtils.assertCommitMetaBlock( events, expectedHeight, kernelHash, @@ -575,9 +575,9 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { updatedWeights: [] }; - let openKernel = await originCore.openKernel.call(); + let openKernel = await mosaicCore.openKernel.call(); - let openKernelHash = await originCore.openKernelHash.call(); + let openKernelHash = await mosaicCore.openKernelHash.call(); let expectedKernelHash = "0xb94e25ddd9ce2be28e1a66c2e0b5ac998573f23d089880aa9c3b8c96ef36221c"; @@ -619,7 +619,7 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { new BN('100'), ]; - await OriginCoreUtils.initializeStakeContract( + await MosaicCoreUtils.initializeStakeContract( stakeAddress, erc20, tokenDeployer, @@ -631,11 +631,11 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { let expectedVerifiedWeight = new BN(initialStakes[0]); let expectedRequiredWeight = new BN(200); - await OriginCoreUtils.verifyVote( + await MosaicCoreUtils.verifyVote( initialStakes[0], initialValidators[0], vote, - originCore, + mosaicCore, kernelHash, expectedVerifiedWeight, expectedRequiredWeight @@ -643,11 +643,11 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { expectedVerifiedWeight = expectedVerifiedWeight.add(new BN(initialStakes[1])); - let events = await OriginCoreUtils.verifyVote( + let events = await MosaicCoreUtils.verifyVote( initialStakes[1], initialValidators[1], vote, - originCore, + mosaicCore, kernelHash, expectedVerifiedWeight, expectedRequiredWeight @@ -655,9 +655,9 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { let expectedHeight = 1; - let head = await originCore.head.call(); + let head = await mosaicCore.head.call(); - OriginCoreUtils.assertCommitMetaBlock( + MosaicCoreUtils.assertCommitMetaBlock( events, expectedHeight, kernelHash, @@ -694,7 +694,7 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { new BN('100'), ]; - await OriginCoreUtils.initializeStakeContract( + await MosaicCoreUtils.initializeStakeContract( stakeAddress, erc20, tokenDeployer, @@ -706,11 +706,11 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { let expectedVerifiedWeight = new BN(initialStakes[0]); let expectedRequiredWeight = new BN(200); - await OriginCoreUtils.verifyVote( + await MosaicCoreUtils.verifyVote( initialStakes[0], initialValidators[0], vote, - originCore, + mosaicCore, kernelHash, expectedVerifiedWeight, expectedRequiredWeight @@ -718,11 +718,11 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { expectedVerifiedWeight = expectedVerifiedWeight.add(new BN(initialStakes[1])); - let events = await OriginCoreUtils.verifyVote( + let events = await MosaicCoreUtils.verifyVote( initialStakes[1], initialValidators[1], vote, - originCore, + mosaicCore, kernelHash, expectedVerifiedWeight, expectedRequiredWeight @@ -730,9 +730,9 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { let expectedHeight = 1; - let head = await originCore.head.call(); + let head = await mosaicCore.head.call(); - OriginCoreUtils.assertCommitMetaBlock( + MosaicCoreUtils.assertCommitMetaBlock( events, expectedHeight, kernelHash, @@ -744,11 +744,11 @@ contract('OriginCore.verifyVote() [commit meta-block]', async (accounts) => { expectedVerifiedWeight = expectedVerifiedWeight.add(new BN(initialStakes[2])); - events = await OriginCoreUtils.verifyVote( + events = await MosaicCoreUtils.verifyVote( initialStakes[2], initialValidators[2], vote, - originCore, + mosaicCore, kernelHash, expectedVerifiedWeight, expectedRequiredWeight @@ -771,7 +771,7 @@ async function proposeMetaBlock() { originDynasty = 1, originBlockHash = web3.utils.sha3("1"); - let tx = await originCore.proposeBlock( + let tx = await mosaicCore.proposeBlock( height, auxiliaryCoreIdentifier, kernelHash, @@ -782,7 +782,7 @@ async function proposeMetaBlock() { originBlockHash, transactionRoot, ); - let events = EventsDecoder.perform(tx.receipt, originCore.address, originCore.abi); + let events = EventsDecoder.perform(tx.receipt, mosaicCore.address, mosaicCore.abi); assert.equal( events.BlockProposed.height, diff --git a/test/core/stake/close_meta_block.js b/test/core/stake/close_meta_block.js index 96c71db4..b217dd65 100644 --- a/test/core/stake/close_meta_block.js +++ b/test/core/stake/close_meta_block.js @@ -28,7 +28,7 @@ const Stake = artifacts.require('Stake'); contract('Stake.closeMetaBlock()', async (accounts) => { - let originCoreAccount = accounts[1]; + let mosaicCoreAccount = accounts[1]; let minimumWeight = new BN('1'); let token; let stake; @@ -37,7 +37,7 @@ contract('Stake.closeMetaBlock()', async (accounts) => { token = await MockToken.new(); stake = await Stake.new( token.address, - originCoreAccount, + mosaicCoreAccount, minimumWeight, ); await StakeUtils.initializeStake( @@ -53,7 +53,7 @@ contract('Stake.closeMetaBlock()', async (accounts) => { for (let expectedHeight = 2; expectedHeight < 5; expectedHeight++) { await stake.closeMetaBlock( new BN(expectedHeight - 1), - {from: originCoreAccount} + {from: mosaicCoreAccount} ); height = await stake.height.call(); @@ -69,7 +69,7 @@ contract('Stake.closeMetaBlock()', async (accounts) => { let tx = await stake.closeMetaBlock( new BN(1), - {from: originCoreAccount} + {from: mosaicCoreAccount} ); let events = Events.perform(tx.receipt, stake.address, stake.abi); assert.strictEqual( @@ -80,7 +80,7 @@ contract('Stake.closeMetaBlock()', async (accounts) => { tx = await stake.closeMetaBlock( new BN(2), - {from: originCoreAccount} + {from: mosaicCoreAccount} ); events = Events.perform(tx.receipt, stake.address, stake.abi); assert.strictEqual( @@ -94,7 +94,7 @@ contract('Stake.closeMetaBlock()', async (accounts) => { await Utils.expectFailedAssert( stake.closeMetaBlock( new BN(3), - {from: originCoreAccount} + {from: mosaicCoreAccount} ) ); }); diff --git a/test/core/stake/constructor.js b/test/core/stake/constructor.js index 9dcc51f0..a542d142 100644 --- a/test/core/stake/constructor.js +++ b/test/core/stake/constructor.js @@ -26,13 +26,13 @@ const Stake = artifacts.require('Stake'); contract('Stake.constructor()', async (accounts) => { let tokenAddress = accounts[3]; - let originCoreAddress = accounts[4]; + let mosaicCoreAddress = accounts[4]; let zeroAddress = '0x0000000000000000000000000000000000000000'; it('should accept a correct construction', async () => { await Stake.new( tokenAddress, - originCoreAddress, + mosaicCoreAddress, new BN('1000'), ); }); @@ -41,21 +41,21 @@ contract('Stake.constructor()', async (accounts) => { await Utils.expectRevert( Stake.new( zeroAddress, - originCoreAddress, + mosaicCoreAddress, new BN('10'), ), 'The address of the staking token must not be zero.' ); }); - it('should reject a zero origin core address', async () => { + it('should reject a zero mosaic core address', async () => { await Utils.expectRevert( Stake.new( tokenAddress, zeroAddress, new BN('10'), ), - 'The address of the origin core must not be zero.' + 'The address of the mosaic core must not be zero.' ); }); @@ -63,7 +63,7 @@ contract('Stake.constructor()', async (accounts) => { await Utils.expectRevert( Stake.new( tokenAddress, - originCoreAddress, + mosaicCoreAddress, new BN('0'), ), 'Minimum weight must be greater than zero.' diff --git a/test/core/stake/deposit.js b/test/core/stake/deposit.js index 80f509a0..a05fbe83 100644 --- a/test/core/stake/deposit.js +++ b/test/core/stake/deposit.js @@ -28,7 +28,7 @@ const Stake = artifacts.require('Stake'); contract('Stake.deposit()', async (accounts) => { - let originCoreAccount = accounts[4]; + let mosaicCoreAccount = accounts[4]; let minimumWeight = new BN('1'); let token; let stake; @@ -37,7 +37,7 @@ contract('Stake.deposit()', async (accounts) => { token = await MockToken.new(); stake = await Stake.new( token.address, - originCoreAccount, + mosaicCoreAccount, minimumWeight, ); await StakeUtils.initializeStake( @@ -198,7 +198,7 @@ contract('Stake.deposit()', async (accounts) => { await stake.closeMetaBlock( new BN(1), - {from: originCoreAccount}, + {from: mosaicCoreAccount}, ); await StakeUtils.deposit( diff --git a/test/core/stake/initialize.js b/test/core/stake/initialize.js index 4fa5c17d..f40041c9 100644 --- a/test/core/stake/initialize.js +++ b/test/core/stake/initialize.js @@ -28,7 +28,7 @@ const Stake = artifacts.require('Stake'); contract('Stake.initialize()', async (accounts) => { let tokenDeployer = accounts[0]; - let originCoreAccount = accounts[1]; + let mosaicCoreAccount = accounts[1]; let minimumWeight = new BN('32000'); let token; let stake; @@ -41,7 +41,7 @@ contract('Stake.initialize()', async (accounts) => { token = await MockToken.new({ from: tokenDeployer }); stake = await Stake.new( token.address, - originCoreAccount, + mosaicCoreAccount, minimumWeight, ); diff --git a/test/core/stake/total_weight_at_height.js b/test/core/stake/total_weight_at_height.js index 168040da..104786d0 100644 --- a/test/core/stake/total_weight_at_height.js +++ b/test/core/stake/total_weight_at_height.js @@ -26,7 +26,7 @@ const Stake = artifacts.require('Stake'); contract('Stake.totalWeightAtHeight()', async (accounts) => { - let originCoreAccount = accounts[0]; + let mosaicCoreAccount = accounts[0]; let minimumWeight = new BN('1'); let token; let stake; @@ -35,7 +35,7 @@ contract('Stake.totalWeightAtHeight()', async (accounts) => { token = await MockToken.new(); stake = await Stake.new( token.address, - originCoreAccount, + mosaicCoreAccount, minimumWeight, ); await StakeUtils.initializeStake( @@ -62,7 +62,7 @@ contract('Stake.totalWeightAtHeight()', async (accounts) => { ); await stake.closeMetaBlock( new BN(1), - {from: originCoreAccount} + {from: mosaicCoreAccount} ) await StakeUtils.deposit( token, @@ -72,7 +72,7 @@ contract('Stake.totalWeightAtHeight()', async (accounts) => { ); await stake.closeMetaBlock( new BN(2), - {from: originCoreAccount} + {from: mosaicCoreAccount} ) await StakeUtils.deposit( token, diff --git a/test/core/stake/weight.js b/test/core/stake/weight.js index a041d46b..50034543 100644 --- a/test/core/stake/weight.js +++ b/test/core/stake/weight.js @@ -26,7 +26,7 @@ const Stake = artifacts.require('Stake'); contract('Stake.weight()', async (accounts) => { - let originCoreAccount = accounts[1]; + let mosaicCoreAccount = accounts[1]; let minimumWeight = new BN('1'); let token; let stake; @@ -35,7 +35,7 @@ contract('Stake.weight()', async (accounts) => { token = await MockToken.new(); stake = await Stake.new( token.address, - originCoreAccount, + mosaicCoreAccount, minimumWeight, ); await StakeUtils.initializeStake( diff --git a/test/gateway/core_utils.js b/test/gateway/core_utils.js index ba34023f..90302403 100644 --- a/test/gateway/core_utils.js +++ b/test/gateway/core_utils.js @@ -21,7 +21,7 @@ const web3 = require('../test_lib/web3.js'); -const Core = artifacts.require("./Core.sol") +const Core = artifacts.require("./SafeCore.sol") , MockToken = artifacts.require("./MockToken.sol") , Workers = artifacts.require("./Workers.sol") , proof = require('../data/proof'); diff --git a/test/gateway/gateway_base/prove_gateway.js b/test/gateway/gateway_base/prove_gateway.js index 8e2910c1..0cf4ef73 100644 --- a/test/gateway/gateway_base/prove_gateway.js +++ b/test/gateway/gateway_base/prove_gateway.js @@ -1,5 +1,5 @@ const GatewayBase = artifacts.require("./MockGatewayBase.sol") - , Core = artifacts.require("./MockCore.sol") + , Core = artifacts.require("./MockSafeCore.sol") , BN = require('bn.js'); const MockMembersManager = artifacts.require('MockMembersManager.sol');