merge master into sms-verification-modal

This commit is contained in:
Jannis R 2016-11-09 19:04:31 +01:00
commit 89c1d9c25c
No known key found for this signature in database
GPG Key ID: 0FE83946296A88A5
9 changed files with 47 additions and 30 deletions

2
Cargo.lock generated
View File

@ -1249,7 +1249,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#90bee2d692c71301ad7266d2d9667cba1a93e9f6" source = "git+https://github.com/ethcore/js-precompiled.git#9054ef95a5d79cbd8fefe4869ec3b4de07e9a72d"
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

@ -14,6 +14,7 @@
// 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/>.
use std::thread;
use std::time::Duration; use std::time::Duration;
use std::io::{Read, Write}; use std::io::{Read, Write};
use std::str::{self, Lines}; use std::str::{self, Lines};
@ -42,8 +43,28 @@ pub fn read_block(lines: &mut Lines, all: bool) -> String {
block block
} }
fn connect(address: &SocketAddr) -> TcpStream {
let mut retries = 0;
let mut last_error = None;
while retries < 10 {
retries += 1;
let res = TcpStream::connect(address);
match res {
Ok(stream) => {
return stream;
},
Err(e) => {
last_error = Some(e);
thread::sleep(Duration::from_millis(retries * 10));
}
}
}
panic!("Unable to connect to the server. Last error: {:?}", last_error);
}
pub fn request(address: &SocketAddr, request: &str) -> Response { pub fn request(address: &SocketAddr, request: &str) -> Response {
let mut req = TcpStream::connect(address).unwrap(); let mut req = connect(address);
req.set_read_timeout(Some(Duration::from_secs(1))).unwrap(); req.set_read_timeout(Some(Duration::from_secs(1))).unwrap();
req.write_all(request.as_bytes()).unwrap(); req.write_all(request.as_bytes()).unwrap();

View File

@ -26,8 +26,7 @@ fn do_json_test(json_data: &[u8]) -> Vec<String> {
let old_schedule = evm::Schedule::new_frontier(); let old_schedule = evm::Schedule::new_frontier();
let new_schedule = evm::Schedule::new_homestead(); let new_schedule = evm::Schedule::new_homestead();
for (name, test) in tests.into_iter() { for (name, test) in tests.into_iter() {
let mut fail = false; let mut fail_unless = |cond: bool, title: &str| if !cond { failed.push(name.clone()); println!("Transaction failed: {:?}: {:?}", name, title); };
let mut fail_unless = |cond: bool| if !cond && !fail { failed.push(name.clone()); println!("Transaction failed: {:?}", name); fail = true };
let number: Option<u64> = test.block_number.map(Into::into); let number: Option<u64> = test.block_number.map(Into::into);
let schedule = match number { let schedule = match number {
@ -35,7 +34,7 @@ fn do_json_test(json_data: &[u8]) -> Vec<String> {
Some(x) if x < 1_150_000 => &old_schedule, Some(x) if x < 1_150_000 => &old_schedule,
Some(_) => &new_schedule Some(_) => &new_schedule
}; };
let allow_network_id_of_one = number.map_or(false, |n| n > 2600000); let allow_network_id_of_one = number.map_or(false, |n| n >= 3_500_000);
let rlp: Vec<u8> = test.rlp.into(); let rlp: Vec<u8> = test.rlp.into();
let res = UntrustedRlp::new(&rlp) let res = UntrustedRlp::new(&rlp)
@ -43,26 +42,26 @@ fn do_json_test(json_data: &[u8]) -> Vec<String> {
.map_err(From::from) .map_err(From::from)
.and_then(|t: SignedTransaction| t.validate(schedule, schedule.have_delegate_call, allow_network_id_of_one)); .and_then(|t: SignedTransaction| t.validate(schedule, schedule.have_delegate_call, allow_network_id_of_one));
fail_unless(test.transaction.is_none() == res.is_err()); fail_unless(test.transaction.is_none() == res.is_err(), "Validity different");
if let (Some(tx), Some(sender)) = (test.transaction, test.sender) { if let (Some(tx), Some(sender)) = (test.transaction, test.sender) {
let t = res.unwrap(); let t = res.unwrap();
fail_unless(t.sender().unwrap() == sender.into()); fail_unless(t.sender().unwrap() == sender.into(), "sender mismatch");
let is_acceptable_network_id = match t.network_id() { let is_acceptable_network_id = match t.network_id() {
None => true, None => true,
Some(1) if allow_network_id_of_one => true, Some(1) if allow_network_id_of_one => true,
_ => false, _ => false,
}; };
fail_unless(is_acceptable_network_id); fail_unless(is_acceptable_network_id, "Network ID unacceptable");
let data: Vec<u8> = tx.data.into(); let data: Vec<u8> = tx.data.into();
fail_unless(t.data == data); fail_unless(t.data == data, "data mismatch");
fail_unless(t.gas_price == tx.gas_price.into()); fail_unless(t.gas_price == tx.gas_price.into(), "gas_price mismatch");
fail_unless(t.nonce == tx.nonce.into()); fail_unless(t.nonce == tx.nonce.into(), "nonce mismatch");
fail_unless(t.value == tx.value.into()); fail_unless(t.value == tx.value.into(), "value mismatch");
let to: Option<ethjson::hash::Address> = tx.to.into(); let to: Option<ethjson::hash::Address> = tx.to.into();
let to: Option<Address> = to.map(Into::into); let to: Option<Address> = to.map(Into::into);
match t.action { match t.action {
Action::Call(dest) => fail_unless(Some(dest) == to), Action::Call(dest) => fail_unless(Some(dest) == to, "call/destination mismatch"),
Action::Create => fail_unless(None == to), Action::Create => fail_unless(None == to, "create mismatch"),
} }
} }
} }
@ -80,3 +79,7 @@ declare_test!{TransactionTests_Homestead_ttTransactionTest, "TransactionTests/Ho
declare_test!{heavy => TransactionTests_Homestead_tt10mbDataField, "TransactionTests/Homestead/tt10mbDataField"} declare_test!{heavy => TransactionTests_Homestead_tt10mbDataField, "TransactionTests/Homestead/tt10mbDataField"}
declare_test!{TransactionTests_Homestead_ttWrongRLPTransaction, "TransactionTests/Homestead/ttWrongRLPTransaction"} declare_test!{TransactionTests_Homestead_ttWrongRLPTransaction, "TransactionTests/Homestead/ttWrongRLPTransaction"}
declare_test!{TransactionTests_RandomTests_tr201506052141PYTHON, "TransactionTests/RandomTests/tr201506052141PYTHON"} declare_test!{TransactionTests_RandomTests_tr201506052141PYTHON, "TransactionTests/RandomTests/tr201506052141PYTHON"}
declare_test!{TransactionTests_Homestead_ttTransactionTestEip155VitaliksTests, "TransactionTests/Homestead/ttTransactionTestEip155VitaliksTests"}
declare_test!{TransactionTests_EIP155_ttTransactionTest, "TransactionTests/EIP155/ttTransactionTest"}
declare_test!{TransactionTests_EIP155_ttTransactionTestEip155VitaliksTests, "TransactionTests/EIP155/ttTransactionTestEip155VitaliksTests"}
declare_test!{TransactionTests_EIP155_ttTransactionTestVRule, "TransactionTests/EIP155/ttTransactionTestVRule"}

View File

@ -1,6 +1,6 @@
{ {
"name": "parity.js", "name": "parity.js",
"version": "0.2.23", "version": "0.2.24",
"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>",

View File

@ -58,7 +58,7 @@ export default class AccountDetails extends Component {
readOnly readOnly
allowCopy allowCopy
hint='the account recovery phrase' hint='the account recovery phrase'
label='account recovery phrase (keep safe)' label='owner recovery phrase (keep private and secure, it allows full and unlimited access to the account)'
value={ phrase } /> value={ phrase } />
); );
} }

View File

@ -85,11 +85,6 @@ export default class Status {
setTimeout(this._pollStatus, timeout); setTimeout(this._pollStatus, timeout);
}; };
const wasConnected = this._store.getState().nodeStatus.isConnected;
if (isConnected !== wasConnected) {
this._fetchEnode();
}
this._store.dispatch(statusCollection({ isConnected, isConnecting, needsToken, secureToken })); this._store.dispatch(statusCollection({ isConnected, isConnecting, needsToken, secureToken }));
if (!isConnected) { if (!isConnected) {
@ -111,8 +106,7 @@ export default class Status {
this._api.parity.netPort(), this._api.parity.netPort(),
this._api.parity.nodeName(), this._api.parity.nodeName(),
this._api.parity.rpcSettings(), this._api.parity.rpcSettings(),
this._api.eth.syncing(), this._api.eth.syncing()
this._pollTraceMode()
]) ])
.then(([clientVersion, coinbase, defaultExtraData, extraData, gasFloorTarget, hashrate, minGasPrice, netChain, netPeers, netPort, nodeName, rpcSettings, syncing, traceMode]) => { .then(([clientVersion, coinbase, defaultExtraData, extraData, gasFloorTarget, hashrate, minGasPrice, netChain, netPeers, netPort, nodeName, rpcSettings, syncing, traceMode]) => {
const isTest = netChain === 'morden' || netChain === 'testnet'; const isTest = netChain === 'morden' || netChain === 'testnet';
@ -134,12 +128,12 @@ export default class Status {
isTest, isTest,
traceMode traceMode
})); }));
nextTimeout();
}) })
.catch((error) => { .catch((error) => {
console.error('_pollStatus', error); console.error('_pollStatus', error);
nextTimeout();
}); });
nextTimeout();
} }
_pollLogs = () => { _pollLogs = () => {

View File

@ -23,7 +23,7 @@ export default class SecureApi extends Api {
super(new Api.Transport.Ws(url, sysuiToken)); super(new Api.Transport.Ws(url, sysuiToken));
this._isConnecting = true; this._isConnecting = true;
this._connectState = 0; this._connectState = sysuiToken === 'initial' ? 1 : 0;
this._needsToken = false; this._needsToken = false;
this._dappsPort = 8080; this._dappsPort = 8080;
this._signerPort = 8180; this._signerPort = 8180;
@ -110,7 +110,7 @@ export default class SecureApi extends Api {
console.log('SecureApi:connectSuccess', this._transport.token); console.log('SecureApi:connectSuccess', this._transport.token);
} }
updateToken (token, connectState) { updateToken (token, connectState = 0) {
this._connectState = connectState; this._connectState = connectState;
this._transport.updateToken(token.replace(/[^a-zA-Z0-9]/g, '')); this._transport.updateToken(token.replace(/[^a-zA-Z0-9]/g, ''));
this._followConnection(); this._followConnection();

View File

@ -128,7 +128,7 @@ class Connection extends Component {
const { api } = this.context; const { api } = this.context;
const { token } = this.state; const { token } = this.state;
api.updateToken(token); api.updateToken(token, 0);
this.setState({ token: '', validToken: false }); this.setState({ token: '', validToken: false });
} }
} }

View File

@ -16,7 +16,7 @@
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};
use std::thread; use std::thread;
use std::time::{self, Duration}; use std::time;
use std::sync::Arc; use std::sync::Arc;
use devtools::{http_client, RandomTempPath}; use devtools::{http_client, RandomTempPath};
use rpc::ConfirmationsQueue; use rpc::ConfirmationsQueue;
@ -50,7 +50,6 @@ pub fn serve() -> (Server, usize, GuardedAuthCodes) {
let builder = ServerBuilder::new(queue, path.to_path_buf()); let builder = ServerBuilder::new(queue, path.to_path_buf());
let port = 35000 + rand::random::<usize>() % 10000; let port = 35000 + rand::random::<usize>() % 10000;
let res = builder.start(format!("127.0.0.1:{}", port).parse().unwrap()).unwrap(); let res = builder.start(format!("127.0.0.1:{}", port).parse().unwrap()).unwrap();
thread::sleep(Duration::from_millis(25));
(res, port, GuardedAuthCodes { (res, port, GuardedAuthCodes {
authcodes: AuthCodes::from_file(&path).unwrap(), authcodes: AuthCodes::from_file(&path).unwrap(),