Bump ethabi & ethereum-types. (#8258)

* Bump ethabi & ethereum-types.

* Fix test.

* Fix hex encodings.
This commit is contained in:
Tomasz Drwięga
2018-04-02 13:12:52 +02:00
committed by André Silva
parent c1cced3662
commit 9108a3bb50
66 changed files with 220 additions and 206 deletions

View File

@@ -120,7 +120,7 @@ mod testing {
Host: 127.0.0.1:{}\r\n\
Connection: Close\r\n\
Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==\r\n\
Sec-WebSocket-Protocol: {:?}_{}\r\n\
Sec-WebSocket-Protocol: {:x}_{}\r\n\
Sec-WebSocket-Version: 13\r\n\
\r\n\
{{}}
@@ -150,7 +150,7 @@ mod testing {
Host: 127.0.0.1:{}\r\n\
Connection: Close\r\n\
Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==\r\n\
Sec-WebSocket-Protocol:{:?}_{}\r\n\
Sec-WebSocket-Protocol:{:x}_{}\r\n\
Sec-WebSocket-Version: 13\r\n\
\r\n\
{{}}

View File

@@ -337,7 +337,7 @@ fn eth_transaction_count() {
let req_before = r#"{
"jsonrpc": "2.0",
"method": "eth_getTransactionCount",
"params": [""#.to_owned() + format!("0x{:?}", address).as_ref() + r#"", "latest"],
"params": [""#.to_owned() + format!("0x{:x}", address).as_ref() + r#"", "latest"],
"id": 15
}"#;
@@ -349,7 +349,7 @@ fn eth_transaction_count() {
"jsonrpc": "2.0",
"method": "eth_sendTransaction",
"params": [{
"from": ""#.to_owned() + format!("0x{:?}", address).as_ref() + r#"",
"from": ""#.to_owned() + format!("0x{:x}", address).as_ref() + r#"",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x30000",
"gasPrice": "0x1",
@@ -365,7 +365,7 @@ fn eth_transaction_count() {
let req_after_latest = r#"{
"jsonrpc": "2.0",
"method": "eth_getTransactionCount",
"params": [""#.to_owned() + format!("0x{:?}", address).as_ref() + r#"", "latest"],
"params": [""#.to_owned() + format!("0x{:x}", address).as_ref() + r#"", "latest"],
"id": 17
}"#;
@@ -377,7 +377,7 @@ fn eth_transaction_count() {
let req_after_pending = r#"{
"jsonrpc": "2.0",
"method": "eth_getTransactionCount",
"params": [""#.to_owned() + format!("0x{:?}", address).as_ref() + r#"", "pending"],
"params": [""#.to_owned() + format!("0x{:x}", address).as_ref() + r#"", "pending"],
"id": 18
}"#;
@@ -403,7 +403,7 @@ fn verify_transaction_counts(name: String, chain: BlockChain) {
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByHash",
"params": [
""#.to_owned() + format!("0x{:?}", hash).as_ref() + r#""
""#.to_owned() + format!("0x{:x}", hash).as_ref() + r#""
],
"id": "# + format!("{}", *id).as_ref() + r#"
}"#;
@@ -463,7 +463,7 @@ fn starting_nonce_test() {
{
"jsonrpc": "2.0",
"method": "eth_getTransactionCount",
"params": [""#.to_owned() + format!("0x{:?}", address).as_ref() + r#"", "latest"],
"params": [""#.to_owned() + format!("0x{:x}", address).as_ref() + r#"", "latest"],
"id": 15
}
"#)

View File

@@ -337,7 +337,7 @@ fn rpc_eth_sign() {
"jsonrpc": "2.0",
"method": "eth_sign",
"params": [
""#.to_owned() + &format!("0x{:?}", account) + r#"",
""#.to_owned() + &format!("0x{:x}", account) + r#"",
"0x0cc175b9c0f1b6a831c399e26977266192eb5ffee6ae2fec3ad71c777531578f"
],
"id": 1
@@ -349,7 +349,7 @@ fn rpc_eth_sign() {
#[test]
fn rpc_eth_author() {
let make_res = |addr| r#"{"jsonrpc":"2.0","result":""#.to_owned() + &format!("0x{:?}", addr) + r#"","id":1}"#;
let make_res = |addr| r#"{"jsonrpc":"2.0","result":""#.to_owned() + &format!("0x{:x}", addr) + r#"","id":1}"#;
let tester = EthTester::default();
let req = r#"{
@@ -402,7 +402,7 @@ fn rpc_eth_accounts() {
// with current policy it should return the account
let request = r#"{"jsonrpc": "2.0", "method": "eth_accounts", "params": [], "id": 1}"#;
let response = r#"{"jsonrpc":"2.0","result":[""#.to_owned() + &format!("0x{:?}", address) + r#""],"id":1}"#;
let response = r#"{"jsonrpc":"2.0","result":[""#.to_owned() + &format!("0x{:x}", address) + r#""],"id":1}"#;
assert_eq!(tester.io.handle_request_sync(request), Some(response.to_owned()));
tester.accounts_provider.set_new_dapps_addresses(Some(vec![1.into()])).unwrap();
@@ -811,7 +811,7 @@ fn rpc_eth_send_transaction() {
"jsonrpc": "2.0",
"method": "eth_sendTransaction",
"params": [{
"from": ""#.to_owned() + format!("0x{:?}", address).as_ref() + r#"",
"from": ""#.to_owned() + format!("0x{:x}", address).as_ref() + r#"",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
@@ -831,7 +831,7 @@ fn rpc_eth_send_transaction() {
let signature = tester.accounts_provider.sign(address, None, t.hash(None)).unwrap();
let t = t.with_signature(signature, None);
let response = r#"{"jsonrpc":"2.0","result":""#.to_owned() + format!("0x{:?}", t.hash()).as_ref() + r#"","id":1}"#;
let response = r#"{"jsonrpc":"2.0","result":""#.to_owned() + format!("0x{:x}", t.hash()).as_ref() + r#"","id":1}"#;
assert_eq!(tester.io.handle_request_sync(&request), Some(response));
@@ -848,7 +848,7 @@ fn rpc_eth_send_transaction() {
let signature = tester.accounts_provider.sign(address, None, t.hash(None)).unwrap();
let t = t.with_signature(signature, None);
let response = r#"{"jsonrpc":"2.0","result":""#.to_owned() + format!("0x{:?}", t.hash()).as_ref() + r#"","id":1}"#;
let response = r#"{"jsonrpc":"2.0","result":""#.to_owned() + format!("0x{:x}", t.hash()).as_ref() + r#"","id":1}"#;
assert_eq!(tester.io.handle_request_sync(&request), Some(response));
}
@@ -862,7 +862,7 @@ fn rpc_eth_sign_transaction() {
"jsonrpc": "2.0",
"method": "eth_signTransaction",
"params": [{
"from": ""#.to_owned() + format!("0x{:?}", address).as_ref() + r#"",
"from": ""#.to_owned() + format!("0x{:x}", address).as_ref() + r#"",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
@@ -890,12 +890,12 @@ fn rpc_eth_sign_transaction() {
r#""blockHash":null,"blockNumber":null,"# +
&format!("\"chainId\":{},", t.chain_id().map_or("null".to_owned(), |n| format!("{}", n))) +
r#""condition":null,"creates":null,"# +
&format!("\"from\":\"0x{:?}\",", &address) +
&format!("\"from\":\"0x{:x}\",", &address) +
r#""gas":"0x76c0","gasPrice":"0x9184e72a000","# +
&format!("\"hash\":\"0x{:?}\",", t.hash()) +
&format!("\"hash\":\"0x{:x}\",", t.hash()) +
r#""input":"0x","# +
r#""nonce":"0x1","# +
&format!("\"publicKey\":\"0x{:?}\",", t.recover_public().unwrap()) +
&format!("\"publicKey\":\"0x{:x}\",", t.recover_public().unwrap()) +
&format!("\"r\":\"0x{:x}\",", U256::from(signature.r())) +
&format!("\"raw\":\"0x{}\",", rlp.to_hex()) +
&format!("\"s\":\"0x{:x}\",", U256::from(signature.s())) +
@@ -918,7 +918,7 @@ fn rpc_eth_send_transaction_with_bad_to() {
"jsonrpc": "2.0",
"method": "eth_sendTransaction",
"params": [{
"from": ""#.to_owned() + format!("0x{:?}", address).as_ref() + r#"",
"from": ""#.to_owned() + format!("0x{:x}", address).as_ref() + r#"",
"to": "",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
@@ -941,7 +941,7 @@ fn rpc_eth_send_transaction_error() {
"jsonrpc": "2.0",
"method": "eth_sendTransaction",
"params": [{
"from": ""#.to_owned() + format!("0x{:?}", address).as_ref() + r#"",
"from": ""#.to_owned() + format!("0x{:x}", address).as_ref() + r#"",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
@@ -999,7 +999,7 @@ fn rpc_eth_send_raw_transaction() {
"id": 1
}"#;
let res = r#"{"jsonrpc":"2.0","result":""#.to_owned() + &format!("0x{:?}", t.hash()) + r#"","id":1}"#;
let res = r#"{"jsonrpc":"2.0","result":""#.to_owned() + &format!("0x{:x}", t.hash()) + r#"","id":1}"#;
assert_eq!(tester.io.handle_request_sync(&req), Some(res));
}
@@ -1150,7 +1150,7 @@ fn rpc_get_work_should_timeout() {
// Request without providing timeout. This should work since we're disabling timeout.
let request = r#"{"jsonrpc": "2.0", "method": "eth_getWork", "params": [], "id": 1}"#;
let work_response = format!(
r#"{{"jsonrpc":"2.0","result":["0x{:?}","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000800000000000000000000000000000000000000000000000000000000000","0x1"],"id":1}}"#,
r#"{{"jsonrpc":"2.0","result":["0x{:x}","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000800000000000000000000000000000000000000000000000000000000000","0x1"],"id":1}}"#,
hash,
);
assert_eq!(eth_tester.io.handle_request_sync(request), Some(work_response.to_owned()));
@@ -1158,7 +1158,7 @@ fn rpc_get_work_should_timeout() {
// Request with timeout of 0 seconds. This should work since we're disabling timeout.
let request = r#"{"jsonrpc": "2.0", "method": "eth_getWork", "params": [0], "id": 1}"#;
let work_response = format!(
r#"{{"jsonrpc":"2.0","result":["0x{:?}","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000800000000000000000000000000000000000000000000000000000000000","0x1"],"id":1}}"#,
r#"{{"jsonrpc":"2.0","result":["0x{:x}","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000800000000000000000000000000000000000000000000000000000000000","0x1"],"id":1}}"#,
hash,
);
assert_eq!(eth_tester.io.handle_request_sync(request), Some(work_response.to_owned()));

View File

@@ -128,7 +128,7 @@ fn should_subscribe_to_logs() {
handler.new_blocks(vec![], vec![], vec![h1], vec![], vec![], vec![], 0);
let (res, receiver) = receiver.into_future().wait().unwrap();
let response = r#"{"jsonrpc":"2.0","method":"eth_subscription","params":{"result":{"address":"0x0000000000000000000000000000000000000005","blockHash":"0x3457d2fa2e3dd33c78ac681cf542e429becf718859053448748383af67e23218","blockNumber":"0x1","data":"0x","logIndex":"0x0","topics":["0x0000000000000000000000000000000000000000000000000000000000000001","0x0000000000000000000000000000000000000000000000000000000000000002","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000"],"transactionHash":""#.to_owned()
+ &format!("0x{:?}", tx_hash)
+ &format!("0x{:x}", tx_hash)
+ r#"","transactionIndex":"0x0","transactionLogIndex":"0x0","type":"mined"},"subscription":"0x416d77337e24399d"}}"#;
assert_eq!(res, Some(response.into()));
@@ -136,7 +136,7 @@ fn should_subscribe_to_logs() {
handler.new_blocks(vec![], vec![], vec![], vec![h1], vec![], vec![], 0);
let (res, receiver) = receiver.into_future().wait().unwrap();
let response = r#"{"jsonrpc":"2.0","method":"eth_subscription","params":{"result":{"address":"0x0000000000000000000000000000000000000005","blockHash":"0x3457d2fa2e3dd33c78ac681cf542e429becf718859053448748383af67e23218","blockNumber":"0x1","data":"0x","logIndex":"0x0","topics":["0x0000000000000000000000000000000000000000000000000000000000000001","0x0000000000000000000000000000000000000000000000000000000000000002","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000"],"transactionHash":""#.to_owned()
+ &format!("0x{:?}", tx_hash)
+ &format!("0x{:x}", tx_hash)
+ r#"","transactionIndex":"0x0","transactionLogIndex":"0x0","type":"removed"},"subscription":"0x416d77337e24399d"}}"#;
assert_eq!(res, Some(response.into()));

View File

@@ -407,7 +407,7 @@ fn rpc_parity_pending_transactions() {
fn rpc_parity_encrypt() {
let deps = Dependencies::new();
let io = deps.default_client();
let key = format!("{:?}", Random.generate().unwrap().public());
let key = format!("{:x}", Random.generate().unwrap().public());
let request = r#"{"jsonrpc": "2.0", "method": "parity_encryptMessage", "params":["0x"#.to_owned() + &key + r#"", "0x01"], "id": 1}"#;
assert!(io.handle_request_sync(&request).unwrap().contains("result"), "Should return success.");
@@ -461,7 +461,7 @@ fn rpc_parity_next_nonce() {
let request = r#"{
"jsonrpc": "2.0",
"method": "parity_nextNonce",
"params": [""#.to_owned() + &format!("0x{:?}", address) + r#""],
"params": [""#.to_owned() + &format!("0x{:x}", address) + r#""],
"id": 1
}"#;
let response1 = r#"{"jsonrpc":"2.0","result":"0x0","id":1}"#;

View File

@@ -234,7 +234,7 @@ fn rpc_parity_remove_transaction() {
let signed = tx.fake_sign(2.into());
let hash = signed.hash();
let request = r#"{"jsonrpc": "2.0", "method": "parity_removeTransaction", "params":[""#.to_owned() + &format!("0x{:?}", hash) + r#""], "id": 1}"#;
let request = r#"{"jsonrpc": "2.0", "method": "parity_removeTransaction", "params":[""#.to_owned() + &format!("0x{:x}", hash) + r#""], "id": 1}"#;
let response = r#"{"jsonrpc":"2.0","result":{"blockHash":null,"blockNumber":null,"chainId":null,"condition":null,"creates":null,"from":"0x0000000000000000000000000000000000000002","gas":"0x76c0","gasPrice":"0x9184e72a000","hash":"0xa2e0da8a8064e0b9f93e95a53c2db6d01280efb8ac72a708d25487e67dd0f8fc","input":"0x","nonce":"0x1","publicKey":null,"r":"0x1","raw":"0xe9018609184e72a0008276c0940000000000000000000000000000000000000005849184e72a80800101","s":"0x1","standardV":"0x4","to":"0x0000000000000000000000000000000000000005","transactionIndex":null,"v":"0x0","value":"0x9184e72a"},"id":1}"#;
miner.pending_transactions.lock().insert(hash, signed);

View File

@@ -77,7 +77,7 @@ fn accounts() {
let tester = setup();
let address = tester.accounts.new_account("").unwrap();
let request = r#"{"jsonrpc": "2.0", "method": "personal_listAccounts", "params": [], "id": 1}"#;
let response = r#"{"jsonrpc":"2.0","result":[""#.to_owned() + &format!("0x{:?}", address) + r#""],"id":1}"#;
let response = r#"{"jsonrpc":"2.0","result":[""#.to_owned() + &format!("0x{:x}", address) + r#""],"id":1}"#;
assert_eq!(tester.io.handle_request_sync(request), Some(response.to_owned()));
}
@@ -92,7 +92,7 @@ fn new_account() {
let accounts = tester.accounts.accounts().unwrap();
assert_eq!(accounts.len(), 1);
let address = accounts[0];
let response = r#"{"jsonrpc":"2.0","result":""#.to_owned() + format!("0x{:?}", address).as_ref() + r#"","id":1}"#;
let response = r#"{"jsonrpc":"2.0","result":""#.to_owned() + format!("0x{:x}", address).as_ref() + r#"","id":1}"#;
assert_eq!(res, Some(response));
}
@@ -106,7 +106,7 @@ fn invalid_password_test(method: &str)
"jsonrpc": "2.0",
"method": ""#.to_owned() + method + r#"",
"params": [{
"from": ""# + format!("0x{:?}", address).as_ref() + r#"",
"from": ""# + format!("0x{:x}", address).as_ref() + r#"",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
@@ -131,7 +131,7 @@ fn sign() {
"method": "personal_sign",
"params": [
""#.to_owned() + format!("0x{}", data.to_hex()).as_ref() + r#"",
""# + format!("0x{:?}", address).as_ref() + r#"",
""# + format!("0x{:x}", address).as_ref() + r#"",
"password123"
],
"id": 1
@@ -156,7 +156,7 @@ fn sign_with_invalid_password() {
"method": "personal_sign",
"params": [
"0x0000000000000000000000000000000000000000000000000000000000000005",
""#.to_owned() + format!("0x{:?}", address).as_ref() + r#"",
""#.to_owned() + format!("0x{:x}", address).as_ref() + r#"",
""
],
"id": 1
@@ -195,7 +195,7 @@ fn sign_and_send_test(method: &str) {
"jsonrpc": "2.0",
"method": ""#.to_owned() + method + r#"",
"params": [{
"from": ""# + format!("0x{:?}", address).as_ref() + r#"",
"from": ""# + format!("0x{:x}", address).as_ref() + r#"",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
@@ -216,7 +216,7 @@ fn sign_and_send_test(method: &str) {
let signature = tester.accounts.sign(address, None, t.hash(None)).unwrap();
let t = t.with_signature(signature, None);
let response = r#"{"jsonrpc":"2.0","result":""#.to_owned() + format!("0x{:?}", t.hash()).as_ref() + r#"","id":1}"#;
let response = r#"{"jsonrpc":"2.0","result":""#.to_owned() + format!("0x{:x}", t.hash()).as_ref() + r#"","id":1}"#;
assert_eq!(tester.io.handle_request_sync(request.as_ref()), Some(response));
@@ -234,7 +234,7 @@ fn sign_and_send_test(method: &str) {
let signature = tester.accounts.sign(address, None, t.hash(None)).unwrap();
let t = t.with_signature(signature, None);
let response = r#"{"jsonrpc":"2.0","result":""#.to_owned() + format!("0x{:?}", t.hash()).as_ref() + r#"","id":1}"#;
let response = r#"{"jsonrpc":"2.0","result":""#.to_owned() + format!("0x{:x}", t.hash()).as_ref() + r#"","id":1}"#;
assert_eq!(tester.io.handle_request_sync(request.as_ref()), Some(response));
}
@@ -259,7 +259,7 @@ fn ec_recover() {
"id": 1
}"#;
let address = format!("0x{:?}", address);
let address = format!("0x{:x}", address);
let response = r#"{"jsonrpc":"2.0","result":""#.to_owned() + &address + r#"","id":1}"#;
assert_eq!(tester.io.handle_request_sync(request.as_ref()), Some(response.into()));
@@ -294,7 +294,7 @@ fn should_unlock_not_account_temporarily_if_allow_perm_is_disabled() {
"jsonrpc": "2.0",
"method": "personal_unlockAccount",
"params": [
""#.to_owned() + &format!("0x{:?}", address) + r#"",
""#.to_owned() + &format!("0x{:x}", address) + r#"",
"password123",
"0x100"
],
@@ -315,7 +315,7 @@ fn should_unlock_account_permanently() {
"jsonrpc": "2.0",
"method": "personal_unlockAccount",
"params": [
""#.to_owned() + &format!("0x{:?}", address) + r#"",
""#.to_owned() + &format!("0x{:x}", address) + r#"",
"password123",
null
],

View File

@@ -216,7 +216,7 @@ fn should_confirm_transaction_and_dispatch() {
"params":["0x1", {"gasPrice":"0x1000","gas":"0x50505"}, "test"],
"id":1
}"#;
let response = r#"{"jsonrpc":"2.0","result":""#.to_owned() + format!("0x{:?}", t.hash()).as_ref() + r#"","id":1}"#;
let response = r#"{"jsonrpc":"2.0","result":""#.to_owned() + format!("0x{:x}", t.hash()).as_ref() + r#"","id":1}"#;
// then
assert_eq!(tester.io.handle_request_sync(&request), Some(response.to_owned()));
@@ -261,11 +261,11 @@ fn should_alter_the_sender_and_nonce() {
"jsonrpc":"2.0",
"method":"signer_confirmRequest",
"params":["0x1", {"sender":""#.to_owned()
+ &format!("0x{:?}", address)
+ &format!("0x{:x}", address)
+ r#"","gasPrice":"0x1000","gas":"0x50505"}, "test"],
"id":1
}"#;
let response = r#"{"jsonrpc":"2.0","result":""#.to_owned() + &format!("0x{:?}", t.hash()) + r#"","id":1}"#;
let response = r#"{"jsonrpc":"2.0","result":""#.to_owned() + &format!("0x{:x}", t.hash()) + r#"","id":1}"#;
// then
assert_eq!(tester.io.handle_request_sync(&request), Some(response.to_owned()));
@@ -312,7 +312,7 @@ fn should_confirm_transaction_with_token() {
"id":1
}"#;
let response = r#"{"jsonrpc":"2.0","result":{"result":""#.to_owned() +
format!("0x{:?}", t.hash()).as_ref() +
format!("0x{:x}", t.hash()).as_ref() +
r#"","token":""#;
// then
@@ -361,7 +361,7 @@ fn should_confirm_transaction_with_rlp() {
"params":["0x1", "0x"#.to_owned() + &rlp.to_hex() + r#""],
"id":1
}"#;
let response = r#"{"jsonrpc":"2.0","result":""#.to_owned() + format!("0x{:?}", t.hash()).as_ref() + r#"","id":1}"#;
let response = r#"{"jsonrpc":"2.0","result":""#.to_owned() + format!("0x{:x}", t.hash()).as_ref() + r#"","id":1}"#;
// then
assert_eq!(tester.io.handle_request_sync(&request), Some(response.to_owned()));
@@ -460,12 +460,12 @@ fn should_confirm_sign_transaction_with_rlp() {
r#""blockHash":null,"blockNumber":null,"# +
&format!("\"chainId\":{},", t.chain_id().map_or("null".to_owned(), |n| format!("{}", n))) +
r#""condition":null,"creates":null,"# +
&format!("\"from\":\"0x{:?}\",", &address) +
&format!("\"from\":\"0x{:x}\",", &address) +
r#""gas":"0x989680","gasPrice":"0x1000","# +
&format!("\"hash\":\"0x{:?}\",", t.hash()) +
&format!("\"hash\":\"0x{:x}\",", t.hash()) +
r#""input":"0x","# +
r#""nonce":"0x0","# +
&format!("\"publicKey\":\"0x{:?}\",", t.public_key().unwrap()) +
&format!("\"publicKey\":\"0x{:x}\",", t.public_key().unwrap()) +
&format!("\"r\":\"0x{:x}\",", U256::from(signature.r())) +
&format!("\"raw\":\"0x{}\",", rlp.to_hex()) +
&format!("\"s\":\"0x{:x}\",", U256::from(signature.s())) +

View File

@@ -95,7 +95,7 @@ fn should_add_sign_to_queue() {
"jsonrpc": "2.0",
"method": "eth_sign",
"params": [
""#.to_owned() + format!("0x{:?}", address).as_ref() + r#"",
""#.to_owned() + format!("0x{:x}", address).as_ref() + r#"",
"0x0000000000000000000000000000000000000000000000000000000000000005"
],
"id": 1
@@ -132,7 +132,7 @@ fn should_post_sign_to_queue() {
"jsonrpc": "2.0",
"method": "parity_postSign",
"params": [
""#.to_owned() + format!("0x{:?}", address).as_ref() + r#"",
""#.to_owned() + format!("0x{:x}", address).as_ref() + r#"",
"0x0000000000000000000000000000000000000000000000000000000000000005"
],
"id": 1
@@ -153,7 +153,7 @@ fn should_check_status_of_request() {
"jsonrpc": "2.0",
"method": "parity_postSign",
"params": [
""#.to_owned() + format!("0x{:?}", address).as_ref() + r#"",
""#.to_owned() + format!("0x{:x}", address).as_ref() + r#"",
"0x0000000000000000000000000000000000000000000000000000000000000005"
],
"id": 1
@@ -182,7 +182,7 @@ fn should_check_status_of_request_when_its_resolved() {
"jsonrpc": "2.0",
"method": "parity_postSign",
"params": [
""#.to_owned() + format!("0x{:?}", address).as_ref() + r#"",
""#.to_owned() + format!("0x{:x}", address).as_ref() + r#"",
"0x0000000000000000000000000000000000000000000000000000000000000005"
],
"id": 1
@@ -219,7 +219,7 @@ fn should_sign_if_account_is_unlocked() {
"jsonrpc": "2.0",
"method": "eth_sign",
"params": [
""#.to_owned() + format!("0x{:?}", acc).as_ref() + r#"",
""#.to_owned() + format!("0x{:x}", acc).as_ref() + r#"",
""# + format!("0x{}", data.to_hex()).as_ref() + r#""
],
"id": 1
@@ -241,7 +241,7 @@ fn should_add_transaction_to_queue() {
"jsonrpc": "2.0",
"method": "eth_sendTransaction",
"params": [{
"from": ""#.to_owned() + format!("0x{:?}", address).as_ref() + r#"",
"from": ""#.to_owned() + format!("0x{:x}", address).as_ref() + r#"",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
@@ -282,7 +282,7 @@ fn should_add_sign_transaction_to_the_queue() {
"jsonrpc": "2.0",
"method": "eth_signTransaction",
"params": [{
"from": ""#.to_owned() + format!("0x{:?}", address).as_ref() + r#"",
"from": ""#.to_owned() + format!("0x{:x}", address).as_ref() + r#"",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
@@ -311,12 +311,12 @@ fn should_add_sign_transaction_to_the_queue() {
r#""blockHash":null,"blockNumber":null,"# +
&format!("\"chainId\":{},", t.chain_id().map_or("null".to_owned(), |n| format!("{}", n))) +
r#""condition":null,"creates":null,"# +
&format!("\"from\":\"0x{:?}\",", &address) +
&format!("\"from\":\"0x{:x}\",", &address) +
r#""gas":"0x76c0","gasPrice":"0x9184e72a000","# +
&format!("\"hash\":\"0x{:?}\",", t.hash()) +
&format!("\"hash\":\"0x{:x}\",", t.hash()) +
r#""input":"0x","# +
r#""nonce":"0x1","# +
&format!("\"publicKey\":\"0x{:?}\",", t.public_key().unwrap()) +
&format!("\"publicKey\":\"0x{:x}\",", t.public_key().unwrap()) +
&format!("\"r\":\"0x{:x}\",", U256::from(signature.r())) +
&format!("\"raw\":\"0x{}\",", rlp.to_hex()) +
&format!("\"s\":\"0x{:x}\",", U256::from(signature.s())) +
@@ -370,7 +370,7 @@ fn should_dispatch_transaction_if_account_is_unlock() {
"jsonrpc": "2.0",
"method": "eth_sendTransaction",
"params": [{
"from": ""#.to_owned() + format!("0x{:?}", acc).as_ref() + r#"",
"from": ""#.to_owned() + format!("0x{:x}", acc).as_ref() + r#"",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
@@ -378,7 +378,7 @@ fn should_dispatch_transaction_if_account_is_unlock() {
}],
"id": 1
}"#;
let response = r#"{"jsonrpc":"2.0","result":""#.to_owned() + format!("0x{:?}", t.hash()).as_ref() + r#"","id":1}"#;
let response = r#"{"jsonrpc":"2.0","result":""#.to_owned() + format!("0x{:x}", t.hash()).as_ref() + r#"","id":1}"#;
// then
assert_eq!(tester.io.handle_request_sync(&request), Some(response.to_owned()));
@@ -395,7 +395,7 @@ fn should_decrypt_message_if_account_is_unlocked() {
// First encrypt message
let request = format!("{}0x{:?}{}",
let request = format!("{}0x{:x}{}",
r#"{"jsonrpc": "2.0", "method": "parity_encryptMessage", "params":[""#,
public,
r#"", "0x01020304"], "id": 1}"#
@@ -403,7 +403,7 @@ fn should_decrypt_message_if_account_is_unlocked() {
let encrypted: Success = serde_json::from_str(&tester.io.handle_request_sync(&request).unwrap()).unwrap();
// then call decrypt
let request = format!("{}{:?}{}{}{}",
let request = format!("{}{:x}{}{}{}",
r#"{"jsonrpc": "2.0", "method": "parity_decryptMessage", "params":["0x"#,
address,
r#"","#,
@@ -428,7 +428,7 @@ fn should_add_decryption_to_the_queue() {
let request = r#"{
"jsonrpc": "2.0",
"method": "parity_decryptMessage",
"params": ["0x"#.to_owned() + &format!("{:?}", acc.address()) + r#"",
"params": ["0x"#.to_owned() + &format!("{:x}", acc.address()) + r#"",
"0x012345"],
"id": 1
}"#;
@@ -459,7 +459,7 @@ fn should_compose_transaction() {
let tester = eth_signing();
let acc = Random.generate().unwrap();
assert_eq!(tester.signer.requests().len(), 0);
let from = format!("{:?}", acc.address());
let from = format!("{:x}", acc.address());
// when
let request = r#"{