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

Commit d75443e

Browse files
authored
Merge pull request #159 from paritytech/snd-refactor
refactor&more (feel free to review, still improving docs and tests)
2 parents 53c56a2 + 18781e5 commit d75443e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+5139
-4240
lines changed

.travis.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ branches:
55
matrix:
66
include:
77
- language: rust
8-
rust: stable
8+
# using `rust: stable` below would be preferable but it randomly
9+
# breaks the rustfmt check on travis (`cargo fmt --all -- --write-mode=diff`)
10+
# sometimes when the rustfmt rules have changed
11+
rust: stable-2018-06-21
912
sudo: required
1013
dist: trusty
1114
cache: cargo
@@ -18,6 +21,8 @@ matrix:
1821
before_script:
1922
- export PATH=/snap/bin:${PATH}
2023
- rustup component add rustfmt-preview
24+
# useful for troubleshooting
25+
- rustfmt --version
2126
script:
2227
# using --write-mode=diff instructs rustfmt to exit with an error code if the input is not formatted correctly
2328
- cargo fmt --all -- --write-mode=diff

Cargo.lock

+966-322
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[workspace]
2-
members = ["tests", "cli", "bridge", "integration-tests", "deploy"]
2+
members = ["cli", "bridge", "integration-tests", "deploy", "contracts"]

bridge/Cargo.toml

+10-6
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,27 @@ version = "0.4.0"
44
authors = ["debris <[email protected]>", "snd <[email protected]>"]
55

66
[dependencies]
7+
bridge-contracts = { path = "../contracts" }
78
futures = "0.1"
89
serde = "1.0"
910
serde_derive = "1.0"
1011
serde_json = "1.0"
1112
tokio-core = "0.1.8"
1213
tokio-timer = "0.1.2"
1314
toml = "0.4.2"
14-
web3 = { git = "https://github.com/tomusdrw/rust-web3", branch = "bridge" }
15-
error-chain = "0.11.0-rc.2"
16-
ethabi = "5.1"
17-
ethabi-derive = "5.0"
18-
ethabi-contract = "5.0"
15+
web3 = { git = "https://github.com/tomusdrw/rust-web3" }
16+
error-chain = "0.11.0"
17+
ethabi = { git = "https://github.com/paritytech/ethabi" }
1918
rustc-hex = "1.0"
2019
log = "0.3"
21-
ethereum-types = "0.2"
20+
ethereum-types = "0.3"
2221
pretty_assertions = "0.2.1"
22+
tiny-keccak = "1.3"
2323

2424
[dev-dependencies]
2525
tempdir = "0.3"
2626
quickcheck = "0.6.1"
27+
jsonrpc-core = "8.0"
28+
29+
[build-dependencies]
30+
solc = { git = "https://github.com/paritytech/rust_solc" }

bridge/build.rs

+22-29
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
// Copyright 2017 Parity Technologies (UK) Ltd.
2+
// This file is part of Parity-Bridge.
3+
4+
// Parity-Bridge is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
9+
// Parity-Bridge is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
14+
// You should have received a copy of the GNU General Public License
15+
// along with Parity-Bridge. If not, see <http://www.gnu.org/licenses/>.
16+
extern crate solc;
17+
118
use std::process::Command;
219

320
fn main() {
@@ -11,43 +28,19 @@ fn main() {
1128
let output = Command::new("git")
1229
.args(&["rev-parse", "HEAD"])
1330
.output()
14-
.unwrap();
31+
.expect("`git rev-parse HEAD` failed to run. run it yourself to verify. file an issue if this persists");
1532
let git_hash = String::from_utf8(output.stdout).unwrap();
1633
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
1734

1835
// make solc version used to compile contracts (`solc --version`)
1936
// available via `env!("SOLC_VERSION")` in sources
20-
let output = Command::new("solc").args(&["--version"]).output().unwrap();
37+
let output = Command::new("solc").args(&["--version"]).output().expect(
38+
"`solc --version` failed to run. run it yourself to verify. file an issue if this persists",
39+
);
2140
let output_string = String::from_utf8(output.stdout).unwrap();
2241
let solc_version = output_string.lines().last().unwrap();
2342
println!("cargo:rustc-env=SOLC_VERSION={}", solc_version);
2443

2544
// compile contracts for inclusion with ethabis `use_contract!`
26-
match Command::new("solc")
27-
.arg("--abi")
28-
.arg("--bin")
29-
.arg("--optimize")
30-
.arg("--output-dir")
31-
.arg("../compiled_contracts")
32-
.arg("--overwrite")
33-
.arg("../contracts/bridge.sol")
34-
.status()
35-
{
36-
Ok(exit_status) => {
37-
if !exit_status.success() {
38-
if let Some(code) = exit_status.code() {
39-
panic!("`solc` exited with error exit status code `{}`", code);
40-
} else {
41-
panic!("`solc` exited because it was terminated by a signal");
42-
}
43-
}
44-
}
45-
Err(err) => {
46-
if let std::io::ErrorKind::NotFound = err.kind() {
47-
panic!("`solc` executable not found in `$PATH`. `solc` is required to compile the bridge contracts. please install it: https://solidity.readthedocs.io/en/develop/installing-solidity.html");
48-
} else {
49-
panic!("an error occurred when trying to spawn `solc`: {}", err);
50-
}
51-
}
52-
}
45+
solc::compile_dir("../contracts", "../compiled_contracts").unwrap();
5346
}

bridge/src/api.rs

-212
This file was deleted.

0 commit comments

Comments
 (0)