Merge pull request #94 from paritytech/snd-auto-compile-contracts

compile contracts in build.rs and remove compiled from git so they do…
This commit is contained in:
Marek Kotewicz 2018-01-19 13:55:31 +01:00 committed by GitHub
commit 1de3cc3db4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 42 additions and 22 deletions

2
.gitignore vendored
View File

@ -20,3 +20,5 @@
truffle/build
node_modules
compiled_contracts

View File

@ -9,18 +9,30 @@ matrix:
rust: stable
cache: cargo
fast_finish: false
before_script:
- sudo add-apt-repository ppa:ethereum/ethereum -y
- sudo apt-get update -y
- sudo apt-get install solc -y
script:
- cargo test --all
- language: rust
rust: beta
cache: cargo
fast_finish: false
before_script:
- sudo add-apt-repository ppa:ethereum/ethereum -y
- sudo apt-get update -y
- sudo apt-get install solc -y
script:
- cargo test --all
- language: rust
rust: nightly
cache: cargo
fast_finish: false
before_script:
- sudo add-apt-repository ppa:ethereum/ethereum -y
- sudo apt-get update -y
- sudo apt-get install solc -y
script:
- cargo test --all
- language: node_js

18
bridge/build.rs Normal file
View File

@ -0,0 +1,18 @@
use std::process::Command;
fn main() {
// rerun build script if bridge contract has changed.
// without this cargo doesn't since the bridge contract
// is outside the crate directories
println!("cargo:rerun-if-changed=../contracts/bridge.sol");
let exit_status = Command::new("solc")
.arg("--abi")
.arg("--bin")
.arg("--optimize")
.arg("--output-dir").arg("../compiled_contracts")
.arg("--overwrite")
.arg("../contracts/bridge.sol")
.status()
.unwrap_or_else(|e| panic!("Error compiling solidity contracts: {}", e));
assert!(exit_status.success(), "There was an error while compiling contracts code.");
}

View File

@ -206,14 +206,14 @@ poll_interval = 2
required_confirmations = 100
[home.contract]
bin = "../contracts/HomeBridge.bin"
bin = "../compiled_contracts/HomeBridge.bin"
[foreign]
account = "0x0000000000000000000000000000000000000001"
ipc = "/foreign.ipc"
[foreign.contract]
bin = "../contracts/ForeignBridge.bin"
bin = "../compiled_contracts/ForeignBridge.bin"
[authorities]
accounts = [
@ -233,7 +233,7 @@ home_deploy = { gas = 20 }
account: "0x1B68Cb0B50181FC4006Ce572cF346e596E51818b".parse().unwrap(),
ipc: "/home.ipc".into(),
contract: ContractConfig {
bin: include_str!("../../contracts/HomeBridge.bin").from_hex().unwrap().into(),
bin: include_str!("../../compiled_contracts/HomeBridge.bin").from_hex().unwrap().into(),
},
poll_interval: Duration::from_secs(2),
request_timeout: Duration::from_secs(5),
@ -242,7 +242,7 @@ home_deploy = { gas = 20 }
foreign: Node {
account: "0x0000000000000000000000000000000000000001".parse().unwrap(),
contract: ContractConfig {
bin: include_str!("../../contracts/ForeignBridge.bin").from_hex().unwrap().into(),
bin: include_str!("../../compiled_contracts/ForeignBridge.bin").from_hex().unwrap().into(),
},
ipc: "/foreign.ipc".into(),
poll_interval: Duration::from_secs(1),
@ -279,14 +279,14 @@ account = "0x1B68Cb0B50181FC4006Ce572cF346e596E51818b"
ipc = ""
[home.contract]
bin = "../contracts/HomeBridge.bin"
bin = "../compiled_contracts/HomeBridge.bin"
[foreign]
account = "0x0000000000000000000000000000000000000001"
ipc = ""
[foreign.contract]
bin = "../contracts/ForeignBridge.bin"
bin = "../compiled_contracts/ForeignBridge.bin"
[authorities]
accounts = [
@ -302,7 +302,7 @@ required_signatures = 2
account: "0x1B68Cb0B50181FC4006Ce572cF346e596E51818b".parse().unwrap(),
ipc: "".into(),
contract: ContractConfig {
bin: include_str!("../../contracts/HomeBridge.bin").from_hex().unwrap().into(),
bin: include_str!("../../compiled_contracts/HomeBridge.bin").from_hex().unwrap().into(),
},
poll_interval: Duration::from_secs(1),
request_timeout: Duration::from_secs(5),
@ -312,7 +312,7 @@ required_signatures = 2
account: "0x0000000000000000000000000000000000000001".parse().unwrap(),
ipc: "".into(),
contract: ContractConfig {
bin: include_str!("../../contracts/ForeignBridge.bin").from_hex().unwrap().into(),
bin: include_str!("../../compiled_contracts/ForeignBridge.bin").from_hex().unwrap().into(),
},
poll_interval: Duration::from_secs(1),
request_timeout: Duration::from_secs(5),

View File

@ -1,2 +1,2 @@
use_contract!(home, "HomeBridge", "../contracts/HomeBridge.abi");
use_contract!(foreign, "ForeignBridge", "../contracts/ForeignBridge.abi");
use_contract!(home, "HomeBridge", "../compiled_contracts/HomeBridge.abi");
use_contract!(foreign, "ForeignBridge", "../compiled_contracts/ForeignBridge.abi");

View File

@ -1 +0,0 @@
[]

View File

@ -1 +0,0 @@
60606040523415600e57600080fd5b603580601b6000396000f3006060604052600080fd00a165627a7a72305820c932e6f428e6d92af95ee55ebcaac74fc940f95c8735edd17dda15edaa19dd5c0029

View File

@ -1 +0,0 @@
[{"constant":true,"inputs":[{"name":"hash","type":"bytes32"},{"name":"index","type":"uint256"}],"name":"signature","outputs":[{"name":"","type":"bytes"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"recipient","type":"address"},{"name":"value","type":"uint256"},{"name":"transactionHash","type":"bytes32"}],"name":"deposit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balances","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"hash","type":"bytes32"}],"name":"message","outputs":[{"name":"","type":"bytes"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"authorities","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"signature","type":"bytes"},{"name":"message","type":"bytes"}],"name":"submitSignature","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"requiredSignatures","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"recipient","type":"address"},{"name":"value","type":"uint256"},{"name":"externalTransfer","type":"bool"}],"name":"transfer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"requiredSignaturesParam","type":"uint256"},{"name":"authoritiesParam","type":"address[]"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"recipient","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"recipient","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"from","type":"address"},{"indexed":false,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"authority","type":"address"},{"indexed":false,"name":"messageHash","type":"bytes32"}],"name":"CollectedSignatures","type":"event"}]

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
[{"constant":true,"inputs":[{"name":"message","type":"bytes"}],"name":"getValueFromMessage","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"authorities","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"message","type":"bytes"}],"name":"isMessageValueSufficientToCoverRelay","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"estimatedGasCostOfWithdraw","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"requiredSignatures","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"v","type":"uint8[]"},{"name":"r","type":"bytes32[]"},{"name":"s","type":"bytes32[]"},{"name":"message","type":"bytes"}],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"message","type":"bytes"}],"name":"getTransactionHashFromMessage","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"message","type":"bytes"}],"name":"getRecipientFromMessage","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"getWithdrawRelayCost","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"requiredSignaturesParam","type":"uint256"},{"name":"authoritiesParam","type":"address[]"},{"name":"estimatedGasCostOfWithdrawParam","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"recipient","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"recipient","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Withdraw","type":"event"}]

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
[]

View File

@ -1 +0,0 @@
60606040523415600e57600080fd5b603580601b6000396000f3006060604052600080fd00a165627a7a72305820318bc66730cca6b481ef2a48d4a91f14251a53bc731dde6483817e418eb22c880029

View File

@ -1 +0,0 @@
[{"constant":true,"inputs":[{"name":"signature","type":"bytes"},{"name":"message","type":"bytes"}],"name":"signer","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"pure","type":"function"}]

View File

@ -1 +0,0 @@
6060604052341561000f57600080fd5b6105988061001e6000396000f300606060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680631c7ede5f14610046575b600080fd5b6100d9600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061011b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000610127838361012f565b905092915050565b6000806000806041865114151561014557600080fd5b602086015192506040860151915060608601519050600161016586610217565b827f010000000000000000000000000000000000000000000000000000000000000090048585604051600081526020016040526000604051602001526040518085600019166000191681526020018460ff1660ff16815260200183600019166000191681526020018260001916600019168152602001945050505050602060405160208103908084039060008661646e5a03f1151561020357600080fd5b505060206040510351935050505092915050565b6000610221610544565b6040805190810160405280601a81526020017f19457468657265756d205369676e6564204d6573736167653a0a0000000000008152509050806102648451610377565b846040518084805190602001908083835b60208310151561029a5780518252602082019150602081019050602083039250610275565b6001836020036101000a03801982511681845116808217855250505050505090500183805190602001908083835b6020831015156102ed57805182526020820191506020810190506020830392506102c8565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b602083101515610340578051825260208201915060208101905060208303925061031b565b6001836020036101000a03801982511681845116808217855250505050505090500193505050506040518091039020915050919050565b61037f610558565b610387610544565b6000806000610394610544565b600060086040518059106103a55750595b9080825280601f01601f19166020018201604052509550879450600093505b60008514151561045b57600a858115156103da57fe5b069250600a858115156103e957fe5b049450826030017f010000000000000000000000000000000000000000000000000000000000000002868580600101965081518110151561042657fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506103c4565b836040518059106104695750595b9080825280601f01601f19166020018201604052509150600090505b8381101561053657856001828603038151811015156104a057fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f01000000000000000000000000000000000000000000000000000000000000000282828151811015156104f957fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080600101915050610485565b819650505050505050919050565b602060405190810160405280600081525090565b6020604051908101604052806000815250905600a165627a7a72305820cbbde89b355daf743e257c135871802a16d706edf62ec0f50eeaf23d3ec294a50029

View File

@ -1 +0,0 @@
[]

View File

@ -1 +0,0 @@
60606040523415600e57600080fd5b603580601b6000396000f3006060604052600080fd00a165627a7a72305820d1bb8ba8b6820603841c347240fb84906fdfb107f23e71a92429f954607061840029