From 8f65a7bcc8fb0984c73f257a8887cb0b76805aca Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Thu, 15 Dec 2016 23:50:16 +0100 Subject: [PATCH 01/10] remove light server capability temporarily --- parity/cli/mod.rs | 7 +------ parity/cli/usage.txt | 1 - parity/configuration.rs | 2 -- parity/run.rs | 19 ++++++------------- 4 files changed, 7 insertions(+), 22 deletions(-) diff --git a/parity/cli/mod.rs b/parity/cli/mod.rs index 59f478bb3..2a34e72ad 100644 --- a/parity/cli/mod.rs +++ b/parity/cli/mod.rs @@ -141,8 +141,6 @@ usage! { flag_reserved_only: bool = false, or |c: &Config| otry!(c.network).reserved_only.clone(), flag_no_ancient_blocks: bool = false, or |_| None, - flag_serve_light: bool = false, - or |c: &Config| otry!(c.network).serve_light.clone(), // -- API and Console Options // RPC @@ -254,7 +252,7 @@ usage! { or |c: &Config| otry!(c.footprint).fat_db.clone(), flag_scale_verifiers: bool = false, or |c: &Config| otry!(c.footprint).scale_verifiers.clone(), - flag_num_verifiers: Option = None, + flag_num_verifiers: Option = None, or |c: &Config| otry!(c.footprint).num_verifiers.clone().map(Some), // -- Import/Export Options @@ -348,7 +346,6 @@ struct Network { node_key: Option, reserved_peers: Option, reserved_only: Option, - serve_light: Option, } #[derive(Default, Debug, PartialEq, RustcDecodable)] @@ -566,7 +563,6 @@ mod tests { flag_reserved_peers: Some("./path_to_file".into()), flag_reserved_only: false, flag_no_ancient_blocks: false, - flag_serve_light: true, // -- API and Console Options // RPC @@ -740,7 +736,6 @@ mod tests { node_key: None, reserved_peers: Some("./path/to/reserved_peers".into()), reserved_only: Some(true), - serve_light: None, }), rpc: Some(Rpc { disable: Some(true), diff --git a/parity/cli/usage.txt b/parity/cli/usage.txt index bbf7ac236..786b5fcd1 100644 --- a/parity/cli/usage.txt +++ b/parity/cli/usage.txt @@ -101,7 +101,6 @@ Networking Options: --max-pending-peers NUM Allow up to NUM pending connections. (default: {flag_max_pending_peers}) --no-ancient-blocks Disable downloading old blocks after snapshot restoration or warp sync. (default: {flag_no_ancient_blocks}) - --serve-light Experimental: Serve light client peers. (default: {flag_serve_light}) API and Console Options: --no-jsonrpc Disable the JSON-RPC API server. (default: {flag_no_jsonrpc}) diff --git a/parity/configuration.rs b/parity/configuration.rs index b9ae2e958..65add781c 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -338,7 +338,6 @@ impl Configuration { no_periodic_snapshot: self.args.flag_no_periodic_snapshot, check_seal: !self.args.flag_no_seal_check, download_old_blocks: !self.args.flag_no_ancient_blocks, - serve_light: self.args.flag_serve_light, verifier_settings: verifier_settings, }; Cmd::Run(run_cmd) @@ -1003,7 +1002,6 @@ mod tests { no_periodic_snapshot: false, check_seal: true, download_old_blocks: true, - serve_light: false, verifier_settings: Default::default(), })); } diff --git a/parity/run.rs b/parity/run.rs index 140c2050c..6bb1a3459 100644 --- a/parity/run.rs +++ b/parity/run.rs @@ -94,7 +94,6 @@ pub struct RunCmd { pub no_periodic_snapshot: bool, pub check_seal: bool, pub download_old_blocks: bool, - pub serve_light: bool, pub verifier_settings: VerifierSettings, } @@ -189,11 +188,6 @@ pub fn execute(cmd: RunCmd, logger: Arc) -> Result<(), String> { ); info!("Operating mode: {}", Colour::White.bold().paint(format!("{}", mode))); - if cmd.serve_light { - info!("Configured to serve light client peers. Please note this feature is {}.", - Colour::White.bold().paint("experimental".to_string())); - } - // display warning about using experimental journaldb alorithm if !algorithm.is_stable() { warn!("Your chosen strategy is {}! You can re-run with --pruning to change.", Colour::Red.bold().paint("unstable")); @@ -213,7 +207,6 @@ pub fn execute(cmd: RunCmd, logger: Arc) -> Result<(), String> { sync_config.fork_block = spec.fork_block(); sync_config.warp_sync = cmd.warp_sync; sync_config.download_old_blocks = cmd.download_old_blocks; - sync_config.serve_light = cmd.serve_light; let passwords = try!(passwords_from_files(&cmd.acc_conf.password_files)); @@ -291,12 +284,12 @@ pub fn execute(cmd: RunCmd, logger: Arc) -> Result<(), String> { // create sync object let (sync_provider, manage_network, chain_notify) = try!(modules::sync( - &mut hypervisor, - sync_config, - net_conf.into(), - client.clone(), - snapshot_service.clone(), - client.clone(), + &mut hypervisor, + sync_config, + net_conf.into(), + client.clone(), + snapshot_service.clone(), + client.clone(), &cmd.logger_config, ).map_err(|e| format!("Sync error: {}", e))); From 670be41b629dff7f4166853a47e7305b1bc40896 Mon Sep 17 00:00:00 2001 From: Nicolas Gotchac Date: Mon, 19 Dec 2016 13:16:59 +0100 Subject: [PATCH 02/10] Fix Wallet Settings Modal (#3856) * Fixes wallet settings modal * Fix linting --- .../WalletDetails/walletDetails.js | 7 ++- .../ParametersStep/parametersStep.js | 1 + .../DetailsStep/detailsStep.js | 4 +- .../modals/WalletSettings/walletSettings.js | 37 ++++++++++----- js/src/ui/Form/TypedInput/typedInput.js | 47 +++++++++++++++---- js/src/util/abi.js | 3 ++ 6 files changed, 74 insertions(+), 25 deletions(-) diff --git a/js/src/modals/CreateWallet/WalletDetails/walletDetails.js b/js/src/modals/CreateWallet/WalletDetails/walletDetails.js index 867f130cf..17a7c68a3 100644 --- a/js/src/modals/CreateWallet/WalletDetails/walletDetails.js +++ b/js/src/modals/CreateWallet/WalletDetails/walletDetails.js @@ -17,7 +17,6 @@ import React, { Component, PropTypes } from 'react'; import { Form, TypedInput, Input, AddressSelect, InputAddress } from '~/ui'; -import { parseAbiType } from '~/util/abi'; import styles from '../createWallet.css'; @@ -105,7 +104,7 @@ export default class WalletDetails extends Component { value={ wallet.owners.slice() } onChange={ this.onOwnersChange } accounts={ accounts } - param={ parseAbiType('address[]') } + param='address[]' />
@@ -115,7 +114,7 @@ export default class WalletDetails extends Component { value={ wallet.required } error={ errors.required } onChange={ this.onRequiredChange } - param={ parseAbiType('uint') } + param='uint' min={ 1 } max={ wallet.owners.length + 1 } /> @@ -126,7 +125,7 @@ export default class WalletDetails extends Component { value={ wallet.daylimit } error={ errors.daylimit } onChange={ this.onDaylimitChange } - param={ parseAbiType('uint') } + param='uint' isEth />
diff --git a/js/src/modals/DeployContract/ParametersStep/parametersStep.js b/js/src/modals/DeployContract/ParametersStep/parametersStep.js index c4004cdf0..0ec62fbd5 100644 --- a/js/src/modals/DeployContract/ParametersStep/parametersStep.js +++ b/js/src/modals/DeployContract/ParametersStep/parametersStep.js @@ -83,6 +83,7 @@ export default class ParametersStep extends Component { accounts={ accounts } onChange={ onChange } param={ param } + isEth={ false } /> ); diff --git a/js/src/modals/ExecuteContract/DetailsStep/detailsStep.js b/js/src/modals/ExecuteContract/DetailsStep/detailsStep.js index 0e54e9ef4..e2d18bf65 100644 --- a/js/src/modals/ExecuteContract/DetailsStep/detailsStep.js +++ b/js/src/modals/ExecuteContract/DetailsStep/detailsStep.js @@ -18,7 +18,6 @@ import React, { Component, PropTypes } from 'react'; import { Checkbox, MenuItem } from 'material-ui'; import { AddressSelect, Form, Input, Select, TypedInput } from '~/ui'; -import { parseAbiType } from '~/util/abi'; import styles from '../executeContract.css'; @@ -162,7 +161,8 @@ export default class DetailsStep extends Component { error={ valuesError[index] } onChange={ onChange } accounts={ accounts } - param={ parseAbiType(input.type) } + param={ input.type } + isEth={ false } /> ); diff --git a/js/src/modals/WalletSettings/walletSettings.js b/js/src/modals/WalletSettings/walletSettings.js index 00b5d3d12..088c0d657 100644 --- a/js/src/modals/WalletSettings/walletSettings.js +++ b/js/src/modals/WalletSettings/walletSettings.js @@ -22,7 +22,6 @@ import { pick } from 'lodash'; import ActionDone from 'material-ui/svg-icons/action/done'; import ContentClear from 'material-ui/svg-icons/content/clear'; import NavigationArrowForward from 'material-ui/svg-icons/navigation/arrow-forward'; -import { parseAbiType } from '~/util/abi'; import { Button, Modal, TxHash, BusyStep, Form, TypedInput, InputAddress, AddressSelect } from '~/ui'; import { fromWei } from '~/api/util/wei'; @@ -107,10 +106,7 @@ class WalletSettings extends Component { return (
-

You are about to make the following modifications

-
- { this.renderChanges(changes) } -
+ { this.renderChanges(changes) }
); @@ -142,19 +138,19 @@ class WalletSettings extends Component { value={ wallet.owners.slice() } onChange={ this.store.onOwnersChange } accounts={ accounts } - param={ parseAbiType('address[]') } + param='address[]' />
@@ -173,11 +169,24 @@ class WalletSettings extends Component { } renderChanges (changes) { - return changes.map((change, index) => ( + if (changes.length === 0) { + return ( +

No modifications have been made to the Wallet settings.

+ ); + } + + const modifications = changes.map((change, index) => (
{ this.renderChange(change) }
)); + + return ( +
+

You are about to make the following modifications

+ { modifications } +
+ ); } renderChange (change) { @@ -297,6 +306,12 @@ class WalletSettings extends Component { return done ? [ closeBtn ] : [ closeBtn, sendingBtn ]; case 'CONFIRMATION': + const { changes } = this.store; + + if (changes.length === 0) { + return [ closeBtn ]; + } + return [ cancelBtn, sendBtn ]; default: diff --git a/js/src/ui/Form/TypedInput/typedInput.js b/js/src/ui/Form/TypedInput/typedInput.js index 3d21dd6d7..230b59c70 100644 --- a/js/src/ui/Form/TypedInput/typedInput.js +++ b/js/src/ui/Form/TypedInput/typedInput.js @@ -26,7 +26,7 @@ import { fromWei, toWei } from '~/api/util/wei'; import Input from '~/ui/Form/Input'; import InputAddressSelect from '~/ui/Form/InputAddressSelect'; import Select from '~/ui/Form/Select'; -import { ABI_TYPES } from '~/util/abi'; +import { ABI_TYPES, parseAbiType } from '~/util/abi'; import styles from './typedInput.css'; @@ -34,22 +34,25 @@ export default class TypedInput extends Component { static propTypes = { onChange: PropTypes.func.isRequired, - param: PropTypes.object.isRequired, accounts: PropTypes.object, error: PropTypes.any, - value: PropTypes.any, - label: PropTypes.string, hint: PropTypes.string, - min: PropTypes.number, + isEth: PropTypes.bool, + label: PropTypes.string, max: PropTypes.number, - isEth: PropTypes.bool + min: PropTypes.number, + param: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.string + ]).isRequired, + value: PropTypes.any }; static defaultProps = { min: null, max: null, - isEth: false + isEth: null }; state = { @@ -64,7 +67,26 @@ export default class TypedInput extends Component { } render () { - const { param, isEth } = this.props; + const { param } = this.props; + + if (typeof param === 'string') { + const parsedParam = parseAbiType(param); + + if (parsedParam) { + return this.renderParam(parsedParam); + } + } + + if (param) { + return this.renderParam(param); + } + + console.error('', `unkown "${param}" param passed to props`); + return null; + } + + renderParam (param) { + const { isEth } = this.props; const { type } = param; if (type === ABI_TYPES.ARRAY) { @@ -163,7 +185,16 @@ export default class TypedInput extends Component { return this.renderDefault(); } + // If the `isEth` prop is present (true or false) + // then render the ETH toggle (usefull for contract execution) + // Don't by default if (type === ABI_TYPES.INT) { + const { isEth } = this.props; + + if (typeof isEth !== 'boolean') { + return this.renderInteger(); + } + return this.renderEth(); } diff --git a/js/src/util/abi.js b/js/src/util/abi.js index b20ed3372..70e3e7705 100644 --- a/js/src/util/abi.js +++ b/js/src/util/abi.js @@ -143,4 +143,7 @@ export function parseAbiType (type) { signed: true }; } + + // If no matches, return null + return null; } From 7185fb0f3771b6ad6d0ef8b7f6ed09421b667503 Mon Sep 17 00:00:00 2001 From: Jannis Redmann Date: Mon, 19 Dec 2016 13:17:15 +0100 Subject: [PATCH 03/10] refresh certifications automatically (#3878) * certifications: eth.getLogs -> filters * linting :shirt:, indentation * certifications: fetch filter changes * certifications: prevent overlapping * certifications: watch blockNumber to refresh * fix email certification contract See ethcore/contracts@d86490e302ab0077197e2acceabf0fc92dad0822 * update email certification contract --- js/package.json | 1 + js/src/modals/Verification/email-store.js | 2 +- .../providers/certifications/middleware.js | 182 +++++++++++------- js/src/ui/Certifications/certifications.css | 1 + 4 files changed, 119 insertions(+), 67 deletions(-) diff --git a/js/package.json b/js/package.json index 6f8693b39..63472f9b8 100644 --- a/js/package.json +++ b/js/package.json @@ -135,6 +135,7 @@ "blockies": "0.0.2", "brace": "0.9.0", "bytes": "2.4.0", + "debounce": "1.0.0", "es6-error": "4.0.0", "es6-promise": "4.0.5", "ethereumjs-tx": "1.1.4", diff --git a/js/src/modals/Verification/email-store.js b/js/src/modals/Verification/email-store.js index a86f9e4b1..941164b1c 100644 --- a/js/src/modals/Verification/email-store.js +++ b/js/src/modals/Verification/email-store.js @@ -23,7 +23,7 @@ import VerificationStore, { } from './store'; import { postToServer } from '../../3rdparty/email-verification'; -const EMAIL_VERIFICATION = 4; // id in the `BadgeReg.sol` contract +const EMAIL_VERIFICATION = 7; // id in the `BadgeReg.sol` contract export default class EmailVerificationStore extends VerificationStore { @observable email = ''; diff --git a/js/src/redux/providers/certifications/middleware.js b/js/src/redux/providers/certifications/middleware.js index 6e4b898d0..0bd2e5157 100644 --- a/js/src/redux/providers/certifications/middleware.js +++ b/js/src/redux/providers/certifications/middleware.js @@ -15,12 +15,41 @@ // along with Parity. If not, see . import { uniq } from 'lodash'; +import debounce from 'debounce'; import ABI from '~/contracts/abi/certifier.json'; import Contract from '~/api/contract'; import Contracts from '~/contracts'; import { addCertification, removeCertification } from './actions'; +// TODO: move this to a more general place +const updatableFilter = (api, onFilter) => { + let filter = null; + + const update = (address, topics) => { + if (filter) { + filter = filter.then((filterId) => { + api.eth.uninstallFilter(filterId); + }); + } + filter = (filter || Promise.resolve()) + .then(() => api.eth.newFilter({ + fromBlock: 0, + toBlock: 'latest', + address, + topics + })) + .then((filterId) => { + onFilter(filterId); + return filterId; + }) + .catch((err) => { + console.error('Failed to create certifications filter:', err); + }); + }; + return update; +}; + export default class CertificationsMiddleware { toMiddleware () { const api = Contracts.get()._api; @@ -29,75 +58,96 @@ export default class CertificationsMiddleware { const Confirmed = contract.events.find((e) => e.name === 'Confirmed'); const Revoked = contract.events.find((e) => e.name === 'Revoked'); - let certifiers = []; - let accounts = []; // these are addresses - - const fetchConfirmedEvents = (dispatch) => { - if (certifiers.length === 0 || accounts.length === 0) return; - api.eth.getLogs({ - fromBlock: 0, - toBlock: 'latest', - address: certifiers.map((c) => c.address), - topics: [ [ Confirmed.signature, Revoked.signature ], accounts ] - }) - .then((logs) => contract.parseEventLogs(logs)) - .then((logs) => { - logs.forEach((log) => { - const certifier = certifiers.find((c) => c.address === log.address); - if (!certifier) { - throw new Error(`Could not find certifier at ${log.address}.`); - } - const { id, name, title, icon } = certifier; - - if (log.event === 'Revoked') { - dispatch(removeCertification(log.params.who.value, id)); - } else { - dispatch(addCertification(log.params.who.value, id, name, title, icon)); - } - }); - }) - .catch((err) => { - console.error('Failed to fetch Confirmed events:', err); - }); - }; - - return (store) => (next) => (action) => { - switch (action.type) { - case 'fetchCertifiers': - badgeReg.certifierCount().then((count) => { - new Array(+count).fill(null).forEach((_, id) => { - badgeReg.fetchCertifier(id) - .then((cert) => { - if (!certifiers.some((c) => c.id === cert.id)) { - certifiers = certifiers.concat(cert); - fetchConfirmedEvents(store.dispatch); - } - }) - .catch((err) => { - console.warn(`Could not fetch certifier ${id}:`, err); - }); - }); - }); - - break; - case 'fetchCertifications': - const { address } = action; - - if (!accounts.includes(address)) { - accounts = accounts.concat(address); - fetchConfirmedEvents(store.dispatch); + return (store) => { + const onLogs = (logs) => { + logs = contract.parseEventLogs(logs); + logs.forEach((log) => { + const certifier = certifiers.find((c) => c.address === log.address); + if (!certifier) { + throw new Error(`Could not find certifier at ${log.address}.`); } + const { id, name, title, icon } = certifier; - break; - case 'setVisibleAccounts': - const { addresses } = action; - accounts = uniq(accounts.concat(addresses)); - fetchConfirmedEvents(store.dispatch); + if (log.event === 'Revoked') { + store.dispatch(removeCertification(log.params.who.value, id)); + } else { + store.dispatch(addCertification(log.params.who.value, id, name, title, icon)); + } + }); + }; - break; - default: - next(action); - } + let filter = null; + + const onFilter = (filterId) => { + filter = filterId; + api.eth.getFilterLogs(filterId) + .then(onLogs) + .catch((err) => { + console.error('Failed to fetch certifier events:', err); + }); + }; + + const fetchChanges = debounce(() => { + api.eth.getFilterChanges(filter) + .then(onLogs) + .catch((err) => { + console.error('Failed to fetch new certifier events:', err); + }); + }, 10 * 1000, true); + api.subscribe('eth_blockNumber', (err) => { + if (err) return; + fetchChanges(); + }); + + const updateFilter = updatableFilter(api, onFilter); + let certifiers = []; + let accounts = []; // these are addresses + + const fetchConfirmedEvents = () => { + updateFilter(certifiers.map((c) => c.address), [ + [ Confirmed.signature, Revoked.signature ], + accounts + ]); + }; + + return (next) => (action) => { + switch (action.type) { + case 'fetchCertifiers': + badgeReg.certifierCount().then((count) => { + new Array(+count).fill(null).forEach((_, id) => { + badgeReg.fetchCertifier(id) + .then((cert) => { + if (!certifiers.some((c) => c.id === cert.id)) { + certifiers = certifiers.concat(cert); + fetchConfirmedEvents(); + } + }) + .catch((err) => { + console.warn(`Could not fetch certifier ${id}:`, err); + }); + }); + }); + + break; + case 'fetchCertifications': + const { address } = action; + + if (!accounts.includes(address)) { + accounts = accounts.concat(address); + fetchConfirmedEvents(); + } + + break; + case 'setVisibleAccounts': + const { addresses } = action; + accounts = uniq(accounts.concat(addresses)); + fetchConfirmedEvents(); + + break; + default: + next(action); + } + }; }; } } diff --git a/js/src/ui/Certifications/certifications.css b/js/src/ui/Certifications/certifications.css index 077830e3a..bff45ce5f 100644 --- a/js/src/ui/Certifications/certifications.css +++ b/js/src/ui/Certifications/certifications.css @@ -22,6 +22,7 @@ .certification { display: inline-block; position: relative; + margin-top: 1em; margin-right: .5em; padding: .3em .6em .2em 2.6em; border-radius: 1em; From 1b59ceb7c1360a3daaa4fea7d34c14af685b74c4 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Mon, 19 Dec 2016 13:17:28 +0100 Subject: [PATCH 04/10] Remove existence & length checks on passwords & phrases (#3854) * Allow input to receive FormattedMessage errors * Only do existence checks on phrases & passwords * Add missing import * Remove existence checks, display security reminder --- .../modals/CreateAccount/NewAccount/index.js | 6 -- .../CreateAccount/NewAccount/newAccount.js | 80 ++++++++---------- .../modals/CreateAccount/NewGeth/newGeth.js | 1 + .../CreateAccount/NewImport/newImport.js | 53 +++++------- js/src/modals/CreateAccount/RawKey/rawKey.js | 53 ++++++------ .../RecoveryPhrase/recoveryPhrase.js | 82 ++++++++----------- js/src/modals/CreateAccount/createAccount.js | 20 ++++- js/src/modals/CreateAccount/errors.js | 45 ++++++++++ js/src/ui/Form/Input/input.js | 5 +- js/src/ui/Warning/index.js | 17 ++++ js/src/ui/Warning/warning.css | 26 ++++++ js/src/ui/Warning/warning.js | 41 ++++++++++ js/src/ui/index.js | 4 +- 13 files changed, 268 insertions(+), 165 deletions(-) create mode 100644 js/src/modals/CreateAccount/errors.js create mode 100644 js/src/ui/Warning/index.js create mode 100644 js/src/ui/Warning/warning.css create mode 100644 js/src/ui/Warning/warning.js diff --git a/js/src/modals/CreateAccount/NewAccount/index.js b/js/src/modals/CreateAccount/NewAccount/index.js index 5d2a3e686..8dc314743 100644 --- a/js/src/modals/CreateAccount/NewAccount/index.js +++ b/js/src/modals/CreateAccount/NewAccount/index.js @@ -14,10 +14,4 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -import { ERRORS } from './newAccount'; - export default from './newAccount'; - -export { - ERRORS -}; diff --git a/js/src/modals/CreateAccount/NewAccount/newAccount.js b/js/src/modals/CreateAccount/NewAccount/newAccount.js index 267ed56bc..c0bcca91a 100644 --- a/js/src/modals/CreateAccount/NewAccount/newAccount.js +++ b/js/src/modals/CreateAccount/NewAccount/newAccount.js @@ -21,21 +21,10 @@ import ActionAutorenew from 'material-ui/svg-icons/action/autorenew'; import { Form, Input, IdentityIcon } from '~/ui'; +import ERRORS from '../errors'; + import styles from '../createAccount.css'; -const ERRORS = { - noName: 'you need to specify a valid name for the account', - noPhrase: 'you need to specify the recovery phrase', - noKey: 'you need to provide the raw private key', - invalidKey: 'the raw key needs to be hex, 64 characters in length and contain the prefix "0x"', - invalidPassword: 'you need to specify a password >= 8 characters', - noMatchPassword: 'the supplied passwords does not match' -}; - -export { - ERRORS -}; - export default class CreateAccount extends Component { static contextTypes = { api: PropTypes.object.isRequired, @@ -49,15 +38,15 @@ export default class CreateAccount extends Component { state = { accountName: '', accountNameError: ERRORS.noName, + accounts: null, + isValidName: false, + isValidPass: false, passwordHint: '', password1: '', - password1Error: ERRORS.invalidPassword, + password1Error: null, password2: '', - password2Error: ERRORS.noMatchPassword, - accounts: null, - selectedAddress: '', - isValidPass: false, - isValidName: false + password2Error: null, + selectedAddress: '' } componentWillMount () { @@ -230,60 +219,55 @@ export default class CreateAccount extends Component { }, this.updateParent); } - onEditPasswordHint = (event, value) => { + onEditPasswordHint = (event, passwordHint) => { this.setState({ - passwordHint: value + passwordHint }); } onEditAccountName = (event) => { - const value = event.target.value; - let error = null; + const accountName = event.target.value; + let accountNameError = null; - if (!value || value.trim().length < 2) { - error = ERRORS.noName; + if (!accountName || !accountName.trim().length) { + accountNameError = ERRORS.noName; } this.setState({ - accountName: value, - accountNameError: error, - isValidName: !error + accountName, + accountNameError, + isValidName: !accountNameError }, this.updateParent); } onEditPassword1 = (event) => { - const value = event.target.value; - let error1 = null; - let error2 = null; + const password1 = event.target.value; + let password2Error = null; - if (!value || value.trim().length < 8) { - error1 = ERRORS.invalidPassword; - } - - if (value !== this.state.password2) { - error2 = ERRORS.noMatchPassword; + if (password1 !== this.state.password2) { + password2Error = ERRORS.noMatchPassword; } this.setState({ - password1: value, - password1Error: error1, - password2Error: error2, - isValidPass: !error1 && !error2 + password1, + password1Error: null, + password2Error, + isValidPass: !password2Error }, this.updateParent); } onEditPassword2 = (event) => { - const value = event.target.value; - let error2 = null; + const password2 = event.target.value; + let password2Error = null; - if (value !== this.state.password1) { - error2 = ERRORS.noMatchPassword; + if (password2 !== this.state.password1) { + password2Error = ERRORS.noMatchPassword; } this.setState({ - password2: value, - password2Error: error2, - isValidPass: !error2 + password2, + password2Error, + isValidPass: !password2Error }, this.updateParent); } diff --git a/js/src/modals/CreateAccount/NewGeth/newGeth.js b/js/src/modals/CreateAccount/NewGeth/newGeth.js index 269075983..f8cd1fbe6 100644 --- a/js/src/modals/CreateAccount/NewGeth/newGeth.js +++ b/js/src/modals/CreateAccount/NewGeth/newGeth.js @@ -47,6 +47,7 @@ export default class NewGeth extends Component {
There are currently no importable keys available from the Geth keystore, which are not already available on your Parity instance
); } + const checkboxes = available.map((account) => { const label = (
diff --git a/js/src/modals/CreateAccount/NewImport/newImport.js b/js/src/modals/CreateAccount/NewImport/newImport.js index 84ec5b425..17a1cfd44 100644 --- a/js/src/modals/CreateAccount/NewImport/newImport.js +++ b/js/src/modals/CreateAccount/NewImport/newImport.js @@ -21,17 +21,13 @@ import EditorAttachFile from 'material-ui/svg-icons/editor/attach-file'; import { Form, Input } from '~/ui'; +import ERRORS from '../errors'; + import styles from '../createAccount.css'; const FAKEPATH = 'C:\\fakepath\\'; const STYLE_HIDDEN = { display: 'none' }; -const ERRORS = { - noName: 'you need to specify a valid name for the account', - noPassword: 'supply a valid password to confirm the transaction', - noFile: 'select a valid wallet file to import' -}; - export default class NewImport extends Component { static propTypes = { onChange: PropTypes.func.isRequired @@ -40,15 +36,15 @@ export default class NewImport extends Component { state = { accountName: '', accountNameError: ERRORS.noName, - passwordHint: '', - password: '', - passwordError: ERRORS.noPassword, - walletFile: '', - walletFileError: ERRORS.noFile, - walletJson: '', + isValidFile: false, isValidPass: false, isValidName: false, - isValidFile: false + password: '', + passwordError: null, + passwordHint: '', + walletFile: '', + walletFileError: ERRORS.noFile, + walletJson: '' } componentWillMount () { @@ -143,39 +139,34 @@ export default class NewImport extends Component { }); } - onEditPasswordHint = (event, value) => { + onEditPasswordHint = (event, passwordHint) => { this.setState({ - passwordHint: value + passwordHint }); } onEditAccountName = (event) => { - const value = event.target.value; - let error = null; + const accountName = event.target.value; + let accountNameError = null; - if (!value || value.trim().length < 2) { - error = ERRORS.noName; + if (!accountName || !accountName.trim().length) { + accountNameError = ERRORS.noName; } this.setState({ - accountName: value, - accountNameError: error, - isValidName: !error + accountName, + accountNameError, + isValidName: !accountNameError }, this.updateParent); } onEditPassword = (event) => { - let error = null; - const value = event.target.value; - - if (!value || !value.length) { - error = ERRORS.noPassword; - } + const password = event.target.value; this.setState({ - password: value, - passwordError: error, - isValidPass: !error + password, + passwordError: null, + isValidPass: true }, this.updateParent); } } diff --git a/js/src/modals/CreateAccount/RawKey/rawKey.js b/js/src/modals/CreateAccount/RawKey/rawKey.js index c0cb84617..f284cf323 100644 --- a/js/src/modals/CreateAccount/RawKey/rawKey.js +++ b/js/src/modals/CreateAccount/RawKey/rawKey.js @@ -20,7 +20,7 @@ import { Form, Input } from '~/ui'; import styles from '../createAccount.css'; -import { ERRORS } from '../NewAccount'; +import ERRORS from '../errors'; export default class RawKey extends Component { static contextTypes = { @@ -32,18 +32,18 @@ export default class RawKey extends Component { } state = { - rawKey: '', - rawKeyError: ERRORS.noKey, accountName: '', accountNameError: ERRORS.noName, + isValidKey: false, + isValidName: false, + isValidPass: false, passwordHint: '', password1: '', - password1Error: ERRORS.invalidPassword, + password1Error: null, password2: '', - password2Error: ERRORS.noMatchPassword, - isValidPass: false, - isValidName: false, - isValidKey: false + password2Error: null, + rawKey: '', + rawKeyError: ERRORS.noKey } componentWillMount () { @@ -138,7 +138,7 @@ export default class RawKey extends Component { const accountName = event.target.value; let accountNameError = null; - if (!accountName || accountName.trim().length < 2) { + if (!accountName || !accountName.trim().length) { accountNameError = ERRORS.noName; } @@ -150,38 +150,33 @@ export default class RawKey extends Component { } onEditPassword1 = (event) => { - const value = event.target.value; - let error1 = null; - let error2 = null; + const password1 = event.target.value; + let password2Error = null; - if (!value || value.trim().length < 8) { - error1 = ERRORS.invalidPassword; - } - - if (value !== this.state.password2) { - error2 = ERRORS.noMatchPassword; + if (password1 !== this.state.password2) { + password2Error = ERRORS.noMatchPassword; } this.setState({ - password1: value, - password1Error: error1, - password2Error: error2, - isValidPass: !error1 && !error2 + password1, + password1Error: null, + password2Error, + isValidPass: !password2Error }, this.updateParent); } onEditPassword2 = (event) => { - const value = event.target.value; - let error2 = null; + const password2 = event.target.value; + let password2Error = null; - if (value !== this.state.password1) { - error2 = ERRORS.noMatchPassword; + if (password2 !== this.state.password1) { + password2Error = ERRORS.noMatchPassword; } this.setState({ - password2: value, - password2Error: error2, - isValidPass: !error2 + password2, + password2Error, + isValidPass: !password2Error }, this.updateParent); } } diff --git a/js/src/modals/CreateAccount/RecoveryPhrase/recoveryPhrase.js b/js/src/modals/CreateAccount/RecoveryPhrase/recoveryPhrase.js index 2736256f1..fd5043024 100644 --- a/js/src/modals/CreateAccount/RecoveryPhrase/recoveryPhrase.js +++ b/js/src/modals/CreateAccount/RecoveryPhrase/recoveryPhrase.js @@ -21,7 +21,7 @@ import { Form, Input } from '~/ui'; import styles from '../createAccount.css'; -import { ERRORS } from '../NewAccount'; +import ERRORS from '../errors'; export default class RecoveryPhrase extends Component { static propTypes = { @@ -29,19 +29,19 @@ export default class RecoveryPhrase extends Component { } state = { - recoveryPhrase: '', - recoveryPhraseError: ERRORS.noPhrase, accountName: '', accountNameError: ERRORS.noName, - passwordHint: '', - password1: '', - password1Error: ERRORS.invalidPassword, - password2: '', - password2Error: ERRORS.noMatchPassword, - windowsPhrase: false, isValidPass: false, isValidName: false, - isValidPhrase: false + isValidPhrase: false, + passwordHint: '', + password1: '', + password1Error: null, + password2: '', + password2Error: null, + recoveryPhrase: '', + recoveryPhraseError: null, + windowsPhrase: false } componentWillMount () { @@ -99,13 +99,13 @@ export default class RecoveryPhrase extends Component { } updateParent = () => { - const { isValidName, isValidPass, isValidPhrase, accountName, passwordHint, password1, recoveryPhrase, windowsPhrase } = this.state; + const { accountName, isValidName, isValidPass, isValidPhrase, password1, passwordHint, recoveryPhrase, windowsPhrase } = this.state; const isValid = isValidName && isValidPass && isValidPhrase; this.props.onChange(isValid, { name: accountName, - passwordHint, password: password1, + passwordHint, phrase: recoveryPhrase, windowsPhrase }); @@ -134,67 +134,57 @@ export default class RecoveryPhrase extends Component { .split(' ') .map((part) => part.trim()) .filter((part) => part.length); - let recoveryPhraseError = null; - - if (!recoveryPhrase || recoveryPhrase.length < 25 || phraseParts.length < 8) { - recoveryPhraseError = ERRORS.noPhrase; - } this.setState({ recoveryPhrase: phraseParts.join(' '), - recoveryPhraseError, - isValidPhrase: !recoveryPhraseError + recoveryPhraseError: null, + isValidPhrase: true }, this.updateParent); } onEditAccountName = (event) => { - const value = event.target.value; - let error = null; + const accountName = event.target.value; + let accountNameError = null; - if (!value || value.trim().length < 2) { - error = ERRORS.noName; + if (!accountName || !accountName.trim().length) { + accountNameError = ERRORS.noName; } this.setState({ - accountName: value, - accountNameError: error, - isValidName: !error + accountName, + accountNameError, + isValidName: !accountNameError }, this.updateParent); } onEditPassword1 = (event) => { - const value = event.target.value; - let error1 = null; - let error2 = null; + const password1 = event.target.value; + let password2Error = null; - if (!value || value.trim().length < 8) { - error1 = ERRORS.invalidPassword; - } - - if (value !== this.state.password2) { - error2 = ERRORS.noMatchPassword; + if (password1 !== this.state.password2) { + password2Error = ERRORS.noMatchPassword; } this.setState({ - password1: value, - password1Error: error1, - password2Error: error2, - isValidPass: !error1 && !error2 + password1, + password1Error: null, + password2Error, + isValidPass: !password2Error }, this.updateParent); } onEditPassword2 = (event) => { - const value = event.target.value; - let error2 = null; + const password2 = event.target.value; + let password2Error = null; - if (value !== this.state.password1) { - error2 = ERRORS.noMatchPassword; + if (password2 !== this.state.password1) { + password2Error = ERRORS.noMatchPassword; } this.setState({ - password2: value, - password2Error: error2, - isValidPass: !error2 + password2, + password2Error, + isValidPass: !password2Error }, this.updateParent); } } diff --git a/js/src/modals/CreateAccount/createAccount.js b/js/src/modals/CreateAccount/createAccount.js index d7ec8487b..569d374cc 100644 --- a/js/src/modals/CreateAccount/createAccount.js +++ b/js/src/modals/CreateAccount/createAccount.js @@ -15,6 +15,7 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; +import { FormattedMessage } from 'react-intl'; import ActionDone from 'material-ui/svg-icons/action/done'; import ActionDoneAll from 'material-ui/svg-icons/action/done-all'; import ContentClear from 'material-ui/svg-icons/content/clear'; @@ -22,7 +23,7 @@ import NavigationArrowBack from 'material-ui/svg-icons/navigation/arrow-back'; import NavigationArrowForward from 'material-ui/svg-icons/navigation/arrow-forward'; import PrintIcon from 'material-ui/svg-icons/action/print'; -import { Button, Modal } from '~/ui'; +import { Button, Modal, Warning } from '~/ui'; import AccountDetails from './AccountDetails'; import AccountDetailsGeth from './AccountDetailsGeth'; @@ -86,6 +87,7 @@ export default class CreateAccount extends Component { actions={ this.renderDialogActions() } current={ stage } steps={ steps }> + { this.renderWarning() } { this.renderPage() } ); @@ -200,6 +202,22 @@ export default class CreateAccount extends Component { } } + renderWarning () { + const { createType, stage } = this.state; + + if (stage !== 1 || ['fromJSON', 'fromPresale'].includes(createType)) { + return null; + } + + return ( + + } /> + ); + } + onNext = () => { this.setState({ stage: this.state.stage + 1 diff --git a/js/src/modals/CreateAccount/errors.js b/js/src/modals/CreateAccount/errors.js new file mode 100644 index 000000000..3edd75423 --- /dev/null +++ b/js/src/modals/CreateAccount/errors.js @@ -0,0 +1,45 @@ +// Copyright 2015, 2016 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import React from 'react'; +import { FormattedMessage } from 'react-intl'; + +export default { + noFile: + , + + noKey: + , + + noMatchPassword: + , + + noName: + , + + invalidKey: + +}; diff --git a/js/src/ui/Form/Input/input.js b/js/src/ui/Form/Input/input.js index 8351de2e6..92d313b5a 100644 --- a/js/src/ui/Form/Input/input.js +++ b/js/src/ui/Form/Input/input.js @@ -50,7 +50,7 @@ export default class Input extends Component { children: PropTypes.node, className: PropTypes.string, disabled: PropTypes.bool, - error: PropTypes.string, + error: nodeOrStringProptype(), readOnly: PropTypes.bool, floatCopy: PropTypes.bool, hint: nodeOrStringProptype(), @@ -96,8 +96,7 @@ export default class Input extends Component { render () { const { value } = this.state; - const { children, className, hideUnderline, disabled, error, label } = this.props; - const { hint, multiLine, rows, type, min, max, style } = this.props; + const { children, className, disabled, error, hideUnderline, hint, label, max, min, multiLine, rows, style, type } = this.props; const readOnly = this.props.readOnly || disabled; diff --git a/js/src/ui/Warning/index.js b/js/src/ui/Warning/index.js new file mode 100644 index 000000000..9b67b7d8a --- /dev/null +++ b/js/src/ui/Warning/index.js @@ -0,0 +1,17 @@ +// Copyright 2015, 2016 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +export default from './warning'; diff --git a/js/src/ui/Warning/warning.css b/js/src/ui/Warning/warning.css new file mode 100644 index 000000000..50caf3473 --- /dev/null +++ b/js/src/ui/Warning/warning.css @@ -0,0 +1,26 @@ +/* Copyright 2015, 2016 Parity Technologies (UK) Ltd. +/* This file is part of Parity. +/* +/* Parity is free software: you can redistribute it and/or modify +/* it under the terms of the GNU General Public License as published by +/* the Free Software Foundation, either version 3 of the License, or +/* (at your option) any later version. +/* +/* Parity is distributed in the hope that it will be useful, +/* but WITHOUT ANY WARRANTY; without even the implied warranty of +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +/* GNU General Public License for more details. +/* +/* You should have received a copy of the GNU General Public License +/* along with Parity. If not, see . +*/ + +.warning { + background: #f80; + border-radius: 0.5em; + color: white; + font-size: 0.75em; + margin-bottom: 1em; + padding: 0.75em; + text-align: center; +} diff --git a/js/src/ui/Warning/warning.js b/js/src/ui/Warning/warning.js new file mode 100644 index 000000000..af612c0c8 --- /dev/null +++ b/js/src/ui/Warning/warning.js @@ -0,0 +1,41 @@ +// Copyright 2015, 2016 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import React, { Component } from 'react'; + +import { nodeOrStringProptype } from '~/util/proptypes'; + +import styles from './warning.css'; + +export default class Warning extends Component { + static propTypes = { + warning: nodeOrStringProptype() + }; + + render () { + const { warning } = this.props; + + if (!warning) { + return null; + } + + return ( +
+ { warning } +
+ ); + } +} diff --git a/js/src/ui/index.js b/js/src/ui/index.js index d7875b72b..da61cc9b9 100644 --- a/js/src/ui/index.js +++ b/js/src/ui/index.js @@ -49,6 +49,7 @@ import Tags from './Tags'; import Tooltips, { Tooltip } from './Tooltips'; import TxHash from './TxHash'; import TxList from './TxList'; +import Warning from './Warning'; export { Actionbar, @@ -99,5 +100,6 @@ export { Tooltips, TxHash, TxList, - TypedInput + TypedInput, + Warning }; From 65f2d2b05002b6dfec154bc9ecfe2cd7e83cdb99 Mon Sep 17 00:00:00 2001 From: GitLab Build Bot Date: Mon, 19 Dec 2016 12:30:05 +0000 Subject: [PATCH 05/10] [ci skip] js-precompiled 20161219-122700 --- Cargo.lock | 2 +- js/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c05cbf190..19777fcc6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1367,7 +1367,7 @@ dependencies = [ [[package]] name = "parity-ui-precompiled" version = "1.4.0" -source = "git+https://github.com/ethcore/js-precompiled.git#3d390b35737ce212d358f26b5ec8d9644b252a88" +source = "git+https://github.com/ethcore/js-precompiled.git#b358c80f48fd8bb5ca5494cf8033cd8aaa03a7ee" dependencies = [ "parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/js/package.json b/js/package.json index 63472f9b8..74af728e4 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,6 @@ { "name": "parity.js", - "version": "0.2.128", + "version": "0.2.129", "main": "release/index.js", "jsnext:main": "src/index.js", "author": "Parity Team ", From 2862e8b92c14507fa09f37596b35f15bc9580c0c Mon Sep 17 00:00:00 2001 From: Jannis Redmann Date: Mon, 19 Dec 2016 14:14:54 +0100 Subject: [PATCH 06/10] update email certification ABI (#3893) --- js/src/contracts/abi/email-verification.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/src/contracts/abi/email-verification.json b/js/src/contracts/abi/email-verification.json index 6a7f5a6d0..3bb0fe650 100644 --- a/js/src/contracts/abi/email-verification.json +++ b/js/src/contracts/abi/email-verification.json @@ -1 +1 @@ -[{"constant":false,"inputs":[{"name":"_new","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"reverse","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_who","type":"address"},{"name":"_puzzle","type":"bytes32"},{"name":"_emailHash","type":"bytes32"}],"name":"puzzle","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"},{"name":"_field","type":"string"}],"name":"getAddress","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_emailHash","type":"bytes32"}],"name":"request","outputs":[],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_new","type":"uint256"}],"name":"setFee","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_code","type":"bytes32"}],"name":"confirm","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"drain","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"},{"name":"_field","type":"string"}],"name":"getUint","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"}],"name":"certified","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"fee","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"},{"name":"_field","type":"string"}],"name":"get","outputs":[{"name":"","type":"bytes32"}],"payable":false,"type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"who","type":"address"},{"indexed":false,"name":"emailHash","type":"bytes32"}],"name":"Requested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"who","type":"address"},{"indexed":true,"name":"emailHash","type":"bytes32"},{"indexed":false,"name":"puzzle","type":"bytes32"}],"name":"Puzzled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"who","type":"address"}],"name":"Confirmed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"who","type":"address"}],"name":"Revoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"old","type":"address"},{"indexed":true,"name":"current","type":"address"}],"name":"NewOwner","type":"event"}] \ No newline at end of file +[{"constant":false,"inputs":[{"name":"_new","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"reverse","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_who","type":"address"},{"name":"_puzzle","type":"bytes32"},{"name":"_emailHash","type":"bytes32"}],"name":"puzzle","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"},{"name":"_field","type":"string"}],"name":"getAddress","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_emailHash","type":"bytes32"}],"name":"request","outputs":[],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_new","type":"uint256"}],"name":"setFee","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_code","type":"bytes32"}],"name":"confirm","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"drain","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"},{"name":"_field","type":"string"}],"name":"getUint","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"}],"name":"certified","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"fee","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"},{"name":"_field","type":"string"}],"name":"get","outputs":[{"name":"","type":"bytes32"}],"payable":false,"type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"who","type":"address"},{"indexed":true,"name":"emailHash","type":"bytes32"}],"name":"Requested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"who","type":"address"},{"indexed":true,"name":"emailHash","type":"bytes32"},{"indexed":false,"name":"puzzle","type":"bytes32"}],"name":"Puzzled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"who","type":"address"}],"name":"Confirmed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"who","type":"address"}],"name":"Revoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"old","type":"address"},{"indexed":true,"name":"current","type":"address"}],"name":"NewOwner","type":"event"}] \ No newline at end of file From 46662899da1138a79dea01664a4e7fdf853c8735 Mon Sep 17 00:00:00 2001 From: keorn Date: Mon, 19 Dec 2016 14:15:39 +0100 Subject: [PATCH 07/10] make spec naming consistent --- ethcore/res/authority_round.json | 4 ++-- ethcore/res/basic_authority.json | 2 +- ethcore/res/instant_seal.json | 2 +- ethcore/res/null.json | 2 +- ethcore/res/null_morden.json | 2 +- ethcore/res/tendermint.json | 2 +- json/src/spec/engine.rs | 9 +++++++-- json/src/spec/seal.rs | 4 ++-- 8 files changed, 16 insertions(+), 11 deletions(-) diff --git a/ethcore/res/authority_round.json b/ethcore/res/authority_round.json index efc0cdeb4..2dd38c755 100644 --- a/ethcore/res/authority_round.json +++ b/ethcore/res/authority_round.json @@ -1,7 +1,7 @@ { "name": "TestAuthorityRound", "engine": { - "AuthorityRound": { + "authorityRound": { "params": { "gasLimitBoundDivisor": "0x0400", "stepDuration": 1, @@ -21,7 +21,7 @@ }, "genesis": { "seal": { - "authority_round": { + "authorityRound": { "step": "0x0", "signature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" } diff --git a/ethcore/res/basic_authority.json b/ethcore/res/basic_authority.json index db4374160..623590bfa 100644 --- a/ethcore/res/basic_authority.json +++ b/ethcore/res/basic_authority.json @@ -1,7 +1,7 @@ { "name": "TestBasicAuthority", "engine": { - "BasicAuthority": { + "basicAuthority": { "params": { "gasLimitBoundDivisor": "0x0400", "durationLimit": "0x0d", diff --git a/ethcore/res/instant_seal.json b/ethcore/res/instant_seal.json index 6a3964e89..b2d119883 100644 --- a/ethcore/res/instant_seal.json +++ b/ethcore/res/instant_seal.json @@ -1,7 +1,7 @@ { "name": "DevelopmentChain", "engine": { - "InstantSeal": null + "instantSeal": null }, "params": { "accountStartNonce": "0x0", diff --git a/ethcore/res/null.json b/ethcore/res/null.json index b9b2b1260..3ec7ce75e 100644 --- a/ethcore/res/null.json +++ b/ethcore/res/null.json @@ -1,7 +1,7 @@ { "name": "Morden", "engine": { - "Null": null + "null": null }, "params": { "accountStartNonce": "0x0", diff --git a/ethcore/res/null_morden.json b/ethcore/res/null_morden.json index 9b792934a..96d804b5b 100644 --- a/ethcore/res/null_morden.json +++ b/ethcore/res/null_morden.json @@ -1,7 +1,7 @@ { "name": "Morden", "engine": { - "Null": null + "null": null }, "params": { "accountStartNonce": "0x0", diff --git a/ethcore/res/tendermint.json b/ethcore/res/tendermint.json index 778757107..da62448e5 100644 --- a/ethcore/res/tendermint.json +++ b/ethcore/res/tendermint.json @@ -1,7 +1,7 @@ { "name": "TestBFT", "engine": { - "Tendermint": { + "tendermint": { "params": { "gasLimitBoundDivisor": "0x0400", "authorities" : [ diff --git a/json/src/spec/engine.rs b/json/src/spec/engine.rs index c95693b5e..b0c34b2ea 100644 --- a/json/src/spec/engine.rs +++ b/json/src/spec/engine.rs @@ -25,16 +25,21 @@ use spec::Tendermint; #[derive(Debug, PartialEq, Deserialize)] pub enum Engine { /// Null engine. + #[serde(rename="null")] Null, /// Instantly sealing engine. + #[serde(rename="instantSeal")] InstantSeal, /// Ethash engine. Ethash(Ethash), /// BasicAuthority engine. + #[serde(rename="basicAuthority")] BasicAuthority(BasicAuthority), /// AuthorityRound engine. + #[serde(rename="authorityRound")] AuthorityRound(AuthorityRound), /// Tendermint engine. + #[serde(rename="tendermint")] Tendermint(Tendermint) } @@ -46,14 +51,14 @@ mod tests { #[test] fn engine_deserialization() { let s = r#"{ - "Null": null + "null": null }"#; let deserialized: Engine = serde_json::from_str(s).unwrap(); assert_eq!(Engine::Null, deserialized); let s = r#"{ - "InstantSeal": null + "instantSeal": null }"#; let deserialized: Engine = serde_json::from_str(s).unwrap(); diff --git a/json/src/spec/seal.rs b/json/src/spec/seal.rs index 1cf1e86e6..2f4e31722 100644 --- a/json/src/spec/seal.rs +++ b/json/src/spec/seal.rs @@ -57,7 +57,7 @@ pub enum Seal { #[serde(rename="ethereum")] Ethereum(Ethereum), /// AuthorityRound seal. - #[serde(rename="authority_round")] + #[serde(rename="authorityRound")] AuthorityRound(AuthorityRoundSeal), /// Tendermint seal. #[serde(rename="tendermint")] @@ -82,7 +82,7 @@ mod tests { },{ "generic": "0xe011bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa" },{ - "authority_round": { + "authorityRound": { "step": "0x0", "signature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" } From 776a45af87876f9f7f1c86f570728d36dafe0f95 Mon Sep 17 00:00:00 2001 From: GitLab Build Bot Date: Mon, 19 Dec 2016 13:25:03 +0000 Subject: [PATCH 08/10] [ci skip] js-precompiled 20161219-132051 --- Cargo.lock | 2 +- js/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 19777fcc6..3ceedcc9e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1367,7 +1367,7 @@ dependencies = [ [[package]] name = "parity-ui-precompiled" version = "1.4.0" -source = "git+https://github.com/ethcore/js-precompiled.git#b358c80f48fd8bb5ca5494cf8033cd8aaa03a7ee" +source = "git+https://github.com/ethcore/js-precompiled.git#e3e33f97c0f3b3d788a859b5bd10f5ca1ee45871" dependencies = [ "parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/js/package.json b/js/package.json index 74af728e4..de52d0d0f 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,6 @@ { "name": "parity.js", - "version": "0.2.129", + "version": "0.2.130", "main": "release/index.js", "jsnext:main": "src/index.js", "author": "Parity Team ", From d3486b45c598e98fbf85462b280995b46093c66d Mon Sep 17 00:00:00 2001 From: arkpar Date: Mon, 19 Dec 2016 14:47:48 +0100 Subject: [PATCH 09/10] Allow retry for future blocks --- ethcore/src/verification/queue/mod.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ethcore/src/verification/queue/mod.rs b/ethcore/src/verification/queue/mod.rs index d268b1cff..4f1e18a20 100644 --- a/ethcore/src/verification/queue/mod.rs +++ b/ethcore/src/verification/queue/mod.rs @@ -486,7 +486,13 @@ impl VerificationQueue { Ok(h) }, Err(err) => { - self.verification.bad.lock().insert(h.clone()); + match err { + // Don't mark future blocks as bad. + Error::Block(BlockError::InvalidTimestamp(ref e)) if e.max.is_some() => {}, + _ => { + self.verification.bad.lock().insert(h.clone()); + } + } Err(err) } } From 5b6cd2183b07e53058eb2d28ebde34c8fca0066c Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Mon, 19 Dec 2016 16:27:03 +0100 Subject: [PATCH 10/10] Fix grammar ("you try" -> "you tried" + article) --- rpc/src/v1/helpers/errors.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpc/src/v1/helpers/errors.rs b/rpc/src/v1/helpers/errors.rs index 68f99795a..4e1ab64eb 100644 --- a/rpc/src/v1/helpers/errors.rs +++ b/rpc/src/v1/helpers/errors.rs @@ -246,7 +246,7 @@ pub fn transaction_message(error: TransactionError) -> String { format!("Transaction gas price is too low. It does not satisfy your node's minimal gas price (minimal: {}, got: {}). Try increasing the gas price.", minimal, got) }, InsufficientBalance { balance, cost } => { - format!("Insufficient funds. Account you try to send transaction from does not have enough funds. Required {} and got: {}.", cost, balance) + format!("Insufficient funds. The account you tried to send transaction from does not have enough funds. Required {} and got: {}.", cost, balance) }, GasLimitExceeded { limit, got } => { format!("Transaction cost exceeds current gas limit. Limit: {}, got: {}. Try decreasing supplied gas.", limit, got)