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]] [[package]]
name = "parity-ui-precompiled" name = "parity-ui-precompiled"
version = "1.4.0" 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 = [ dependencies = [
"parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]

View File

@ -1,7 +1,7 @@
{ {
"name": "TestAuthorityRound", "name": "TestAuthorityRound",
"engine": { "engine": {
"AuthorityRound": { "authorityRound": {
"params": { "params": {
"gasLimitBoundDivisor": "0x0400", "gasLimitBoundDivisor": "0x0400",
"stepDuration": 1, "stepDuration": 1,
@ -21,7 +21,7 @@
}, },
"genesis": { "genesis": {
"seal": { "seal": {
"authority_round": { "authorityRound": {
"step": "0x0", "step": "0x0",
"signature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "signature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
{ {
"name": "parity.js", "name": "parity.js",
"version": "0.2.128", "version": "0.2.130",
"main": "release/index.js", "main": "release/index.js",
"jsnext:main": "src/index.js", "jsnext:main": "src/index.js",
"author": "Parity Team <admin@parity.io>", "author": "Parity Team <admin@parity.io>",
@ -135,6 +135,7 @@
"blockies": "0.0.2", "blockies": "0.0.2",
"brace": "0.9.0", "brace": "0.9.0",
"bytes": "2.4.0", "bytes": "2.4.0",
"debounce": "1.0.0",
"es6-error": "4.0.0", "es6-error": "4.0.0",
"es6-promise": "4.0.5", "es6-promise": "4.0.5",
"ethereumjs-tx": "1.1.4", "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 // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
import { ERRORS } from './newAccount';
export default 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 { Form, Input, IdentityIcon } from '~/ui';
import ERRORS from '../errors';
import styles from '../createAccount.css'; 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 { export default class CreateAccount extends Component {
static contextTypes = { static contextTypes = {
api: PropTypes.object.isRequired, api: PropTypes.object.isRequired,
@ -49,15 +38,15 @@ export default class CreateAccount extends Component {
state = { state = {
accountName: '', accountName: '',
accountNameError: ERRORS.noName, accountNameError: ERRORS.noName,
accounts: null,
isValidName: false,
isValidPass: false,
passwordHint: '', passwordHint: '',
password1: '', password1: '',
password1Error: ERRORS.invalidPassword, password1Error: null,
password2: '', password2: '',
password2Error: ERRORS.noMatchPassword, password2Error: null,
accounts: null, selectedAddress: ''
selectedAddress: '',
isValidPass: false,
isValidName: false
} }
componentWillMount () { componentWillMount () {
@ -230,60 +219,55 @@ export default class CreateAccount extends Component {
}, this.updateParent); }, this.updateParent);
} }
onEditPasswordHint = (event, value) => { onEditPasswordHint = (event, passwordHint) => {
this.setState({ this.setState({
passwordHint: value passwordHint
}); });
} }
onEditAccountName = (event) => { onEditAccountName = (event) => {
const value = event.target.value; const accountName = event.target.value;
let error = null; let accountNameError = null;
if (!value || value.trim().length < 2) { if (!accountName || !accountName.trim().length) {
error = ERRORS.noName; accountNameError = ERRORS.noName;
} }
this.setState({ this.setState({
accountName: value, accountName,
accountNameError: error, accountNameError,
isValidName: !error isValidName: !accountNameError
}, this.updateParent); }, this.updateParent);
} }
onEditPassword1 = (event) => { onEditPassword1 = (event) => {
const value = event.target.value; const password1 = event.target.value;
let error1 = null; let password2Error = null;
let error2 = null;
if (!value || value.trim().length < 8) { if (password1 !== this.state.password2) {
error1 = ERRORS.invalidPassword; password2Error = ERRORS.noMatchPassword;
}
if (value !== this.state.password2) {
error2 = ERRORS.noMatchPassword;
} }
this.setState({ this.setState({
password1: value, password1,
password1Error: error1, password1Error: null,
password2Error: error2, password2Error,
isValidPass: !error1 && !error2 isValidPass: !password2Error
}, this.updateParent); }, this.updateParent);
} }
onEditPassword2 = (event) => { onEditPassword2 = (event) => {
const value = event.target.value; const password2 = event.target.value;
let error2 = null; let password2Error = null;
if (value !== this.state.password1) { if (password2 !== this.state.password1) {
error2 = ERRORS.noMatchPassword; password2Error = ERRORS.noMatchPassword;
} }
this.setState({ this.setState({
password2: value, password2,
password2Error: error2, password2Error,
isValidPass: !error2 isValidPass: !password2Error
}, this.updateParent); }, 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> <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 checkboxes = available.map((account) => {
const label = ( const label = (
<div className={ styles.selection }> <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 { Form, Input } from '~/ui';
import ERRORS from '../errors';
import styles from '../createAccount.css'; import styles from '../createAccount.css';
const FAKEPATH = 'C:\\fakepath\\'; const FAKEPATH = 'C:\\fakepath\\';
const STYLE_HIDDEN = { display: 'none' }; 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 { export default class NewImport extends Component {
static propTypes = { static propTypes = {
onChange: PropTypes.func.isRequired onChange: PropTypes.func.isRequired
@ -40,15 +36,15 @@ export default class NewImport extends Component {
state = { state = {
accountName: '', accountName: '',
accountNameError: ERRORS.noName, accountNameError: ERRORS.noName,
passwordHint: '', isValidFile: false,
password: '',
passwordError: ERRORS.noPassword,
walletFile: '',
walletFileError: ERRORS.noFile,
walletJson: '',
isValidPass: false, isValidPass: false,
isValidName: false, isValidName: false,
isValidFile: false password: '',
passwordError: null,
passwordHint: '',
walletFile: '',
walletFileError: ERRORS.noFile,
walletJson: ''
} }
componentWillMount () { componentWillMount () {
@ -143,39 +139,34 @@ export default class NewImport extends Component {
}); });
} }
onEditPasswordHint = (event, value) => { onEditPasswordHint = (event, passwordHint) => {
this.setState({ this.setState({
passwordHint: value passwordHint
}); });
} }
onEditAccountName = (event) => { onEditAccountName = (event) => {
const value = event.target.value; const accountName = event.target.value;
let error = null; let accountNameError = null;
if (!value || value.trim().length < 2) { if (!accountName || !accountName.trim().length) {
error = ERRORS.noName; accountNameError = ERRORS.noName;
} }
this.setState({ this.setState({
accountName: value, accountName,
accountNameError: error, accountNameError,
isValidName: !error isValidName: !accountNameError
}, this.updateParent); }, this.updateParent);
} }
onEditPassword = (event) => { onEditPassword = (event) => {
let error = null; const password = event.target.value;
const value = event.target.value;
if (!value || !value.length) {
error = ERRORS.noPassword;
}
this.setState({ this.setState({
password: value, password,
passwordError: error, passwordError: null,
isValidPass: !error isValidPass: true
}, this.updateParent); }, this.updateParent);
} }
} }

View File

@ -20,7 +20,7 @@ import { Form, Input } from '~/ui';
import styles from '../createAccount.css'; import styles from '../createAccount.css';
import { ERRORS } from '../NewAccount'; import ERRORS from '../errors';
export default class RawKey extends Component { export default class RawKey extends Component {
static contextTypes = { static contextTypes = {
@ -32,18 +32,18 @@ export default class RawKey extends Component {
} }
state = { state = {
rawKey: '',
rawKeyError: ERRORS.noKey,
accountName: '', accountName: '',
accountNameError: ERRORS.noName, accountNameError: ERRORS.noName,
isValidKey: false,
isValidName: false,
isValidPass: false,
passwordHint: '', passwordHint: '',
password1: '', password1: '',
password1Error: ERRORS.invalidPassword, password1Error: null,
password2: '', password2: '',
password2Error: ERRORS.noMatchPassword, password2Error: null,
isValidPass: false, rawKey: '',
isValidName: false, rawKeyError: ERRORS.noKey
isValidKey: false
} }
componentWillMount () { componentWillMount () {
@ -138,7 +138,7 @@ export default class RawKey extends Component {
const accountName = event.target.value; const accountName = event.target.value;
let accountNameError = null; let accountNameError = null;
if (!accountName || accountName.trim().length < 2) { if (!accountName || !accountName.trim().length) {
accountNameError = ERRORS.noName; accountNameError = ERRORS.noName;
} }
@ -150,38 +150,33 @@ export default class RawKey extends Component {
} }
onEditPassword1 = (event) => { onEditPassword1 = (event) => {
const value = event.target.value; const password1 = event.target.value;
let error1 = null; let password2Error = null;
let error2 = null;
if (!value || value.trim().length < 8) { if (password1 !== this.state.password2) {
error1 = ERRORS.invalidPassword; password2Error = ERRORS.noMatchPassword;
}
if (value !== this.state.password2) {
error2 = ERRORS.noMatchPassword;
} }
this.setState({ this.setState({
password1: value, password1,
password1Error: error1, password1Error: null,
password2Error: error2, password2Error,
isValidPass: !error1 && !error2 isValidPass: !password2Error
}, this.updateParent); }, this.updateParent);
} }
onEditPassword2 = (event) => { onEditPassword2 = (event) => {
const value = event.target.value; const password2 = event.target.value;
let error2 = null; let password2Error = null;
if (value !== this.state.password1) { if (password2 !== this.state.password1) {
error2 = ERRORS.noMatchPassword; password2Error = ERRORS.noMatchPassword;
} }
this.setState({ this.setState({
password2: value, password2,
password2Error: error2, password2Error,
isValidPass: !error2 isValidPass: !password2Error
}, this.updateParent); }, this.updateParent);
} }
} }

View File

@ -21,7 +21,7 @@ import { Form, Input } from '~/ui';
import styles from '../createAccount.css'; import styles from '../createAccount.css';
import { ERRORS } from '../NewAccount'; import ERRORS from '../errors';
export default class RecoveryPhrase extends Component { export default class RecoveryPhrase extends Component {
static propTypes = { static propTypes = {
@ -29,19 +29,19 @@ export default class RecoveryPhrase extends Component {
} }
state = { state = {
recoveryPhrase: '',
recoveryPhraseError: ERRORS.noPhrase,
accountName: '', accountName: '',
accountNameError: ERRORS.noName, accountNameError: ERRORS.noName,
passwordHint: '',
password1: '',
password1Error: ERRORS.invalidPassword,
password2: '',
password2Error: ERRORS.noMatchPassword,
windowsPhrase: false,
isValidPass: false, isValidPass: false,
isValidName: false, isValidName: false,
isValidPhrase: false isValidPhrase: false,
passwordHint: '',
password1: '',
password1Error: null,
password2: '',
password2Error: null,
recoveryPhrase: '',
recoveryPhraseError: null,
windowsPhrase: false
} }
componentWillMount () { componentWillMount () {
@ -99,13 +99,13 @@ export default class RecoveryPhrase extends Component {
} }
updateParent = () => { 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; const isValid = isValidName && isValidPass && isValidPhrase;
this.props.onChange(isValid, { this.props.onChange(isValid, {
name: accountName, name: accountName,
passwordHint,
password: password1, password: password1,
passwordHint,
phrase: recoveryPhrase, phrase: recoveryPhrase,
windowsPhrase windowsPhrase
}); });
@ -134,67 +134,57 @@ export default class RecoveryPhrase extends Component {
.split(' ') .split(' ')
.map((part) => part.trim()) .map((part) => part.trim())
.filter((part) => part.length); .filter((part) => part.length);
let recoveryPhraseError = null;
if (!recoveryPhrase || recoveryPhrase.length < 25 || phraseParts.length < 8) {
recoveryPhraseError = ERRORS.noPhrase;
}
this.setState({ this.setState({
recoveryPhrase: phraseParts.join(' '), recoveryPhrase: phraseParts.join(' '),
recoveryPhraseError, recoveryPhraseError: null,
isValidPhrase: !recoveryPhraseError isValidPhrase: true
}, this.updateParent); }, this.updateParent);
} }
onEditAccountName = (event) => { onEditAccountName = (event) => {
const value = event.target.value; const accountName = event.target.value;
let error = null; let accountNameError = null;
if (!value || value.trim().length < 2) { if (!accountName || !accountName.trim().length) {
error = ERRORS.noName; accountNameError = ERRORS.noName;
} }
this.setState({ this.setState({
accountName: value, accountName,
accountNameError: error, accountNameError,
isValidName: !error isValidName: !accountNameError
}, this.updateParent); }, this.updateParent);
} }
onEditPassword1 = (event) => { onEditPassword1 = (event) => {
const value = event.target.value; const password1 = event.target.value;
let error1 = null; let password2Error = null;
let error2 = null;
if (!value || value.trim().length < 8) { if (password1 !== this.state.password2) {
error1 = ERRORS.invalidPassword; password2Error = ERRORS.noMatchPassword;
}
if (value !== this.state.password2) {
error2 = ERRORS.noMatchPassword;
} }
this.setState({ this.setState({
password1: value, password1,
password1Error: error1, password1Error: null,
password2Error: error2, password2Error,
isValidPass: !error1 && !error2 isValidPass: !password2Error
}, this.updateParent); }, this.updateParent);
} }
onEditPassword2 = (event) => { onEditPassword2 = (event) => {
const value = event.target.value; const password2 = event.target.value;
let error2 = null; let password2Error = null;
if (value !== this.state.password1) { if (password2 !== this.state.password1) {
error2 = ERRORS.noMatchPassword; password2Error = ERRORS.noMatchPassword;
} }
this.setState({ this.setState({
password2: value, password2,
password2Error: error2, password2Error,
isValidPass: !error2 isValidPass: !password2Error
}, this.updateParent); }, this.updateParent);
} }
} }

View File

@ -15,6 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
import React, { Component, PropTypes } from 'react'; import React, { Component, PropTypes } from 'react';
import { FormattedMessage } from 'react-intl';
import ActionDone from 'material-ui/svg-icons/action/done'; import ActionDone from 'material-ui/svg-icons/action/done';
import ActionDoneAll from 'material-ui/svg-icons/action/done-all'; import ActionDoneAll from 'material-ui/svg-icons/action/done-all';
import ContentClear from 'material-ui/svg-icons/content/clear'; 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 NavigationArrowForward from 'material-ui/svg-icons/navigation/arrow-forward';
import PrintIcon from 'material-ui/svg-icons/action/print'; 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 AccountDetails from './AccountDetails';
import AccountDetailsGeth from './AccountDetailsGeth'; import AccountDetailsGeth from './AccountDetailsGeth';
@ -86,6 +87,7 @@ export default class CreateAccount extends Component {
actions={ this.renderDialogActions() } actions={ this.renderDialogActions() }
current={ stage } current={ stage }
steps={ steps }> steps={ steps }>
{ this.renderWarning() }
{ this.renderPage() } { this.renderPage() }
</Modal> </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 = () => { onNext = () => {
this.setState({ this.setState({
stage: this.state.stage + 1 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 React, { Component, PropTypes } from 'react';
import { Form, TypedInput, Input, AddressSelect, InputAddress } from '~/ui'; import { Form, TypedInput, Input, AddressSelect, InputAddress } from '~/ui';
import { parseAbiType } from '~/util/abi';
import styles from '../createWallet.css'; import styles from '../createWallet.css';
@ -105,7 +104,7 @@ export default class WalletDetails extends Component {
value={ wallet.owners.slice() } value={ wallet.owners.slice() }
onChange={ this.onOwnersChange } onChange={ this.onOwnersChange }
accounts={ accounts } accounts={ accounts }
param={ parseAbiType('address[]') } param='address[]'
/> />
<div className={ styles.splitInput }> <div className={ styles.splitInput }>
@ -115,7 +114,7 @@ export default class WalletDetails extends Component {
value={ wallet.required } value={ wallet.required }
error={ errors.required } error={ errors.required }
onChange={ this.onRequiredChange } onChange={ this.onRequiredChange }
param={ parseAbiType('uint') } param='uint'
min={ 1 } min={ 1 }
max={ wallet.owners.length + 1 } max={ wallet.owners.length + 1 }
/> />
@ -126,7 +125,7 @@ export default class WalletDetails extends Component {
value={ wallet.daylimit } value={ wallet.daylimit }
error={ errors.daylimit } error={ errors.daylimit }
onChange={ this.onDaylimitChange } onChange={ this.onDaylimitChange }
param={ parseAbiType('uint') } param='uint'
isEth isEth
/> />
</div> </div>

View File

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

View File

@ -18,7 +18,6 @@ import React, { Component, PropTypes } from 'react';
import { Checkbox, MenuItem } from 'material-ui'; import { Checkbox, MenuItem } from 'material-ui';
import { AddressSelect, Form, Input, Select, TypedInput } from '~/ui'; import { AddressSelect, Form, Input, Select, TypedInput } from '~/ui';
import { parseAbiType } from '~/util/abi';
import styles from '../executeContract.css'; import styles from '../executeContract.css';
@ -162,7 +161,8 @@ export default class DetailsStep extends Component {
error={ valuesError[index] } error={ valuesError[index] }
onChange={ onChange } onChange={ onChange }
accounts={ accounts } accounts={ accounts }
param={ parseAbiType(input.type) } param={ input.type }
isEth={ false }
/> />
</div> </div>
); );

View File

@ -23,7 +23,7 @@ import VerificationStore, {
} from './store'; } from './store';
import { postToServer } from '../../3rdparty/email-verification'; 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 { export default class EmailVerificationStore extends VerificationStore {
@observable email = ''; @observable email = '';

View File

@ -22,7 +22,6 @@ import { pick } from 'lodash';
import ActionDone from 'material-ui/svg-icons/action/done'; import ActionDone from 'material-ui/svg-icons/action/done';
import ContentClear from 'material-ui/svg-icons/content/clear'; import ContentClear from 'material-ui/svg-icons/content/clear';
import NavigationArrowForward from 'material-ui/svg-icons/navigation/arrow-forward'; 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 { Button, Modal, TxHash, BusyStep, Form, TypedInput, InputAddress, AddressSelect } from '~/ui';
import { fromWei } from '~/api/util/wei'; import { fromWei } from '~/api/util/wei';
@ -107,10 +106,7 @@ class WalletSettings extends Component {
return ( return (
<div> <div>
<p>You are about to make the following modifications</p> { this.renderChanges(changes) }
<div>
{ this.renderChanges(changes) }
</div>
</div> </div>
); );
@ -142,19 +138,19 @@ class WalletSettings extends Component {
value={ wallet.owners.slice() } value={ wallet.owners.slice() }
onChange={ this.store.onOwnersChange } onChange={ this.store.onOwnersChange }
accounts={ accounts } accounts={ accounts }
param={ parseAbiType('address[]') } param='address[]'
/> />
<div className={ styles.splitInput }> <div className={ styles.splitInput }>
<TypedInput <TypedInput
label='required owners' label='required owners'
hint='number of required owners to accept a transaction' hint='number of required owners to accept a transaction'
value={ wallet.require }
error={ errors.require } error={ errors.require }
onChange={ this.store.onRequireChange }
param={ parseAbiType('uint') }
min={ 1 } min={ 1 }
onChange={ this.store.onRequireChange }
max={ wallet.owners.length } max={ wallet.owners.length }
param='uint'
value={ wallet.require }
/> />
<TypedInput <TypedInput
@ -163,7 +159,7 @@ class WalletSettings extends Component {
value={ wallet.dailylimit } value={ wallet.dailylimit }
error={ errors.dailylimit } error={ errors.dailylimit }
onChange={ this.store.onDailylimitChange } onChange={ this.store.onDailylimitChange }
param={ parseAbiType('uint') } param='uint'
isEth isEth
/> />
</div> </div>
@ -173,11 +169,24 @@ class WalletSettings extends Component {
} }
renderChanges (changes) { 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}` }> <div key={ `${change.type}_${index}` }>
{ this.renderChange(change) } { this.renderChange(change) }
</div> </div>
)); ));
return (
<div>
<p>You are about to make the following modifications</p>
{ modifications }
</div>
);
} }
renderChange (change) { renderChange (change) {
@ -297,6 +306,12 @@ class WalletSettings extends Component {
return done ? [ closeBtn ] : [ closeBtn, sendingBtn ]; return done ? [ closeBtn ] : [ closeBtn, sendingBtn ];
case 'CONFIRMATION': case 'CONFIRMATION':
const { changes } = this.store;
if (changes.length === 0) {
return [ closeBtn ];
}
return [ cancelBtn, sendBtn ]; return [ cancelBtn, sendBtn ];
default: default:

View File

@ -15,12 +15,41 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
import { uniq } from 'lodash'; import { uniq } from 'lodash';
import debounce from 'debounce';
import ABI from '~/contracts/abi/certifier.json'; import ABI from '~/contracts/abi/certifier.json';
import Contract from '~/api/contract'; import Contract from '~/api/contract';
import Contracts from '~/contracts'; import Contracts from '~/contracts';
import { addCertification, removeCertification } from './actions'; 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 { export default class CertificationsMiddleware {
toMiddleware () { toMiddleware () {
const api = Contracts.get()._api; const api = Contracts.get()._api;
@ -29,75 +58,96 @@ export default class CertificationsMiddleware {
const Confirmed = contract.events.find((e) => e.name === 'Confirmed'); const Confirmed = contract.events.find((e) => e.name === 'Confirmed');
const Revoked = contract.events.find((e) => e.name === 'Revoked'); const Revoked = contract.events.find((e) => e.name === 'Revoked');
let certifiers = []; return (store) => {
let accounts = []; // these are addresses const onLogs = (logs) => {
logs = contract.parseEventLogs(logs);
const fetchConfirmedEvents = (dispatch) => { logs.forEach((log) => {
if (certifiers.length === 0 || accounts.length === 0) return; const certifier = certifiers.find((c) => c.address === log.address);
api.eth.getLogs({ if (!certifier) {
fromBlock: 0, throw new Error(`Could not find certifier at ${log.address}.`);
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);
} }
const { id, name, title, icon } = certifier;
break; if (log.event === 'Revoked') {
case 'setVisibleAccounts': store.dispatch(removeCertification(log.params.who.value, id));
const { addresses } = action; } else {
accounts = uniq(accounts.concat(addresses)); store.dispatch(addCertification(log.params.who.value, id, name, title, icon));
fetchConfirmedEvents(store.dispatch); }
});
};
break; let filter = null;
default:
next(action); 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);
}
};
}; };
} }
} }

View File

@ -22,6 +22,7 @@
.certification { .certification {
display: inline-block; display: inline-block;
position: relative; position: relative;
margin-top: 1em;
margin-right: .5em; margin-right: .5em;
padding: .3em .6em .2em 2.6em; padding: .3em .6em .2em 2.6em;
border-radius: 1em; border-radius: 1em;

View File

@ -50,7 +50,7 @@ export default class Input extends Component {
children: PropTypes.node, children: PropTypes.node,
className: PropTypes.string, className: PropTypes.string,
disabled: PropTypes.bool, disabled: PropTypes.bool,
error: PropTypes.string, error: nodeOrStringProptype(),
readOnly: PropTypes.bool, readOnly: PropTypes.bool,
floatCopy: PropTypes.bool, floatCopy: PropTypes.bool,
hint: nodeOrStringProptype(), hint: nodeOrStringProptype(),
@ -96,8 +96,7 @@ export default class Input extends Component {
render () { render () {
const { value } = this.state; const { value } = this.state;
const { children, className, hideUnderline, disabled, error, label } = this.props; const { children, className, disabled, error, hideUnderline, hint, label, max, min, multiLine, rows, style, type } = this.props;
const { hint, multiLine, rows, type, min, max, style } = this.props;
const readOnly = this.props.readOnly || disabled; 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 Input from '~/ui/Form/Input';
import InputAddressSelect from '~/ui/Form/InputAddressSelect'; import InputAddressSelect from '~/ui/Form/InputAddressSelect';
import Select from '~/ui/Form/Select'; import Select from '~/ui/Form/Select';
import { ABI_TYPES } from '~/util/abi'; import { ABI_TYPES, parseAbiType } from '~/util/abi';
import styles from './typedInput.css'; import styles from './typedInput.css';
@ -34,22 +34,25 @@ export default class TypedInput extends Component {
static propTypes = { static propTypes = {
onChange: PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,
param: PropTypes.object.isRequired,
accounts: PropTypes.object, accounts: PropTypes.object,
error: PropTypes.any, error: PropTypes.any,
value: PropTypes.any,
label: PropTypes.string,
hint: PropTypes.string, hint: PropTypes.string,
min: PropTypes.number, isEth: PropTypes.bool,
label: PropTypes.string,
max: PropTypes.number, max: PropTypes.number,
isEth: PropTypes.bool min: PropTypes.number,
param: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string
]).isRequired,
value: PropTypes.any
}; };
static defaultProps = { static defaultProps = {
min: null, min: null,
max: null, max: null,
isEth: false isEth: null
}; };
state = { state = {
@ -64,7 +67,26 @@ export default class TypedInput extends Component {
} }
render () { 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; const { type } = param;
if (type === ABI_TYPES.ARRAY) { if (type === ABI_TYPES.ARRAY) {
@ -163,7 +185,16 @@ export default class TypedInput extends Component {
return this.renderDefault(); 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) { if (type === ABI_TYPES.INT) {
const { isEth } = this.props;
if (typeof isEth !== 'boolean') {
return this.renderInteger();
}
return this.renderEth(); 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 Tooltips, { Tooltip } from './Tooltips';
import TxHash from './TxHash'; import TxHash from './TxHash';
import TxList from './TxList'; import TxList from './TxList';
import Warning from './Warning';
export { export {
Actionbar, Actionbar,
@ -99,5 +100,6 @@ export {
Tooltips, Tooltips,
TxHash, TxHash,
TxList, TxList,
TypedInput TypedInput,
Warning
}; };

View File

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

View File

@ -25,16 +25,21 @@ use spec::Tendermint;
#[derive(Debug, PartialEq, Deserialize)] #[derive(Debug, PartialEq, Deserialize)]
pub enum Engine { pub enum Engine {
/// Null engine. /// Null engine.
#[serde(rename="null")]
Null, Null,
/// Instantly sealing engine. /// Instantly sealing engine.
#[serde(rename="instantSeal")]
InstantSeal, InstantSeal,
/// Ethash engine. /// Ethash engine.
Ethash(Ethash), Ethash(Ethash),
/// BasicAuthority engine. /// BasicAuthority engine.
#[serde(rename="basicAuthority")]
BasicAuthority(BasicAuthority), BasicAuthority(BasicAuthority),
/// AuthorityRound engine. /// AuthorityRound engine.
#[serde(rename="authorityRound")]
AuthorityRound(AuthorityRound), AuthorityRound(AuthorityRound),
/// Tendermint engine. /// Tendermint engine.
#[serde(rename="tendermint")]
Tendermint(Tendermint) Tendermint(Tendermint)
} }
@ -46,14 +51,14 @@ mod tests {
#[test] #[test]
fn engine_deserialization() { fn engine_deserialization() {
let s = r#"{ let s = r#"{
"Null": null "null": null
}"#; }"#;
let deserialized: Engine = serde_json::from_str(s).unwrap(); let deserialized: Engine = serde_json::from_str(s).unwrap();
assert_eq!(Engine::Null, deserialized); assert_eq!(Engine::Null, deserialized);
let s = r#"{ let s = r#"{
"InstantSeal": null "instantSeal": null
}"#; }"#;
let deserialized: Engine = serde_json::from_str(s).unwrap(); let deserialized: Engine = serde_json::from_str(s).unwrap();

View File

@ -57,7 +57,7 @@ pub enum Seal {
#[serde(rename="ethereum")] #[serde(rename="ethereum")]
Ethereum(Ethereum), Ethereum(Ethereum),
/// AuthorityRound seal. /// AuthorityRound seal.
#[serde(rename="authority_round")] #[serde(rename="authorityRound")]
AuthorityRound(AuthorityRoundSeal), AuthorityRound(AuthorityRoundSeal),
/// Tendermint seal. /// Tendermint seal.
#[serde(rename="tendermint")] #[serde(rename="tendermint")]
@ -82,7 +82,7 @@ mod tests {
},{ },{
"generic": "0xe011bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa" "generic": "0xe011bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa"
},{ },{
"authority_round": { "authorityRound": {
"step": "0x0", "step": "0x0",
"signature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "signature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
} }

View File

@ -147,8 +147,6 @@ usage! {
flag_reserved_only: bool = false, flag_reserved_only: bool = false,
or |c: &Config| otry!(c.network).reserved_only.clone(), or |c: &Config| otry!(c.network).reserved_only.clone(),
flag_no_ancient_blocks: bool = false, or |_| None, 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 // -- API and Console Options
// RPC // RPC
@ -360,7 +358,6 @@ struct Network {
node_key: Option<String>, node_key: Option<String>,
reserved_peers: Option<String>, reserved_peers: Option<String>,
reserved_only: Option<bool>, reserved_only: Option<bool>,
serve_light: Option<bool>,
} }
#[derive(Default, Debug, PartialEq, RustcDecodable)] #[derive(Default, Debug, PartialEq, RustcDecodable)]
@ -584,7 +581,6 @@ mod tests {
flag_reserved_peers: Some("./path_to_file".into()), flag_reserved_peers: Some("./path_to_file".into()),
flag_reserved_only: false, flag_reserved_only: false,
flag_no_ancient_blocks: false, flag_no_ancient_blocks: false,
flag_serve_light: true,
// -- API and Console Options // -- API and Console Options
// RPC // RPC
@ -764,7 +760,6 @@ mod tests {
node_key: None, node_key: None,
reserved_peers: Some("./path/to/reserved_peers".into()), reserved_peers: Some("./path/to/reserved_peers".into()),
reserved_only: Some(true), reserved_only: Some(true),
serve_light: None,
}), }),
rpc: Some(Rpc { rpc: Some(Rpc {
disable: Some(true), 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}) --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 --no-ancient-blocks Disable downloading old blocks after snapshot restoration
or warp sync. (default: {flag_no_ancient_blocks}) or warp sync. (default: {flag_no_ancient_blocks})
--serve-light Experimental: Serve light client peers. (default: {flag_serve_light})
API and Console Options: API and Console Options:
--no-jsonrpc Disable the JSON-RPC API server. (default: {flag_no_jsonrpc}) --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, no_periodic_snapshot: self.args.flag_no_periodic_snapshot,
check_seal: !self.args.flag_no_seal_check, check_seal: !self.args.flag_no_seal_check,
download_old_blocks: !self.args.flag_no_ancient_blocks, download_old_blocks: !self.args.flag_no_ancient_blocks,
serve_light: self.args.flag_serve_light,
light: self.args.flag_light, light: self.args.flag_light,
verifier_settings: verifier_settings, verifier_settings: verifier_settings,
}; };
@ -1033,7 +1032,6 @@ mod tests {
no_periodic_snapshot: false, no_periodic_snapshot: false,
check_seal: true, check_seal: true,
download_old_blocks: true, download_old_blocks: true,
serve_light: false,
verifier_settings: Default::default(), verifier_settings: Default::default(),
light: false, light: false,
})); }));

View File

@ -93,7 +93,6 @@ pub struct RunCmd {
pub no_periodic_snapshot: bool, pub no_periodic_snapshot: bool,
pub check_seal: bool, pub check_seal: bool,
pub download_old_blocks: bool, pub download_old_blocks: bool,
pub serve_light: bool,
pub verifier_settings: VerifierSettings, pub verifier_settings: VerifierSettings,
pub light: bool, 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))); 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 // display warning about using experimental journaldb alorithm
if !algorithm.is_stable() { if !algorithm.is_stable() {
warn!("Your chosen strategy is {}! You can re-run with --pruning to change.", Colour::Red.bold().paint("unstable")); 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.fork_block = spec.fork_block();
sync_config.warp_sync = cmd.warp_sync; sync_config.warp_sync = cmd.warp_sync;
sync_config.download_old_blocks = cmd.download_old_blocks; 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)); 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) 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 } => { 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 } => { GasLimitExceeded { limit, got } => {
format!("Transaction cost exceeds current gas limit. Limit: {}, got: {}. Try decreasing supplied gas.", limit, got) format!("Transaction cost exceeds current gas limit. Limit: {}, got: {}. Try decreasing supplied gas.", limit, got)