Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d30c715134 | ||
|
|
a21db69686 | ||
|
|
9afd1006ed |
52
Cargo.lock
generated
52
Cargo.lock
generated
@@ -277,7 +277,7 @@ dependencies = [
|
||||
name = "common-types"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"ethcore-util 1.7.3",
|
||||
"ethcore-util 1.7.4",
|
||||
"ethjson 0.1.0",
|
||||
"rlp 0.2.0",
|
||||
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -476,7 +476,7 @@ dependencies = [
|
||||
"ethcore-ipc-nano 1.7.0",
|
||||
"ethcore-logger 1.7.0",
|
||||
"ethcore-stratum 1.7.0",
|
||||
"ethcore-util 1.7.3",
|
||||
"ethcore-util 1.7.4",
|
||||
"ethjson 0.1.0",
|
||||
"ethkey 0.2.0",
|
||||
"ethstore 0.1.0",
|
||||
@@ -545,7 +545,7 @@ name = "ethcore-ipc"
|
||||
version = "1.7.0"
|
||||
dependencies = [
|
||||
"ethcore-devtools 1.7.0",
|
||||
"ethcore-util 1.7.3",
|
||||
"ethcore-util 1.7.4",
|
||||
"nanomsg 0.5.1 (git+https://github.com/paritytech/nanomsg.rs.git?branch=parity-1.7)",
|
||||
"semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@@ -594,7 +594,7 @@ dependencies = [
|
||||
"ethcore-ipc 1.7.0",
|
||||
"ethcore-ipc-codegen 1.7.0",
|
||||
"ethcore-ipc-nano 1.7.0",
|
||||
"ethcore-util 1.7.3",
|
||||
"ethcore-util 1.7.4",
|
||||
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"nanomsg 0.5.1 (git+https://github.com/paritytech/nanomsg.rs.git?branch=parity-1.7)",
|
||||
"semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -611,7 +611,7 @@ dependencies = [
|
||||
"ethcore-ipc 1.7.0",
|
||||
"ethcore-ipc-codegen 1.7.0",
|
||||
"ethcore-network 1.7.0",
|
||||
"ethcore-util 1.7.3",
|
||||
"ethcore-util 1.7.4",
|
||||
"evm 0.1.0",
|
||||
"futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -650,7 +650,7 @@ dependencies = [
|
||||
"ethcore-devtools 1.7.0",
|
||||
"ethcore-io 1.7.0",
|
||||
"ethcore-logger 1.7.0",
|
||||
"ethcore-util 1.7.3",
|
||||
"ethcore-util 1.7.4",
|
||||
"ethcrypto 0.1.0",
|
||||
"ethkey 0.2.0",
|
||||
"igd 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -681,7 +681,7 @@ dependencies = [
|
||||
"ethcore-ipc-codegen 1.7.0",
|
||||
"ethcore-ipc-nano 1.7.0",
|
||||
"ethcore-logger 1.7.0",
|
||||
"ethcore-util 1.7.3",
|
||||
"ethcore-util 1.7.4",
|
||||
"ethcrypto 0.1.0",
|
||||
"ethkey 0.2.0",
|
||||
"futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -711,7 +711,7 @@ dependencies = [
|
||||
"ethcore-ipc-codegen 1.7.0",
|
||||
"ethcore-ipc-nano 1.7.0",
|
||||
"ethcore-logger 1.7.0",
|
||||
"ethcore-util 1.7.3",
|
||||
"ethcore-util 1.7.4",
|
||||
"futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"jsonrpc-core 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)",
|
||||
"jsonrpc-macros 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)",
|
||||
@@ -724,7 +724,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ethcore-util"
|
||||
version = "1.7.3"
|
||||
version = "1.7.4"
|
||||
dependencies = [
|
||||
"ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -774,7 +774,7 @@ name = "ethjson"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ethcore-util 1.7.3",
|
||||
"ethcore-util 1.7.4",
|
||||
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -855,7 +855,7 @@ dependencies = [
|
||||
"ethcore-ipc-nano 1.7.0",
|
||||
"ethcore-light 1.7.0",
|
||||
"ethcore-network 1.7.0",
|
||||
"ethcore-util 1.7.3",
|
||||
"ethcore-util 1.7.4",
|
||||
"ethkey 0.2.0",
|
||||
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -874,7 +874,7 @@ dependencies = [
|
||||
"bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"common-types 0.1.0",
|
||||
"ethcore-util 1.7.3",
|
||||
"ethcore-util 1.7.4",
|
||||
"ethjson 0.1.0",
|
||||
"evmjit 1.7.0",
|
||||
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -891,7 +891,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"docopt 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ethcore 1.7.0",
|
||||
"ethcore-util 1.7.3",
|
||||
"ethcore-util 1.7.4",
|
||||
"ethjson 0.1.0",
|
||||
"evm 0.1.0",
|
||||
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -1136,7 +1136,7 @@ version = "1.7.0"
|
||||
dependencies = [
|
||||
"ethcore-ipc 1.7.0",
|
||||
"ethcore-ipc-codegen 1.7.0",
|
||||
"ethcore-util 1.7.3",
|
||||
"ethcore-util 1.7.4",
|
||||
"semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@@ -1530,7 +1530,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ethcore-util 1.7.3",
|
||||
"ethcore-util 1.7.4",
|
||||
"futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"native-contract-generator 0.1.0",
|
||||
]
|
||||
@@ -1735,7 +1735,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "parity"
|
||||
version = "1.7.3"
|
||||
version = "1.7.4"
|
||||
dependencies = [
|
||||
"ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"app_dirs 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -1755,7 +1755,7 @@ dependencies = [
|
||||
"ethcore-logger 1.7.0",
|
||||
"ethcore-secretstore 1.0.0",
|
||||
"ethcore-stratum 1.7.0",
|
||||
"ethcore-util 1.7.3",
|
||||
"ethcore-util 1.7.4",
|
||||
"ethkey 0.2.0",
|
||||
"ethsync 1.7.0",
|
||||
"fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -1801,7 +1801,7 @@ dependencies = [
|
||||
"clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ethcore-devtools 1.7.0",
|
||||
"ethcore-util 1.7.3",
|
||||
"ethcore-util 1.7.4",
|
||||
"fetch 0.1.0",
|
||||
"futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"jsonrpc-core 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)",
|
||||
@@ -1845,7 +1845,7 @@ name = "parity-hash-fetch"
|
||||
version = "1.7.0"
|
||||
dependencies = [
|
||||
"ethabi 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ethcore-util 1.7.3",
|
||||
"ethcore-util 1.7.4",
|
||||
"fetch 0.1.0",
|
||||
"futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -1863,7 +1863,7 @@ version = "1.7.0"
|
||||
dependencies = [
|
||||
"cid 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ethcore 1.7.0",
|
||||
"ethcore-util 1.7.3",
|
||||
"ethcore-util 1.7.4",
|
||||
"jsonrpc-http-server 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)",
|
||||
"mime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"multihash 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -1876,7 +1876,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"ethcore 1.7.0",
|
||||
"ethcore-io 1.7.0",
|
||||
"ethcore-util 1.7.3",
|
||||
"ethcore-util 1.7.4",
|
||||
"ethkey 0.2.0",
|
||||
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rlp 0.2.0",
|
||||
@@ -1906,7 +1906,7 @@ dependencies = [
|
||||
"ethcore-ipc 1.7.0",
|
||||
"ethcore-light 1.7.0",
|
||||
"ethcore-logger 1.7.0",
|
||||
"ethcore-util 1.7.3",
|
||||
"ethcore-util 1.7.4",
|
||||
"ethcrypto 0.1.0",
|
||||
"ethjson 0.1.0",
|
||||
"ethkey 0.2.0",
|
||||
@@ -1948,7 +1948,7 @@ dependencies = [
|
||||
name = "parity-rpc-client"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"ethcore-util 1.7.3",
|
||||
"ethcore-util 1.7.4",
|
||||
"futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"jsonrpc-core 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)",
|
||||
"jsonrpc-ws-server 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)",
|
||||
@@ -1998,7 +1998,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "parity-ui-precompiled"
|
||||
version = "1.4.0"
|
||||
source = "git+https://github.com/paritytech/js-precompiled.git?branch=beta#657a34702890778823bbd0f2aeb6e015b2053744"
|
||||
source = "git+https://github.com/paritytech/js-precompiled.git?branch=beta#b24d0f6572640beb37924e709151fb124453c2e4"
|
||||
dependencies = [
|
||||
"parity-dapps-glue 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@@ -2011,7 +2011,7 @@ dependencies = [
|
||||
"ethcore 1.7.0",
|
||||
"ethcore-ipc 1.7.0",
|
||||
"ethcore-ipc-codegen 1.7.0",
|
||||
"ethcore-util 1.7.3",
|
||||
"ethcore-util 1.7.4",
|
||||
"ethsync 1.7.0",
|
||||
"futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-common-types 1.7.0",
|
||||
@@ -2367,7 +2367,7 @@ name = "rpc-cli"
|
||||
version = "1.4.0"
|
||||
dependencies = [
|
||||
"bigint 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ethcore-util 1.7.3",
|
||||
"ethcore-util 1.7.4",
|
||||
"futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-rpc 1.7.0",
|
||||
"parity-rpc-client 1.4.0",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
description = "Parity Ethereum client"
|
||||
name = "parity"
|
||||
version = "1.7.3"
|
||||
version = "1.7.4"
|
||||
license = "GPL-3.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
build = "build.rs"
|
||||
|
||||
@@ -98,18 +98,17 @@ impl Pricer for ModexpPricer {
|
||||
let exp_len = read_len();
|
||||
let mod_len = read_len();
|
||||
|
||||
let max_len = U256::from(u32::max_value() / 2);
|
||||
if base_len > max_len || mod_len > max_len {
|
||||
return U256::max_value();
|
||||
if mod_len.is_zero() && base_len.is_zero() {
|
||||
return U256::zero()
|
||||
}
|
||||
|
||||
let base_len = base_len.low_u64();
|
||||
let exp_len = exp_len.low_u64();
|
||||
let mod_len = mod_len.low_u64();
|
||||
let m = max(mod_len, base_len);
|
||||
if m == 0 {
|
||||
return U256::zero();
|
||||
let max_len = U256::from(u32::max_value() / 2);
|
||||
if base_len > max_len || mod_len > max_len || exp_len > max_len {
|
||||
return U256::max_value();
|
||||
}
|
||||
let (base_len, exp_len, mod_len) = (base_len.low_u64(), exp_len.low_u64(), mod_len.low_u64());
|
||||
|
||||
let m = max(mod_len, base_len);
|
||||
// read fist 32-byte word of the exponent.
|
||||
let exp_low = if base_len + 96 >= input.len() as u64 { U256::zero() } else {
|
||||
let mut buf = [0; 32];
|
||||
@@ -130,8 +129,7 @@ impl ModexpPricer {
|
||||
let bit_index = if exp_low.is_zero() { 0 } else { (255 - exp_low.leading_zeros()) as u64 };
|
||||
if len <= 32 {
|
||||
bit_index
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
8 * (len - 32) + bit_index
|
||||
}
|
||||
}
|
||||
@@ -712,6 +710,24 @@ mod tests {
|
||||
native: ethereum_builtin("modexp"),
|
||||
activate_at: 0,
|
||||
};
|
||||
|
||||
// test for potential exp len overflow
|
||||
{
|
||||
let input = FromHex::from_hex("\
|
||||
00000000000000000000000000000000000000000000000000000000000000ff\
|
||||
2a1e530000000000000000000000000000000000000000000000000000000000\
|
||||
0000000000000000000000000000000000000000000000000000000000000000"
|
||||
).unwrap();
|
||||
|
||||
let mut output = vec![0u8; 32];
|
||||
let expected = FromHex::from_hex("0000000000000000000000000000000000000000000000000000000000000000").unwrap();
|
||||
let expected_cost = U256::max_value();
|
||||
|
||||
f.execute(&input[..], &mut BytesRef::Fixed(&mut output[..])).expect("Builtin should fail");
|
||||
assert_eq!(output, expected);
|
||||
assert_eq!(f.cost(&input[..]), expected_cost.into());
|
||||
}
|
||||
|
||||
// fermat's little theorem example.
|
||||
{
|
||||
let input = FromHex::from_hex("\
|
||||
|
||||
@@ -75,7 +75,13 @@ export function bytesToAscii (bytes) {
|
||||
}
|
||||
|
||||
export function asciiToHex (string) {
|
||||
return '0x' + string.split('').map((s) => s.charCodeAt(0).toString(16)).join('');
|
||||
let result = '0x';
|
||||
|
||||
for (let i = 0; i < string.length; ++i) {
|
||||
result += ('0' + string.charCodeAt(i).toString(16)).substr(-2);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
export function padRight (input, length) {
|
||||
|
||||
@@ -68,6 +68,14 @@ describe('api/util/format', () => {
|
||||
it('correctly converts a non-empty string', () => {
|
||||
expect(asciiToHex('abc')).to.equal('0x616263');
|
||||
});
|
||||
|
||||
it('correctly converts where charCode < 0x10', () => {
|
||||
expect(
|
||||
asciiToHex(
|
||||
[32, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0].map((v) => String.fromCharCode(v)).join('')
|
||||
)
|
||||
).to.equal('0x20100f0e0d0c0b0a09080706050403020100');
|
||||
});
|
||||
});
|
||||
|
||||
describe('hexToAscii', () => {
|
||||
|
||||
@@ -53,11 +53,11 @@ class InputAddressSelect extends Component {
|
||||
|
||||
const filteredContacts = nextAllowedValues
|
||||
? pick(contacts, nextAllowedValues)
|
||||
: accounts;
|
||||
: contacts;
|
||||
|
||||
const filteredContracts = nextAllowedValues
|
||||
? pick(contracts, nextAllowedValues)
|
||||
: accounts;
|
||||
: contracts;
|
||||
|
||||
return (
|
||||
<AddressSelect
|
||||
|
||||
@@ -28,12 +28,12 @@
|
||||
}
|
||||
|
||||
.signData {
|
||||
background: rgba(255,255,255, 0.25);
|
||||
border: 0.25em solid red;
|
||||
margin-left: 2em;
|
||||
padding: 0.5em;
|
||||
font-size: 0.75em;
|
||||
padding: 0.5rem;
|
||||
overflow: auto;
|
||||
max-height: 6em;
|
||||
max-width: calc(100% - 2em);
|
||||
max-height: 10em;
|
||||
}
|
||||
|
||||
.signData > p {
|
||||
|
||||
@@ -18,7 +18,9 @@ import { observer } from 'mobx-react';
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { connect } from 'react-redux';
|
||||
import ReactMarkdown from 'react-markdown';
|
||||
|
||||
import { hexToAscii } from '~/api/util/format';
|
||||
import HardwareStore from '~/mobx/hardwareStore';
|
||||
|
||||
import Account from '../Account';
|
||||
@@ -28,16 +30,39 @@ import RequestOrigin from '../RequestOrigin';
|
||||
import styles from './signRequest.css';
|
||||
|
||||
function isAscii (data) {
|
||||
for (var i = 2; i < data.length; i += 2) {
|
||||
for (let i = 2; i < data.length; i += 2) {
|
||||
let n = parseInt(data.substr(i, 2), 16);
|
||||
|
||||
if (n < 32 || n >= 128) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function decodeMarkdown (data) {
|
||||
return decodeURIComponent(escape(hexToAscii(data)));
|
||||
}
|
||||
|
||||
export function isMarkdown (data) {
|
||||
try {
|
||||
const decoded = decodeMarkdown(data);
|
||||
|
||||
for (let i = 0; i < decoded.length; i++) {
|
||||
const code = decoded.charCodeAt(i);
|
||||
|
||||
if (code < 32 && code !== 10) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return decoded.indexOf('#') !== -1 || decoded.indexOf('*') !== -1;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@observer
|
||||
class SignRequest extends Component {
|
||||
static contextTypes = {
|
||||
@@ -89,29 +114,26 @@ class SignRequest extends Component {
|
||||
);
|
||||
}
|
||||
|
||||
renderAsciiDetails (ascii) {
|
||||
return (
|
||||
<div className={ styles.signData }>
|
||||
<p>{ascii}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
renderData (data) {
|
||||
if (isAscii(data)) {
|
||||
return hexToAscii(data);
|
||||
}
|
||||
|
||||
if (isMarkdown(data)) {
|
||||
return (
|
||||
<ReactMarkdown source={ decodeMarkdown(data) } />
|
||||
);
|
||||
}
|
||||
|
||||
renderBinaryDetails (data) {
|
||||
return (
|
||||
<div className={ styles.signData }>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id='signer.signRequest.unknownBinary'
|
||||
defaultMessage='(Unknown binary data)'
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
<FormattedMessage
|
||||
id='signer.signRequest.unknownBinary'
|
||||
defaultMessage='(Unknown binary data)'
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
renderDetails () {
|
||||
const { api } = this.context;
|
||||
const { address, data, netVersion, origin, signerStore } = this.props;
|
||||
const { balances, externalLink } = signerStore;
|
||||
|
||||
@@ -121,6 +143,8 @@ class SignRequest extends Component {
|
||||
return <div />;
|
||||
}
|
||||
|
||||
const hashToSign = this.context.api.util.sha3(data);
|
||||
|
||||
return (
|
||||
<div className={ styles.signDetails }>
|
||||
<div className={ styles.address }>
|
||||
@@ -133,18 +157,16 @@ class SignRequest extends Component {
|
||||
/>
|
||||
<RequestOrigin origin={ origin } />
|
||||
</div>
|
||||
<div className={ styles.info } title={ api.util.sha3(data) }>
|
||||
<div className={ styles.info } title={ hashToSign }>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id='signer.signRequest.request'
|
||||
defaultMessage='A request to sign data using your account:'
|
||||
/>
|
||||
</p>
|
||||
{
|
||||
isAscii(data)
|
||||
? this.renderAsciiDetails(api.util.hexToAscii(data))
|
||||
: this.renderBinaryDetails(data)
|
||||
}
|
||||
<div className={ styles.signData }>
|
||||
<p>{ this.renderData(data) }</p>
|
||||
</div>
|
||||
<p>
|
||||
<strong>
|
||||
<FormattedMessage
|
||||
|
||||
@@ -18,7 +18,9 @@ import { shallow } from 'enzyme';
|
||||
import React from 'react';
|
||||
import sinon from 'sinon';
|
||||
|
||||
import SignRequest from './';
|
||||
import { asciiToHex } from '~/api/util/format';
|
||||
|
||||
import SignRequest, { isMarkdown } from './signRequest';
|
||||
|
||||
let component;
|
||||
let reduxStore;
|
||||
@@ -81,4 +83,24 @@ describe('views/Signer/components/SignRequest', () => {
|
||||
it('renders', () => {
|
||||
expect(component).to.be.ok;
|
||||
});
|
||||
|
||||
describe('isMarkdown', () => {
|
||||
it('returns true for markdown', () => {
|
||||
const testMd = '# this is some\n\n*markdown*';
|
||||
const encodedMd = asciiToHex(unescape(encodeURIComponent(testMd)));
|
||||
|
||||
expect(isMarkdown(encodedMd)).to.be.true;
|
||||
});
|
||||
|
||||
it('return true with utf-8 markdown', () => {
|
||||
const testMd = '# header\n\n(n) you are not a citizen of, or resident in, or located in, or incorporated or otherwise established in, the People\'s Republic of China 参与方并非中华人民共和国公民,或不常住中华人民共和国,或不位于中华人民共和国境内,或并非在中华人民共和国设立或以其他方式组建; and';
|
||||
const encodedMd = asciiToHex(unescape(encodeURIComponent(testMd)));
|
||||
|
||||
expect(isMarkdown(encodedMd)).to.be.true;
|
||||
});
|
||||
|
||||
it('returns false for randow data', () => {
|
||||
expect(isMarkdown('0x1234')).to.be.false;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -462,7 +462,7 @@
|
||||
<key>OVERWRITE_PERMISSIONS</key>
|
||||
<false/>
|
||||
<key>VERSION</key>
|
||||
<string>1.7.3</string>
|
||||
<string>1.7.4</string>
|
||||
</dict>
|
||||
<key>UUID</key>
|
||||
<string>2DCD5B81-7BAF-4DA1-9251-6274B089FD36</string>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
!define DESCRIPTION "Fast, light, robust Ethereum implementation"
|
||||
!define VERSIONMAJOR 1
|
||||
!define VERSIONMINOR 7
|
||||
!define VERSIONBUILD 3
|
||||
!define VERSIONBUILD 4
|
||||
!define ARGS "--warp"
|
||||
!define FIRST_START_ARGS "ui --warp --mode=passive"
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ use std::cmp::max;
|
||||
use std::str::FromStr;
|
||||
use cli::{Args, ArgsError};
|
||||
use util::{Hashable, H256, U256, Bytes, version_data, Address};
|
||||
use util::journaldb::Algorithm;
|
||||
use util::Colour;
|
||||
use ethsync::{NetworkConfiguration, is_valid_node_url, AllowIP};
|
||||
use ethcore::ethstore::ethkey::{Secret, Public};
|
||||
@@ -37,7 +36,7 @@ use parity_rpc::NetworkSettings;
|
||||
use cache::CacheConfig;
|
||||
use helpers::{to_duration, to_mode, to_block_id, to_u256, to_pending_set, to_price, replace_home, replace_home_and_local,
|
||||
geth_ipc_path, parity_ipc_path, to_bootnodes, to_addresses, to_address, to_gas_limit, to_queue_strategy};
|
||||
use params::{SpecType, ResealPolicy, AccountsConfig, GasPricerConfig, MinerExtras, Pruning, Switch};
|
||||
use params::{SpecType, ResealPolicy, AccountsConfig, GasPricerConfig, MinerExtras};
|
||||
use ethcore_logger::Config as LogConfig;
|
||||
use dir::{self, Directories, default_hypervisor_path, default_local_path, default_data_path};
|
||||
use dapps::Configuration as DappsConfiguration;
|
||||
@@ -123,15 +122,8 @@ impl Configuration {
|
||||
let fat_db = self.args.flag_fat_db.parse()?;
|
||||
let compaction = self.args.flag_db_compaction.parse()?;
|
||||
let wal = !self.args.flag_fast_and_loose;
|
||||
match self.args.flag_warp {
|
||||
// Logging is not initialized yet, so we print directly to stderr
|
||||
Some(true) if fat_db == Switch::On => writeln!(&mut stderr(), "Warning: Warp Sync is disabled because Fat DB is turned on").expect("Error writing to stderr"),
|
||||
Some(true) if tracing == Switch::On => writeln!(&mut stderr(), "Warning: Warp Sync is disabled because tracing is turned on").expect("Error writing to stderr"),
|
||||
Some(true) if pruning == Pruning::Specific(Algorithm::Archive) => writeln!(&mut stderr(), "Warning: Warp Sync is disabled because pruning mode is set to archive").expect("Error writing to stderr"),
|
||||
_ => {},
|
||||
};
|
||||
let public_node = self.args.flag_public_node;
|
||||
let warp_sync = !self.args.flag_no_warp && fat_db != Switch::On && tracing != Switch::On && pruning != Pruning::Specific(Algorithm::Archive);
|
||||
let warp_sync = !self.args.flag_no_warp;
|
||||
let geth_compatibility = self.args.flag_geth;
|
||||
let mut dapps_conf = self.dapps_config();
|
||||
let ipfs_conf = self.ipfs_config();
|
||||
|
||||
@@ -38,6 +38,7 @@ use parity_reactor::EventLoop;
|
||||
use parity_rpc::{NetworkSettings, informant, is_major_importing};
|
||||
use updater::{UpdatePolicy, Updater};
|
||||
use util::{Colour, version, Mutex, Condvar};
|
||||
use util::journaldb::Algorithm;
|
||||
|
||||
use params::{
|
||||
SpecType, Pruning, AccountsConfig, GasPricerConfig, MinerExtras, Switch,
|
||||
@@ -474,7 +475,21 @@ pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> R
|
||||
}
|
||||
|
||||
sync_config.fork_block = spec.fork_block();
|
||||
sync_config.warp_sync = spec.engine.supports_warp() && cmd.warp_sync;
|
||||
let mut warp_sync = cmd.warp_sync;
|
||||
if warp_sync {
|
||||
// Logging is not initialized yet, so we print directly to stderr
|
||||
if fat_db {
|
||||
warn!("Warning: Warp Sync is disabled because Fat DB is turned on.");
|
||||
warp_sync = false;
|
||||
} else if tracing {
|
||||
warn!("Warning: Warp Sync is disabled because tracing is turned on.");
|
||||
warp_sync = false;
|
||||
} else if algorithm != Algorithm::OverlayRecent {
|
||||
warn!("Warning: Warp Sync is disabled because of non-default pruning mode.");
|
||||
warp_sync = false;
|
||||
}
|
||||
}
|
||||
sync_config.warp_sync = spec.engine.supports_warp() && warp_sync;
|
||||
sync_config.download_old_blocks = cmd.download_old_blocks;
|
||||
sync_config.serve_light = cmd.serve_light;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ description = "Ethcore utility library"
|
||||
homepage = "http://parity.io"
|
||||
license = "GPL-3.0"
|
||||
name = "ethcore-util"
|
||||
version = "1.7.3"
|
||||
version = "1.7.4"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
build = "build.rs"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user