Skip to content
This repository was archived by the owner on Sep 18, 2020. It is now read-only.

Commit

Permalink
Bump rustc-hex from 1.0.0 to 2.0.1 (#228)
Browse files Browse the repository at this point in the history
* Bump rustc-hex from 1.0.0 to 2.0.1

Bumps [rustc-hex](https://github.com/debris/rustc-hex) from 1.0.0 to 2.0.1.
- [Release notes](https://github.com/debris/rustc-hex/releases)
- [Commits](https://github.com/debris/rustc-hex/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Update.
  • Loading branch information
dependabot-preview[bot] authored and tomusdrw committed Oct 22, 2019
1 parent 80e749e commit 5390a02
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 47 deletions.
10 changes: 2 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ toml = "0.5.3"
web3 = { git = "https://github.com/tomusdrw/rust-web3" }
error-chain = "0.12"
ethabi = "9.0"
rustc-hex = "1.0"
rustc-hex = "2.0"
log = "0.4"
ethereum-types = "0.8"
pretty_assertions = "0.6.1"
Expand Down
18 changes: 9 additions & 9 deletions bridge/src/accept_message_from_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,22 +225,22 @@ mod tests {
let main_transport = mock_transport!(
"eth_call" =>
req => json!([{
"data": format!("0x{}", get_message_call_data.to_hex()),
"data": format!("0x{}", get_message_call_data.to_hex::<String>()),
"to": format!("0x{:x}", main_contract_address),
}, "latest"]),
res => json!(format!("0x{}", encoded_message.to_hex()));
res => json!(format!("0x{}", encoded_message.to_hex::<String>()));
);

let side_transport = mock_transport!(
"eth_call" =>
req => json!([{
"data": format!("0x{}", has_accepted_call_data.to_hex()),
"data": format!("0x{}", has_accepted_call_data.to_hex::<String>()),
"to": format!("0x{:x}", side_contract_address),
}, "latest"]),
res => json!(format!("0x{}", ethabi::encode(&[ethabi::Token::Bool(false)]).to_hex()));
res => json!(format!("0x{}", ethabi::encode(&[ethabi::Token::Bool(false)]).to_hex::<String>()));
"eth_sendTransaction" =>
req => json!([{
"data": format!("0x{}", accept_message_call_data.to_hex()),
"data": format!("0x{}", accept_message_call_data.to_hex::<String>()),
"from": "0x0000000000000000000000000000000000000001",
"gas": "0xfd",
"gasPrice": "0xa0",
Expand Down Expand Up @@ -349,19 +349,19 @@ mod tests {
let main_transport = mock_transport!(
"eth_call" =>
req => json!([{
"data": format!("0x{}", get_message_call_data.to_hex()),
"data": format!("0x{}", get_message_call_data.to_hex::<String>()),
"to": main_contract_address,
}, "latest"]),
res => json!(format!("0x{}", encoded_message.to_hex()));
res => json!(format!("0x{}", encoded_message.to_hex::<String>()));
);

let side_transport = mock_transport!(
"eth_call" =>
req => json!([{
"data": format!("0x{}", has_accepted_call_data.to_hex()),
"data": format!("0x{}", has_accepted_call_data.to_hex::<String>()),
"to": side_contract_address,
}, "latest"]),
res => json!(format!("0x{}", ethabi::encode(&[ethabi::Token::Bool(true)]).to_hex()));
res => json!(format!("0x{}", ethabi::encode(&[ethabi::Token::Bool(true)]).to_hex::<String>()));
);

let main_contract = MainContract {
Expand Down
8 changes: 4 additions & 4 deletions bridge/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ main_deploy = { gas = "20", gas_price = "0" }
http: "http://localhost:8545".into(),
contract: ContractConfig {
bin: include_str!("../../compiled_contracts/Main.bin")
.from_hex()
.from_hex::<Vec<u8>>()
.unwrap()
.into(),
},
Expand All @@ -303,7 +303,7 @@ main_deploy = { gas = "20", gas_price = "0" }
side: NodeConfig {
contract: ContractConfig {
bin: include_str!("../../compiled_contracts/Side.bin")
.from_hex()
.from_hex::<Vec<u8>>()
.unwrap()
.into(),
},
Expand Down Expand Up @@ -369,7 +369,7 @@ required_signatures = 2
http: "".into(),
contract: ContractConfig {
bin: include_str!("../../compiled_contracts/Main.bin")
.from_hex()
.from_hex::<Vec<u8>>()
.unwrap()
.into(),
},
Expand All @@ -381,7 +381,7 @@ required_signatures = 2
http: "".into(),
contract: ContractConfig {
bin: include_str!("../../compiled_contracts/Side.bin")
.from_hex()
.from_hex::<Vec<u8>>()
.unwrap()
.into(),
},
Expand Down
2 changes: 1 addition & 1 deletion bridge/src/message_to_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ mod test {
recipient,
};

assert_eq!(message.to_bytes(), "75ebc3036b5a5a758be9a8c0e6f6ed8d46c640dda39845de99d9570ba76798e275ebc3036b5a5a758be9a8c0e6f6ed8d46c640dda39845de99d9570ba76798ffeac4a655451e159313c3641e29824e77d6fcb0aaeac4a655451e159313c3641e29824e77d6fcb0bb".from_hex().unwrap())
assert_eq!(message.to_bytes(), "75ebc3036b5a5a758be9a8c0e6f6ed8d46c640dda39845de99d9570ba76798e275ebc3036b5a5a758be9a8c0e6f6ed8d46c640dda39845de99d9570ba76798ffeac4a655451e159313c3641e29824e77d6fcb0aaeac4a655451e159313c3641e29824e77d6fcb0bb".from_hex::<Vec<u8>>().unwrap())
}

quickcheck! {
Expand Down
14 changes: 7 additions & 7 deletions bridge/src/side_to_main_sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,26 +212,26 @@ mod tests {
let signature = "8697c15331677e6ebccccaff3454fce5edbc8cca8697c15331677aff3454fce5edbc8cca8697c15331677e6ebccccaff3454fce5edbc8cca8697c15331677e6ebc";

let tx_data = contracts::side::functions::submit_signed_message::encode_input(
signature.from_hex().unwrap(),
signature.from_hex::<Vec<u8>>().unwrap(),
message.to_bytes(),
);

let transport = mock_transport!(
"eth_call" =>
req => json!([{
"data": format!("0x{}", call_data.to_hex()),
"data": format!("0x{}", call_data.to_hex::<String>()),
"to": format!("0x{:x}", side_contract_address),
}, "latest"]),
res => json!(format!("0x{}", ethabi::encode(&[ethabi::Token::Bool(false)]).to_hex()));
res => json!(format!("0x{}", ethabi::encode(&[ethabi::Token::Bool(false)]).to_hex::<String>()));
"eth_sign" =>
req => json!([
format!("0x{:x}", authority_address),
format!("0x{}", message.to_bytes().to_hex())
format!("0x{}", message.to_bytes().to_hex::<String>())
]),
res => json!(format!("0x{}", signature));
"eth_sendTransaction" =>
req => json!([{
"data": format!("0x{}", tx_data.to_hex()),
"data": format!("0x{}", tx_data.to_hex::<String>()),
"from": format!("0x{:x}", authority_address),
"gas": "0xfd",
"gasPrice": "0xa0",
Expand Down Expand Up @@ -320,10 +320,10 @@ mod tests {
let transport = mock_transport!(
"eth_call" =>
req => json!([{
"data": format!("0x{}", call_data.to_hex()),
"data": format!("0x{}", call_data.to_hex::<String>()),
"to": side_contract_address,
}, "latest"]),
res => json!(format!("0x{}", ethabi::encode(&[ethabi::Token::Bool(true)]).to_hex()));
res => json!(format!("0x{}", ethabi::encode(&[ethabi::Token::Bool(true)]).to_hex::<String>()));
);

let side_contract = SideContract {
Expand Down
36 changes: 22 additions & 14 deletions bridge/src/side_to_main_signatures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,18 +253,21 @@ mod tests {
let main_contract_address: Address =
"0000000000000000000000000000000000000fff".parse().unwrap();

let signature = Signature::from_bytes("8697c15331677e6ebccccaff3454fce5edbc8cca8697c15331677aff3454fce5edbc8cca8697c15331677e6ebccccaff3454fce5edbc8cca8697c15331677e6ebc".from_hex().unwrap().as_slice()).unwrap();
let sig: Vec<u8> = "8697c15331677e6ebccccaff3454fce5edbc8cca8697c15331677aff3454fce5edbc8cca8697c15331677e6ebccccaff3454fce5edbc8cca8697c15331677e6ebc"
.from_hex()
.unwrap();
let signature = Signature::from_bytes(&*sig).unwrap();

let tx_hash = "1db8f385535c0d178b8f40016048f3a3cffee8f94e68978ea4b277f57b638f0b";
let data: Vec<u8> = vec![10, 0];

let main_transport = mock_transport!(
"eth_call" =>
req => json!([{
"data": format!("0x{}", contracts::main::functions::accepted_messages::encode_input(log.message_hash).to_hex()),
"data": format!("0x{}", contracts::main::functions::accepted_messages::encode_input(log.message_hash).to_hex::<String>()),
"to": format!("0x{:x}", main_contract_address),
}, "latest"]),
res => json!(format!("0x{}", ethabi::encode(&[ethabi::Token::Bool(false)]).to_hex()));
res => json!(format!("0x{}", ethabi::encode(&[ethabi::Token::Bool(false)]).to_hex::<String>()));
"eth_sendTransaction" =>
req => json!([{
"data": format!(
Expand All @@ -277,7 +280,7 @@ mod tests {
data.clone(),
message.sender,
message.recipient,
).to_hex()
).to_hex::<String>()
),
"from": format!("0x{:x}", authority_address),
"gas": "0xfd",
Expand All @@ -291,22 +294,25 @@ mod tests {
let side_transport = mock_transport!(
"eth_call" =>
req => json!([{
"data": format!("0x{}", contracts::side::functions::message::encode_input(log.message_hash).to_hex()),
"data": format!("0x{}",
contracts::side::functions::message::encode_input(log.message_hash).to_hex::<String>()),
"to": format!("0x{:x}", side_contract_address),
}, "latest"]),
res => json!(format!("0x{}", ethabi::encode(&[ethabi::Token::Bytes(message.to_bytes())]).to_hex()));
res => json!(format!("0x{}",
ethabi::encode(&[ethabi::Token::Bytes(message.to_bytes())]).to_hex::<String>()));
"eth_call" =>
req => json!([{
"data": format!("0x{}", contracts::side::functions::signature::encode_input(log.message_hash, 0).to_hex()),
"data": format!("0x{}", contracts::side::functions::signature::encode_input(log.message_hash, 0).to_hex::<String>()),
"to": format!("0x{:x}", side_contract_address),
}, "latest"]),
res => json!(format!("0x{}", ethabi::encode(&[ethabi::Token::Bytes(signature.to_bytes())]).to_hex()));
res => json!(format!("0x{}",
ethabi::encode(&[ethabi::Token::Bytes(signature.to_bytes())]).to_hex::<String>()));
"eth_call" =>
req => json!([{
"data": format!("0x{}", contracts::side::functions::relayed_messages::encode_input(message.message_id).to_hex()),
"data": format!("0x{}", contracts::side::functions::relayed_messages::encode_input(message.message_id).to_hex::<String>()),
"to": format!("0x{:x}", side_contract_address),
}, "latest"]),
res => json!(format!("0x{}", ethabi::encode(&[ethabi::Token::Bytes(data)]).to_hex()));
res => json!(format!("0x{}", ethabi::encode(&[ethabi::Token::Bytes(data)]).to_hex::<String>()));
);

let main_contract = MainContract {
Expand Down Expand Up @@ -404,19 +410,21 @@ mod tests {
let main_transport = mock_transport!(
"eth_call" =>
req => json!([{
"data": format!("0x{}", contracts::main::functions::accepted_messages::encode_input(log.message_hash).to_hex()),
"data": format!("0x{}", contracts::main::functions::accepted_messages::encode_input(log.message_hash).to_hex::<String>()),
"to": main_contract_address,
}, "latest"]),
res => json!(format!("0x{}", ethabi::encode(&[ethabi::Token::Bool(true)]).to_hex()));
res => json!(format!("0x{}", ethabi::encode(&[ethabi::Token::Bool(true)]).to_hex::<String>()));
);

let side_transport = mock_transport!(
"eth_call" =>
req => json!([{
"data": format!("0x{}", contracts::side::functions::message::encode_input(log.message_hash).to_hex()),
"data": format!("0x{}",
contracts::side::functions::message::encode_input(log.message_hash).to_hex::<String>()),
"to": side_contract_address,
}, "latest"]),
res => json!(format!("0x{}", ethabi::encode(&[ethabi::Token::Bytes(message.to_bytes())]).to_hex()));
res => json!(format!("0x{}",
ethabi::encode(&[ethabi::Token::Bytes(message.to_bytes())]).to_hex::<String>()));
);

let main_contract = MainContract {
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ethereum-types = "0.8"
futures = "0.1"
jsonrpc-core = "14.0"
pretty_assertions = "0.6.1"
rustc-hex = "1.0"
rustc-hex = "2.0"
serde_json = "1.0"
tempfile = "3"
tokio-core = "0.1.8"
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/tests/basic_deposit_then_withdraw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ fn test_basic_deposit_then_withdraw() {
value: None,
data: Some(
include_str!("../../compiled_contracts/RecipientTest.bin")
.from_hex()
.from_hex::<Vec<u8>>()
.unwrap()
.into(),
),
Expand All @@ -331,7 +331,7 @@ fn test_basic_deposit_then_withdraw() {
value: None,
data: Some(
include_str!("../../compiled_contracts/RecipientTest.bin")
.from_hex()
.from_hex::<Vec<u8>>()
.unwrap()
.into(),
),
Expand Down

0 comments on commit 5390a02

Please sign in to comment.