Commit Graph

603 Commits

Author SHA1 Message Date
Yurii Rashkovskii e5afb28783
Problem: AsRef implementation of App
It isn't really necessary for anything that I can see.

Solution: remove it
2018-04-26 17:57:29 -07:00
Yurii Rashkovskii 96ecfab2c6
Problem: unlocking account every time to sign a tx
On my computer, this takes approximately 0.3 seconds, which is clearly
a deal-breaker. In retrospect, this is an obvious problem because
of key derivation function use.

Solution: unlock accounts permanently.

This cut down time to sign one transaction is 0.0001 or so.
2018-04-26 17:53:38 -07:00
Yurii Rashkovskii 94b1343594
Problem: sending unsigned transactions over API
This means that the node has to sign the transaction itself.
It might be acceptable in a localized setup, but can't be used
with untrusted setups. For example, once HTTP RPC is supported,
we can't really use infrastructure like INFURA to send transactions.

Solution: switch to signing transactions in bridge

This absolutely requires separating the accounts used by validators
and administrative tasks as this will otherwise interfere with
management of nonces.
2018-04-26 17:50:07 -07:00
Yurii Rashkovskii dd49a8a184
Merge pull request #40 from yrashk/unknown-balance
Problem: unknown balance warning
2018-04-24 12:16:24 -07:00
Yurii Rashkovskii 4151237c54
Problem: RPC transport change conflated with keystore
As a part of the original feature request, there was a need
for the bridge to be able to sign its own transactions. However,
this didn't fully materialize in the original patch, and only
configuration parameters were implemented.

Solution: remove these last conflated bits
and make this a pure transport change patch.
2018-04-19 10:13:45 -07:00
Yurii Rashkovskii de6cabc534
Problem: non-integration tests don't compile anymore
Solution: remove `ipc` parameter to make them compile
2018-04-19 09:58:12 -07:00
Yurii Rashkovskii 449c97cf5b
Problem: unnecessarily complicated string formatting
Solution: use format!() macro instead of manual concatenation
2018-04-19 09:51:38 -07:00
Yurii Rashkovskii 39202644b8
Problem: some unnecessary leftovers in the RPC patch
Solution: remove them
2018-04-19 09:51:38 -07:00
Yurii Rashkovskii e0831d58fc
Problem: yarn.lock entry in gitignore
This file is unrelated to the RPC patch

Solution: remove it
2018-04-19 09:51:37 -07:00
Yurii Rashkovskii ab938e1c5a
Problem: Cargo manifest still includes test_bridge_stuff
Solution: remove it from the manifest
2018-04-19 09:51:37 -07:00
Yurii Rashkovskii 5b9c67f0ac
Problem: RPC patch introduces examples/local_dev
This directory doesn't reallly do anything to RPC.

Solution: extract it
2018-04-19 09:51:37 -07:00
Yurii Rashkovskii 12a44b53bd
Problem: two sets of external tests
RPC patch has introduced a separate basic test that, on the surface
of it, is not too dissimilar from the basic deposit and withdrawal
test already defined in integration tests.

Solution: make sure integration tests run and remove newly introduced test
2018-04-19 09:51:37 -07:00
Yurii Rashkovskii c04d6a282e
Problem: RPC patch doesn't compile yet
The inner workings of choosing IPC vs RPC haven't been worked out.

Solution: remove IPC in favour of RPC
2018-04-19 09:51:37 -07:00
Edward Mack aacea235bb
Problem: IPC doesn't scale well
Using IPC means bridge has to run alognside the node
on the same machine. This, at times, presents problems
in terms of efficiency or coupling of deployment.

Solution: switch to RPC
2018-04-19 09:51:32 -07:00
Yurii Rashkovskii e885fdfe21
Merge pull request #43 from yrashk/fix-tests
Problem: non-integration tests don't compile
2018-04-19 09:51:12 -07:00
Yurii Rashkovskii c3894736b5
Problem: non-integration tests don't compile
Solution: use an updated version of the API
to make them compile
2018-04-17 07:53:42 -07:00
Yurii Rashkovskii 976256780b
Problem: unknown balance warning
Upon startup, bridge produces the following warning:

```
WARN:bridge::bridge::deposit_relay: foreign contract balance is unknown
```

This happens because the RPC response from the node might
not come/get processed immediately.

By itself this warning means that the deposit_relay won't
perform any operations.

Solution: don't commence operations until balances are retrieved

Also, indicate when balances are retrieved:

```
INFO:bridge::bridge: Retrieved home contract balance
INFO:bridge::bridge: Retrieved foreign contract balance
```

This shows us that the balances are successfully retrieved and
bridge can commence its operations.
2018-04-16 07:21:31 -07:00
Alexander Kolotov da91da9db7
Merge pull request #36 from yrashk/insufficient-funds
Problem: bridge crashes with insufficient balance
2018-04-11 23:30:33 +03:00
Yurii Rashkovskii 618d3bcb00
Problem: bridge crashes with insufficient balance
Currently there are two possible situations related to low balance on
the account which is used for bridge operations:

1. The account which is used to sign transactions to be addressed by
ForeignBridge contract has low balance. So, the bridge is not able to do
deposit_relay and withdraw_confirm.
2. The account which is used to sign transactions to be addressed by
HomeBridge contract has low balance. So, the bridge is not able to do
withdraw_relay.

In both cases bridges hangs silently at the moment of sending
transactions and does not proceed with further actions even the
operation is intended to be performed in opposite direction (e.g. the
bridge hangs at the moment to perform withdraw_relay, so deposit_relay
cannot be performed either).

Solution: make bridge track its balance and hande insufficient

Bridge will crash with ERR_INSUFFICIENT_FUNDS (code 4) so that
supervisor can decide what should happen next. It will also log the
condition.

P.S.Make sure to run the tests with `--test-threads=1` to avoid
other test conflicting with this one. A better solution to this
issue must be devised later, however.
2018-04-04 10:42:16 +04:00
Alexander Kolotov bd9146013e
Merge pull request #32 from yrashk/flexible-restarts
Problem: complexity associated with error handling
2018-03-19 23:54:11 +03:00
Yurii Rashkovskii 38e1cac265
Problem: intentional bridge shutdowns
It is impossible to tell whether the bridge
is being shut down intentionally or because of
an error. This is particularly important
for supervising the process, both in development
and production.

Solution: handle SIGINT and SIGTERM as a special case
and designate a separate status code (3) for intentional
shutdowns.

Also, include an example supervisor for development
mode (examples/suprevisor). Simply prepend it before
the invocation of bridge to supervise it.
2018-03-15 21:14:37 +07:00
Yurii Rashkovskii 103af3e3fa
Problem: complexity associated with error handling
Currently, bridge will try to handle errors in some
way in order to attempt to restore its functionality.

However, this limits as to how the errors can be handled
as every time a change in handling is needed, a patch
for bridge will needed.

Overtime, this will inevitably grow into a full-fledged
supervisor.

However, there are already supervisor programs out there
(starting from all-encompassing systemd down to small
supervision utilities)

Solution: revert the handling of errors to the old behaviour
but (very importantly) make bridge return meaningful error
codes for all known error types so that the supervisor
can make a proper decision as to what has to be done
(restart, delayed restart, permanent shutdown, notification,
etc.)
2018-03-15 20:16:15 +07:00
Alexander Kolotov 24b719dc98
Merge pull request #31 from yrashk/master-2
Problem: main development branch is obscurely named
2018-03-15 15:59:43 +03:00
Alexander Kolotov 9c375cc89b
Merge pull request #25 from yrashk/ipc-lost
Problem: bridge dies when Parity is stopped
2018-03-10 10:13:07 +01:00
Alexander Kolotov 1b0315bfa1
Merge pull request #26 from yrashk/integration-tests-work
Problem: integration tests won't compile or pass
2018-03-09 10:04:30 +01:00
Yurii Rashkovskii 732711d2d0
Problem: can't compile inyegration tests
Solution: add missing instructions for building
token
2018-03-09 08:09:27 +00:00
Yurii Rashkovskii 870cb3c969
Problem: bridge won't start if it can't connect to the nodes
Solution: attempt to connect to the nodes until successful
2018-03-09 06:29:43 +07:00
Yurii Rashkovskii e68ff4a7cd
Problem: error message mentioning Parity
Bridge should be usable with other node implementations.

Solution: remove reference to Parity
2018-03-05 15:28:41 +07:00
Yurii Rashkovskii d9bc432ab8
Problem: integration tests won't compile or pass
Solution: map it to the API used in bridge.sol
2018-03-05 15:23:36 +07:00
Roman Storm e37ca29477
Merge pull request #24 from akolotov/poa-dev-2
Initial support of simple deployment procedure for several bridge instances
2018-02-27 18:22:32 -08:00
Yurii Rashkovskii b8a5b8eeb8
Problem: bridge dies when Parity is stopped
Steps to reproduce:

Run two Parity-based nodes responsible for Home and Foreign chains.
Run bridge: RUST_LOG=info bridge --config ... --database ....
Kill parity process responsible for Foreign chain.
Expected results:
The bridge handles gracefully death of Parity node: warns about the
connection lose, shutdowns all operations (deposit_relay,
withdraw_confirm and withdraw_relay) for a while, waits when the
connection appears and runs all operations after that.

Actual results:
After killing Parity process the following appear in the terminal where
the bridge is running:

WARN:<unknown>: Unexpected IO error: Error { repr: Os { code: 32,
message: "Broken pipe" } }
No messages appear from withdraw_confirm and withdraw_relay.
Then after some time (few seconds or few minutes) the following appear
on the terminal and the bridge dies:

Request eth_blockNumber timed out

Solution: once "Broken pipe" error is caught, attempt to
reconnect repeatedly with a pause of 1 second between attempts.

When other errors are caught, simply restart the bridge,
as there is no indication that the connection has been severed.

Fixes #22
2018-02-28 05:35:18 +07:00
Alexander Kolotov dcdb5cf75f proposed changes for https://github.com/poanetwork/parity-bridge/issues/20 and https://github.com/poanetwork/parity-bridge/issues/18 2018-02-28 01:20:09 +03:00
Alexander Kolotov ee633d18a2 rolled back a workaround from HomeBridge contract after removing little-endian encoding for integers in withdraw_confirm's message 2018-02-25 00:24:00 +03:00
Alexander Kolotov 57bce4579a fixes #23 2018-02-25 00:21:23 +03:00
Alexander Kolotov 2f2af35440 fixed missed semicolon 2018-02-24 07:34:45 +03:00
Alexander Kolotov 5e1b7f43f7 example of ERC20 token to work with current version of ForeignBridge contract 2018-02-23 04:26:48 +03:00
Alexander Kolotov 0714eb70c8 quick and dirty fix to allow performing withdraw. A separate issue will be created 2018-02-23 04:25:45 +03:00
Alexander Kolotov ca64cf3b6a merge from master branch 2018-02-16 02:13:46 +03:00
snd 396198781d
Merge pull request #114 from paritytech/snd-issue-112
fix #112 - users were able to burn value during withdraw
2018-02-15 14:48:00 +01:00
Maximilian Krüger 586afe8773 bridge.sol: uint -> uint256: more explicit, clear.
seen in many other solidity projects with high code quality
2018-02-15 14:27:07 +01:00
Maximilian Krüger 033a923432 make ForeignBridge.submitSignature a bit easier to understand 2018-02-15 14:22:20 +01:00
Maximilian Krüger 9753db7326 cli/Cargo.toml: bump `env_logger` to `0.4` 2018-02-15 13:13:59 +01:00
Maximilian Krüger 0246119518 remove panics. improve error handling for signature.
resolves grumble:
https://github.com/paritytech/parity-bridge/pull/114#discussion_r168406741
2018-02-15 12:49:12 +01:00
Maximilian Krüger 4226a045cd README.md: add missing word 2018-02-15 12:07:36 +01:00
Maximilian Krüger 763e065b67 update readme 2018-02-15 11:49:47 +01:00
Maximilian Krüger f437a2f2de README.md: mention homeGasPrice 2018-02-15 11:38:57 +01:00
Maximilian Krüger 6f13eb4b05 shorten error handling
resolve grumble:
https://github.com/paritytech/parity-bridge/pull/114#discussion_r168433291
2018-02-15 11:33:59 +01:00
Maximilian Krüger ca7f758587 remove unnecessary `.clone()`
resolves grumble:
https://github.com/paritytech/parity-bridge/pull/114#discussion_r168406837
2018-02-15 11:18:26 +01:00
Maximilian Krüger 189d5b2331 remove redundant conversions
resolves grumbles:
https://github.com/paritytech/parity-bridge/pull/114#discussion_r168407959
https://github.com/paritytech/parity-bridge/pull/114#discussion_r168408026
2018-02-15 11:17:42 +01:00
Maximilian Krüger 55192e9830 proper error handling instead of expect 2018-02-14 12:13:49 +01:00