Backporting to beta (#4152)
* Fix broken transfer total balance (#4127) * Add proper label to method decoding inputs (#4136) * Another minor estimation fix (#4133) * Return 0 instead of error with out of gas on estimate_gas * Fix stuff up. * Another estimate gas fix. * Alter balance to maximum possible rather than GP=0. * Only increase to amount strictly necessary. * Get rid of unsafe code in ethkey, propagate incorrect Secret errors. (#4119) * Implementing secret * Fixing tests * Refactor VoteCollector (#4101) * dir * simple validator list * stub validator contract * make the engine hold Weak<Client> instead of IoChannel * validator set factory * register weak client with ValidatorContract * check chain security * add address array to generator * register provider contract * update validator set on notify * add validator contract spec * simple list test * split update and contract test * contract change * use client in tendermint * fix deadlock * step duration in params * adapt tendermint tests * add storage fields to test spec * constructor spec * execute under wrong address * create under correct address * revert * validator contract constructor * move genesis block lookup * add removal ability to contract * validator contract adding validators * fix basic authority * validator changing test * more docs * update sync tests * remove env_logger * another env_logger * cameltoe * hold EngineClient instead of Client * return error on misbehaviour * nicer return * sprinkle docs * Reenable mainnet update server. (#4137) * basic tests for subscribeToEvents (#4115) * subscribeToEvent fixtures ✅ * subscribeToEvent tests ✅ * temporarily skip failing test (#4138) * Improvements and optimisations to estimate_gas (#4142) * Return 0 instead of error with out of gas on estimate_gas * Fix stuff up. * Another estimate gas fix. * Alter balance to maximum possible rather than GP=0. * Only increase to amount strictly necessary. * Improvements and optimisations to estimate_gas. - Introduce proper error type - Avoid building costly traces * Fix tests. * Actually fix testsActually fix tests * Use estimateGas error (as per updated implementation) (#4131) * Use estimateGas error (as per updated implementation) * EXCEPTION_ERROR as per #4142 * Better error log reporting & handling (#4128) * Don't pop-up notifications after network switch (#4076) * Better notifications * Don't pollute with notifs if switched networks * Better connection close/open events / No more notifs on change network * PR Grumbles * Add close and open events to HTTP // Add tests * Fix tests * WIP Signer Fix * Fix Signer // Better reconnection handling * PR Grumbles * PR Grumbles * Fixes wrong fetching of balances + Notifications * Secure API WIP * Updated Secure API Connection + Status * Linting * Linting * Updated Secure API Logic * Proper handling of token updates // Fixing poping notifications * PR Grumbles * PR Grumbles * Fixing tests * Trim spaces from InputAddress (#4126) * Trim spaces for addresses * onSubmit has only value, not event * onSubmit (again) * Length check on trimmed value * Remove bindActionCreators({}, dispatch) (empty) (#4135)
This commit is contained in:
@@ -36,6 +36,7 @@ mod codes {
|
||||
pub const UNKNOWN_ERROR: i64 = -32009;
|
||||
pub const TRANSACTION_ERROR: i64 = -32010;
|
||||
pub const EXECUTION_ERROR: i64 = -32015;
|
||||
pub const EXCEPTION_ERROR: i64 = -32016;
|
||||
pub const ACCOUNT_LOCKED: i64 = -32020;
|
||||
pub const PASSWORD_INVALID: i64 = -32021;
|
||||
pub const ACCOUNT_ERROR: i64 = -32023;
|
||||
@@ -130,6 +131,14 @@ pub fn state_pruned() -> Error {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn exceptional() -> Error {
|
||||
Error {
|
||||
code: ErrorCode::ServerError(codes::EXCEPTION_ERROR),
|
||||
message: "The execution failed due to an exception.".into(),
|
||||
data: None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn no_work() -> Error {
|
||||
Error {
|
||||
code: ErrorCode::ServerError(codes::NO_WORK),
|
||||
@@ -286,6 +295,7 @@ pub fn from_rlp_error(error: DecoderError) -> Error {
|
||||
pub fn from_call_error(error: CallError) -> Error {
|
||||
match error {
|
||||
CallError::StatePruned => state_pruned(),
|
||||
CallError::Exceptional => exceptional(),
|
||||
CallError::Execution(e) => execution(e),
|
||||
CallError::TransactionNotFound => internal("{}, this should not be the case with eth_call, most likely a bug.", CallError::TransactionNotFound),
|
||||
}
|
||||
|
||||
@@ -660,7 +660,6 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM> Eth for EthClient<C, SN, S, M, EM> where
|
||||
num => take_weak!(self.client).call(&signed, num.into(), Default::default()),
|
||||
};
|
||||
|
||||
|
||||
result
|
||||
.map(|b| b.output.into())
|
||||
.map_err(errors::from_call_error)
|
||||
|
||||
@@ -19,7 +19,7 @@ use std::sync::{Arc, Weak};
|
||||
use std::collections::BTreeMap;
|
||||
use util::{Address};
|
||||
|
||||
use ethkey::{Brain, Generator};
|
||||
use ethkey::{Brain, Generator, Secret};
|
||||
use ethcore::account_provider::AccountProvider;
|
||||
use ethcore::client::MiningBlockChainClient;
|
||||
|
||||
@@ -73,7 +73,8 @@ impl<C: 'static> ParityAccounts for ParityAccountsClient<C> where C: MiningBlock
|
||||
self.active()?;
|
||||
let store = take_weak!(self.accounts);
|
||||
|
||||
store.insert_account(*Brain::new(phrase).generate().unwrap().secret(), &pass)
|
||||
let brain = Brain::new(phrase).generate().unwrap();
|
||||
store.insert_account(brain.secret().clone(), &pass)
|
||||
.map(Into::into)
|
||||
.map_err(|e| errors::account("Could not create account.", e))
|
||||
}
|
||||
@@ -92,7 +93,9 @@ impl<C: 'static> ParityAccounts for ParityAccountsClient<C> where C: MiningBlock
|
||||
self.active()?;
|
||||
let store = take_weak!(self.accounts);
|
||||
|
||||
store.insert_account(secret.into(), &pass)
|
||||
let secret = Secret::from_slice(&secret.0)
|
||||
.map_err(|e| errors::account("Could not create account.", e))?;
|
||||
store.insert_account(secret, &pass)
|
||||
.map(Into::into)
|
||||
.map_err(|e| errors::account("Could not create account.", e))
|
||||
}
|
||||
|
||||
@@ -307,7 +307,7 @@ const POSITIVE_NONCE_SPEC: &'static [u8] = br#"{
|
||||
|
||||
#[test]
|
||||
fn eth_transaction_count() {
|
||||
let secret = "8a283037bb19c4fed7b1c569e40c7dcff366165eb869110a1b11532963eb9cb2".into();
|
||||
let secret = "8a283037bb19c4fed7b1c569e40c7dcff366165eb869110a1b11532963eb9cb2".parse().unwrap();
|
||||
let tester = EthTester::from_spec(Spec::load(TRANSACTION_COUNT_SPEC).expect("invalid chain spec"));
|
||||
let address = tester.accounts.insert_account(secret, "").unwrap();
|
||||
tester.accounts.unlock_account_permanently(address, "".into()).unwrap();
|
||||
|
||||
@@ -561,6 +561,7 @@ fn rpc_eth_code() {
|
||||
fn rpc_eth_call_latest() {
|
||||
let tester = EthTester::default();
|
||||
tester.client.set_execution_result(Ok(Executed {
|
||||
exception: None,
|
||||
gas: U256::zero(),
|
||||
gas_used: U256::from(0xff30),
|
||||
refunded: U256::from(0x5),
|
||||
@@ -596,6 +597,7 @@ fn rpc_eth_call_latest() {
|
||||
fn rpc_eth_call() {
|
||||
let tester = EthTester::default();
|
||||
tester.client.set_execution_result(Ok(Executed {
|
||||
exception: None,
|
||||
gas: U256::zero(),
|
||||
gas_used: U256::from(0xff30),
|
||||
refunded: U256::from(0x5),
|
||||
@@ -631,6 +633,7 @@ fn rpc_eth_call() {
|
||||
fn rpc_eth_call_default_block() {
|
||||
let tester = EthTester::default();
|
||||
tester.client.set_execution_result(Ok(Executed {
|
||||
exception: None,
|
||||
gas: U256::zero(),
|
||||
gas_used: U256::from(0xff30),
|
||||
refunded: U256::from(0x5),
|
||||
@@ -665,6 +668,7 @@ fn rpc_eth_call_default_block() {
|
||||
fn rpc_eth_estimate_gas() {
|
||||
let tester = EthTester::default();
|
||||
tester.client.set_execution_result(Ok(Executed {
|
||||
exception: None,
|
||||
gas: U256::zero(),
|
||||
gas_used: U256::from(0xff30),
|
||||
refunded: U256::from(0x5),
|
||||
@@ -700,6 +704,7 @@ fn rpc_eth_estimate_gas() {
|
||||
fn rpc_eth_estimate_gas_default_block() {
|
||||
let tester = EthTester::default();
|
||||
tester.client.set_execution_result(Ok(Executed {
|
||||
exception: None,
|
||||
gas: U256::zero(),
|
||||
gas_used: U256::from(0xff30),
|
||||
refunded: U256::from(0x5),
|
||||
|
||||
@@ -51,6 +51,7 @@ fn io() -> Tester {
|
||||
block_hash: 10.into(),
|
||||
}]);
|
||||
*client.execution_result.write() = Some(Ok(Executed {
|
||||
exception: None,
|
||||
gas: 20_000.into(),
|
||||
gas_used: 10_000.into(),
|
||||
refunded: 0.into(),
|
||||
|
||||
@@ -25,7 +25,7 @@ use util::{H64 as Eth64, H160 as Eth160, H256 as Eth256, H520 as Eth520, H512 as
|
||||
macro_rules! impl_hash {
|
||||
($name: ident, $other: ident, $size: expr) => {
|
||||
/// Hash serialization
|
||||
pub struct $name([u8; $size]);
|
||||
pub struct $name(pub [u8; $size]);
|
||||
|
||||
impl Eq for $name { }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user