From 8f2fd9b603f74aa8a44dc0e8c3b845d497f9b279 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Tue, 29 May 2018 11:22:57 -0700 Subject: Rename Signer to Wallet, rename GAS_ESTIMATE to GAS_LIMIT --- packages/0x.js/test/global_hooks.ts | 2 +- packages/contract-wrappers/test/global_hooks.ts | 2 +- .../protocol/Exchange/MixinSignatureValidator.sol | 4 +-- .../protocol/Exchange/interfaces/ISigner.sol | 34 ---------------------- .../protocol/Exchange/interfaces/IWallet.sol | 34 ++++++++++++++++++++++ packages/contracts/src/utils/web3_wrapper.ts | 2 +- packages/dev-utils/src/constants.ts | 2 +- packages/dev-utils/src/web3_factory.ts | 4 +-- packages/order-watcher/test/global_hooks.ts | 2 +- 9 files changed, 43 insertions(+), 43 deletions(-) delete mode 100644 packages/contracts/src/contracts/current/protocol/Exchange/interfaces/ISigner.sol create mode 100644 packages/contracts/src/contracts/current/protocol/Exchange/interfaces/IWallet.sol diff --git a/packages/0x.js/test/global_hooks.ts b/packages/0x.js/test/global_hooks.ts index d9768e61c..6d2c3219b 100644 --- a/packages/0x.js/test/global_hooks.ts +++ b/packages/0x.js/test/global_hooks.ts @@ -11,7 +11,7 @@ before('migrate contracts', async function(): Promise { const mochaTestTimeoutMs = 20000; this.timeout(mochaTestTimeoutMs); const txDefaults = { - gas: devConstants.GAS_ESTIMATE, + gas: devConstants.GAS_LIMIT, from: devConstants.TESTRPC_FIRST_ADDRESS, }; const artifactsDir = `../migrations/artifacts/1.0.0`; diff --git a/packages/contract-wrappers/test/global_hooks.ts b/packages/contract-wrappers/test/global_hooks.ts index d9768e61c..6d2c3219b 100644 --- a/packages/contract-wrappers/test/global_hooks.ts +++ b/packages/contract-wrappers/test/global_hooks.ts @@ -11,7 +11,7 @@ before('migrate contracts', async function(): Promise { const mochaTestTimeoutMs = 20000; this.timeout(mochaTestTimeoutMs); const txDefaults = { - gas: devConstants.GAS_ESTIMATE, + gas: devConstants.GAS_LIMIT, from: devConstants.TESTRPC_FIRST_ADDRESS, }; const artifactsDir = `../migrations/artifacts/1.0.0`; diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol index 7f46766d6..7f4e20b5b 100644 --- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol +++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol @@ -20,7 +20,7 @@ pragma solidity ^0.4.24; import "./mixins/MSignatureValidator.sol"; import "./mixins/MTransactions.sol"; -import "./interfaces/ISigner.sol"; +import "./interfaces/IWallet.sol"; import "./interfaces/IValidator.sol"; import "./libs/LibExchangeErrors.sol"; import "../../utils/LibBytes/LibBytes.sol"; @@ -168,7 +168,7 @@ contract MixinSignatureValidator is // Signature verified by wallet contract. // If used with an order, the maker of the order is the wallet contract. } else if (signatureType == SignatureType.Wallet) { - isValid = ISigner(signer).isValidSignature(hash, signature); + isValid = IWallet(signer).isValidSignature(hash, signature); return isValid; // Signature verified by validator contract. diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/ISigner.sol b/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/ISigner.sol deleted file mode 100644 index 0186ad490..000000000 --- a/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/ISigner.sol +++ /dev/null @@ -1,34 +0,0 @@ -/* - - Copyright 2018 ZeroEx Intl. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -pragma solidity ^0.4.24; - -contract ISigner { - - /// @dev Verifies that a signature is valid. - /// @param hash Message hash that is signed. - /// @param signature Proof of signing. - /// @return Validity of order signature. - function isValidSignature( - bytes32 hash, - bytes signature - ) - external - view - returns (bool isValid); -} diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/IWallet.sol b/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/IWallet.sol new file mode 100644 index 000000000..c86a2c057 --- /dev/null +++ b/packages/contracts/src/contracts/current/protocol/Exchange/interfaces/IWallet.sol @@ -0,0 +1,34 @@ +/* + + Copyright 2018 ZeroEx Intl. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +pragma solidity ^0.4.24; + +contract IWallet { + + /// @dev Verifies that a signature is valid. + /// @param hash Message hash that is signed. + /// @param signature Proof of signing. + /// @return Validity of order signature. + function isValidSignature( + bytes32 hash, + bytes signature + ) + external + view + returns (bool isValid); +} diff --git a/packages/contracts/src/utils/web3_wrapper.ts b/packages/contracts/src/utils/web3_wrapper.ts index 02595506b..4b8512222 100644 --- a/packages/contracts/src/utils/web3_wrapper.ts +++ b/packages/contracts/src/utils/web3_wrapper.ts @@ -7,7 +7,7 @@ import { coverage } from './coverage'; export const txDefaults = { from: devConstants.TESTRPC_FIRST_ADDRESS, - gas: devConstants.GAS_ESTIMATE, + gas: devConstants.GAS_LIMIT, }; const providerConfigs = { shouldUseInProcessGanache: true }; export const provider = web3Factory.getRpcProvider(providerConfigs); diff --git a/packages/dev-utils/src/constants.ts b/packages/dev-utils/src/constants.ts index 48efd62cc..56e87d764 100644 --- a/packages/dev-utils/src/constants.ts +++ b/packages/dev-utils/src/constants.ts @@ -1,6 +1,6 @@ export const constants = { RPC_URL: 'http://localhost:8545', RPC_PORT: 8545, - GAS_ESTIMATE: 8000000, + GAS_LIMIT: 7000000, TESTRPC_FIRST_ADDRESS: '0x5409ed021d9299bf6814279a6a1411a7e866a631', }; diff --git a/packages/dev-utils/src/web3_factory.ts b/packages/dev-utils/src/web3_factory.ts index 98fccd835..c273035da 100644 --- a/packages/dev-utils/src/web3_factory.ts +++ b/packages/dev-utils/src/web3_factory.ts @@ -28,7 +28,7 @@ export const web3Factory = { if (!hasAddresses) { provider.addProvider(new EmptyWalletSubprovider()); } - provider.addProvider(new FakeGasEstimateSubprovider(constants.GAS_ESTIMATE)); + provider.addProvider(new FakeGasEstimateSubprovider(constants.GAS_LIMIT)); const logger = { log: (arg: any) => { fs.appendFileSync('ganache.log', `${arg}\n`); @@ -41,7 +41,7 @@ export const web3Factory = { } provider.addProvider( new GanacheSubprovider({ - gasLimit: constants.GAS_ESTIMATE, + gasLimit: constants.GAS_LIMIT, logger, verbose: env.parseBoolean(EnvVars.VerboseGanache), port: 8545, diff --git a/packages/order-watcher/test/global_hooks.ts b/packages/order-watcher/test/global_hooks.ts index 1df80533c..3d3f0e474 100644 --- a/packages/order-watcher/test/global_hooks.ts +++ b/packages/order-watcher/test/global_hooks.ts @@ -12,7 +12,7 @@ before('migrate contracts', async function(): Promise { const mochaTestTimeoutMs = 20000; this.timeout(mochaTestTimeoutMs); const txDefaults = { - gas: devConstants.GAS_ESTIMATE, + gas: devConstants.GAS_LIMIT, from: devConstants.TESTRPC_FIRST_ADDRESS, }; const artifactsDir = `../migrations/artifacts/1.0.0`; -- cgit v1.2.3