Merge branch 'master' into lightsync

This commit is contained in:
Robert Habermeier 2016-12-19 18:53:52 +01:00
commit 70d53dcfd6
39 changed files with 488 additions and 288 deletions

2
Cargo.lock generated
View File

@ -1368,7 +1368,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#e3e33f97c0f3b3d788a859b5bd10f5ca1ee45871"
dependencies = [
"parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

View File

@ -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"
}

View File

@ -1,7 +1,7 @@
{
"name": "TestBasicAuthority",
"engine": {
"BasicAuthority": {
"basicAuthority": {
"params": {
"gasLimitBoundDivisor": "0x0400",
"durationLimit": "0x0d",

View File

@ -1,7 +1,7 @@
{
"name": "DevelopmentChain",
"engine": {
"InstantSeal": null
"instantSeal": null
},
"params": {
"accountStartNonce": "0x0",

View File

@ -1,7 +1,7 @@
{
"name": "Morden",
"engine": {
"Null": null
"null": null
},
"params": {
"accountStartNonce": "0x0",

View File

@ -1,7 +1,7 @@
{
"name": "Morden",
"engine": {
"Null": null
"null": null
},
"params": {
"accountStartNonce": "0x0",

View File

@ -1,7 +1,7 @@
{
"name": "TestBFT",
"engine": {
"Tendermint": {
"tendermint": {
"params": {
"gasLimitBoundDivisor": "0x0400",
"authorities" : [

View File

@ -486,7 +486,13 @@ impl<K: Kind> VerificationQueue<K> {
Ok(h)
},
Err(err) => {
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)
}
}

View File

@ -1,6 +1,6 @@
{
"name": "parity.js",
"version": "0.2.128",
"version": "0.2.130",
"main": "release/index.js",
"jsnext:main": "src/index.js",
"author": "Parity Team <admin@parity.io>",
@ -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",

View File

@ -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"}]
[{"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"}]

View File

@ -14,10 +14,4 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import { ERRORS } from './newAccount';
export default from './newAccount';
export {
ERRORS
};

View File

@ -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);
}

View File

@ -47,6 +47,7 @@ export default class NewGeth extends Component {
<div className={ styles.list }>There are currently no importable keys available from the Geth keystore, which are not already available on your Parity instance</div>
);
}
const checkboxes = available.map((account) => {
const label = (
<div className={ styles.selection }>

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -15,6 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
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() }
</Modal>
);
@ -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 (
<Warning warning={
<FormattedMessage
id='createAccount.warning.insecurePassword'
defaultMessage='It is recommended that a strong password be used to secure your accounts. Empty and trivial passwords are a security risk.' />
} />
);
}
onNext = () => {
this.setState({
stage: this.state.stage + 1

View File

@ -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 <http://www.gnu.org/licenses/>.
import React from 'react';
import { FormattedMessage } from 'react-intl';
export default {
noFile:
<FormattedMessage
id='createAccount.error.noFile'
defaultMessage='select a valid wallet file to import' />,
noKey:
<FormattedMessage
id='createAccount.error.noKey'
defaultMessage='you need to provide the raw private key' />,
noMatchPassword:
<FormattedMessage
id='createAccount.error.noMatchPassword'
defaultMessage='the supplied passwords does not match' />,
noName:
<FormattedMessage
id='createAccount.error.noName'
defaultMessage='you need to specify a valid name for the account' />,
invalidKey:
<FormattedMessage
id='createAccount.error.invalidKey'
defaultMessage='the raw key needs to be hex, 64 characters in length and contain the prefix "0x"' />
};

View File

@ -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[]'
/>
<div className={ styles.splitInput }>
@ -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
/>
</div>

View File

@ -83,6 +83,7 @@ export default class ParametersStep extends Component {
accounts={ accounts }
onChange={ onChange }
param={ param }
isEth={ false }
/>
</div>
);

View File

@ -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 }
/>
</div>
);

View File

@ -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 = '';

View File

@ -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';
@ -106,12 +105,9 @@ class WalletSettings extends Component {
const { changes } = this.store;
return (
<div>
<p>You are about to make the following modifications</p>
<div>
{ this.renderChanges(changes) }
</div>
</div>
);
default:
@ -142,19 +138,19 @@ class WalletSettings extends Component {
value={ wallet.owners.slice() }
onChange={ this.store.onOwnersChange }
accounts={ accounts }
param={ parseAbiType('address[]') }
param='address[]'
/>
<div className={ styles.splitInput }>
<TypedInput
label='required owners'
hint='number of required owners to accept a transaction'
value={ wallet.require }
error={ errors.require }
onChange={ this.store.onRequireChange }
param={ parseAbiType('uint') }
min={ 1 }
onChange={ this.store.onRequireChange }
max={ wallet.owners.length }
param='uint'
value={ wallet.require }
/>
<TypedInput
@ -163,7 +159,7 @@ class WalletSettings extends Component {
value={ wallet.dailylimit }
error={ errors.dailylimit }
onChange={ this.store.onDailylimitChange }
param={ parseAbiType('uint') }
param='uint'
isEth
/>
</div>
@ -173,11 +169,24 @@ class WalletSettings extends Component {
}
renderChanges (changes) {
return changes.map((change, index) => (
if (changes.length === 0) {
return (
<p>No modifications have been made to the Wallet settings.</p>
);
}
const modifications = changes.map((change, index) => (
<div key={ `${change.type}_${index}` }>
{ this.renderChange(change) }
</div>
));
return (
<div>
<p>You are about to make the following modifications</p>
{ modifications }
</div>
);
}
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:

View File

@ -15,12 +15,41 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
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,19 +58,9 @@ 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) => {
return (store) => {
const onLogs = (logs) => {
logs = contract.parseEventLogs(logs);
logs.forEach((log) => {
const certifier = certifiers.find((c) => c.address === log.address);
if (!certifier) {
@ -50,18 +69,48 @@ export default class CertificationsMiddleware {
const { id, name, title, icon } = certifier;
if (log.event === 'Revoked') {
dispatch(removeCertification(log.params.who.value, id));
store.dispatch(removeCertification(log.params.who.value, id));
} else {
dispatch(addCertification(log.params.who.value, id, name, title, icon));
store.dispatch(addCertification(log.params.who.value, id, name, title, icon));
}
});
})
.catch((err) => {
console.error('Failed to fetch Confirmed events:', err);
});
};
return (store) => (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) => {
@ -70,7 +119,7 @@ export default class CertificationsMiddleware {
.then((cert) => {
if (!certifiers.some((c) => c.id === cert.id)) {
certifiers = certifiers.concat(cert);
fetchConfirmedEvents(store.dispatch);
fetchConfirmedEvents();
}
})
.catch((err) => {
@ -85,19 +134,20 @@ export default class CertificationsMiddleware {
if (!accounts.includes(address)) {
accounts = accounts.concat(address);
fetchConfirmedEvents(store.dispatch);
fetchConfirmedEvents();
}
break;
case 'setVisibleAccounts':
const { addresses } = action;
accounts = uniq(accounts.concat(addresses));
fetchConfirmedEvents(store.dispatch);
fetchConfirmedEvents();
break;
default:
next(action);
}
};
};
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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('<TypedInput>', `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();
}

View File

@ -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 <http://www.gnu.org/licenses/>.
export default from './warning';

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
.warning {
background: #f80;
border-radius: 0.5em;
color: white;
font-size: 0.75em;
margin-bottom: 1em;
padding: 0.75em;
text-align: center;
}

View File

@ -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 <http://www.gnu.org/licenses/>.
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 (
<div className={ styles.warning }>
{ warning }
</div>
);
}
}

View File

@ -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
};

View File

@ -143,4 +143,7 @@ export function parseAbiType (type) {
signed: true
};
}
// If no matches, return null
return null;
}

View File

@ -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();

View File

@ -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"
}

View File

@ -147,8 +147,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
@ -360,7 +358,6 @@ struct Network {
node_key: Option<String>,
reserved_peers: Option<String>,
reserved_only: Option<bool>,
serve_light: Option<bool>,
}
#[derive(Default, Debug, PartialEq, RustcDecodable)]
@ -584,7 +581,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
@ -764,7 +760,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),

View File

@ -126,7 +126,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})

View File

@ -341,7 +341,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,
light: self.args.flag_light,
verifier_settings: verifier_settings,
};
@ -1033,7 +1032,6 @@ mod tests {
no_periodic_snapshot: false,
check_seal: true,
download_old_blocks: true,
serve_light: false,
verifier_settings: Default::default(),
light: false,
}));

View File

@ -93,7 +93,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,
pub light: bool,
}
@ -254,11 +253,6 @@ pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> R
);
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"));
@ -278,7 +272,6 @@ pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> R
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));

View File

@ -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)