Merge pull request #47 from paritytech/rename
rename to home/foreign, closes #46
This commit is contained in:
commit
d721b1ff2b
72
README.md
72
README.md
|
@ -5,7 +5,7 @@
|
||||||
[travis-image]: https://travis-ci.org/paritytech/parity-bridge.svg?branch=master
|
[travis-image]: https://travis-ci.org/paritytech/parity-bridge.svg?branch=master
|
||||||
[travis-url]: https://travis-ci.org/paritytech/parity-bridge
|
[travis-url]: https://travis-ci.org/paritytech/parity-bridge
|
||||||
|
|
||||||
simple bridge between ethereum foundation and kovan networks
|
Simple bridge between ValidatorSet-based parity chain (foreign) with any other Parity chain (home).
|
||||||
|
|
||||||
### build
|
### build
|
||||||
|
|
||||||
|
@ -33,20 +33,20 @@ Options:
|
||||||
### configuration [file example](./examples/config.toml)
|
### configuration [file example](./examples/config.toml)
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[mainnet]
|
[home]
|
||||||
account = "0x006e27b6a72e1f34c626762f3c4761547aff1421"
|
account = "0x006e27b6a72e1f34c626762f3c4761547aff1421"
|
||||||
ipc = "/Users/marek/Library/Application Support/io.parity.ethereum/jsonrpc.ipc"
|
ipc = "/Users/marek/Library/Application Support/io.parity.ethereum/jsonrpc.ipc"
|
||||||
required_confirmations = 0
|
required_confirmations = 0
|
||||||
|
|
||||||
[mainnet.contract]
|
[home.contract]
|
||||||
bin = "contracts/EthereumBridge.bin"
|
bin = "contracts/EthereumBridge.bin"
|
||||||
|
|
||||||
[testnet]
|
[foreign]
|
||||||
account = "0x006e27b6a72e1f34c626762f3c4761547aff1421"
|
account = "0x006e27b6a72e1f34c626762f3c4761547aff1421"
|
||||||
ipc = "/Users/marek/Library/Application Support/io.parity.ethereum/jsonrpc.ipc"
|
ipc = "/Users/marek/Library/Application Support/io.parity.ethereum/jsonrpc.ipc"
|
||||||
required_confirmations = 0
|
required_confirmations = 0
|
||||||
|
|
||||||
[testnet.contract]
|
[foreign.contract]
|
||||||
bin = "contracts/KovanBridge.bin"
|
bin = "contracts/KovanBridge.bin"
|
||||||
|
|
||||||
[authorities]
|
[authorities]
|
||||||
|
@ -58,27 +58,27 @@ accounts = [
|
||||||
required_signatures = 2
|
required_signatures = 2
|
||||||
|
|
||||||
[transactions]
|
[transactions]
|
||||||
mainnet_deploy = { gas = 500000 }
|
home_deploy = { gas = 500000 }
|
||||||
testnet_deploy = { gas = 500000 }
|
foreign_deploy = { gas = 500000 }
|
||||||
```
|
```
|
||||||
|
|
||||||
#### mainnet options
|
#### home options
|
||||||
|
|
||||||
- `mainnet.account` - authority address on the mainnet (**required**)
|
- `home.account` - authority address on the home (**required**)
|
||||||
- `mainnet.ipc` - path to mainnet parity ipc handle (**required**)
|
- `home.ipc` - path to home parity ipc handle (**required**)
|
||||||
- `mainnet.contract.bin` - path to the compiled bridge contract (**required**)
|
- `home.contract.bin` - path to the compiled bridge contract (**required**)
|
||||||
- `mainnet.required_confirmations` - number of confirmation required to consider transaction final on mainnet (default: **12**)
|
- `home.required_confirmations` - number of confirmation required to consider transaction final on home (default: **12**)
|
||||||
- `mainnet.poll_interval` - specify how often mainnet node should be polled for changes (in seconds, default: **1**)
|
- `home.poll_interval` - specify how often home node should be polled for changes (in seconds, default: **1**)
|
||||||
- `mainnet.request_timeout` - specify request timeout (in seconds, default: **5**)
|
- `home.request_timeout` - specify request timeout (in seconds, default: **5**)
|
||||||
|
|
||||||
#### testnet options
|
#### foreign options
|
||||||
|
|
||||||
- `testnet.account` - authority address on the testnet (**required**)
|
- `foreign.account` - authority address on the foreign (**required**)
|
||||||
- `testnet.ipc` - path to testnet parity ipc handle (**required**)
|
- `foreign.ipc` - path to foreign parity ipc handle (**required**)
|
||||||
- `testnet.contract.bin` - path to the compiled bridge contract (**required**)
|
- `foreign.contract.bin` - path to the compiled bridge contract (**required**)
|
||||||
- `testnet.required_confirmations` - number of confirmation required to consider transaction final on testnet (default: **12**)
|
- `foreign.required_confirmations` - number of confirmation required to consider transaction final on foreign (default: **12**)
|
||||||
- `testnet.poll_interval` - specify how often mainnet node should be polled for changes (in seconds, default: **1**)
|
- `foreign.poll_interval` - specify how often home node should be polled for changes (in seconds, default: **1**)
|
||||||
- `testnet.request_timeout` - specify request timeout (in seconds, default: **5**)
|
- `foreign.request_timeout` - specify request timeout (in seconds, default: **5**)
|
||||||
|
|
||||||
|
|
||||||
#### authorities options
|
#### authorities options
|
||||||
|
@ -88,10 +88,10 @@ testnet_deploy = { gas = 500000 }
|
||||||
|
|
||||||
#### transaction options
|
#### transaction options
|
||||||
|
|
||||||
- `transaction.mainnet_deploy.gas` - specify how much gas should be consumed by mainnet contract deploy
|
- `transaction.home_deploy.gas` - specify how much gas should be consumed by home contract deploy
|
||||||
- `transaction.mainnet_deploy.gas_price` - specify gas price for mainnet contract deploy
|
- `transaction.home_deploy.gas_price` - specify gas price for home contract deploy
|
||||||
- `transaction.testnet_deploy.gas` - specify how much gas should be consumed by testnet contract deploy
|
- `transaction.foreign_deploy.gas` - specify how much gas should be consumed by foreign contract deploy
|
||||||
- `transaction.testnet_deploy.gas_price` - specify gas price for mainnet contract deploy
|
- `transaction.foreign_deploy.gas_price` - specify gas price for home contract deploy
|
||||||
- `transaction.deposit_relay.gas` - specify how much gas should be consumed by deposit relay
|
- `transaction.deposit_relay.gas` - specify how much gas should be consumed by deposit relay
|
||||||
- `transaction.deposit_relay.gas_price` - specify gas price for deposit relay
|
- `transaction.deposit_relay.gas_price` - specify gas price for deposit relay
|
||||||
- `transaction.withdraw_confirm.gas` - specify how much gas should be consumed by withdraw confirm
|
- `transaction.withdraw_confirm.gas` - specify how much gas should be consumed by withdraw confirm
|
||||||
|
@ -102,10 +102,10 @@ testnet_deploy = { gas = 500000 }
|
||||||
### database file format
|
### database file format
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
mainnet_contract_address = "0x49edf201c1e139282643d5e7c6fb0c7219ad1db7"
|
home_contract_address = "0x49edf201c1e139282643d5e7c6fb0c7219ad1db7"
|
||||||
testnet_contract_address = "0x49edf201c1e139282643d5e7c6fb0c7219ad1db8"
|
foreign_contract_address = "0x49edf201c1e139282643d5e7c6fb0c7219ad1db8"
|
||||||
mainnet_deploy = 100
|
home_deploy = 100
|
||||||
testnet_deploy = 101
|
foreign_deploy = 101
|
||||||
checked_deposit_relay = 120
|
checked_deposit_relay = 120
|
||||||
checked_withdraw_relay = 121
|
checked_withdraw_relay = 121
|
||||||
checked_withdraw_confirm = 121
|
checked_withdraw_confirm = 121
|
||||||
|
@ -113,12 +113,12 @@ checked_withdraw_confirm = 121
|
||||||
|
|
||||||
**all fields are required**
|
**all fields are required**
|
||||||
|
|
||||||
- `mainnet_contract_address` - address of the bridge contract on mainnet
|
- `home_contract_address` - address of the bridge contract on home chain
|
||||||
- `testnet_contract_address` - address of the bridge contract on testnet
|
- `foreign_contract_address` - address of the bridge contract on foreign chain
|
||||||
- `mainnet_deploy` - block number at which mainnet contract has been deployed
|
- `home_deploy` - block number at which home contract has been deployed
|
||||||
- `testnet_deploy` - block number at which testnet contract has been deployed
|
- `foreign_deploy` - block number at which foreign contract has been deployed
|
||||||
- `checked_deposit_relay` - number of the last block for which an authority has relayed deposits to the testnet
|
- `checked_deposit_relay` - number of the last block for which an authority has relayed deposits to the foreign
|
||||||
- `checked_withdraw_relay` - number of the last block for which an authority has relayed withdraws to the mainnet
|
- `checked_withdraw_relay` - number of the last block for which an authority has relayed withdraws to the home
|
||||||
- `checked_withdraw_confirm` - number of the last block for which an authirty has confirmed withdraw
|
- `checked_withdraw_confirm` - number of the last block for which an authirty has confirmed withdraw
|
||||||
|
|
||||||
### example run
|
### example run
|
||||||
|
@ -129,7 +129,7 @@ checked_withdraw_confirm = 121
|
||||||
|
|
||||||
- example run requires a parity instance running
|
- example run requires a parity instance running
|
||||||
- this parity instance can be started by running `examples/parity_start.sh`
|
- this parity instance can be started by running `examples/parity_start.sh`
|
||||||
- it connects to this parity instance twice. one connection treats the node as `mainnet`, whereas the other as `testnet`
|
- it connects to this parity instance twice. one connection treats the node as `home`, whereas the other as `foreign`
|
||||||
- by default, parity tries to unlock account generates from seedphrase `this is sparta` - `0x006e27b6a72e1f34c626762f3c4761547aff1421`
|
- by default, parity tries to unlock account generates from seedphrase `this is sparta` - `0x006e27b6a72e1f34c626762f3c4761547aff1421`
|
||||||
- this is just an example. the 'real world' bridge needs to connect to the two different parity instances
|
- this is just an example. the 'real world' bridge needs to connect to the two different parity instances
|
||||||
|
|
||||||
|
|
|
@ -5,36 +5,36 @@ use web3::Transport;
|
||||||
use web3::transports::ipc::Ipc;
|
use web3::transports::ipc::Ipc;
|
||||||
use error::{Error, ResultExt, ErrorKind};
|
use error::{Error, ResultExt, ErrorKind};
|
||||||
use config::Config;
|
use config::Config;
|
||||||
use contracts::{mainnet, testnet};
|
use contracts::{home, foreign};
|
||||||
|
|
||||||
pub struct App<T> where T: Transport {
|
pub struct App<T> where T: Transport {
|
||||||
pub config: Config,
|
pub config: Config,
|
||||||
pub database_path: PathBuf,
|
pub database_path: PathBuf,
|
||||||
pub connections: Connections<T>,
|
pub connections: Connections<T>,
|
||||||
pub mainnet_bridge: mainnet::EthereumBridge,
|
pub home_bridge: home::HomeBridge,
|
||||||
pub testnet_bridge: testnet::KovanBridge,
|
pub foreign_bridge: foreign::ForeignBridge,
|
||||||
pub timer: Timer,
|
pub timer: Timer,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Connections<T> where T: Transport {
|
pub struct Connections<T> where T: Transport {
|
||||||
pub mainnet: T,
|
pub home: T,
|
||||||
pub testnet: T,
|
pub foreign: T,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Connections<Ipc> {
|
impl Connections<Ipc> {
|
||||||
pub fn new_ipc<P: AsRef<Path>>(handle: &Handle, mainnet: P, testnet: P) -> Result<Self, Error> {
|
pub fn new_ipc<P: AsRef<Path>>(handle: &Handle, home: P, foreign: P) -> Result<Self, Error> {
|
||||||
let mainnet = Ipc::with_event_loop(mainnet, handle)
|
let home = Ipc::with_event_loop(home, handle)
|
||||||
.map_err(ErrorKind::Web3)
|
.map_err(ErrorKind::Web3)
|
||||||
.map_err(Error::from)
|
.map_err(Error::from)
|
||||||
.chain_err(|| "Cannot connect to mainnet node ipc")?;
|
.chain_err(|| "Cannot connect to home node ipc")?;
|
||||||
let testnet = Ipc::with_event_loop(testnet, handle)
|
let foreign = Ipc::with_event_loop(foreign, handle)
|
||||||
.map_err(ErrorKind::Web3)
|
.map_err(ErrorKind::Web3)
|
||||||
.map_err(Error::from)
|
.map_err(Error::from)
|
||||||
.chain_err(|| "Cannot connect to testnet node ipc")?;
|
.chain_err(|| "Cannot connect to foreign node ipc")?;
|
||||||
|
|
||||||
let result = Connections {
|
let result = Connections {
|
||||||
mainnet,
|
home,
|
||||||
testnet,
|
foreign,
|
||||||
};
|
};
|
||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
|
@ -43,21 +43,21 @@ impl Connections<Ipc> {
|
||||||
impl<T: Transport> Connections<T> {
|
impl<T: Transport> Connections<T> {
|
||||||
pub fn as_ref(&self) -> Connections<&T> {
|
pub fn as_ref(&self) -> Connections<&T> {
|
||||||
Connections {
|
Connections {
|
||||||
mainnet: &self.mainnet,
|
home: &self.home,
|
||||||
testnet: &self.testnet,
|
foreign: &self.foreign,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl App<Ipc> {
|
impl App<Ipc> {
|
||||||
pub fn new_ipc<P: AsRef<Path>>(config: Config, database_path: P, handle: &Handle) -> Result<Self, Error> {
|
pub fn new_ipc<P: AsRef<Path>>(config: Config, database_path: P, handle: &Handle) -> Result<Self, Error> {
|
||||||
let connections = Connections::new_ipc(handle, &config.mainnet.ipc, &config.testnet.ipc)?;
|
let connections = Connections::new_ipc(handle, &config.home.ipc, &config.foreign.ipc)?;
|
||||||
let result = App {
|
let result = App {
|
||||||
config,
|
config,
|
||||||
database_path: database_path.as_ref().to_path_buf(),
|
database_path: database_path.as_ref().to_path_buf(),
|
||||||
connections,
|
connections,
|
||||||
mainnet_bridge: mainnet::EthereumBridge::default(),
|
home_bridge: home::HomeBridge::default(),
|
||||||
testnet_bridge: testnet::KovanBridge::default(),
|
foreign_bridge: foreign::ForeignBridge::default(),
|
||||||
timer: Timer::default(),
|
timer: Timer::default(),
|
||||||
};
|
};
|
||||||
Ok(result)
|
Ok(result)
|
||||||
|
@ -70,8 +70,8 @@ impl<T: Transport> App<T> {
|
||||||
config: self.config.clone(),
|
config: self.config.clone(),
|
||||||
connections: self.connections.as_ref(),
|
connections: self.connections.as_ref(),
|
||||||
database_path: self.database_path.clone(),
|
database_path: self.database_path.clone(),
|
||||||
mainnet_bridge: mainnet::EthereumBridge::default(),
|
home_bridge: home::HomeBridge::default(),
|
||||||
testnet_bridge: testnet::KovanBridge::default(),
|
foreign_bridge: foreign::ForeignBridge::default(),
|
||||||
timer: self.timer.clone(),
|
timer: self.timer.clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,22 +42,22 @@ impl<T: Transport + Clone> Future for Deploy<T> {
|
||||||
DeployState::CheckIfNeeded => match Database::load(&self.app.database_path).map_err(ErrorKind::from) {
|
DeployState::CheckIfNeeded => match Database::load(&self.app.database_path).map_err(ErrorKind::from) {
|
||||||
Ok(database) => return Ok(Deployed::Existing(database).into()),
|
Ok(database) => return Ok(Deployed::Existing(database).into()),
|
||||||
Err(ErrorKind::MissingFile(_)) => {
|
Err(ErrorKind::MissingFile(_)) => {
|
||||||
let main_data = self.app.mainnet_bridge.constructor(
|
let main_data = self.app.home_bridge.constructor(
|
||||||
self.app.config.mainnet.contract.bin.clone().0,
|
self.app.config.home.contract.bin.clone().0,
|
||||||
ethabi::util::pad_u32(self.app.config.authorities.required_signatures),
|
ethabi::util::pad_u32(self.app.config.authorities.required_signatures),
|
||||||
self.app.config.authorities.accounts.iter().map(|a| a.0.clone()).collect::<Vec<_>>()
|
self.app.config.authorities.accounts.iter().map(|a| a.0.clone()).collect::<Vec<_>>()
|
||||||
);
|
);
|
||||||
let test_data = self.app.testnet_bridge.constructor(
|
let test_data = self.app.foreign_bridge.constructor(
|
||||||
self.app.config.testnet.contract.bin.clone().0,
|
self.app.config.foreign.contract.bin.clone().0,
|
||||||
ethabi::util::pad_u32(self.app.config.authorities.required_signatures),
|
ethabi::util::pad_u32(self.app.config.authorities.required_signatures),
|
||||||
self.app.config.authorities.accounts.iter().map(|a| a.0.clone()).collect::<Vec<_>>()
|
self.app.config.authorities.accounts.iter().map(|a| a.0.clone()).collect::<Vec<_>>()
|
||||||
);
|
);
|
||||||
|
|
||||||
let main_tx_request = TransactionRequest {
|
let main_tx_request = TransactionRequest {
|
||||||
from: self.app.config.mainnet.account,
|
from: self.app.config.home.account,
|
||||||
to: None,
|
to: None,
|
||||||
gas: Some(self.app.config.txs.mainnet_deploy.gas.into()),
|
gas: Some(self.app.config.txs.home_deploy.gas.into()),
|
||||||
gas_price: Some(self.app.config.txs.mainnet_deploy.gas_price.into()),
|
gas_price: Some(self.app.config.txs.home_deploy.gas_price.into()),
|
||||||
value: None,
|
value: None,
|
||||||
data: Some(main_data.into()),
|
data: Some(main_data.into()),
|
||||||
nonce: None,
|
nonce: None,
|
||||||
|
@ -65,10 +65,10 @@ impl<T: Transport + Clone> Future for Deploy<T> {
|
||||||
};
|
};
|
||||||
|
|
||||||
let test_tx_request = TransactionRequest {
|
let test_tx_request = TransactionRequest {
|
||||||
from: self.app.config.testnet.account,
|
from: self.app.config.foreign.account,
|
||||||
to: None,
|
to: None,
|
||||||
gas: Some(self.app.config.txs.testnet_deploy.gas.into()),
|
gas: Some(self.app.config.txs.foreign_deploy.gas.into()),
|
||||||
gas_price: Some(self.app.config.txs.testnet_deploy.gas_price.into()),
|
gas_price: Some(self.app.config.txs.foreign_deploy.gas_price.into()),
|
||||||
value: None,
|
value: None,
|
||||||
data: Some(test_data.into()),
|
data: Some(test_data.into()),
|
||||||
nonce: None,
|
nonce: None,
|
||||||
|
@ -76,17 +76,17 @@ impl<T: Transport + Clone> Future for Deploy<T> {
|
||||||
};
|
};
|
||||||
|
|
||||||
let main_future = api::send_transaction_with_confirmation(
|
let main_future = api::send_transaction_with_confirmation(
|
||||||
self.app.connections.mainnet.clone(),
|
self.app.connections.home.clone(),
|
||||||
main_tx_request,
|
main_tx_request,
|
||||||
self.app.config.mainnet.poll_interval,
|
self.app.config.home.poll_interval,
|
||||||
self.app.config.mainnet.required_confirmations
|
self.app.config.home.required_confirmations
|
||||||
);
|
);
|
||||||
|
|
||||||
let test_future = api::send_transaction_with_confirmation(
|
let test_future = api::send_transaction_with_confirmation(
|
||||||
self.app.connections.testnet.clone(),
|
self.app.connections.foreign.clone(),
|
||||||
test_tx_request,
|
test_tx_request,
|
||||||
self.app.config.testnet.poll_interval,
|
self.app.config.foreign.poll_interval,
|
||||||
self.app.config.testnet.required_confirmations
|
self.app.config.foreign.required_confirmations
|
||||||
);
|
);
|
||||||
|
|
||||||
DeployState::Deploying(main_future.join(test_future))
|
DeployState::Deploying(main_future.join(test_future))
|
||||||
|
@ -96,10 +96,10 @@ impl<T: Transport + Clone> Future for Deploy<T> {
|
||||||
DeployState::Deploying(ref mut future) => {
|
DeployState::Deploying(ref mut future) => {
|
||||||
let (main_receipt, test_receipt) = try_ready!(future.poll().map_err(ErrorKind::Web3));
|
let (main_receipt, test_receipt) = try_ready!(future.poll().map_err(ErrorKind::Web3));
|
||||||
let database = Database {
|
let database = Database {
|
||||||
mainnet_contract_address: main_receipt.contract_address.expect("contract creation receipt must have an address; qed"),
|
home_contract_address: main_receipt.contract_address.expect("contract creation receipt must have an address; qed"),
|
||||||
testnet_contract_address: test_receipt.contract_address.expect("contract creation receipt must have an address; qed"),
|
foreign_contract_address: test_receipt.contract_address.expect("contract creation receipt must have an address; qed"),
|
||||||
mainnet_deploy: main_receipt.block_number.low_u64(),
|
home_deploy: main_receipt.block_number.low_u64(),
|
||||||
testnet_deploy: test_receipt.block_number.low_u64(),
|
foreign_deploy: test_receipt.block_number.low_u64(),
|
||||||
checked_deposit_relay: main_receipt.block_number.low_u64(),
|
checked_deposit_relay: main_receipt.block_number.low_u64(),
|
||||||
checked_withdraw_relay: test_receipt.block_number.low_u64(),
|
checked_withdraw_relay: test_receipt.block_number.low_u64(),
|
||||||
checked_withdraw_confirm: test_receipt.block_number.low_u64(),
|
checked_withdraw_confirm: test_receipt.block_number.low_u64(),
|
||||||
|
|
|
@ -8,23 +8,23 @@ use ethabi::RawLog;
|
||||||
use api::{LogStream, self, ApiCall};
|
use api::{LogStream, self, ApiCall};
|
||||||
use error::{Error, Result};
|
use error::{Error, Result};
|
||||||
use database::Database;
|
use database::Database;
|
||||||
use contracts::{mainnet, testnet};
|
use contracts::{home, foreign};
|
||||||
use util::web3_filter;
|
use util::web3_filter;
|
||||||
use app::App;
|
use app::App;
|
||||||
|
|
||||||
fn deposits_filter(mainnet: &mainnet::EthereumBridge, address: Address) -> FilterBuilder {
|
fn deposits_filter(home: &home::HomeBridge, address: Address) -> FilterBuilder {
|
||||||
let filter = mainnet.events().deposit().create_filter();
|
let filter = home.events().deposit().create_filter();
|
||||||
web3_filter(filter, address)
|
web3_filter(filter, address)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn deposit_relay_payload(mainnet: &mainnet::EthereumBridge, testnet: &testnet::KovanBridge, log: Log) -> Result<Bytes> {
|
fn deposit_relay_payload(home: &home::HomeBridge, foreign: &foreign::ForeignBridge, log: Log) -> Result<Bytes> {
|
||||||
let raw_log = RawLog {
|
let raw_log = RawLog {
|
||||||
topics: log.topics.into_iter().map(|t| t.0).collect(),
|
topics: log.topics.into_iter().map(|t| t.0).collect(),
|
||||||
data: log.data.0,
|
data: log.data.0,
|
||||||
};
|
};
|
||||||
let deposit_log = mainnet.events().deposit().parse_log(raw_log)?;
|
let deposit_log = home.events().deposit().parse_log(raw_log)?;
|
||||||
let hash = log.transaction_hash.expect("log to be mined and contain `transaction_hash`");
|
let hash = log.transaction_hash.expect("log to be mined and contain `transaction_hash`");
|
||||||
let payload = testnet.functions().deposit().input(deposit_log.recipient, deposit_log.value, hash.0);
|
let payload = foreign.functions().deposit().input(deposit_log.recipient, deposit_log.value, hash.0);
|
||||||
Ok(payload.into())
|
Ok(payload.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,14 +44,14 @@ enum DepositRelayState<T: Transport> {
|
||||||
pub fn create_deposit_relay<T: Transport + Clone>(app: Arc<App<T>>, init: &Database) -> DepositRelay<T> {
|
pub fn create_deposit_relay<T: Transport + Clone>(app: Arc<App<T>>, init: &Database) -> DepositRelay<T> {
|
||||||
let logs_init = api::LogStreamInit {
|
let logs_init = api::LogStreamInit {
|
||||||
after: init.checked_deposit_relay,
|
after: init.checked_deposit_relay,
|
||||||
request_timeout: app.config.mainnet.request_timeout,
|
request_timeout: app.config.home.request_timeout,
|
||||||
poll_interval: app.config.mainnet.poll_interval,
|
poll_interval: app.config.home.poll_interval,
|
||||||
confirmations: app.config.mainnet.required_confirmations,
|
confirmations: app.config.home.required_confirmations,
|
||||||
filter: deposits_filter(&app.mainnet_bridge, init.mainnet_contract_address.clone()),
|
filter: deposits_filter(&app.home_bridge, init.home_contract_address.clone()),
|
||||||
};
|
};
|
||||||
DepositRelay {
|
DepositRelay {
|
||||||
logs: api::log_stream(app.connections.mainnet.clone(), app.timer.clone(), logs_init),
|
logs: api::log_stream(app.connections.home.clone(), app.timer.clone(), logs_init),
|
||||||
testnet_contract: init.testnet_contract_address.clone(),
|
foreign_contract: init.foreign_contract_address.clone(),
|
||||||
state: DepositRelayState::Wait,
|
state: DepositRelayState::Wait,
|
||||||
app,
|
app,
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ pub struct DepositRelay<T: Transport> {
|
||||||
app: Arc<App<T>>,
|
app: Arc<App<T>>,
|
||||||
logs: LogStream<T>,
|
logs: LogStream<T>,
|
||||||
state: DepositRelayState<T>,
|
state: DepositRelayState<T>,
|
||||||
testnet_contract: Address,
|
foreign_contract: Address,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Transport> Stream for DepositRelay<T> {
|
impl<T: Transport> Stream for DepositRelay<T> {
|
||||||
|
@ -75,12 +75,12 @@ impl<T: Transport> Stream for DepositRelay<T> {
|
||||||
let item = try_stream!(self.logs.poll());
|
let item = try_stream!(self.logs.poll());
|
||||||
let deposits = item.logs
|
let deposits = item.logs
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|log| deposit_relay_payload(&self.app.mainnet_bridge, &self.app.testnet_bridge, log))
|
.map(|log| deposit_relay_payload(&self.app.home_bridge, &self.app.foreign_bridge, log))
|
||||||
.collect::<Result<Vec<_>>>()?
|
.collect::<Result<Vec<_>>>()?
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|payload| TransactionRequest {
|
.map(|payload| TransactionRequest {
|
||||||
from: self.app.config.testnet.account.clone(),
|
from: self.app.config.foreign.account.clone(),
|
||||||
to: Some(self.testnet_contract.clone()),
|
to: Some(self.foreign_contract.clone()),
|
||||||
gas: Some(self.app.config.txs.deposit_relay.gas.into()),
|
gas: Some(self.app.config.txs.deposit_relay.gas.into()),
|
||||||
gas_price: Some(self.app.config.txs.deposit_relay.gas_price.into()),
|
gas_price: Some(self.app.config.txs.deposit_relay.gas_price.into()),
|
||||||
value: None,
|
value: None,
|
||||||
|
@ -90,8 +90,8 @@ impl<T: Transport> Stream for DepositRelay<T> {
|
||||||
})
|
})
|
||||||
.map(|request| {
|
.map(|request| {
|
||||||
self.app.timer.timeout(
|
self.app.timer.timeout(
|
||||||
api::send_transaction(&self.app.connections.testnet, request),
|
api::send_transaction(&self.app.connections.foreign, request),
|
||||||
self.app.config.testnet.request_timeout)
|
self.app.config.foreign.request_timeout)
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
@ -118,13 +118,13 @@ impl<T: Transport> Stream for DepositRelay<T> {
|
||||||
mod tests {
|
mod tests {
|
||||||
use rustc_hex::FromHex;
|
use rustc_hex::FromHex;
|
||||||
use web3::types::{Log, Bytes};
|
use web3::types::{Log, Bytes};
|
||||||
use contracts::{mainnet, testnet};
|
use contracts::{home, foreign};
|
||||||
use super::deposit_relay_payload;
|
use super::deposit_relay_payload;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_deposit_relay_payload() {
|
fn test_deposit_relay_payload() {
|
||||||
let mainnet = mainnet::EthereumBridge::default();
|
let home = home::HomeBridge::default();
|
||||||
let testnet = testnet::KovanBridge::default();
|
let foreign = foreign::ForeignBridge::default();
|
||||||
|
|
||||||
let data = "000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0".from_hex().unwrap();
|
let data = "000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0".from_hex().unwrap();
|
||||||
let log = Log {
|
let log = Log {
|
||||||
|
@ -134,7 +134,7 @@ mod tests {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let payload = deposit_relay_payload(&mainnet, &testnet, log).unwrap();
|
let payload = deposit_relay_payload(&home, &foreign, log).unwrap();
|
||||||
let expected: Bytes = "26b3293f000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364".from_hex().unwrap().into();
|
let expected: Bytes = "26b3293f000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364".from_hex().unwrap().into();
|
||||||
assert_eq!(expected, payload);
|
assert_eq!(expected, payload);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,22 +8,22 @@ use web3::Transport;
|
||||||
use web3::types::{H256, H520, Address, TransactionRequest, Log, Bytes, FilterBuilder};
|
use web3::types::{H256, H520, Address, TransactionRequest, Log, Bytes, FilterBuilder};
|
||||||
use api::{self, LogStream, ApiCall};
|
use api::{self, LogStream, ApiCall};
|
||||||
use app::App;
|
use app::App;
|
||||||
use contracts::testnet;
|
use contracts::foreign;
|
||||||
use util::web3_filter;
|
use util::web3_filter;
|
||||||
use database::Database;
|
use database::Database;
|
||||||
use error::Error;
|
use error::Error;
|
||||||
|
|
||||||
fn withdraws_filter(testnet: &testnet::KovanBridge, address: Address) -> FilterBuilder {
|
fn withdraws_filter(foreign: &foreign::ForeignBridge, address: Address) -> FilterBuilder {
|
||||||
let filter = testnet.events().withdraw().create_filter();
|
let filter = foreign.events().withdraw().create_filter();
|
||||||
web3_filter(filter, address)
|
web3_filter(filter, address)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn withdraw_confirm_sign_payload(testnet: &testnet::KovanBridge, log: Log) -> Result<Bytes, Error> {
|
fn withdraw_confirm_sign_payload(foreign: &foreign::ForeignBridge, log: Log) -> Result<Bytes, Error> {
|
||||||
let raw_log = RawLog {
|
let raw_log = RawLog {
|
||||||
topics: log.topics.into_iter().map(|t| t.0).collect(),
|
topics: log.topics.into_iter().map(|t| t.0).collect(),
|
||||||
data: log.data.0,
|
data: log.data.0,
|
||||||
};
|
};
|
||||||
let withdraw_log = testnet.events().withdraw().parse_log(raw_log)?;
|
let withdraw_log = foreign.events().withdraw().parse_log(raw_log)?;
|
||||||
let hash = log.transaction_hash.expect("log to be mined and contain `transaction_hash`");
|
let hash = log.transaction_hash.expect("log to be mined and contain `transaction_hash`");
|
||||||
let mut result = vec![0u8; 84];
|
let mut result = vec![0u8; 84];
|
||||||
result[0..20].copy_from_slice(&withdraw_log.recipient);
|
result[0..20].copy_from_slice(&withdraw_log.recipient);
|
||||||
|
@ -32,8 +32,8 @@ fn withdraw_confirm_sign_payload(testnet: &testnet::KovanBridge, log: Log) -> Re
|
||||||
Ok(result.into())
|
Ok(result.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn withdraw_submit_signature_payload(testnet: &testnet::KovanBridge, withdraw_payload: Bytes, signature: H520) -> Bytes {
|
fn withdraw_submit_signature_payload(foreign: &foreign::ForeignBridge, withdraw_payload: Bytes, signature: H520) -> Bytes {
|
||||||
testnet.functions().submit_signature().input(signature.to_vec(), withdraw_payload.0).into()
|
foreign.functions().submit_signature().input(signature.to_vec(), withdraw_payload.0).into()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// State of withdraw confirmation.
|
/// State of withdraw confirmation.
|
||||||
|
@ -58,15 +58,15 @@ enum WithdrawConfirmState<T: Transport> {
|
||||||
pub fn create_withdraw_confirm<T: Transport + Clone>(app: Arc<App<T>>, init: &Database) -> WithdrawConfirm<T> {
|
pub fn create_withdraw_confirm<T: Transport + Clone>(app: Arc<App<T>>, init: &Database) -> WithdrawConfirm<T> {
|
||||||
let logs_init = api::LogStreamInit {
|
let logs_init = api::LogStreamInit {
|
||||||
after: init.checked_withdraw_confirm,
|
after: init.checked_withdraw_confirm,
|
||||||
request_timeout: app.config.testnet.request_timeout,
|
request_timeout: app.config.foreign.request_timeout,
|
||||||
poll_interval: app.config.testnet.poll_interval,
|
poll_interval: app.config.foreign.poll_interval,
|
||||||
confirmations: app.config.testnet.required_confirmations,
|
confirmations: app.config.foreign.required_confirmations,
|
||||||
filter: withdraws_filter(&app.testnet_bridge, init.testnet_contract_address.clone()),
|
filter: withdraws_filter(&app.foreign_bridge, init.foreign_contract_address.clone()),
|
||||||
};
|
};
|
||||||
|
|
||||||
WithdrawConfirm {
|
WithdrawConfirm {
|
||||||
logs: api::log_stream(app.connections.testnet.clone(), app.timer.clone(), logs_init),
|
logs: api::log_stream(app.connections.foreign.clone(), app.timer.clone(), logs_init),
|
||||||
testnet_contract: init.testnet_contract_address.clone(),
|
foreign_contract: init.foreign_contract_address.clone(),
|
||||||
state: WithdrawConfirmState::Wait,
|
state: WithdrawConfirmState::Wait,
|
||||||
app,
|
app,
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ pub struct WithdrawConfirm<T: Transport> {
|
||||||
app: Arc<App<T>>,
|
app: Arc<App<T>>,
|
||||||
logs: LogStream<T>,
|
logs: LogStream<T>,
|
||||||
state: WithdrawConfirmState<T>,
|
state: WithdrawConfirmState<T>,
|
||||||
testnet_contract: Address,
|
foreign_contract: Address,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Transport> Stream for WithdrawConfirm<T> {
|
impl<T: Transport> Stream for WithdrawConfirm<T> {
|
||||||
|
@ -90,15 +90,15 @@ impl<T: Transport> Stream for WithdrawConfirm<T> {
|
||||||
let item = try_stream!(self.logs.poll());
|
let item = try_stream!(self.logs.poll());
|
||||||
let withdraws = item.logs
|
let withdraws = item.logs
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|log| withdraw_confirm_sign_payload(&self.app.testnet_bridge, log))
|
.map(|log| withdraw_confirm_sign_payload(&self.app.foreign_bridge, log))
|
||||||
.collect::<Result<Vec<_>, _>>()?;
|
.collect::<Result<Vec<_>, _>>()?;
|
||||||
|
|
||||||
let requests = withdraws.clone()
|
let requests = withdraws.clone()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|bytes| {
|
.map(|bytes| {
|
||||||
self.app.timer.timeout(
|
self.app.timer.timeout(
|
||||||
api::sign(&self.app.connections.testnet, self.app.config.testnet.account.clone(), bytes),
|
api::sign(&self.app.connections.foreign, self.app.config.foreign.account.clone(), bytes),
|
||||||
self.app.config.testnet.request_timeout)
|
self.app.config.foreign.request_timeout)
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
@ -112,14 +112,14 @@ impl<T: Transport> Stream for WithdrawConfirm<T> {
|
||||||
let signatures = try_ready!(future.poll());
|
let signatures = try_ready!(future.poll());
|
||||||
// borrow checker...
|
// borrow checker...
|
||||||
let app = &self.app;
|
let app = &self.app;
|
||||||
let testnet_contract = &self.testnet_contract;
|
let foreign_contract = &self.foreign_contract;
|
||||||
let confirmations = withdraws
|
let confirmations = withdraws
|
||||||
.drain(ops::RangeFull)
|
.drain(ops::RangeFull)
|
||||||
.zip(signatures.into_iter())
|
.zip(signatures.into_iter())
|
||||||
.map(|(withdraw, signature)| withdraw_submit_signature_payload(&app.testnet_bridge, withdraw, signature))
|
.map(|(withdraw, signature)| withdraw_submit_signature_payload(&app.foreign_bridge, withdraw, signature))
|
||||||
.map(|payload| TransactionRequest {
|
.map(|payload| TransactionRequest {
|
||||||
from: app.config.testnet.account.clone(),
|
from: app.config.foreign.account.clone(),
|
||||||
to: Some(testnet_contract.clone()),
|
to: Some(foreign_contract.clone()),
|
||||||
gas: Some(app.config.txs.withdraw_confirm.gas.into()),
|
gas: Some(app.config.txs.withdraw_confirm.gas.into()),
|
||||||
gas_price: Some(app.config.txs.withdraw_confirm.gas_price.into()),
|
gas_price: Some(app.config.txs.withdraw_confirm.gas_price.into()),
|
||||||
value: None,
|
value: None,
|
||||||
|
@ -129,8 +129,8 @@ impl<T: Transport> Stream for WithdrawConfirm<T> {
|
||||||
})
|
})
|
||||||
.map(|request| {
|
.map(|request| {
|
||||||
app.timer.timeout(
|
app.timer.timeout(
|
||||||
api::send_transaction(&app.connections.testnet, request),
|
api::send_transaction(&app.connections.foreign, request),
|
||||||
app.config.testnet.request_timeout)
|
app.config.foreign.request_timeout)
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
@ -157,12 +157,12 @@ impl<T: Transport> Stream for WithdrawConfirm<T> {
|
||||||
mod tests {
|
mod tests {
|
||||||
use rustc_hex::FromHex;
|
use rustc_hex::FromHex;
|
||||||
use web3::types::{Log, Bytes};
|
use web3::types::{Log, Bytes};
|
||||||
use contracts::testnet;
|
use contracts::foreign;
|
||||||
use super::{withdraw_confirm_sign_payload, withdraw_submit_signature_payload};
|
use super::{withdraw_confirm_sign_payload, withdraw_submit_signature_payload};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_withdraw_confirm_sign_payload() {
|
fn test_withdraw_confirm_sign_payload() {
|
||||||
let testnet = testnet::KovanBridge::default();
|
let foreign = foreign::ForeignBridge::default();
|
||||||
|
|
||||||
let data = "000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0".from_hex().unwrap();
|
let data = "000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0".from_hex().unwrap();
|
||||||
let log = Log {
|
let log = Log {
|
||||||
|
@ -172,19 +172,19 @@ mod tests {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let payload = withdraw_confirm_sign_payload(&testnet, log).unwrap();
|
let payload = withdraw_confirm_sign_payload(&foreign, log).unwrap();
|
||||||
let expected: Bytes = "aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364".from_hex().unwrap().into();
|
let expected: Bytes = "aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364".from_hex().unwrap().into();
|
||||||
assert_eq!(expected, payload);
|
assert_eq!(expected, payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_withdraw_submit_signature_payload() {
|
fn test_withdraw_submit_signature_payload() {
|
||||||
let testnet = testnet::KovanBridge::default();
|
let foreign = foreign::ForeignBridge::default();
|
||||||
|
|
||||||
let message: Bytes = "aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364".from_hex().unwrap().into();
|
let message: Bytes = "aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364".from_hex().unwrap().into();
|
||||||
let signature = "0x8697c15331677e6ebccccaff3454fce5edbc8cca8697c15331677aff3454fce5edbc8cca8697c15331677e6ebccccaff3454fce5edbc8cca8697c15331677e6ebc".parse().unwrap();
|
let signature = "0x8697c15331677e6ebccccaff3454fce5edbc8cca8697c15331677aff3454fce5edbc8cca8697c15331677e6ebccccaff3454fce5edbc8cca8697c15331677e6ebc".parse().unwrap();
|
||||||
|
|
||||||
let payload = withdraw_submit_signature_payload(&testnet, message, signature);
|
let payload = withdraw_submit_signature_payload(&foreign, message, signature);
|
||||||
let expected: Bytes = "630cea8e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000418697c15331677e6ebccccaff3454fce5edbc8cca8697c15331677aff3454fce5edbc8cca8697c15331677e6ebccccaff3454fce5edbc8cca8697c15331677e6ebc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000054aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364000000000000000000000000".from_hex().unwrap().into();
|
let expected: Bytes = "630cea8e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000418697c15331677e6ebccccaff3454fce5edbc8cca8697c15331677aff3454fce5edbc8cca8697c15331677e6ebccccaff3454fce5edbc8cca8697c15331677e6ebc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000054aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364000000000000000000000000".from_hex().unwrap().into();
|
||||||
assert_eq!(expected, payload);
|
assert_eq!(expected, payload);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,13 +7,13 @@ use web3::types::{H256, Address, FilterBuilder, Log, Bytes, TransactionRequest};
|
||||||
use ethabi::{RawLog, self};
|
use ethabi::{RawLog, self};
|
||||||
use app::App;
|
use app::App;
|
||||||
use api::{self, LogStream, ApiCall};
|
use api::{self, LogStream, ApiCall};
|
||||||
use contracts::{mainnet, testnet};
|
use contracts::{home, foreign};
|
||||||
use util::web3_filter;
|
use util::web3_filter;
|
||||||
use database::Database;
|
use database::Database;
|
||||||
use error::{self, Error};
|
use error::{self, Error};
|
||||||
|
|
||||||
fn collected_signatures_filter(testnet: &testnet::KovanBridge, address: Address) -> FilterBuilder {
|
fn collected_signatures_filter(foreign: &foreign::ForeignBridge, address: Address) -> FilterBuilder {
|
||||||
let filter = testnet.events().collected_signatures().create_filter();
|
let filter = foreign.events().collected_signatures().create_filter();
|
||||||
web3_filter(filter, address)
|
web3_filter(filter, address)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,22 +23,22 @@ struct RelayAssignment {
|
||||||
message_payload: Bytes,
|
message_payload: Bytes,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn signatures_payload(testnet: &testnet::KovanBridge, signatures: u32, my_address: Address, log: Log) -> error::Result<Option<RelayAssignment>> {
|
fn signatures_payload(foreign: &foreign::ForeignBridge, signatures: u32, my_address: Address, log: Log) -> error::Result<Option<RelayAssignment>> {
|
||||||
let raw_log = RawLog {
|
let raw_log = RawLog {
|
||||||
topics: log.topics.into_iter().map(|t| t.0).collect(),
|
topics: log.topics.into_iter().map(|t| t.0).collect(),
|
||||||
data: log.data.0,
|
data: log.data.0,
|
||||||
};
|
};
|
||||||
let collected_signatures = testnet.events().collected_signatures().parse_log(raw_log)?;
|
let collected_signatures = foreign.events().collected_signatures().parse_log(raw_log)?;
|
||||||
if collected_signatures.authority != my_address.0 {
|
if collected_signatures.authority != my_address.0 {
|
||||||
// someone else will relay this transaction to mainnet
|
// someone else will relay this transaction to home
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
let signature_payloads = (0..signatures).into_iter()
|
let signature_payloads = (0..signatures).into_iter()
|
||||||
.map(|index| ethabi::util::pad_u32(index))
|
.map(|index| ethabi::util::pad_u32(index))
|
||||||
.map(|index| testnet.functions().signature().input(collected_signatures.message_hash, index))
|
.map(|index| foreign.functions().signature().input(collected_signatures.message_hash, index))
|
||||||
.map(Into::into)
|
.map(Into::into)
|
||||||
.collect();
|
.collect();
|
||||||
let message_payload = testnet.functions().message().input(collected_signatures.message_hash).into();
|
let message_payload = foreign.functions().message().input(collected_signatures.message_hash).into();
|
||||||
|
|
||||||
Ok(Some(RelayAssignment {
|
Ok(Some(RelayAssignment {
|
||||||
signature_payloads,
|
signature_payloads,
|
||||||
|
@ -46,13 +46,13 @@ fn signatures_payload(testnet: &testnet::KovanBridge, signatures: u32, my_addres
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn withdraw_relay_payload(mainnet: &mainnet::EthereumBridge, signatures: Vec<Bytes>, message: Bytes) -> Bytes {
|
fn withdraw_relay_payload(home: &home::HomeBridge, signatures: Vec<Bytes>, message: Bytes) -> Bytes {
|
||||||
assert_eq!(message.0.len(), 84, "KovanBridge never accepts messages with len != 84 bytes; qed");
|
assert_eq!(message.0.len(), 84, "ForeignBridge never accepts messages with len != 84 bytes; qed");
|
||||||
let mut v_vec = Vec::new();
|
let mut v_vec = Vec::new();
|
||||||
let mut r_vec = Vec::new();
|
let mut r_vec = Vec::new();
|
||||||
let mut s_vec = Vec::new();
|
let mut s_vec = Vec::new();
|
||||||
for signature in signatures {
|
for signature in signatures {
|
||||||
assert_eq!(signature.0.len(), 65, "KovanBridge never accepts signatures with len != 65 bytes; qed");
|
assert_eq!(signature.0.len(), 65, "ForeignBridge never accepts signatures with len != 65 bytes; qed");
|
||||||
let mut r = [0u8; 32];
|
let mut r = [0u8; 32];
|
||||||
let mut s= [0u8; 32];
|
let mut s= [0u8; 32];
|
||||||
let mut v = [0u8; 32];
|
let mut v = [0u8; 32];
|
||||||
|
@ -63,7 +63,7 @@ fn withdraw_relay_payload(mainnet: &mainnet::EthereumBridge, signatures: Vec<Byt
|
||||||
s_vec.push(s);
|
s_vec.push(s);
|
||||||
r_vec.push(r);
|
r_vec.push(r);
|
||||||
}
|
}
|
||||||
mainnet.functions().withdraw().input(v_vec, r_vec, s_vec, message.0).into()
|
home.functions().withdraw().input(v_vec, r_vec, s_vec, message.0).into()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum WithdrawRelayState<T: Transport> {
|
pub enum WithdrawRelayState<T: Transport> {
|
||||||
|
@ -82,16 +82,16 @@ pub enum WithdrawRelayState<T: Transport> {
|
||||||
pub fn create_withdraw_relay<T: Transport + Clone>(app: Arc<App<T>>, init: &Database) -> WithdrawRelay<T> {
|
pub fn create_withdraw_relay<T: Transport + Clone>(app: Arc<App<T>>, init: &Database) -> WithdrawRelay<T> {
|
||||||
let logs_init = api::LogStreamInit {
|
let logs_init = api::LogStreamInit {
|
||||||
after: init.checked_withdraw_relay,
|
after: init.checked_withdraw_relay,
|
||||||
request_timeout: app.config.testnet.request_timeout,
|
request_timeout: app.config.foreign.request_timeout,
|
||||||
poll_interval: app.config.testnet.poll_interval,
|
poll_interval: app.config.foreign.poll_interval,
|
||||||
confirmations: app.config.testnet.required_confirmations,
|
confirmations: app.config.foreign.required_confirmations,
|
||||||
filter: collected_signatures_filter(&app.testnet_bridge, init.testnet_contract_address.clone()),
|
filter: collected_signatures_filter(&app.foreign_bridge, init.foreign_contract_address.clone()),
|
||||||
};
|
};
|
||||||
|
|
||||||
WithdrawRelay {
|
WithdrawRelay {
|
||||||
logs: api::log_stream(app.connections.testnet.clone(), app.timer.clone(), logs_init),
|
logs: api::log_stream(app.connections.foreign.clone(), app.timer.clone(), logs_init),
|
||||||
mainnet_contract: init.mainnet_contract_address.clone(),
|
home_contract: init.home_contract_address.clone(),
|
||||||
testnet_contract: init.testnet_contract_address.clone(),
|
foreign_contract: init.foreign_contract_address.clone(),
|
||||||
state: WithdrawRelayState::Wait,
|
state: WithdrawRelayState::Wait,
|
||||||
app,
|
app,
|
||||||
}
|
}
|
||||||
|
@ -101,8 +101,8 @@ pub struct WithdrawRelay<T: Transport> {
|
||||||
app: Arc<App<T>>,
|
app: Arc<App<T>>,
|
||||||
logs: LogStream<T>,
|
logs: LogStream<T>,
|
||||||
state: WithdrawRelayState<T>,
|
state: WithdrawRelayState<T>,
|
||||||
testnet_contract: Address,
|
foreign_contract: Address,
|
||||||
mainnet_contract: Address,
|
home_contract: Address,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Transport> Stream for WithdrawRelay<T> {
|
impl<T: Transport> Stream for WithdrawRelay<T> {
|
||||||
|
@ -117,9 +117,9 @@ impl<T: Transport> Stream for WithdrawRelay<T> {
|
||||||
let assignments = item.logs
|
let assignments = item.logs
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|log| signatures_payload(
|
.map(|log| signatures_payload(
|
||||||
&self.app.testnet_bridge,
|
&self.app.foreign_bridge,
|
||||||
self.app.config.authorities.required_signatures,
|
self.app.config.authorities.required_signatures,
|
||||||
self.app.config.testnet.account.clone(),
|
self.app.config.foreign.account.clone(),
|
||||||
log))
|
log))
|
||||||
.collect::<error::Result<Vec<_>>>()?;
|
.collect::<error::Result<Vec<_>>>()?;
|
||||||
|
|
||||||
|
@ -131,8 +131,8 @@ impl<T: Transport> Stream for WithdrawRelay<T> {
|
||||||
let message_calls = messages.into_iter()
|
let message_calls = messages.into_iter()
|
||||||
.map(|payload| {
|
.map(|payload| {
|
||||||
self.app.timer.timeout(
|
self.app.timer.timeout(
|
||||||
api::call(&self.app.connections.testnet, self.testnet_contract.clone(), payload),
|
api::call(&self.app.connections.foreign, self.foreign_contract.clone(), payload),
|
||||||
self.app.config.testnet.request_timeout)
|
self.app.config.foreign.request_timeout)
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
@ -141,8 +141,8 @@ impl<T: Transport> Stream for WithdrawRelay<T> {
|
||||||
payloads.into_iter()
|
payloads.into_iter()
|
||||||
.map(|payload| {
|
.map(|payload| {
|
||||||
self.app.timer.timeout(
|
self.app.timer.timeout(
|
||||||
api::call(&self.app.connections.testnet, self.testnet_contract.clone(), payload),
|
api::call(&self.app.connections.foreign, self.foreign_contract.clone(), payload),
|
||||||
self.app.config.testnet.request_timeout)
|
self.app.config.foreign.request_timeout)
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
})
|
})
|
||||||
|
@ -158,13 +158,13 @@ impl<T: Transport> Stream for WithdrawRelay<T> {
|
||||||
let (messages, signatures) = try_ready!(future.poll());
|
let (messages, signatures) = try_ready!(future.poll());
|
||||||
assert_eq!(messages.len(), signatures.len());
|
assert_eq!(messages.len(), signatures.len());
|
||||||
let app = &self.app;
|
let app = &self.app;
|
||||||
let mainnet_contract = &self.mainnet_contract;
|
let home_contract = &self.home_contract;
|
||||||
|
|
||||||
let relays = messages.into_iter().zip(signatures.into_iter())
|
let relays = messages.into_iter().zip(signatures.into_iter())
|
||||||
.map(|(message, signatures)| withdraw_relay_payload(&app.mainnet_bridge, signatures, message))
|
.map(|(message, signatures)| withdraw_relay_payload(&app.home_bridge, signatures, message))
|
||||||
.map(|payload| TransactionRequest {
|
.map(|payload| TransactionRequest {
|
||||||
from: app.config.mainnet.account.clone(),
|
from: app.config.home.account.clone(),
|
||||||
to: Some(mainnet_contract.clone()),
|
to: Some(home_contract.clone()),
|
||||||
gas: Some(app.config.txs.withdraw_relay.gas.into()),
|
gas: Some(app.config.txs.withdraw_relay.gas.into()),
|
||||||
gas_price: Some(app.config.txs.withdraw_relay.gas_price.into()),
|
gas_price: Some(app.config.txs.withdraw_relay.gas_price.into()),
|
||||||
value: None,
|
value: None,
|
||||||
|
@ -174,8 +174,8 @@ impl<T: Transport> Stream for WithdrawRelay<T> {
|
||||||
})
|
})
|
||||||
.map(|request| {
|
.map(|request| {
|
||||||
app.timer.timeout(
|
app.timer.timeout(
|
||||||
api::send_transaction(&app.connections.mainnet, request),
|
api::send_transaction(&app.connections.home, request),
|
||||||
app.config.mainnet.request_timeout)
|
app.config.home.request_timeout)
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
WithdrawRelayState::RelayWithdraws {
|
WithdrawRelayState::RelayWithdraws {
|
||||||
|
@ -201,12 +201,12 @@ impl<T: Transport> Stream for WithdrawRelay<T> {
|
||||||
mod tests {
|
mod tests {
|
||||||
use rustc_hex::FromHex;
|
use rustc_hex::FromHex;
|
||||||
use web3::types::{Log, Bytes};
|
use web3::types::{Log, Bytes};
|
||||||
use contracts::{mainnet, testnet};
|
use contracts::{home, foreign};
|
||||||
use super::{signatures_payload, withdraw_relay_payload};
|
use super::{signatures_payload, withdraw_relay_payload};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_signatures_payload() {
|
fn test_signatures_payload() {
|
||||||
let testnet = testnet::KovanBridge::default();
|
let foreign = foreign::ForeignBridge::default();
|
||||||
let my_address = "0xaff3454fce5edbc8cca8697c15331677e6ebcccc".parse().unwrap();
|
let my_address = "0xaff3454fce5edbc8cca8697c15331677e6ebcccc".parse().unwrap();
|
||||||
|
|
||||||
let data = "000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0".from_hex().unwrap();
|
let data = "000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0".from_hex().unwrap();
|
||||||
|
@ -218,7 +218,7 @@ mod tests {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let assignment = signatures_payload(&testnet, 2, my_address, log).unwrap().unwrap();
|
let assignment = signatures_payload(&foreign, 2, my_address, log).unwrap().unwrap();
|
||||||
let expected_message: Bytes = "490a32c600000000000000000000000000000000000000000000000000000000000000f0".from_hex().unwrap().into();
|
let expected_message: Bytes = "490a32c600000000000000000000000000000000000000000000000000000000000000f0".from_hex().unwrap().into();
|
||||||
let expected_signatures: Vec<Bytes> = vec![
|
let expected_signatures: Vec<Bytes> = vec![
|
||||||
"1812d99600000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000000".from_hex().unwrap().into(),
|
"1812d99600000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000000".from_hex().unwrap().into(),
|
||||||
|
@ -230,7 +230,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_signatures_payload_not_ours() {
|
fn test_signatures_payload_not_ours() {
|
||||||
let testnet = testnet::KovanBridge::default();
|
let foreign = foreign::ForeignBridge::default();
|
||||||
let my_address = "0xaff3454fce5edbc8cca8697c15331677e6ebcccd".parse().unwrap();
|
let my_address = "0xaff3454fce5edbc8cca8697c15331677e6ebcccd".parse().unwrap();
|
||||||
|
|
||||||
let data = "000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0".from_hex().unwrap();
|
let data = "000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0".from_hex().unwrap();
|
||||||
|
@ -242,20 +242,20 @@ mod tests {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let assignment = signatures_payload(&testnet, 2, my_address, log).unwrap();
|
let assignment = signatures_payload(&foreign, 2, my_address, log).unwrap();
|
||||||
assert_eq!(None, assignment);
|
assert_eq!(None, assignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_withdraw_relay_payload() {
|
fn test_withdraw_relay_payload() {
|
||||||
let mainnet = mainnet::EthereumBridge::default();
|
let home = home::HomeBridge::default();
|
||||||
let signatures: Vec<Bytes> = vec![
|
let signatures: Vec<Bytes> = vec![
|
||||||
vec![0x11; 65].into(),
|
vec![0x11; 65].into(),
|
||||||
vec![0x22; 65].into(),
|
vec![0x22; 65].into(),
|
||||||
];
|
];
|
||||||
let message: Bytes = vec![0x33; 84].into();
|
let message: Bytes = vec![0x33; 84].into();
|
||||||
|
|
||||||
let payload = withdraw_relay_payload(&mainnet, signatures, message);
|
let payload = withdraw_relay_payload(&home, signatures, message);
|
||||||
let expected: Bytes = "9ce318f6000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000002111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222220000000000000000000000000000000000000000000000000000000000000002111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222220000000000000000000000000000000000000000000000000000000000000054333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333000000000000000000000000".from_hex().unwrap().into();
|
let expected: Bytes = "9ce318f6000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000002111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222220000000000000000000000000000000000000000000000000000000000000002111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222220000000000000000000000000000000000000000000000000000000000000054333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333000000000000000000000000".from_hex().unwrap().into();
|
||||||
assert_eq!(expected, payload);
|
assert_eq!(expected, payload);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,8 @@ const DEFAULT_TIMEOUT: u64 = 5;
|
||||||
/// Application config.
|
/// Application config.
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub mainnet: Node,
|
pub home: Node,
|
||||||
pub testnet: Node,
|
pub foreign: Node,
|
||||||
pub authorities: Authorities,
|
pub authorities: Authorities,
|
||||||
pub txs: Transactions,
|
pub txs: Transactions,
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,8 @@ impl Config {
|
||||||
|
|
||||||
fn from_load_struct(config: load::Config) -> Result<Config, Error> {
|
fn from_load_struct(config: load::Config) -> Result<Config, Error> {
|
||||||
let result = Config {
|
let result = Config {
|
||||||
mainnet: Node::from_load_struct(config.mainnet)?,
|
home: Node::from_load_struct(config.home)?,
|
||||||
testnet: Node::from_load_struct(config.testnet)?,
|
foreign: Node::from_load_struct(config.foreign)?,
|
||||||
authorities: Authorities {
|
authorities: Authorities {
|
||||||
accounts: config.authorities.accounts,
|
accounts: config.authorities.accounts,
|
||||||
required_signatures: config.authorities.required_signatures,
|
required_signatures: config.authorities.required_signatures,
|
||||||
|
@ -82,8 +82,8 @@ impl Node {
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Default, Clone)]
|
#[derive(Debug, PartialEq, Default, Clone)]
|
||||||
pub struct Transactions {
|
pub struct Transactions {
|
||||||
pub mainnet_deploy: TransactionConfig,
|
pub home_deploy: TransactionConfig,
|
||||||
pub testnet_deploy: TransactionConfig,
|
pub foreign_deploy: TransactionConfig,
|
||||||
pub deposit_relay: TransactionConfig,
|
pub deposit_relay: TransactionConfig,
|
||||||
pub withdraw_confirm: TransactionConfig,
|
pub withdraw_confirm: TransactionConfig,
|
||||||
pub withdraw_relay: TransactionConfig,
|
pub withdraw_relay: TransactionConfig,
|
||||||
|
@ -92,8 +92,8 @@ pub struct Transactions {
|
||||||
impl Transactions {
|
impl Transactions {
|
||||||
fn from_load_struct(cfg: load::Transactions) -> Self {
|
fn from_load_struct(cfg: load::Transactions) -> Self {
|
||||||
Transactions {
|
Transactions {
|
||||||
mainnet_deploy: cfg.mainnet_deploy.map(TransactionConfig::from_load_struct).unwrap_or_default(),
|
home_deploy: cfg.home_deploy.map(TransactionConfig::from_load_struct).unwrap_or_default(),
|
||||||
testnet_deploy: cfg.testnet_deploy.map(TransactionConfig::from_load_struct).unwrap_or_default(),
|
foreign_deploy: cfg.foreign_deploy.map(TransactionConfig::from_load_struct).unwrap_or_default(),
|
||||||
deposit_relay: cfg.deposit_relay.map(TransactionConfig::from_load_struct).unwrap_or_default(),
|
deposit_relay: cfg.deposit_relay.map(TransactionConfig::from_load_struct).unwrap_or_default(),
|
||||||
withdraw_confirm: cfg.withdraw_confirm.map(TransactionConfig::from_load_struct).unwrap_or_default(),
|
withdraw_confirm: cfg.withdraw_confirm.map(TransactionConfig::from_load_struct).unwrap_or_default(),
|
||||||
withdraw_relay: cfg.withdraw_relay.map(TransactionConfig::from_load_struct).unwrap_or_default(),
|
withdraw_relay: cfg.withdraw_relay.map(TransactionConfig::from_load_struct).unwrap_or_default(),
|
||||||
|
@ -137,8 +137,8 @@ mod load {
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub mainnet: Node,
|
pub home: Node,
|
||||||
pub testnet: Node,
|
pub foreign: Node,
|
||||||
pub authorities: Authorities,
|
pub authorities: Authorities,
|
||||||
pub transactions: Option<Transactions>,
|
pub transactions: Option<Transactions>,
|
||||||
}
|
}
|
||||||
|
@ -157,8 +157,8 @@ mod load {
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct Transactions {
|
pub struct Transactions {
|
||||||
pub mainnet_deploy: Option<TransactionConfig>,
|
pub home_deploy: Option<TransactionConfig>,
|
||||||
pub testnet_deploy: Option<TransactionConfig>,
|
pub foreign_deploy: Option<TransactionConfig>,
|
||||||
pub deposit_relay: Option<TransactionConfig>,
|
pub deposit_relay: Option<TransactionConfig>,
|
||||||
pub withdraw_confirm: Option<TransactionConfig>,
|
pub withdraw_confirm: Option<TransactionConfig>,
|
||||||
pub withdraw_relay: Option<TransactionConfig>,
|
pub withdraw_relay: Option<TransactionConfig>,
|
||||||
|
@ -194,21 +194,21 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn load_full_setup_from_str() {
|
fn load_full_setup_from_str() {
|
||||||
let toml = r#"
|
let toml = r#"
|
||||||
[mainnet]
|
[home]
|
||||||
account = "0x1B68Cb0B50181FC4006Ce572cF346e596E51818b"
|
account = "0x1B68Cb0B50181FC4006Ce572cF346e596E51818b"
|
||||||
ipc = "/mainnet.ipc"
|
ipc = "/home.ipc"
|
||||||
poll_interval = 2
|
poll_interval = 2
|
||||||
required_confirmations = 100
|
required_confirmations = 100
|
||||||
|
|
||||||
[mainnet.contract]
|
[home.contract]
|
||||||
bin = "../contracts/EthereumBridge.bin"
|
bin = "../contracts/HomeBridge.bin"
|
||||||
|
|
||||||
[testnet]
|
[foreign]
|
||||||
account = "0x0000000000000000000000000000000000000001"
|
account = "0x0000000000000000000000000000000000000001"
|
||||||
ipc = "/testnet.ipc"
|
ipc = "/foreign.ipc"
|
||||||
|
|
||||||
[testnet.contract]
|
[foreign.contract]
|
||||||
bin = "../contracts/KovanBridge.bin"
|
bin = "../contracts/ForeignBridge.bin"
|
||||||
|
|
||||||
[authorities]
|
[authorities]
|
||||||
accounts = [
|
accounts = [
|
||||||
|
@ -219,27 +219,27 @@ accounts = [
|
||||||
required_signatures = 2
|
required_signatures = 2
|
||||||
|
|
||||||
[transactions]
|
[transactions]
|
||||||
mainnet_deploy = { gas = 20 }
|
home_deploy = { gas = 20 }
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
let mut expected = Config {
|
let mut expected = Config {
|
||||||
txs: Transactions::default(),
|
txs: Transactions::default(),
|
||||||
mainnet: Node {
|
home: Node {
|
||||||
account: "0x1B68Cb0B50181FC4006Ce572cF346e596E51818b".parse().unwrap(),
|
account: "0x1B68Cb0B50181FC4006Ce572cF346e596E51818b".parse().unwrap(),
|
||||||
ipc: "/mainnet.ipc".into(),
|
ipc: "/home.ipc".into(),
|
||||||
contract: ContractConfig {
|
contract: ContractConfig {
|
||||||
bin: include_str!("../../contracts/EthereumBridge.bin").from_hex().unwrap().into(),
|
bin: include_str!("../../contracts/HomeBridge.bin").from_hex().unwrap().into(),
|
||||||
},
|
},
|
||||||
poll_interval: Duration::from_secs(2),
|
poll_interval: Duration::from_secs(2),
|
||||||
request_timeout: Duration::from_secs(5),
|
request_timeout: Duration::from_secs(5),
|
||||||
required_confirmations: 100,
|
required_confirmations: 100,
|
||||||
},
|
},
|
||||||
testnet: Node {
|
foreign: Node {
|
||||||
account: "0x0000000000000000000000000000000000000001".parse().unwrap(),
|
account: "0x0000000000000000000000000000000000000001".parse().unwrap(),
|
||||||
contract: ContractConfig {
|
contract: ContractConfig {
|
||||||
bin: include_str!("../../contracts/KovanBridge.bin").from_hex().unwrap().into(),
|
bin: include_str!("../../contracts/ForeignBridge.bin").from_hex().unwrap().into(),
|
||||||
},
|
},
|
||||||
ipc: "/testnet.ipc".into(),
|
ipc: "/foreign.ipc".into(),
|
||||||
poll_interval: Duration::from_secs(1),
|
poll_interval: Duration::from_secs(1),
|
||||||
request_timeout: Duration::from_secs(5),
|
request_timeout: Duration::from_secs(5),
|
||||||
required_confirmations: 12,
|
required_confirmations: 12,
|
||||||
|
@ -254,7 +254,7 @@ mainnet_deploy = { gas = 20 }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
expected.txs.mainnet_deploy = TransactionConfig {
|
expected.txs.home_deploy = TransactionConfig {
|
||||||
gas: 20,
|
gas: 20,
|
||||||
gas_price: 0,
|
gas_price: 0,
|
||||||
};
|
};
|
||||||
|
@ -266,19 +266,19 @@ mainnet_deploy = { gas = 20 }
|
||||||
#[test]
|
#[test]
|
||||||
fn load_minimal_setup_from_str() {
|
fn load_minimal_setup_from_str() {
|
||||||
let toml = r#"
|
let toml = r#"
|
||||||
[mainnet]
|
[home]
|
||||||
account = "0x1B68Cb0B50181FC4006Ce572cF346e596E51818b"
|
account = "0x1B68Cb0B50181FC4006Ce572cF346e596E51818b"
|
||||||
ipc = ""
|
ipc = ""
|
||||||
|
|
||||||
[mainnet.contract]
|
[home.contract]
|
||||||
bin = "../contracts/EthereumBridge.bin"
|
bin = "../contracts/HomeBridge.bin"
|
||||||
|
|
||||||
[testnet]
|
[foreign]
|
||||||
account = "0x0000000000000000000000000000000000000001"
|
account = "0x0000000000000000000000000000000000000001"
|
||||||
ipc = ""
|
ipc = ""
|
||||||
|
|
||||||
[testnet.contract]
|
[foreign.contract]
|
||||||
bin = "../contracts/KovanBridge.bin"
|
bin = "../contracts/ForeignBridge.bin"
|
||||||
|
|
||||||
[authorities]
|
[authorities]
|
||||||
accounts = [
|
accounts = [
|
||||||
|
@ -290,21 +290,21 @@ required_signatures = 2
|
||||||
"#;
|
"#;
|
||||||
let expected = Config {
|
let expected = Config {
|
||||||
txs: Transactions::default(),
|
txs: Transactions::default(),
|
||||||
mainnet: Node {
|
home: Node {
|
||||||
account: "0x1B68Cb0B50181FC4006Ce572cF346e596E51818b".parse().unwrap(),
|
account: "0x1B68Cb0B50181FC4006Ce572cF346e596E51818b".parse().unwrap(),
|
||||||
ipc: "".into(),
|
ipc: "".into(),
|
||||||
contract: ContractConfig {
|
contract: ContractConfig {
|
||||||
bin: include_str!("../../contracts/EthereumBridge.bin").from_hex().unwrap().into(),
|
bin: include_str!("../../contracts/HomeBridge.bin").from_hex().unwrap().into(),
|
||||||
},
|
},
|
||||||
poll_interval: Duration::from_secs(1),
|
poll_interval: Duration::from_secs(1),
|
||||||
request_timeout: Duration::from_secs(5),
|
request_timeout: Duration::from_secs(5),
|
||||||
required_confirmations: 12,
|
required_confirmations: 12,
|
||||||
},
|
},
|
||||||
testnet: Node {
|
foreign: Node {
|
||||||
account: "0x0000000000000000000000000000000000000001".parse().unwrap(),
|
account: "0x0000000000000000000000000000000000000001".parse().unwrap(),
|
||||||
ipc: "".into(),
|
ipc: "".into(),
|
||||||
contract: ContractConfig {
|
contract: ContractConfig {
|
||||||
bin: include_str!("../../contracts/KovanBridge.bin").from_hex().unwrap().into(),
|
bin: include_str!("../../contracts/ForeignBridge.bin").from_hex().unwrap().into(),
|
||||||
},
|
},
|
||||||
poll_interval: Duration::from_secs(1),
|
poll_interval: Duration::from_secs(1),
|
||||||
request_timeout: Duration::from_secs(5),
|
request_timeout: Duration::from_secs(5),
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
use_contract!(mainnet, "EthereumBridge", "../contracts/EthereumBridge.abi");
|
use_contract!(home, "HomeBridge", "../contracts/HomeBridge.abi");
|
||||||
use_contract!(testnet, "KovanBridge", "../contracts/KovanBridge.abi");
|
use_contract!(foreign, "ForeignBridge", "../contracts/ForeignBridge.abi");
|
||||||
|
|
|
@ -8,14 +8,14 @@ use error::{Error, ResultExt, ErrorKind};
|
||||||
/// Application "database".
|
/// Application "database".
|
||||||
#[derive(Debug, PartialEq, Deserialize, Serialize, Default, Clone)]
|
#[derive(Debug, PartialEq, Deserialize, Serialize, Default, Clone)]
|
||||||
pub struct Database {
|
pub struct Database {
|
||||||
/// Address of mainnet contract.
|
/// Address of home contract.
|
||||||
pub mainnet_contract_address: Address,
|
pub home_contract_address: Address,
|
||||||
/// Address of testnet contract.
|
/// Address of foreign contract.
|
||||||
pub testnet_contract_address: Address,
|
pub foreign_contract_address: Address,
|
||||||
/// Number of block at which mainnet contract has been deployed.
|
/// Number of block at which home contract has been deployed.
|
||||||
pub mainnet_deploy: u64,
|
pub home_deploy: u64,
|
||||||
/// Number of block at which testnet contract has been deployed.
|
/// Number of block at which foreign contract has been deployed.
|
||||||
pub testnet_deploy: u64,
|
pub foreign_deploy: u64,
|
||||||
/// Number of last block which has been checked for deposit relays.
|
/// Number of last block which has been checked for deposit relays.
|
||||||
pub checked_deposit_relay: u64,
|
pub checked_deposit_relay: u64,
|
||||||
/// Number of last block which has been checked for withdraw relays.
|
/// Number of last block which has been checked for withdraw relays.
|
||||||
|
@ -64,20 +64,20 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn database_to_and_from_str() {
|
fn database_to_and_from_str() {
|
||||||
let toml =
|
let toml =
|
||||||
r#"mainnet_contract_address = "0x49edf201c1e139282643d5e7c6fb0c7219ad1db7"
|
r#"home_contract_address = "0x49edf201c1e139282643d5e7c6fb0c7219ad1db7"
|
||||||
testnet_contract_address = "0x49edf201c1e139282643d5e7c6fb0c7219ad1db8"
|
foreign_contract_address = "0x49edf201c1e139282643d5e7c6fb0c7219ad1db8"
|
||||||
mainnet_deploy = 100
|
home_deploy = 100
|
||||||
testnet_deploy = 101
|
foreign_deploy = 101
|
||||||
checked_deposit_relay = 120
|
checked_deposit_relay = 120
|
||||||
checked_withdraw_relay = 121
|
checked_withdraw_relay = 121
|
||||||
checked_withdraw_confirm = 121
|
checked_withdraw_confirm = 121
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
let expected = Database {
|
let expected = Database {
|
||||||
mainnet_contract_address: "0x49edf201c1e139282643d5e7c6fb0c7219ad1db7".parse().unwrap(),
|
home_contract_address: "0x49edf201c1e139282643d5e7c6fb0c7219ad1db7".parse().unwrap(),
|
||||||
testnet_contract_address: "0x49edf201c1e139282643d5e7c6fb0c7219ad1db8".parse().unwrap(),
|
foreign_contract_address: "0x49edf201c1e139282643d5e7c6fb0c7219ad1db8".parse().unwrap(),
|
||||||
mainnet_deploy: 100,
|
home_deploy: 100,
|
||||||
testnet_deploy: 101,
|
foreign_deploy: 101,
|
||||||
checked_deposit_relay: 120,
|
checked_deposit_relay: 120,
|
||||||
checked_withdraw_relay: 121,
|
checked_withdraw_relay: 121,
|
||||||
checked_withdraw_confirm: 121,
|
checked_withdraw_confirm: 121,
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
60606040523415600e57600080fd5b603580601b6000396000f3006060604052600080fd00a165627a7a72305820c733ecef2aa1d616125ac7e6e57619bb9be23be96002392497d6de20de2eb7520029
|
60606040523415600e57600080fd5b603580601b6000396000f3006060604052600080fd00a165627a7a723058201dad5c43bba0bffc89ca5cf275cee04095a323df75058b9e5cfb736e54381f790029
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
||||||
60606040523415600e57600080fd5b603580601b6000396000f3006060604052600080fd00a165627a7a7230582010abed03fe6aaf49bc220a827f9623bba69e66c12cc9ff0cacca576d64435e8a0029
|
60606040523415600e57600080fd5b603580601b6000396000f3006060604052600080fd00a165627a7a723058204971c18e0e1ddf69fded6644effcdb50c80ccc6d5a8aa81fe9fbfa53e1b68d100029
|
|
@ -1 +1 @@
|
||||||
6060604052341561000f57600080fd5b6105818061001e6000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680631c7ede5f1461003d57600080fd5b6100d0600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610112565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600061011e8383610126565b905092915050565b6000806000806041865114151561013c57600080fd5b602086015192506040860151915060608601519050600161015c8661020e565b827f010000000000000000000000000000000000000000000000000000000000000090048585604051600081526020016040526000604051602001526040518085600019166000191681526020018460ff1660ff16815260200183600019166000191681526020018260001916600019168152602001945050505050602060405160208103908084039060008661646e5a03f115156101fa57600080fd5b505060206040510351935050505092915050565b600061021861052d565b6040805190810160405280601a81526020017f19457468657265756d205369676e6564204d6573736167653a0a00000000000081525090508061025b845161036e565b846040518084805190602001908083835b602083101515610291578051825260208201915060208101905060208303925061026c565b6001836020036101000a03801982511681845116808217855250505050505090500183805190602001908083835b6020831015156102e457805182526020820191506020810190506020830392506102bf565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b6020831015156103375780518252602082019150602081019050602083039250610312565b6001836020036101000a03801982511681845116808217855250505050505090500193505050506040518091039020915050919050565b610376610541565b61037e61052d565b60008061038961052d565b6000600860405180591061039a5750595b90808252806020026020018201604052509450600093505b60008714151561044957600a878115156103c857fe5b069250600a878115156103d757fe5b049650826030017f010000000000000000000000000000000000000000000000000000000000000002858580600101965081518110151561041457fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506103b2565b836040518059106104575750595b90808252806020026020018201604052509150600090505b83811015610520578460018286030381518110151561048a57fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f01000000000000000000000000000000000000000000000000000000000000000282828151811015156104e357fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350808060010191505061046f565b8195505050505050919050565b602060405190810160405280600081525090565b6020604051908101604052806000815250905600a165627a7a723058207b8a7203a547fd5753097cda5f928c1e787042c695f02c19fc78789fd45789800029
|
6060604052341561000f57600080fd5b6105818061001e6000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680631c7ede5f1461003d57600080fd5b6100d0600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610112565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600061011e8383610126565b905092915050565b6000806000806041865114151561013c57600080fd5b602086015192506040860151915060608601519050600161015c8661020e565b827f010000000000000000000000000000000000000000000000000000000000000090048585604051600081526020016040526000604051602001526040518085600019166000191681526020018460ff1660ff16815260200183600019166000191681526020018260001916600019168152602001945050505050602060405160208103908084039060008661646e5a03f115156101fa57600080fd5b505060206040510351935050505092915050565b600061021861052d565b6040805190810160405280601a81526020017f19457468657265756d205369676e6564204d6573736167653a0a00000000000081525090508061025b845161036e565b846040518084805190602001908083835b602083101515610291578051825260208201915060208101905060208303925061026c565b6001836020036101000a03801982511681845116808217855250505050505090500183805190602001908083835b6020831015156102e457805182526020820191506020810190506020830392506102bf565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b6020831015156103375780518252602082019150602081019050602083039250610312565b6001836020036101000a03801982511681845116808217855250505050505090500193505050506040518091039020915050919050565b610376610541565b61037e61052d565b60008061038961052d565b6000600860405180591061039a5750595b90808252806020026020018201604052509450600093505b60008714151561044957600a878115156103c857fe5b069250600a878115156103d757fe5b049650826030017f010000000000000000000000000000000000000000000000000000000000000002858580600101965081518110151561041457fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506103b2565b836040518059106104575750595b90808252806020026020018201604052509150600090505b83811015610520578460018286030381518110151561048a57fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f01000000000000000000000000000000000000000000000000000000000000000282828151811015156104e357fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350808060010191505061046f565b8195505050505050919050565b602060405190810160405280600081525090565b6020604051908101604052806000815250905600a165627a7a72305820fb76108a72fef4e281cb9e45df4aa8d8c33dcc5bff00ea6f7e5d9719a27745260029
|
|
@ -1 +1 @@
|
||||||
60606040523415600e57600080fd5b603580601b6000396000f3006060604052600080fd00a165627a7a72305820daa411d194914efc8a9b3681d5e8f795a940401e0a2d5ecb20e17c1036e123190029
|
60606040523415600e57600080fd5b603580601b6000396000f3006060604052600080fd00a165627a7a723058200905d3e14b8b5697c0ffc99aac06fac68a87f03b29568419dadf089de31f7f130029
|
|
@ -63,7 +63,7 @@ library Signer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
contract EthereumBridge {
|
contract HomeBridge {
|
||||||
using Authorities for address[];
|
using Authorities for address[];
|
||||||
|
|
||||||
/// Number of authorities signatures required to withdraw the money.
|
/// Number of authorities signatures required to withdraw the money.
|
||||||
|
@ -74,7 +74,7 @@ contract EthereumBridge {
|
||||||
/// Contract authorities.
|
/// Contract authorities.
|
||||||
address[] public authorities;
|
address[] public authorities;
|
||||||
|
|
||||||
/// Used kovan transaction hashes.
|
/// Used foreign transaction hashes.
|
||||||
mapping (bytes32 => bool) withdraws;
|
mapping (bytes32 => bool) withdraws;
|
||||||
|
|
||||||
/// Event created on money deposit.
|
/// Event created on money deposit.
|
||||||
|
@ -100,7 +100,7 @@ contract EthereumBridge {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Constructor.
|
/// Constructor.
|
||||||
function EthereumBridge (uint n, address[] a) {
|
function HomeBridge (uint n, address[] a) {
|
||||||
require(n != 0);
|
require(n != 0);
|
||||||
require(n <= a.length);
|
require(n <= a.length);
|
||||||
requiredSignatures = n;
|
requiredSignatures = n;
|
||||||
|
@ -117,7 +117,7 @@ contract EthereumBridge {
|
||||||
/// message contains:
|
/// message contains:
|
||||||
/// withdrawal recipient (bytes20)
|
/// withdrawal recipient (bytes20)
|
||||||
/// withdrawal value (uint)
|
/// withdrawal value (uint)
|
||||||
/// kovan transaction hash (bytes32) // to avoid transaction duplication
|
/// foreign transaction hash (bytes32) // to avoid transaction duplication
|
||||||
function withdraw (uint8[] v, bytes32[] r, bytes32[] s, bytes message) allAuthorities(v, r, s, message) {
|
function withdraw (uint8[] v, bytes32[] r, bytes32[] s, bytes message) allAuthorities(v, r, s, message) {
|
||||||
address recipient;
|
address recipient;
|
||||||
uint value;
|
uint value;
|
||||||
|
@ -138,7 +138,7 @@ contract EthereumBridge {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
contract KovanBridge {
|
contract ForeignBridge {
|
||||||
using Authorities for address[];
|
using Authorities for address[];
|
||||||
|
|
||||||
struct SignaturesCollection {
|
struct SignaturesCollection {
|
||||||
|
@ -176,11 +176,11 @@ contract KovanBridge {
|
||||||
/// Event created on money transfer
|
/// Event created on money transfer
|
||||||
event Transfer(address from, address to, uint value);
|
event Transfer(address from, address to, uint value);
|
||||||
|
|
||||||
/// Collected signatures which should be relayed to ethereum chain.
|
/// Collected signatures which should be relayed to home chain.
|
||||||
event CollectedSignatures(address authority, bytes32 messageHash);
|
event CollectedSignatures(address authority, bytes32 messageHash);
|
||||||
|
|
||||||
/// Constructor.
|
/// Constructor.
|
||||||
function KovanBridge(uint n, address[] a) {
|
function ForeignBridge(uint n, address[] a) {
|
||||||
require(n != 0);
|
require(n != 0);
|
||||||
require(n <= a.length);
|
require(n <= a.length);
|
||||||
requiredSignatures = n;
|
requiredSignatures = n;
|
||||||
|
@ -233,7 +233,7 @@ contract KovanBridge {
|
||||||
/// for withdraw message contains:
|
/// for withdraw message contains:
|
||||||
/// withdrawal recipient (bytes20)
|
/// withdrawal recipient (bytes20)
|
||||||
/// withdrawal value (uint)
|
/// withdrawal value (uint)
|
||||||
/// kovan transaction hash (bytes32) // to avoid transaction duplication
|
/// foreign transaction hash (bytes32) // to avoid transaction duplication
|
||||||
function submitSignature (bytes signature, bytes message) onlyAuthority() {
|
function submitSignature (bytes signature, bytes message) onlyAuthority() {
|
||||||
// Validate submited signatures
|
// Validate submited signatures
|
||||||
require(Signer.signer(signature, message) == msg.sender);
|
require(Signer.signer(signature, message) == msg.sender);
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
[mainnet]
|
[home]
|
||||||
account = "0x006e27b6a72e1f34c626762f3c4761547aff1421"
|
account = "0x006e27b6a72e1f34c626762f3c4761547aff1421"
|
||||||
ipc = "/Users/marek/Library/Application Support/io.parity.ethereum/jsonrpc.ipc"
|
ipc = "/Users/marek/Library/Application Support/io.parity.ethereum/jsonrpc.ipc"
|
||||||
required_confirmations = 0
|
required_confirmations = 0
|
||||||
|
|
||||||
[mainnet.contract]
|
[home.contract]
|
||||||
bin = "contracts/EthereumBridge.bin"
|
bin = "contracts/EthereumBridge.bin"
|
||||||
|
|
||||||
[testnet]
|
[foreign]
|
||||||
account = "0x006e27b6a72e1f34c626762f3c4761547aff1421"
|
account = "0x006e27b6a72e1f34c626762f3c4761547aff1421"
|
||||||
ipc = "/Users/marek/Library/Application Support/io.parity.ethereum/jsonrpc.ipc"
|
ipc = "/Users/marek/Library/Application Support/io.parity.ethereum/jsonrpc.ipc"
|
||||||
required_confirmations = 0
|
required_confirmations = 0
|
||||||
|
|
||||||
[testnet.contract]
|
[foreign.contract]
|
||||||
bin = "contracts/KovanBridge.bin"
|
bin = "contracts/KovanBridge.bin"
|
||||||
|
|
||||||
[authorities]
|
[authorities]
|
||||||
|
@ -21,6 +21,6 @@ accounts = [
|
||||||
required_signatures = 1
|
required_signatures = 1
|
||||||
|
|
||||||
[transactions]
|
[transactions]
|
||||||
mainnet_deploy = { gas = 1000000 }
|
home_deploy = { gas = 1000000 }
|
||||||
testnet_deploy = { gas = 3000000 }
|
foreign_deploy = { gas = 3000000 }
|
||||||
deposit_relay = { gas = 100000 }
|
deposit_relay = { gas = 100000 }
|
||||||
|
|
|
@ -78,14 +78,14 @@ macro_rules! test_app_stream {
|
||||||
(
|
(
|
||||||
name => $name: ident,
|
name => $name: ident,
|
||||||
database => $db: expr,
|
database => $db: expr,
|
||||||
mainnet => account => $mainnet_acc: expr, confirmations => $mainnet_conf: expr;
|
home => account => $home_acc: expr, confirmations => $home_conf: expr;
|
||||||
testnet => account => $testnet_acc: expr, confirmations => $testnet_conf: expr;
|
foreign => account => $foreign_acc: expr, confirmations => $foreign_conf: expr;
|
||||||
authorities => accounts => $authorities_accs: expr, signatures => $signatures: expr;
|
authorities => accounts => $authorities_accs: expr, signatures => $signatures: expr;
|
||||||
txs => $txs: expr,
|
txs => $txs: expr,
|
||||||
init => $init_stream: expr,
|
init => $init_stream: expr,
|
||||||
expected => $expected: expr,
|
expected => $expected: expr,
|
||||||
mainnet_transport => [$($mainnet_method: expr => req => $mainnet_req: expr, res => $mainnet_res: expr ;)*],
|
home_transport => [$($home_method: expr => req => $home_req: expr, res => $home_res: expr ;)*],
|
||||||
testnet_transport => [$($testnet_method: expr => req => $testnet_req: expr, res => $testnet_res: expr ;)*]
|
foreign_transport => [$($foreign_method: expr => req => $foreign_req: expr, res => $foreign_res: expr ;)*]
|
||||||
) => {
|
) => {
|
||||||
#[test]
|
#[test]
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
|
@ -94,43 +94,43 @@ macro_rules! test_app_stream {
|
||||||
use self::std::time::Duration;
|
use self::std::time::Duration;
|
||||||
use self::futures::{Future, Stream};
|
use self::futures::{Future, Stream};
|
||||||
use self::bridge::app::{App, Connections};
|
use self::bridge::app::{App, Connections};
|
||||||
use self::bridge::contracts::{testnet, mainnet};
|
use self::bridge::contracts::{foreign, home};
|
||||||
use self::bridge::config::{Config, Authorities, Node, ContractConfig, Transactions, TransactionConfig};
|
use self::bridge::config::{Config, Authorities, Node, ContractConfig, Transactions, TransactionConfig};
|
||||||
use self::bridge::database::Database;
|
use self::bridge::database::Database;
|
||||||
|
|
||||||
let mainnet = $crate::MockedTransport {
|
let home = $crate::MockedTransport {
|
||||||
requests: Default::default(),
|
requests: Default::default(),
|
||||||
expected_requests: vec![$($mainnet_method),*].into_iter().zip(vec![$($mainnet_req),*].into_iter()).map(Into::into).collect(),
|
expected_requests: vec![$($home_method),*].into_iter().zip(vec![$($home_req),*].into_iter()).map(Into::into).collect(),
|
||||||
mocked_responses: vec![$($mainnet_res),*],
|
mocked_responses: vec![$($home_res),*],
|
||||||
};
|
};
|
||||||
|
|
||||||
let testnet = $crate::MockedTransport {
|
let foreign = $crate::MockedTransport {
|
||||||
requests: Default::default(),
|
requests: Default::default(),
|
||||||
expected_requests: vec![$($testnet_method),*].into_iter().zip(vec![$($testnet_req),*].into_iter()).map(Into::into).collect(),
|
expected_requests: vec![$($foreign_method),*].into_iter().zip(vec![$($foreign_req),*].into_iter()).map(Into::into).collect(),
|
||||||
mocked_responses: vec![$($testnet_res),*],
|
mocked_responses: vec![$($foreign_res),*],
|
||||||
};
|
};
|
||||||
|
|
||||||
let config = Config {
|
let config = Config {
|
||||||
txs: $txs,
|
txs: $txs,
|
||||||
mainnet: Node {
|
home: Node {
|
||||||
account: $mainnet_acc.parse().unwrap(),
|
account: $home_acc.parse().unwrap(),
|
||||||
ipc: "".into(),
|
ipc: "".into(),
|
||||||
contract: ContractConfig {
|
contract: ContractConfig {
|
||||||
bin: Default::default(),
|
bin: Default::default(),
|
||||||
},
|
},
|
||||||
poll_interval: Duration::from_secs(0),
|
poll_interval: Duration::from_secs(0),
|
||||||
request_timeout: Duration::from_secs(5),
|
request_timeout: Duration::from_secs(5),
|
||||||
required_confirmations: $mainnet_conf,
|
required_confirmations: $home_conf,
|
||||||
},
|
},
|
||||||
testnet: Node {
|
foreign: Node {
|
||||||
account: $testnet_acc.parse().unwrap(),
|
account: $foreign_acc.parse().unwrap(),
|
||||||
ipc: "".into(),
|
ipc: "".into(),
|
||||||
contract: ContractConfig {
|
contract: ContractConfig {
|
||||||
bin: Default::default(),
|
bin: Default::default(),
|
||||||
},
|
},
|
||||||
poll_interval: Duration::from_secs(0),
|
poll_interval: Duration::from_secs(0),
|
||||||
request_timeout: Duration::from_secs(5),
|
request_timeout: Duration::from_secs(5),
|
||||||
required_confirmations: $testnet_conf,
|
required_confirmations: $foreign_conf,
|
||||||
},
|
},
|
||||||
authorities: Authorities {
|
authorities: Authorities {
|
||||||
accounts: $authorities_accs.iter().map(|a: &&str| a.parse().unwrap()).collect(),
|
accounts: $authorities_accs.iter().map(|a: &&str| a.parse().unwrap()).collect(),
|
||||||
|
@ -142,11 +142,11 @@ macro_rules! test_app_stream {
|
||||||
config,
|
config,
|
||||||
database_path: "".into(),
|
database_path: "".into(),
|
||||||
connections: Connections {
|
connections: Connections {
|
||||||
mainnet: &mainnet,
|
home: &home,
|
||||||
testnet: &testnet,
|
foreign: &foreign,
|
||||||
},
|
},
|
||||||
mainnet_bridge: mainnet::EthereumBridge::default(),
|
home_bridge: home::HomeBridge::default(),
|
||||||
testnet_bridge: testnet::KovanBridge::default(),
|
foreign_bridge: foreign::ForeignBridge::default(),
|
||||||
timer: Default::default(),
|
timer: Default::default(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,10 @@ use bridge::bridge::create_deposit_relay;
|
||||||
test_app_stream! {
|
test_app_stream! {
|
||||||
name => deposit_relay_basic,
|
name => deposit_relay_basic,
|
||||||
database => Database::default(),
|
database => Database::default(),
|
||||||
mainnet =>
|
home =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
testnet =>
|
foreign =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
authorities =>
|
authorities =>
|
||||||
|
@ -23,7 +23,7 @@ test_app_stream! {
|
||||||
txs => Transactions::default(),
|
txs => Transactions::default(),
|
||||||
init => |app, db| create_deposit_relay(app, db).take(2),
|
init => |app, db| create_deposit_relay(app, db).take(2),
|
||||||
expected => vec![0x1005, 0x1006],
|
expected => vec![0x1005, 0x1006],
|
||||||
mainnet_transport => [
|
home_transport => [
|
||||||
"eth_blockNumber" =>
|
"eth_blockNumber" =>
|
||||||
req => r#"[]"#,
|
req => r#"[]"#,
|
||||||
res => r#""0x1011""#;
|
res => r#""0x1011""#;
|
||||||
|
@ -37,7 +37,7 @@ test_app_stream! {
|
||||||
req => r#"[{"address":["0x0000000000000000000000000000000000000000"],"fromBlock":"0x1006","limit":null,"toBlock":"0x1006","topics":[["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"],null,null,null]}]"#,
|
req => r#"[{"address":["0x0000000000000000000000000000000000000000"],"fromBlock":"0x1006","limit":null,"toBlock":"0x1006","topics":[["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"],null,null,null]}]"#,
|
||||||
res => r#"[]"#;
|
res => r#"[]"#;
|
||||||
],
|
],
|
||||||
testnet_transport => []
|
foreign_transport => []
|
||||||
}
|
}
|
||||||
|
|
||||||
test_app_stream! {
|
test_app_stream! {
|
||||||
|
@ -46,10 +46,10 @@ test_app_stream! {
|
||||||
checked_deposit_relay: 5,
|
checked_deposit_relay: 5,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
mainnet =>
|
home =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
testnet =>
|
foreign =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
authorities =>
|
authorities =>
|
||||||
|
@ -61,7 +61,7 @@ test_app_stream! {
|
||||||
txs => Transactions::default(),
|
txs => Transactions::default(),
|
||||||
init => |app, db| create_deposit_relay(app, db).take(2),
|
init => |app, db| create_deposit_relay(app, db).take(2),
|
||||||
expected => vec![0x1005, 0x1006],
|
expected => vec![0x1005, 0x1006],
|
||||||
mainnet_transport => [
|
home_transport => [
|
||||||
"eth_blockNumber" =>
|
"eth_blockNumber" =>
|
||||||
req => r#"[]"#,
|
req => r#"[]"#,
|
||||||
res => r#""0x1011""#;
|
res => r#""0x1011""#;
|
||||||
|
@ -75,7 +75,7 @@ test_app_stream! {
|
||||||
req => r#"[{"address":["0x0000000000000000000000000000000000000000"],"fromBlock":"0x1006","limit":null,"toBlock":"0x1006","topics":[["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"],null,null,null]}]"#,
|
req => r#"[{"address":["0x0000000000000000000000000000000000000000"],"fromBlock":"0x1006","limit":null,"toBlock":"0x1006","topics":[["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"],null,null,null]}]"#,
|
||||||
res => r#"[]"#;
|
res => r#"[]"#;
|
||||||
],
|
],
|
||||||
testnet_transport => [
|
foreign_transport => [
|
||||||
"eth_sendTransaction" =>
|
"eth_sendTransaction" =>
|
||||||
req => r#"[{"data":"0x26b3293f000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364","from":"0x0000000000000000000000000000000000000001","gas":"0x0","gasPrice":"0x0","to":"0x0000000000000000000000000000000000000000"}]"#,
|
req => r#"[{"data":"0x26b3293f000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364","from":"0x0000000000000000000000000000000000000001","gas":"0x0","gasPrice":"0x0","to":"0x0000000000000000000000000000000000000000"}]"#,
|
||||||
res => r#""0x1db8f385535c0d178b8f40016048f3a3cffee8f94e68978ea4b277f57b638f0b""#;
|
res => r#""0x1db8f385535c0d178b8f40016048f3a3cffee8f94e68978ea4b277f57b638f0b""#;
|
||||||
|
@ -88,10 +88,10 @@ test_app_stream! {
|
||||||
checked_deposit_relay: 5,
|
checked_deposit_relay: 5,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
mainnet =>
|
home =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
testnet =>
|
foreign =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
authorities =>
|
authorities =>
|
||||||
|
@ -109,7 +109,7 @@ test_app_stream! {
|
||||||
},
|
},
|
||||||
init => |app, db| create_deposit_relay(app, db).take(1),
|
init => |app, db| create_deposit_relay(app, db).take(1),
|
||||||
expected => vec![0x1005],
|
expected => vec![0x1005],
|
||||||
mainnet_transport => [
|
home_transport => [
|
||||||
"eth_blockNumber" =>
|
"eth_blockNumber" =>
|
||||||
req => r#"[]"#,
|
req => r#"[]"#,
|
||||||
res => r#""0x1011""#;
|
res => r#""0x1011""#;
|
||||||
|
@ -117,7 +117,7 @@ test_app_stream! {
|
||||||
req => r#"[{"address":["0x0000000000000000000000000000000000000000"],"fromBlock":"0x6","limit":null,"toBlock":"0x1005","topics":[["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"],null,null,null]}]"#,
|
req => r#"[{"address":["0x0000000000000000000000000000000000000000"],"fromBlock":"0x6","limit":null,"toBlock":"0x1005","topics":[["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"],null,null,null]}]"#,
|
||||||
res => r#"[{"address":"0x0000000000000000000000000000000000000000","topics":["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"],"data":"0x000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0","type":"","transactionHash":"0x884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364"}]"#;
|
res => r#"[{"address":"0x0000000000000000000000000000000000000000","topics":["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"],"data":"0x000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0","type":"","transactionHash":"0x884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364"}]"#;
|
||||||
],
|
],
|
||||||
testnet_transport => [
|
foreign_transport => [
|
||||||
"eth_sendTransaction" =>
|
"eth_sendTransaction" =>
|
||||||
req => r#"[{"data":"0x26b3293f000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364","from":"0x0000000000000000000000000000000000000001","gas":"0xfd","gasPrice":"0xa0","to":"0x0000000000000000000000000000000000000000"}]"#,
|
req => r#"[{"data":"0x26b3293f000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364","from":"0x0000000000000000000000000000000000000001","gas":"0xfd","gasPrice":"0xa0","to":"0x0000000000000000000000000000000000000000"}]"#,
|
||||||
res => r#""0x1db8f385535c0d178b8f40016048f3a3cffee8f94e68978ea4b277f57b638f0b""#;
|
res => r#""0x1db8f385535c0d178b8f40016048f3a3cffee8f94e68978ea4b277f57b638f0b""#;
|
||||||
|
@ -127,14 +127,14 @@ test_app_stream! {
|
||||||
test_app_stream! {
|
test_app_stream! {
|
||||||
name => deposit_relay_contract_address,
|
name => deposit_relay_contract_address,
|
||||||
database => Database {
|
database => Database {
|
||||||
mainnet_contract_address: "0x0000000000000000000000000000000000000cc1".parse().unwrap(),
|
home_contract_address: "0x0000000000000000000000000000000000000cc1".parse().unwrap(),
|
||||||
testnet_contract_address: "0x0000000000000000000000000000000000000dd1".parse().unwrap(),
|
foreign_contract_address: "0x0000000000000000000000000000000000000dd1".parse().unwrap(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
mainnet =>
|
home =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
testnet =>
|
foreign =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
authorities =>
|
authorities =>
|
||||||
|
@ -146,7 +146,7 @@ test_app_stream! {
|
||||||
txs => Transactions::default(),
|
txs => Transactions::default(),
|
||||||
init => |app, db| create_deposit_relay(app, db).take(1),
|
init => |app, db| create_deposit_relay(app, db).take(1),
|
||||||
expected => vec![0x1005],
|
expected => vec![0x1005],
|
||||||
mainnet_transport => [
|
home_transport => [
|
||||||
"eth_blockNumber" =>
|
"eth_blockNumber" =>
|
||||||
req => r#"[]"#,
|
req => r#"[]"#,
|
||||||
res => r#""0x1011""#;
|
res => r#""0x1011""#;
|
||||||
|
@ -154,7 +154,7 @@ test_app_stream! {
|
||||||
req => r#"[{"address":["0x0000000000000000000000000000000000000cc1"],"fromBlock":"0x1","limit":null,"toBlock":"0x1005","topics":[["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"],null,null,null]}]"#,
|
req => r#"[{"address":["0x0000000000000000000000000000000000000cc1"],"fromBlock":"0x1","limit":null,"toBlock":"0x1005","topics":[["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"],null,null,null]}]"#,
|
||||||
res => r#"[{"address":"0x0000000000000000000000000000000000000cc1","topics":["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"],"data":"0x000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0","type":"","transactionHash":"0x884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364"}]"#;
|
res => r#"[{"address":"0x0000000000000000000000000000000000000cc1","topics":["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"],"data":"0x000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0","type":"","transactionHash":"0x884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364"}]"#;
|
||||||
],
|
],
|
||||||
testnet_transport => [
|
foreign_transport => [
|
||||||
"eth_sendTransaction" =>
|
"eth_sendTransaction" =>
|
||||||
req => r#"[{"data":"0x26b3293f000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364","from":"0x0000000000000000000000000000000000000001","gas":"0x0","gasPrice":"0x0","to":"0x0000000000000000000000000000000000000dd1"}]"#,
|
req => r#"[{"data":"0x26b3293f000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364","from":"0x0000000000000000000000000000000000000001","gas":"0x0","gasPrice":"0x0","to":"0x0000000000000000000000000000000000000dd1"}]"#,
|
||||||
res => r#""0x1db8f385535c0d178b8f40016048f3a3cffee8f94e68978ea4b277f57b638f0b""#;
|
res => r#""0x1db8f385535c0d178b8f40016048f3a3cffee8f94e68978ea4b277f57b638f0b""#;
|
||||||
|
@ -164,14 +164,14 @@ test_app_stream! {
|
||||||
test_app_stream! {
|
test_app_stream! {
|
||||||
name => deposit_relay_accounts,
|
name => deposit_relay_accounts,
|
||||||
database => Database {
|
database => Database {
|
||||||
mainnet_contract_address: "0x0000000000000000000000000000000000000cc1".parse().unwrap(),
|
home_contract_address: "0x0000000000000000000000000000000000000cc1".parse().unwrap(),
|
||||||
testnet_contract_address: "0x0000000000000000000000000000000000000dd1".parse().unwrap(),
|
foreign_contract_address: "0x0000000000000000000000000000000000000dd1".parse().unwrap(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
mainnet =>
|
home =>
|
||||||
account => "0x00000000000000000000000000000000000000ff",
|
account => "0x00000000000000000000000000000000000000ff",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
testnet =>
|
foreign =>
|
||||||
account => "0x00000000000000000000000000000000000000ee",
|
account => "0x00000000000000000000000000000000000000ee",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
authorities =>
|
authorities =>
|
||||||
|
@ -183,7 +183,7 @@ test_app_stream! {
|
||||||
txs => Transactions::default(),
|
txs => Transactions::default(),
|
||||||
init => |app, db| create_deposit_relay(app, db).take(1),
|
init => |app, db| create_deposit_relay(app, db).take(1),
|
||||||
expected => vec![0x1005],
|
expected => vec![0x1005],
|
||||||
mainnet_transport => [
|
home_transport => [
|
||||||
"eth_blockNumber" =>
|
"eth_blockNumber" =>
|
||||||
req => r#"[]"#,
|
req => r#"[]"#,
|
||||||
res => r#""0x1011""#;
|
res => r#""0x1011""#;
|
||||||
|
@ -191,7 +191,7 @@ test_app_stream! {
|
||||||
req => r#"[{"address":["0x0000000000000000000000000000000000000cc1"],"fromBlock":"0x1","limit":null,"toBlock":"0x1005","topics":[["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"],null,null,null]}]"#,
|
req => r#"[{"address":["0x0000000000000000000000000000000000000cc1"],"fromBlock":"0x1","limit":null,"toBlock":"0x1005","topics":[["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"],null,null,null]}]"#,
|
||||||
res => r#"[{"address":"0x0000000000000000000000000000000000000cc1","topics":["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"],"data":"0x000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0","type":"","transactionHash":"0x884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364"}]"#;
|
res => r#"[{"address":"0x0000000000000000000000000000000000000cc1","topics":["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"],"data":"0x000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0","type":"","transactionHash":"0x884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364"}]"#;
|
||||||
],
|
],
|
||||||
testnet_transport => [
|
foreign_transport => [
|
||||||
"eth_sendTransaction" =>
|
"eth_sendTransaction" =>
|
||||||
req => r#"[{"data":"0x26b3293f000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364","from":"0x00000000000000000000000000000000000000ee","gas":"0x0","gasPrice":"0x0","to":"0x0000000000000000000000000000000000000dd1"}]"#,
|
req => r#"[{"data":"0x26b3293f000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364","from":"0x00000000000000000000000000000000000000ee","gas":"0x0","gasPrice":"0x0","to":"0x0000000000000000000000000000000000000dd1"}]"#,
|
||||||
res => r#""0x1db8f385535c0d178b8f40016048f3a3cffee8f94e68978ea4b277f57b638f0b""#;
|
res => r#""0x1db8f385535c0d178b8f40016048f3a3cffee8f94e68978ea4b277f57b638f0b""#;
|
||||||
|
@ -201,10 +201,10 @@ test_app_stream! {
|
||||||
test_app_stream! {
|
test_app_stream! {
|
||||||
name => deposit_relay_multiple_logs,
|
name => deposit_relay_multiple_logs,
|
||||||
database => Database::default(),
|
database => Database::default(),
|
||||||
mainnet =>
|
home =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
testnet =>
|
foreign =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
authorities =>
|
authorities =>
|
||||||
|
@ -216,7 +216,7 @@ test_app_stream! {
|
||||||
txs => Transactions::default(),
|
txs => Transactions::default(),
|
||||||
init => |app, db| create_deposit_relay(app, db).take(1),
|
init => |app, db| create_deposit_relay(app, db).take(1),
|
||||||
expected => vec![0x1005],
|
expected => vec![0x1005],
|
||||||
mainnet_transport => [
|
home_transport => [
|
||||||
"eth_blockNumber" =>
|
"eth_blockNumber" =>
|
||||||
req => r#"[]"#,
|
req => r#"[]"#,
|
||||||
res => r#""0x1011""#;
|
res => r#""0x1011""#;
|
||||||
|
@ -224,7 +224,7 @@ test_app_stream! {
|
||||||
req => r#"[{"address":["0x0000000000000000000000000000000000000000"],"fromBlock":"0x1","limit":null,"toBlock":"0x1005","topics":[["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"],null,null,null]}]"#,
|
req => r#"[{"address":["0x0000000000000000000000000000000000000000"],"fromBlock":"0x1","limit":null,"toBlock":"0x1005","topics":[["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"],null,null,null]}]"#,
|
||||||
res => r#"[{"address":"0x0000000000000000000000000000000000000000","topics":["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"],"data":"0x000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0","type":"","transactionHash":"0x884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364"},{"address":"0x0000000000000000000000000000000000000000","topics":["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"],"data":"0x000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0","type":"","transactionHash":"0x884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a942436f"}]"#;
|
res => r#"[{"address":"0x0000000000000000000000000000000000000000","topics":["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"],"data":"0x000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0","type":"","transactionHash":"0x884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364"},{"address":"0x0000000000000000000000000000000000000000","topics":["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"],"data":"0x000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0","type":"","transactionHash":"0x884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a942436f"}]"#;
|
||||||
],
|
],
|
||||||
testnet_transport => [
|
foreign_transport => [
|
||||||
"eth_sendTransaction" =>
|
"eth_sendTransaction" =>
|
||||||
req => r#"[{"data":"0x26b3293f000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364","from":"0x0000000000000000000000000000000000000001","gas":"0x0","gasPrice":"0x0","to":"0x0000000000000000000000000000000000000000"}]"#,
|
req => r#"[{"data":"0x26b3293f000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebcccc00000000000000000000000000000000000000000000000000000000000000f0884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364","from":"0x0000000000000000000000000000000000000001","gas":"0x0","gasPrice":"0x0","to":"0x0000000000000000000000000000000000000000"}]"#,
|
||||||
res => r#""0x1db8f385535c0d178b8f40016048f3a3cffee8f94e68978ea4b277f57b638f0b""#;
|
res => r#""0x1db8f385535c0d178b8f40016048f3a3cffee8f94e68978ea4b277f57b638f0b""#;
|
||||||
|
|
|
@ -8,10 +8,10 @@ use bridge::bridge::create_withdraw_confirm;
|
||||||
test_app_stream! {
|
test_app_stream! {
|
||||||
name => withdraw_confirm_basic,
|
name => withdraw_confirm_basic,
|
||||||
database => Database::default(),
|
database => Database::default(),
|
||||||
mainnet =>
|
home =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
testnet =>
|
foreign =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
authorities =>
|
authorities =>
|
||||||
|
@ -23,8 +23,8 @@ test_app_stream! {
|
||||||
txs => Transactions::default(),
|
txs => Transactions::default(),
|
||||||
init => |app, db| create_withdraw_confirm(app, db).take(2),
|
init => |app, db| create_withdraw_confirm(app, db).take(2),
|
||||||
expected => vec![0x1005, 0x1006],
|
expected => vec![0x1005, 0x1006],
|
||||||
mainnet_transport => [],
|
home_transport => [],
|
||||||
testnet_transport => [
|
foreign_transport => [
|
||||||
"eth_blockNumber" =>
|
"eth_blockNumber" =>
|
||||||
req => r#"[]"#,
|
req => r#"[]"#,
|
||||||
res => r#""0x1011""#;
|
res => r#""0x1011""#;
|
||||||
|
@ -46,10 +46,10 @@ test_app_stream! {
|
||||||
checked_withdraw_confirm: 0xf5,
|
checked_withdraw_confirm: 0xf5,
|
||||||
..Database::default()
|
..Database::default()
|
||||||
},
|
},
|
||||||
mainnet =>
|
home =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 1;
|
confirmations => 1;
|
||||||
testnet =>
|
foreign =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
authorities =>
|
authorities =>
|
||||||
|
@ -61,8 +61,8 @@ test_app_stream! {
|
||||||
txs => Transactions::default(),
|
txs => Transactions::default(),
|
||||||
init => |app, db| create_withdraw_confirm(app, db).take(2),
|
init => |app, db| create_withdraw_confirm(app, db).take(2),
|
||||||
expected => vec![0x1005, 0x1006],
|
expected => vec![0x1005, 0x1006],
|
||||||
mainnet_transport => [],
|
home_transport => [],
|
||||||
testnet_transport => [
|
foreign_transport => [
|
||||||
"eth_blockNumber" =>
|
"eth_blockNumber" =>
|
||||||
req => r#"[]"#,
|
req => r#"[]"#,
|
||||||
res => r#""0x0100""#;
|
res => r#""0x0100""#;
|
||||||
|
@ -85,14 +85,14 @@ test_app_stream! {
|
||||||
name => withdraw_confirm_contract_address,
|
name => withdraw_confirm_contract_address,
|
||||||
database => Database {
|
database => Database {
|
||||||
checked_withdraw_confirm: 0x00F5,
|
checked_withdraw_confirm: 0x00F5,
|
||||||
mainnet_contract_address: "0x49edf201c1e139282643d5e7c6fb0c7219ad1db7".parse().unwrap(),
|
home_contract_address: "0x49edf201c1e139282643d5e7c6fb0c7219ad1db7".parse().unwrap(),
|
||||||
testnet_contract_address: "0x49edf201c1e139282643d5e7c6fb0c7219ad1db8".parse().unwrap(),
|
foreign_contract_address: "0x49edf201c1e139282643d5e7c6fb0c7219ad1db8".parse().unwrap(),
|
||||||
..Database::default()
|
..Database::default()
|
||||||
},
|
},
|
||||||
mainnet =>
|
home =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
testnet =>
|
foreign =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
authorities =>
|
authorities =>
|
||||||
|
@ -104,8 +104,8 @@ test_app_stream! {
|
||||||
txs => Transactions::default(),
|
txs => Transactions::default(),
|
||||||
init => |app, db| create_withdraw_confirm(app, db).take(2),
|
init => |app, db| create_withdraw_confirm(app, db).take(2),
|
||||||
expected => vec![0x1005, 0x1006],
|
expected => vec![0x1005, 0x1006],
|
||||||
mainnet_transport => [],
|
home_transport => [],
|
||||||
testnet_transport => [
|
foreign_transport => [
|
||||||
"eth_blockNumber" =>
|
"eth_blockNumber" =>
|
||||||
req => r#"[]"#,
|
req => r#"[]"#,
|
||||||
res => r#""0x0100""#;
|
res => r#""0x0100""#;
|
||||||
|
@ -128,14 +128,14 @@ test_app_stream! {
|
||||||
name => withdraw_confirm_payload_gas,
|
name => withdraw_confirm_payload_gas,
|
||||||
database => Database {
|
database => Database {
|
||||||
checked_withdraw_confirm: 0x00F5,
|
checked_withdraw_confirm: 0x00F5,
|
||||||
mainnet_contract_address: "0x49edf201c1e139282643d5e7c6fb0c7219ad1db7".parse().unwrap(),
|
home_contract_address: "0x49edf201c1e139282643d5e7c6fb0c7219ad1db7".parse().unwrap(),
|
||||||
testnet_contract_address: "0x49edf201c1e139282643d5e7c6fb0c7219ad1db8".parse().unwrap(),
|
foreign_contract_address: "0x49edf201c1e139282643d5e7c6fb0c7219ad1db8".parse().unwrap(),
|
||||||
..Database::default()
|
..Database::default()
|
||||||
},
|
},
|
||||||
mainnet =>
|
home =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
testnet =>
|
foreign =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
authorities =>
|
authorities =>
|
||||||
|
@ -153,8 +153,8 @@ test_app_stream! {
|
||||||
},
|
},
|
||||||
init => |app, db| create_withdraw_confirm(app, db).take(2),
|
init => |app, db| create_withdraw_confirm(app, db).take(2),
|
||||||
expected => vec![0x1005, 0x1006],
|
expected => vec![0x1005, 0x1006],
|
||||||
mainnet_transport => [],
|
home_transport => [],
|
||||||
testnet_transport => [
|
foreign_transport => [
|
||||||
"eth_blockNumber" =>
|
"eth_blockNumber" =>
|
||||||
req => r#"[]"#,
|
req => r#"[]"#,
|
||||||
res => r#""0x0100""#;
|
res => r#""0x0100""#;
|
||||||
|
@ -182,14 +182,14 @@ test_app_stream! {
|
||||||
test_app_stream! {
|
test_app_stream! {
|
||||||
name => withdraw_confirm_payload_multiple,
|
name => withdraw_confirm_payload_multiple,
|
||||||
database => Database {
|
database => Database {
|
||||||
mainnet_contract_address: "0x49edf201c1e139282643d5e7c6fb0c7219ad1db7".parse().unwrap(),
|
home_contract_address: "0x49edf201c1e139282643d5e7c6fb0c7219ad1db7".parse().unwrap(),
|
||||||
testnet_contract_address: "0x49edf201c1e139282643d5e7c6fb0c7219ad1db8".parse().unwrap(),
|
foreign_contract_address: "0x49edf201c1e139282643d5e7c6fb0c7219ad1db8".parse().unwrap(),
|
||||||
..Database::default()
|
..Database::default()
|
||||||
},
|
},
|
||||||
mainnet =>
|
home =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
testnet =>
|
foreign =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
authorities =>
|
authorities =>
|
||||||
|
@ -207,8 +207,8 @@ test_app_stream! {
|
||||||
},
|
},
|
||||||
init => |app, db| create_withdraw_confirm(app, db).take(2),
|
init => |app, db| create_withdraw_confirm(app, db).take(2),
|
||||||
expected => vec![0x2, 0x1006],
|
expected => vec![0x2, 0x1006],
|
||||||
mainnet_transport => [],
|
home_transport => [],
|
||||||
testnet_transport => [
|
foreign_transport => [
|
||||||
"eth_blockNumber" =>
|
"eth_blockNumber" =>
|
||||||
req => r#"[]"#,
|
req => r#"[]"#,
|
||||||
res => r#""0xe""#;
|
res => r#""0xe""#;
|
||||||
|
|
|
@ -8,10 +8,10 @@ use bridge::bridge::create_withdraw_relay;
|
||||||
test_app_stream! {
|
test_app_stream! {
|
||||||
name => withdraw_relay_basic,
|
name => withdraw_relay_basic,
|
||||||
database => Database::default(),
|
database => Database::default(),
|
||||||
mainnet =>
|
home =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
testnet =>
|
foreign =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
authorities =>
|
authorities =>
|
||||||
|
@ -23,8 +23,8 @@ test_app_stream! {
|
||||||
txs => Transactions::default(),
|
txs => Transactions::default(),
|
||||||
init => |app, db| create_withdraw_relay(app, db).take(2),
|
init => |app, db| create_withdraw_relay(app, db).take(2),
|
||||||
expected => vec![0x1005, 0x1006],
|
expected => vec![0x1005, 0x1006],
|
||||||
mainnet_transport => [],
|
home_transport => [],
|
||||||
testnet_transport => [
|
foreign_transport => [
|
||||||
"eth_blockNumber" =>
|
"eth_blockNumber" =>
|
||||||
req => r#"[]"#,
|
req => r#"[]"#,
|
||||||
res => r#""0x1011""#;
|
res => r#""0x1011""#;
|
||||||
|
@ -43,10 +43,10 @@ test_app_stream! {
|
||||||
test_app_stream! {
|
test_app_stream! {
|
||||||
name => withdraw_relay_single_log_no_relay,
|
name => withdraw_relay_single_log_no_relay,
|
||||||
database => Database::default(),
|
database => Database::default(),
|
||||||
mainnet =>
|
home =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
testnet =>
|
foreign =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
authorities =>
|
authorities =>
|
||||||
|
@ -58,8 +58,8 @@ test_app_stream! {
|
||||||
txs => Transactions::default(),
|
txs => Transactions::default(),
|
||||||
init => |app, db| create_withdraw_relay(app, db).take(1),
|
init => |app, db| create_withdraw_relay(app, db).take(1),
|
||||||
expected => vec![0x1005],
|
expected => vec![0x1005],
|
||||||
mainnet_transport => [],
|
home_transport => [],
|
||||||
testnet_transport => [
|
foreign_transport => [
|
||||||
"eth_blockNumber" =>
|
"eth_blockNumber" =>
|
||||||
req => r#"[]"#,
|
req => r#"[]"#,
|
||||||
res => r#""0x1011""#;
|
res => r#""0x1011""#;
|
||||||
|
@ -72,10 +72,10 @@ test_app_stream! {
|
||||||
test_app_stream! {
|
test_app_stream! {
|
||||||
name => withdraw_relay_single_log_relay,
|
name => withdraw_relay_single_log_relay,
|
||||||
database => Database::default(),
|
database => Database::default(),
|
||||||
mainnet =>
|
home =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
testnet =>
|
foreign =>
|
||||||
account => "0xaff3454fce5edbc8cca8697c15331677e6ebcccc",
|
account => "0xaff3454fce5edbc8cca8697c15331677e6ebcccc",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
authorities =>
|
authorities =>
|
||||||
|
@ -87,12 +87,12 @@ test_app_stream! {
|
||||||
txs => Transactions::default(),
|
txs => Transactions::default(),
|
||||||
init => |app, db| create_withdraw_relay(app, db).take(1),
|
init => |app, db| create_withdraw_relay(app, db).take(1),
|
||||||
expected => vec![0x1005],
|
expected => vec![0x1005],
|
||||||
mainnet_transport => [
|
home_transport => [
|
||||||
"eth_sendTransaction" =>
|
"eth_sendTransaction" =>
|
||||||
req => r#"[{"data":"0x9ce318f6000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000002111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222220000000000000000000000000000000000000000000000000000000000000002111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222220000000000000000000000000000000000000000000000000000000000000054333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333000000000000000000000000","from":"0x0000000000000000000000000000000000000001","gas":"0x0","gasPrice":"0x0","to":"0x0000000000000000000000000000000000000000"}]"#,
|
req => r#"[{"data":"0x9ce318f6000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000002111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222220000000000000000000000000000000000000000000000000000000000000002111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222220000000000000000000000000000000000000000000000000000000000000054333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333000000000000000000000000","from":"0x0000000000000000000000000000000000000001","gas":"0x0","gasPrice":"0x0","to":"0x0000000000000000000000000000000000000000"}]"#,
|
||||||
res => r#""0x1db8f385535c0d178b8f40016048f3a3cffee8f94e68978ea4b277f57b638f0b""#;
|
res => r#""0x1db8f385535c0d178b8f40016048f3a3cffee8f94e68978ea4b277f57b638f0b""#;
|
||||||
],
|
],
|
||||||
testnet_transport => [
|
foreign_transport => [
|
||||||
"eth_blockNumber" =>
|
"eth_blockNumber" =>
|
||||||
req => r#"[]"#,
|
req => r#"[]"#,
|
||||||
res => r#""0x1011""#;
|
res => r#""0x1011""#;
|
||||||
|
@ -114,10 +114,10 @@ test_app_stream! {
|
||||||
test_app_stream! {
|
test_app_stream! {
|
||||||
name => withdraw_relay_check_gas,
|
name => withdraw_relay_check_gas,
|
||||||
database => Database::default(),
|
database => Database::default(),
|
||||||
mainnet =>
|
home =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
testnet =>
|
foreign =>
|
||||||
account => "0xaff3454fce5edbc8cca8697c15331677e6ebcccc",
|
account => "0xaff3454fce5edbc8cca8697c15331677e6ebcccc",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
authorities =>
|
authorities =>
|
||||||
|
@ -135,12 +135,12 @@ test_app_stream! {
|
||||||
},
|
},
|
||||||
init => |app, db| create_withdraw_relay(app, db).take(1),
|
init => |app, db| create_withdraw_relay(app, db).take(1),
|
||||||
expected => vec![0x1005],
|
expected => vec![0x1005],
|
||||||
mainnet_transport => [
|
home_transport => [
|
||||||
"eth_sendTransaction" =>
|
"eth_sendTransaction" =>
|
||||||
req => r#"[{"data":"0x9ce318f6000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000002111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222220000000000000000000000000000000000000000000000000000000000000002111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222220000000000000000000000000000000000000000000000000000000000000054333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333000000000000000000000000","from":"0x0000000000000000000000000000000000000001","gas":"0x10","gasPrice":"0x20","to":"0x0000000000000000000000000000000000000000"}]"#,
|
req => r#"[{"data":"0x9ce318f6000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000002111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222220000000000000000000000000000000000000000000000000000000000000002111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222220000000000000000000000000000000000000000000000000000000000000054333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333000000000000000000000000","from":"0x0000000000000000000000000000000000000001","gas":"0x10","gasPrice":"0x20","to":"0x0000000000000000000000000000000000000000"}]"#,
|
||||||
res => r#""0x1db8f385535c0d178b8f40016048f3a3cffee8f94e68978ea4b277f57b638f0b""#;
|
res => r#""0x1db8f385535c0d178b8f40016048f3a3cffee8f94e68978ea4b277f57b638f0b""#;
|
||||||
],
|
],
|
||||||
testnet_transport => [
|
foreign_transport => [
|
||||||
"eth_blockNumber" =>
|
"eth_blockNumber" =>
|
||||||
req => r#"[]"#,
|
req => r#"[]"#,
|
||||||
res => r#""0x1011""#;
|
res => r#""0x1011""#;
|
||||||
|
@ -162,14 +162,14 @@ test_app_stream! {
|
||||||
test_app_stream! {
|
test_app_stream! {
|
||||||
name => withdraw_relay_single_contract_addresses,
|
name => withdraw_relay_single_contract_addresses,
|
||||||
database => Database {
|
database => Database {
|
||||||
mainnet_contract_address: "0x00000000000000000000000000000000000000dd".parse().unwrap(),
|
home_contract_address: "0x00000000000000000000000000000000000000dd".parse().unwrap(),
|
||||||
testnet_contract_address: "0x00000000000000000000000000000000000000ee".parse().unwrap(),
|
foreign_contract_address: "0x00000000000000000000000000000000000000ee".parse().unwrap(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
mainnet =>
|
home =>
|
||||||
account => "0x0000000000000000000000000000000000000001",
|
account => "0x0000000000000000000000000000000000000001",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
testnet =>
|
foreign =>
|
||||||
account => "0xaff3454fce5edbc8cca8697c15331677e6ebcccc",
|
account => "0xaff3454fce5edbc8cca8697c15331677e6ebcccc",
|
||||||
confirmations => 12;
|
confirmations => 12;
|
||||||
authorities =>
|
authorities =>
|
||||||
|
@ -181,12 +181,12 @@ test_app_stream! {
|
||||||
txs => Transactions::default(),
|
txs => Transactions::default(),
|
||||||
init => |app, db| create_withdraw_relay(app, db).take(1),
|
init => |app, db| create_withdraw_relay(app, db).take(1),
|
||||||
expected => vec![0x1005],
|
expected => vec![0x1005],
|
||||||
mainnet_transport => [
|
home_transport => [
|
||||||
"eth_sendTransaction" =>
|
"eth_sendTransaction" =>
|
||||||
req => r#"[{"data":"0x9ce318f6000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000002111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222220000000000000000000000000000000000000000000000000000000000000002111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222220000000000000000000000000000000000000000000000000000000000000054333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333000000000000000000000000","from":"0x0000000000000000000000000000000000000001","gas":"0x0","gasPrice":"0x0","to":"0x00000000000000000000000000000000000000dd"}]"#,
|
req => r#"[{"data":"0x9ce318f6000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000002111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222220000000000000000000000000000000000000000000000000000000000000002111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222220000000000000000000000000000000000000000000000000000000000000054333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333000000000000000000000000","from":"0x0000000000000000000000000000000000000001","gas":"0x0","gasPrice":"0x0","to":"0x00000000000000000000000000000000000000dd"}]"#,
|
||||||
res => r#""0x1db8f385535c0d178b8f40016048f3a3cffee8f94e68978ea4b277f57b638f0b""#;
|
res => r#""0x1db8f385535c0d178b8f40016048f3a3cffee8f94e68978ea4b277f57b638f0b""#;
|
||||||
],
|
],
|
||||||
testnet_transport => [
|
foreign_transport => [
|
||||||
"eth_blockNumber" =>
|
"eth_blockNumber" =>
|
||||||
req => r#"[]"#,
|
req => r#"[]"#,
|
||||||
res => r#""0x1011""#;
|
res => r#""0x1011""#;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
var KovanBridge = artifacts.require("KovanBridge");
|
var ForeignBridge = artifacts.require("ForeignBridge");
|
||||||
|
|
||||||
contract('KovanBridge', function(accounts) {
|
contract('ForeignBridge', function(accounts) {
|
||||||
it("should deploy contract", function() {
|
it("should deploy contract", function() {
|
||||||
var meta;
|
var meta;
|
||||||
var requiredSignatures = 1;
|
var requiredSignatures = 1;
|
||||||
var authorities = [accounts[0], accounts[1]];
|
var authorities = [accounts[0], accounts[1]];
|
||||||
|
|
||||||
return KovanBridge.new(requiredSignatures, authorities).then(function(instance) {
|
return ForeignBridge.new(requiredSignatures, authorities).then(function(instance) {
|
||||||
meta = instance;
|
meta = instance;
|
||||||
return meta.requiredSignatures.call();
|
return meta.requiredSignatures.call();
|
||||||
}).then(function(result) {
|
}).then(function(result) {
|
||||||
|
@ -19,7 +19,7 @@ contract('KovanBridge', function(accounts) {
|
||||||
|
|
||||||
it("should fail to deploy contract with not enough required signatures", function() {
|
it("should fail to deploy contract with not enough required signatures", function() {
|
||||||
var authorities = [accounts[0], accounts[1]];
|
var authorities = [accounts[0], accounts[1]];
|
||||||
return KovanBridge.new(0, authorities).then(function(_) {
|
return ForeignBridge.new(0, authorities).then(function(_) {
|
||||||
assert(false, "Contract should fail to deploy");
|
assert(false, "Contract should fail to deploy");
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
// do nothing
|
// do nothing
|
||||||
|
@ -28,7 +28,7 @@ contract('KovanBridge', function(accounts) {
|
||||||
|
|
||||||
it("should fail to deploy contract with to many signatures", function() {
|
it("should fail to deploy contract with to many signatures", function() {
|
||||||
var authorities = [accounts[0], accounts[1]];
|
var authorities = [accounts[0], accounts[1]];
|
||||||
return KovanBridge.new(3, authorities).then(function(_) {
|
return ForeignBridge.new(3, authorities).then(function(_) {
|
||||||
assert(false, "Contract should fail to deploy");
|
assert(false, "Contract should fail to deploy");
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
// do nothing
|
// do nothing
|
||||||
|
@ -43,7 +43,7 @@ contract('KovanBridge', function(accounts) {
|
||||||
var value = web3.toWei(1, "ether");
|
var value = web3.toWei(1, "ether");
|
||||||
var hash = "0xe55bb43c36cdf79e23b4adc149cdded921f0d482e613c50c6540977c213bc408";
|
var hash = "0xe55bb43c36cdf79e23b4adc149cdded921f0d482e613c50c6540977c213bc408";
|
||||||
|
|
||||||
return KovanBridge.new(requiredSignatures, authorities).then(function(instance) {
|
return ForeignBridge.new(requiredSignatures, authorities).then(function(instance) {
|
||||||
meta = instance;
|
meta = instance;
|
||||||
return meta.deposit(user_account, value, hash, { from: authorities[0] });
|
return meta.deposit(user_account, value, hash, { from: authorities[0] });
|
||||||
}).then(function(result) {
|
}).then(function(result) {
|
||||||
|
@ -65,7 +65,7 @@ contract('KovanBridge', function(accounts) {
|
||||||
var value = web3.toWei(1, "ether");
|
var value = web3.toWei(1, "ether");
|
||||||
var hash = "0xe55bb43c36cdf79e23b4adc149cdded921f0d482e613c50c6540977c213bc408";
|
var hash = "0xe55bb43c36cdf79e23b4adc149cdded921f0d482e613c50c6540977c213bc408";
|
||||||
|
|
||||||
return KovanBridge.new(requiredSignatures, authorities).then(function(instance) {
|
return ForeignBridge.new(requiredSignatures, authorities).then(function(instance) {
|
||||||
meta = instance;
|
meta = instance;
|
||||||
return meta.deposit(user_account, value, hash, { from: authorities[0] });
|
return meta.deposit(user_account, value, hash, { from: authorities[0] });
|
||||||
}).then(function(result) {
|
}).then(function(result) {
|
||||||
|
@ -94,7 +94,7 @@ contract('KovanBridge', function(accounts) {
|
||||||
var value = web3.toWei(1, "ether");
|
var value = web3.toWei(1, "ether");
|
||||||
var hash = "0xe55bb43c36cdf79e23b4adc149cdded921f0d482e613c50c6540977c213bc408";
|
var hash = "0xe55bb43c36cdf79e23b4adc149cdded921f0d482e613c50c6540977c213bc408";
|
||||||
|
|
||||||
return KovanBridge.new(requiredSignatures, authorities).then(function(instance) {
|
return ForeignBridge.new(requiredSignatures, authorities).then(function(instance) {
|
||||||
meta = instance;
|
meta = instance;
|
||||||
return meta.deposit(user_account, value, hash, { from: authorities[0] });
|
return meta.deposit(user_account, value, hash, { from: authorities[0] });
|
||||||
}).then(function(result) {
|
}).then(function(result) {
|
||||||
|
@ -123,7 +123,7 @@ contract('KovanBridge', function(accounts) {
|
||||||
var value = web3.toWei(3, "ether");
|
var value = web3.toWei(3, "ether");
|
||||||
var value2 = web3.toWei(1, "ether");
|
var value2 = web3.toWei(1, "ether");
|
||||||
var hash = "0xe55bb43c36cdf79e23b4adc149cdded921f0d482e613c50c6540977c213bc408";
|
var hash = "0xe55bb43c36cdf79e23b4adc149cdded921f0d482e613c50c6540977c213bc408";
|
||||||
return KovanBridge.new(requiredSignatures, authorities).then(function(instance) {
|
return ForeignBridge.new(requiredSignatures, authorities).then(function(instance) {
|
||||||
meta = instance;
|
meta = instance;
|
||||||
return meta.deposit(user_account, value, hash, { from: authorities[0] });
|
return meta.deposit(user_account, value, hash, { from: authorities[0] });
|
||||||
}).then(function(result) {
|
}).then(function(result) {
|
||||||
|
@ -153,7 +153,7 @@ contract('KovanBridge', function(accounts) {
|
||||||
var value = web3.toWei(3, "ether");
|
var value = web3.toWei(3, "ether");
|
||||||
var value2 = web3.toWei(4, "ether");
|
var value2 = web3.toWei(4, "ether");
|
||||||
var hash = "0xe55bb43c36cdf79e23b4adc149cdded921f0d482e613c50c6540977c213bc408";
|
var hash = "0xe55bb43c36cdf79e23b4adc149cdded921f0d482e613c50c6540977c213bc408";
|
||||||
return KovanBridge.new(requiredSignatures, authorities).then(function(instance) {
|
return ForeignBridge.new(requiredSignatures, authorities).then(function(instance) {
|
||||||
meta = instance;
|
meta = instance;
|
||||||
return meta.deposit(user_account, value, hash, { from: authorities[0] });
|
return meta.deposit(user_account, value, hash, { from: authorities[0] });
|
||||||
}).then(function(result) {
|
}).then(function(result) {
|
||||||
|
@ -173,7 +173,7 @@ contract('KovanBridge', function(accounts) {
|
||||||
var value = web3.toWei(3, "ether");
|
var value = web3.toWei(3, "ether");
|
||||||
var value2 = web3.toWei(1, "ether");
|
var value2 = web3.toWei(1, "ether");
|
||||||
var hash = "0xe55bb43c36cdf79e23b4adc149cdded921f0d482e613c50c6540977c213bc408";
|
var hash = "0xe55bb43c36cdf79e23b4adc149cdded921f0d482e613c50c6540977c213bc408";
|
||||||
return KovanBridge.new(requiredSignatures, authorities).then(function(instance) {
|
return ForeignBridge.new(requiredSignatures, authorities).then(function(instance) {
|
||||||
meta = instance;
|
meta = instance;
|
||||||
return meta.deposit(user_account, value, hash, { from: authorities[0] });
|
return meta.deposit(user_account, value, hash, { from: authorities[0] });
|
||||||
}).then(function(result) {
|
}).then(function(result) {
|
||||||
|
@ -222,7 +222,7 @@ contract('KovanBridge', function(accounts) {
|
||||||
var requiredSignatures = 1;
|
var requiredSignatures = 1;
|
||||||
var authorities = [accounts[0], accounts[1]];
|
var authorities = [accounts[0], accounts[1]];
|
||||||
var message = "0x111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
|
var message = "0x111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
|
||||||
return KovanBridge.new(requiredSignatures, authorities).then(function(instance) {
|
return ForeignBridge.new(requiredSignatures, authorities).then(function(instance) {
|
||||||
meta = instance;
|
meta = instance;
|
||||||
return sign(authorities[0], message);
|
return sign(authorities[0], message);
|
||||||
}).then(function(result) {
|
}).then(function(result) {
|
||||||
|
@ -247,7 +247,7 @@ contract('KovanBridge', function(accounts) {
|
||||||
var requiredSignatures = 2;
|
var requiredSignatures = 2;
|
||||||
var authorities = [accounts[0], accounts[1]];
|
var authorities = [accounts[0], accounts[1]];
|
||||||
var message = "0x111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
|
var message = "0x111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
|
||||||
return KovanBridge.new(requiredSignatures, authorities).then(function(instance) {
|
return ForeignBridge.new(requiredSignatures, authorities).then(function(instance) {
|
||||||
meta = instance;
|
meta = instance;
|
||||||
return sign(authorities[0], message);
|
return sign(authorities[0], message);
|
||||||
}).then(function(result) {
|
}).then(function(result) {
|
||||||
|
@ -265,7 +265,7 @@ contract('KovanBridge', function(accounts) {
|
||||||
var authorities = [accounts[0], accounts[1]];
|
var authorities = [accounts[0], accounts[1]];
|
||||||
var message = "0x111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
|
var message = "0x111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
|
||||||
var message2 = "0x111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112";
|
var message2 = "0x111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112";
|
||||||
return KovanBridge.new(requiredSignatures, authorities).then(function(instance) {
|
return ForeignBridge.new(requiredSignatures, authorities).then(function(instance) {
|
||||||
meta = instance;
|
meta = instance;
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
sign(authorities[0], message),
|
sign(authorities[0], message),
|
||||||
|
@ -320,7 +320,7 @@ contract('KovanBridge', function(accounts) {
|
||||||
var requiredSignatures = 1;
|
var requiredSignatures = 1;
|
||||||
var authorities = [accounts[0], accounts[1]];
|
var authorities = [accounts[0], accounts[1]];
|
||||||
var message = "0x1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
|
var message = "0x1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
|
||||||
return KovanBridge.new(requiredSignatures, authorities).then(function(instance) {
|
return ForeignBridge.new(requiredSignatures, authorities).then(function(instance) {
|
||||||
meta = instance;
|
meta = instance;
|
||||||
return sign(authorities[0], message);
|
return sign(authorities[0], message);
|
||||||
}).then(function(result) {
|
}).then(function(result) {
|
||||||
|
@ -338,7 +338,7 @@ contract('KovanBridge', function(accounts) {
|
||||||
var authorities = [accounts[0], accounts[1]];
|
var authorities = [accounts[0], accounts[1]];
|
||||||
var message = "0x111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
|
var message = "0x111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
|
||||||
var message2 = "0x111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112";
|
var message2 = "0x111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112";
|
||||||
return KovanBridge.new(requiredSignatures, authorities).then(function(instance) {
|
return ForeignBridge.new(requiredSignatures, authorities).then(function(instance) {
|
||||||
meta = instance;
|
meta = instance;
|
||||||
return sign(authorities[0], message);
|
return sign(authorities[0], message);
|
||||||
}).then(function(result) {
|
}).then(function(result) {
|
||||||
|
@ -355,7 +355,7 @@ contract('KovanBridge', function(accounts) {
|
||||||
var requiredSignatures = 1;
|
var requiredSignatures = 1;
|
||||||
var authorities = [accounts[0], accounts[1]];
|
var authorities = [accounts[0], accounts[1]];
|
||||||
var message = "0x111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
|
var message = "0x111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
|
||||||
return KovanBridge.new(requiredSignatures, authorities).then(function(instance) {
|
return ForeignBridge.new(requiredSignatures, authorities).then(function(instance) {
|
||||||
meta = instance;
|
meta = instance;
|
||||||
return sign(authorities[0], message);
|
return sign(authorities[0], message);
|
||||||
}).then(function(result) {
|
}).then(function(result) {
|
||||||
|
@ -372,7 +372,7 @@ contract('KovanBridge', function(accounts) {
|
||||||
var requiredSignatures = 0;
|
var requiredSignatures = 0;
|
||||||
var authorities = [accounts[0], accounts[1]];
|
var authorities = [accounts[0], accounts[1]];
|
||||||
var message = "0x111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
|
var message = "0x111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
|
||||||
return KovanBridge.new(requiredSignatures, authorities).then(function(instance) {
|
return ForeignBridge.new(requiredSignatures, authorities).then(function(instance) {
|
||||||
meta = instance;
|
meta = instance;
|
||||||
return sign(authorities[0], message);
|
return sign(authorities[0], message);
|
||||||
}).then(function(result) {
|
}).then(function(result) {
|
|
@ -1,12 +1,12 @@
|
||||||
var EthereumBridge = artifacts.require("EthereumBridge");
|
var HomeBridge = artifacts.require("HomeBridge");
|
||||||
|
|
||||||
contract('EthereumBridge', function(accounts) {
|
contract('HomeBridge', function(accounts) {
|
||||||
it("should deploy contract", function() {
|
it("should deploy contract", function() {
|
||||||
var meta;
|
var meta;
|
||||||
var requiredSignatures = 1;
|
var requiredSignatures = 1;
|
||||||
var authorities = [accounts[0], accounts[1]];
|
var authorities = [accounts[0], accounts[1]];
|
||||||
|
|
||||||
return EthereumBridge.new(requiredSignatures, authorities).then(function(instance) {
|
return HomeBridge.new(requiredSignatures, authorities).then(function(instance) {
|
||||||
meta = instance;
|
meta = instance;
|
||||||
return meta.requiredSignatures.call();
|
return meta.requiredSignatures.call();
|
||||||
}).then(function(result) {
|
}).then(function(result) {
|
||||||
|
@ -19,7 +19,7 @@ contract('EthereumBridge', function(accounts) {
|
||||||
|
|
||||||
it("should fail to deploy contract with not enough required signatures", function() {
|
it("should fail to deploy contract with not enough required signatures", function() {
|
||||||
var authorities = [accounts[0], accounts[1]];
|
var authorities = [accounts[0], accounts[1]];
|
||||||
return EthereumBridge.new(0, authorities).then(function(_) {
|
return HomeBridge.new(0, authorities).then(function(_) {
|
||||||
assert(false, "Contract should fail to deploy");
|
assert(false, "Contract should fail to deploy");
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
// do nothing
|
// do nothing
|
||||||
|
@ -28,7 +28,7 @@ contract('EthereumBridge', function(accounts) {
|
||||||
|
|
||||||
it("should fail to deploy contract with to many signatures", function() {
|
it("should fail to deploy contract with to many signatures", function() {
|
||||||
var authorities = [accounts[0], accounts[1]];
|
var authorities = [accounts[0], accounts[1]];
|
||||||
return EthereumBridge.new(3, authorities).then(function(_) {
|
return HomeBridge.new(3, authorities).then(function(_) {
|
||||||
assert(false, "Contract should fail to deploy");
|
assert(false, "Contract should fail to deploy");
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
// do nothing
|
// do nothing
|
||||||
|
@ -42,7 +42,7 @@ contract('EthereumBridge', function(accounts) {
|
||||||
let user_account = accounts[2];
|
let user_account = accounts[2];
|
||||||
let value = web3.toWei(1, "ether");
|
let value = web3.toWei(1, "ether");
|
||||||
|
|
||||||
return EthereumBridge.new(requiredSignatures, authorities).then(function(instance) {
|
return HomeBridge.new(requiredSignatures, authorities).then(function(instance) {
|
||||||
meta = instance;
|
meta = instance;
|
||||||
return meta.sendTransaction({
|
return meta.sendTransaction({
|
||||||
value: value,
|
value: value,
|
Loading…
Reference in New Issue