Beta backports (#4569)

* Fixing evmbin compilation and added standard build. (#4561)

* Alias for personal_sendTransaction (#4554)

* Fix console dapp (#4544)

* Fixing linting issues. Better support for console as secure app

* Fixing linting issues

* Fix no data sent in TxQueue dapp (#4502)

* Fix wrong PropType req for Embedded Signer

* Fix wrong data for tx #4499
This commit is contained in:
Tomasz Drwięga 2017-02-16 17:46:25 +01:00 committed by Gav Wood
parent 19520442c1
commit 07324795f1
14 changed files with 613 additions and 470 deletions

View File

@ -379,6 +379,7 @@ darwin:
export PLATFORM=x86_64-apple-darwin export PLATFORM=x86_64-apple-darwin
cargo build -j 8 --features final --release #$CARGOFLAGS cargo build -j 8 --features final --release #$CARGOFLAGS
cargo build -j 8 --features final --release -p ethstore #$CARGOFLAGS cargo build -j 8 --features final --release -p ethstore #$CARGOFLAGS
cargo build -j 8 --features final --release -p evmbin #$CARGOFLAGS
rm -rf parity.md5 rm -rf parity.md5
md5sum target/release/parity > parity.md5 md5sum target/release/parity > parity.md5
export SHA3=$(target/release/parity tools hash target/release/parity) export SHA3=$(target/release/parity tools hash target/release/parity)
@ -500,7 +501,7 @@ test-windows:
- git submodule update --init --recursive - git submodule update --init --recursive
script: script:
- set RUST_BACKTRACE=1 - set RUST_BACKTRACE=1
- echo cargo test --features json-tests -p rlp -p ethash -p ethcore -p ethcore-bigint -p ethcore-dapps -p ethcore-rpc -p ethcore-signer -p ethcore-util -p ethcore-network -p ethcore-io -p ethkey -p ethstore -p ethsync -p ethcore-ipc -p ethcore-ipc-tests -p ethcore-ipc-nano -p parity %CARGOFLAGS% --verbose --release - echo cargo test --features json-tests -p rlp -p ethash -p ethcore -p ethcore-bigint -p ethcore-dapps -p ethcore-rpc -p ethcore-signer -p ethcore-util -p ethcore-network -p ethcore-io -p ethkey -p ethstore -p evmbin -p ethsync -p ethcore-ipc -p ethcore-ipc-tests -p ethcore-ipc-nano -p parity %CARGOFLAGS% --verbose --release
tags: tags:
- rust-windows - rust-windows
allow_failure: true allow_failure: true

11
Cargo.lock generated
View File

@ -25,6 +25,7 @@ dependencies = [
"ethcore-stratum 1.5.0", "ethcore-stratum 1.5.0",
"ethcore-util 1.5.2", "ethcore-util 1.5.2",
"ethsync 1.5.0", "ethsync 1.5.0",
"evmbin 1.5.0",
"fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.9.14 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.9.14 (registry+https://github.com/rust-lang/crates.io-index)",
"isatty 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "isatty 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -766,6 +767,16 @@ dependencies = [
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "evmbin"
version = "1.5.0"
dependencies = [
"docopt 0.6.80 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore 1.5.0",
"ethcore-util 1.5.2",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "evmjit" name = "evmjit"
version = "1.5.0" version = "1.5.0"

View File

@ -47,6 +47,7 @@ ethcore-ipc-hypervisor = { path = "ipc/hypervisor" }
ethcore-logger = { path = "logger" } ethcore-logger = { path = "logger" }
ethcore-stratum = { path = "stratum" } ethcore-stratum = { path = "stratum" }
ethcore-dapps = { path = "dapps", optional = true } ethcore-dapps = { path = "dapps", optional = true }
evmbin = { path = "evmbin" }
rpc-cli = { path = "rpc_cli" } rpc-cli = { path = "rpc_cli" }
parity-rpc-client = { path = "rpc_client" } parity-rpc-client = { path = "rpc_client" }
ethcore-light = { path = "ethcore/light" } ethcore-light = { path = "ethcore/light" }

View File

@ -312,7 +312,7 @@ impl Server {
let special = Arc::new({ let special = Arc::new({
let mut special = HashMap::new(); let mut special = HashMap::new();
special.insert(router::SpecialEndpoint::Rpc, rpc::rpc(handler, panic_handler.clone())); special.insert(router::SpecialEndpoint::Rpc, rpc::rpc(handler, cors_domains.clone(), panic_handler.clone()));
special.insert(router::SpecialEndpoint::Utils, apps::utils()); special.insert(router::SpecialEndpoint::Utils, apps::utils());
special.insert( special.insert(
router::SpecialEndpoint::Api, router::SpecialEndpoint::Api,

View File

@ -21,11 +21,15 @@ use jsonrpc_core::{IoHandler, ResponseHandler, Request, Response};
use jsonrpc_http_server::{ServerHandler, PanicHandler, AccessControlAllowOrigin, RpcHandler}; use jsonrpc_http_server::{ServerHandler, PanicHandler, AccessControlAllowOrigin, RpcHandler};
use endpoint::{Endpoint, EndpointPath, Handler}; use endpoint::{Endpoint, EndpointPath, Handler};
pub fn rpc(handler: Arc<IoHandler>, panic_handler: Arc<Mutex<Option<Box<Fn() -> () + Send>>>>) -> Box<Endpoint> { pub fn rpc(
handler: Arc<IoHandler>,
cors_domains: Vec<String>,
panic_handler: Arc<Mutex<Option<Box<Fn() -> () + Send>>>>,
) -> Box<Endpoint> {
Box::new(RpcEndpoint { Box::new(RpcEndpoint {
handler: Arc::new(RpcMiddleware::new(handler)), handler: Arc::new(RpcMiddleware::new(handler)),
panic_handler: panic_handler, panic_handler: panic_handler,
cors_domain: None, cors_domain: Some(cors_domains.into_iter().map(AccessControlAllowOrigin::Value).collect()),
// NOTE [ToDr] We don't need to do any hosts validation here. It's already done in router. // NOTE [ToDr] We don't need to do any hosts validation here. It's already done in router.
allowed_hosts: None, allowed_hosts: None,
}) })

View File

@ -1,7 +1,7 @@
[package] [package]
name = "evm" name = "evmbin"
description = "Parity's EVM implementation" description = "Parity's EVM implementation"
version = "0.1.0" version = "1.5.0"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
[lib] [lib]

View File

@ -31,7 +31,7 @@ pub struct FakeExt {
impl Default for FakeExt { impl Default for FakeExt {
fn default() -> Self { fn default() -> Self {
FakeExt { FakeExt {
schedule: Schedule::new_homestead_gas_fix(), schedule: Schedule::new_post_eip150(usize::max_value(), true, true, true),
store: HashMap::new(), store: HashMap::new(),
depth: 1, depth: 1,
} }
@ -51,8 +51,8 @@ impl Ext for FakeExt {
unimplemented!(); unimplemented!();
} }
fn exists_and_not_null(&self, address: &Address) -> bool { fn exists_and_not_null(&self, _address: &Address) -> bool {
unimplemented!(); unimplemented!();
} }
fn origin_balance(&self) -> U256 { fn origin_balance(&self) -> U256 {

View File

@ -21,7 +21,6 @@
extern crate ethcore; extern crate ethcore;
extern crate rustc_serialize; extern crate rustc_serialize;
extern crate docopt; extern crate docopt;
#[macro_use]
extern crate ethcore_util as util; extern crate ethcore_util as util;
mod ext; mod ext;

View File

@ -260,7 +260,7 @@ export class LocalTransaction extends BaseTransaction {
to: transaction.to, to: transaction.to,
nonce: transaction.nonce, nonce: transaction.nonce,
value: transaction.value, value: transaction.value,
data: transaction.data, data: transaction.input,
gasPrice, gas gasPrice, gas
}; };

File diff suppressed because one or more lines are too long

View File

@ -14,54 +14,35 @@
// 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 parity from '~/jsonrpc/interfaces/parity';
import signer from '~/jsonrpc/interfaces/signer';
import trace from '~/jsonrpc/interfaces/trace';
export default function web3extensions (web3) { export default function web3extensions (web3) {
const { Method, formatters } = web3._extend; const { Method } = web3._extend;
// TODO [ToDr] Consider output/input formatters.
const methods = (object, name) => {
return Object.keys(object).map(method => {
return new Method({
name: method,
call: `${name}_{method}`,
params: object[method].params.length
});
});
};
return [{ return [{
property: 'personal', property: 'parity',
methods: [ methods: methods(parity, 'parity'),
new Method({
name: 'sendTransaction',
call: 'personal_sendTransaction',
params: 2,
inputFormatter: [formatters.inputTransactionFormatter, null]
}),
new Method({
name: 'signerEnabled',
call: 'personal_signerEnabled',
params: 0,
inputFormatter: []
})
],
properties: [] properties: []
}, { }, {
property: 'ethcore', property: 'signer',
methods: [ methods: methods(signer, 'signer'),
new Method({ properties: []
name: 'getNetPeers', }, {
call: 'ethcore_netPeers', property: 'trace',
params: 0, methods: methods(trace, 'trace'),
outputFormatter: x => x
}),
new Method({
name: 'getNetChain',
call: 'ethcore_netChain',
params: 0,
outputFormatter: x => x
}),
new Method({
name: 'gasPriceStatistics',
call: 'ethcore_gasPriceStatistics',
params: 0,
outputFormatter: a => a.map(web3.toBigNumber)
}),
new Method({
name: 'unsignedTransactionsCount',
call: 'ethcore_unsignedTransactionsCount',
params: 0,
inputFormatter: []
})
],
properties: [] properties: []
}]; }];
} }

View File

@ -117,4 +117,9 @@ impl<C: 'static, M: 'static> Personal for PersonalClient<C, M> where C: MiningBl
dispatch::SignWith::Password(password) dispatch::SignWith::Password(password)
).map(|v| v.into_value().into()) ).map(|v| v.into_value().into())
} }
fn sign_and_send_transaction(&self, request: TransactionRequest, password: String) -> Result<RpcH256, Error> {
warn!("Using deprecated personal_signAndSendTransaction, use personal_sendTransaction instead.");
self.send_transaction(request, password)
}
} }

View File

@ -112,16 +112,25 @@ fn sign_and_send_transaction_with_invalid_password() {
assert_eq!(tester.io.handle_request_sync(request.as_ref()), Some(response.into())); assert_eq!(tester.io.handle_request_sync(request.as_ref()), Some(response.into()));
} }
#[test]
fn send_transaction() {
sign_and_send_test("personal_sendTransaction");
}
#[test] #[test]
fn sign_and_send_transaction() { fn sign_and_send_transaction() {
sign_and_send_test("personal_signAndSendTransaction");
}
fn sign_and_send_test(method: &str) {
let tester = setup(); let tester = setup();
let address = tester.accounts.new_account("password123").unwrap(); let address = tester.accounts.new_account("password123").unwrap();
let request = r#"{ let request = r#"{
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method": "personal_sendTransaction", "method": ""#.to_owned() + method + r#"",
"params": [{ "params": [{
"from": ""#.to_owned() + format!("0x{:?}", address).as_ref() + r#"", "from": ""# + format!("0x{:?}", address).as_ref() + r#"",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567", "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x76c0", "gas": "0x76c0",
"gasPrice": "0x9184e72a000", "gasPrice": "0x9184e72a000",

View File

@ -38,5 +38,9 @@ build_rpc_trait! {
/// Sends transaction and signs it in single call. The account is not unlocked in such case. /// Sends transaction and signs it in single call. The account is not unlocked in such case.
#[rpc(name = "personal_sendTransaction")] #[rpc(name = "personal_sendTransaction")]
fn send_transaction(&self, TransactionRequest, String) -> Result<H256, Error>; fn send_transaction(&self, TransactionRequest, String) -> Result<H256, Error>;
/// Deprecated alias for `personal_sendTransaction`.
#[rpc(name = "personal_signAndSendTransaction")]
fn sign_and_send_transaction(&self, TransactionRequest, String) -> Result<H256, Error>;
} }
} }