Commit Graph

603 Commits

Author SHA1 Message Date
Peter van Nostrand ab0407c345 Problem: the readme and example config TOML files include obsolete gas-price config options
Solution: remove the old config options, document the new gas-price config options
2018-05-24 19:28:23 -04:00
Yurii Rashkovskii fac38d7059
Problem: can't be merged with the master without a conflict
Solution: resolve the conflict

(Merge remote-tracking branch 'origin/master' into required-signatures)
2018-05-23 22:20:19 -07:00
Yurii Rashkovskii 863b92ad2c
Merge pull request #85 from poanetwork/get-gas-price-from-oracle
Problem: no functionality exists to dynamically fetch gas-prices
2018-05-23 22:15:41 -07:00
Peter van Nostrand aaa5bee49e Problem: no functionality exists to dynamically fetch gas-prices
Currently, gas-prices are set upon bridge startup via the
Users's config TOML file; this value remains constant for the
life of the Bridge.

Solution: create a mechanism that asynchronously queries
gas-prices from an "Oracle" service on a timed interval. This
mechanism should be a stream of gas-prices that can be polled
from the Bridge.
2018-05-23 20:42:13 -04:00
Yurii Rashkovskii 379973f315
Problem: tracking RequiredSignaturesChanged is complicated
This requires retreiving validators contract, calling
`requiredSignatures()` and carefully tracking
`RequiredSignaturesChanged` events.

Solution: use recently introduced additional parameter in
CollectedSignatures to obtain the number of required signatures.
2018-05-23 01:02:12 -07:00
Yurii Rashkovskii 8a56c5cafb
Problem: required_signatures is static
Validators' information is completely configured through validators
contracts and does not depend on `authorities.required_signatures`
parameter of bridge's configuration.

The number of validators also could be changed during run-time and
therefore `authorities.required_signatures` parameter will not reflect
the actual number of signatures required for transaction validation.

Solution: retrieve required_signatures from RequiredSignaturesChanged
event and requiredSignatures() method

Closes #74
2018-05-19 08:38:53 -07:00
Yurii Rashkovskii cc4147c9cc
Problem: ERR_BRIDGE_CRASH is erroneously set to 11
Solution: change it to 12 (as per documentation)
2018-05-16 16:22:49 -07:00
Yurii Rashkovskii d25bea1a93
Problem: integration tests get stuck (most of the time)
Solution: ensure not failing the initial checking of the balance
if it was in fact successful.
2018-05-11 11:02:44 -07:00
Yurii Rashkovskii c513d010c7
Prepare 0.2.0 2018-05-08 11:03:33 -07:00
Alexander Kolotov 1eec1f0c9e
Merge pull request #76 from yrashk/log-error-context
Problem: errors do not show their context
2018-05-08 11:33:01 +03:00
Yurii Rashkovskii 40b21ddb7d
Problem: errors do not show their context
If the error like this appears in the logs:
```
INFO:bridge::bridge::withdraw_confirm: waiting for new withdraws that
should get signed
WARN:bridge: Bridge crashed with Error(Transport("Incomplete"), State {
next_error: None, backtrace: None })
Error(Transport("Incomplete"), State { next_error: None, backtrace: None
})
```
it is hard to understand which side of the bridge failed. The message
must contains type of operation (`deposit_relay`, `withdraw_confirm` or
`withdraw_relay`) and side of bridge (URL of RPC channel).

Solution: record error's top level context and print it out if recorded

Addresses #75
2018-05-08 00:48:35 -07:00
Alexander Kolotov a66eb931fc
Merge pull request #71 from yrashk/filter-tail
Problem: eth_getLogs returning no logs in some cases
2018-05-05 09:09:23 +03:00
Alexander Kolotov e4e2c40a29
Merge pull request #70 from yrashk/foreign-rpc-log
Problem: Foreign RPC URL is not reported in the logs
2018-05-05 09:09:01 +03:00
Yurii Rashkovskii c3c2461af3
Problem: eth_getLogs returning no logs in some cases
Sometimes there's an event and eth_getLogs returns
nothing.

Solution: trim the nulls from the topic filter's tail

It appears that in some implementations or setups
eth_getLogs topics: [A, null, null, null] won't return
logs when only [A] was there.

This patch is a quick workaround that trims nulls from
that said tail. A proper fix would likely require
an incursion into ethabi to make Topic optional.
2018-05-04 13:58:19 -07:00
Yurii Rashkovskii b7459f00e6
Problem: Foreign RPC URL is not reported in the logs
The current behavior for logs displayed during the bridge initialization
is not consistent - home url is reported whereas foreign url is not.

Solution: report it

Fixes #69
2018-05-04 11:03:25 -07:00
Yurii Rashkovskii ce487b34a6
Problem: bridge tests failing
Solution: bring them up to date
2018-05-04 11:02:17 -07:00
Yurii Rashkovskii f98fc49aed
Problem: bridge tests don't compile
Solution: the database format changed, accommodate that
2018-05-04 10:55:30 -07:00
Alexander Kolotov 43e7863b7d
Merge pull request #68 from yrashk/drop-home-foreign-deploy-db
Problem: home_deploy and foreign_deploy fields
2018-05-04 20:23:45 +03:00
Yurii Rashkovskii 4feca245f1
Problem: home_deploy and foreign_deploy fields
These fields in database are no longer useful outside of
integration testing.

Solution: make them optional

Closes #67
2018-05-04 10:08:12 -07:00
Alexander Kolotov 009d40aa50
Merge pull request #66 from yrashk/tx-concurrency
Problem: bridge sends out transactions slowly
2018-05-04 10:49:20 +03:00
Yurii Rashkovskii 97c419e229
Problem: concurrent transactions setting is hard to discover
Solution: document it
2018-05-03 14:24:40 -07:00
Yurii Rashkovskii fbe77d7359
Problem: bridge sends out transactions slowly
This is because it is limiting them to one at a time
per operation type. This was done so that there's no
gaps in nonces due to undelivered transactions.

Solution: allow concurrent sending of transactions

By default, 100 transactions are allowed.

Note, however, that now there's a chance that nonce
gaps may be formed under cerain circumstances.
2018-05-03 14:14:42 -07:00
Yurii Rashkovskii 83eeb9d51b
Merge pull request #63 from akolotov/contracts-dir-update
added README to reflect that contracts are for integration tests only
2018-05-02 08:56:16 -07:00
Alexander Kolotov 2e6bd0b930 added README to reflect that contracts are for integration tests only
Contracts in the repo are not used for the bridge any more.
So, in order to reduce number of questions in the future, a note to reflect the status of contracts is added.
2018-05-02 18:36:51 +03:00
Alexander Kolotov 549bec6460
Merge pull request #62 from akolotov/readme-update-1
bridge config example updated
2018-05-02 18:26:58 +03:00
Alexander Kolotov d540973533 bridge config example updated
Examples in the git repo could lead to situation when a public node (especially a Kovan public) could drop transaction due to low gas price (0 by default).
In order to reduce number of questions which could appear with usage of examples, the `gas_price` field is initialized with 1 gwei in the corresponding files.
2018-05-02 18:13:15 +03:00
Igor Barinov d0c14da3af
Update README.md
Added Waffle badge
2018-05-02 09:54:17 -04:00
Yurii Rashkovskii 67c59b6ae6
Merge pull request #60 from yrashk/new-readme
Problem: README is oudated
2018-05-01 19:10:39 -07:00
Yurii Rashkovskii 6a371cfb46
Merge pull request #58 from yrashk/contract-setting
Problem: `contract` configuration is no longer necessary
2018-05-01 19:10:29 -07:00
Yurii Rashkovskii 3552aa7016
Merge pull request #59 from yrashk/estimated-gas-cost-of-withdrawal
Problem: estimated_gas_cost_of_withdraw setting is no longer useful
2018-05-01 19:10:19 -07:00
Yurii Rashkovskii aa613b6c97
Merge pull request #61 from yrashk/error-codes
Problem: error exit codes list is still limiting
2018-05-01 19:10:10 -07:00
Yurii Rashkovskii 2c8defc24b
Problem: README is oudated
It describes a lot of things that are no longer relevant to POA bridge.

Solution: update and reduce it
2018-05-01 14:08:07 -07:00
Yurii Rashkovskii 4fcdae54f2
Problem: error exit codes list is still limiting
There are even sometimes incorrectly deducted.

There are more situations that can be distinguished -- for example,
nonce re-use. This particular error will be conflated with insufficient
funds because they share the error code in the JSON-RPC respponse.

Proposed solution: discriminate JSON-RPC responses with 32010 code
according to their message.

Closes #54
2018-05-01 14:06:20 -07:00
Yurii Rashkovskii 6ed056b744
Problem: estimated_gas_cost_of_withdraw setting is no longer useful
Solution: remove it from the default build
2018-05-01 11:58:08 -07:00
Yurii Rashkovskii 633e4a122a
Problem: `contract` configuration is no longer necessary
It is only necessary when deploying

Solution: remove the requirement for this configuration option
but leave it for the `deploy` feature used in integration tests
until they are rewritten to use external deployment mechanics.
2018-05-01 11:40:30 -07:00
Alexander Kolotov f6c6546e77
Merge pull request #56 from yrashk/failing-tests
Problem: bridge crate tests failing to compile
2018-05-01 20:43:15 +03:00
Alexander Kolotov 2930243d18
Merge pull request #55 from yrashk/deploy-disabled
Problem: bridge should not deploy its contracts anymore
2018-05-01 20:42:28 +03:00
Yurii Rashkovskii 935f6bdc9b
Problem: bridge crate tests failing to compile
Solution: bring them up to date
2018-05-01 10:03:42 -07:00
Yurii Rashkovskii 9a192c1e07
Problem: bridge should not deploy its contracts anymore
Bridge's contracts are now developed in a separate repository
and have their own deployment procedure:

https://github.com/poanetwork/poa-parity-bridge-contracts

However, our integration tests are not yet updated to
use this deployment procedure.

Solution: disable deployment compile-time by default
and only use it in integration tests as a stopgap measure
until the new deployment procedure (or any other viable
alternative) has been used.
2018-05-01 09:43:34 -07:00
Alexander Kolotov cdb79b9ba7
Merge pull request #53 from yrashk/descr-copyright-notice
Problem: copyright notice and description are outdated
2018-05-01 18:37:36 +03:00
Yurii Rashkovskii 87cf71a1ce
Problem: copyright notice and description are outdated
Solution: include POA Networks Ltd. and update the description
2018-05-01 08:08:46 -07:00
Yurii Rashkovskii 8718583d3b
Merge pull request #51 from yrashk/nonce-reuse
Problem: nonce reuse
2018-04-29 17:03:20 -07:00
Yurii Rashkovskii 385c5885dd
Problem: nonce reuse without error
In cases when the node is backed by a cluster of nodes,
one node will not share the same information with the
other, hence it will not be able to report nonce reuse,
ultimately leading to lost transactions as they are
discarded later.

Solution: combine getTransactionCount with an internal counter
so that validator controls its own nonces, but in case if
something external happens, it can reset itself against
those externalities.
2018-04-29 16:41:03 -07:00
Yurii Rashkovskii a1269272e2
Problem: nonce reuse
Unfortunately, bridge will still reuse nonce very often.
Specifically when trying to send more than one transaction at
a time, clearly a faulty behaviour.

Solution: chain retrieving a nonce with subsequent sending
of the transaction.

However, chaining these is not enough as it'll still fail.

This is happening because bridge module is polling all its components
(deposit_relay, withdraw_confirm, withdraw_relay) sequentially,
 and some of them maybe waiting on their transactions to go through.

However, those transactions are also done as composed futures of nonce
retrieval and transaction sending. This means that it is very often
that first, these futures will go through the nonce acquisition process,
get the same values, and then submit transactions with the same nonce.

This patch makes NonceCheck future check if the transaction failed
with this specific issue of nonce reuse and effectively restarts from
the beginning in that case, repeating nonce acquisition process... until
it succeeeds.
2018-04-29 13:20:42 -07:00
Yurii Rashkovskii 45e284835d
Merge pull request #50 from yrashk/withdraw-confirm-signing
Problem: withdraw_confirm failure
2018-04-28 16:10:05 -07:00
Yurii Rashkovskii 072291813c
Problem: withdraw_confirm failure
If a node configured as Foreign for the bridge and it has no validator
account unlocked the bridge crashes and produces the following message:

```
INFO:bridge::bridge::withdraw_confirm: got 1 new withdraws to sign
INFO:bridge::bridge::withdraw_confirm: withdraw is ready for signature
submission. tx hash 0x6493…4fa8
INFO:bridge::bridge::withdraw_confirm: signing
WARN:bridge: Bridge crashed with Error(Transport("Unexpected response
status code: 405 Method Not Allowed"), State { next_error: None,
backtrace: None })
Error(Transport("Unexpected response status code: 405 Method Not
Allowed"), State { next_error: None, backtrace: None })
```

Solution: sign messages locally

Closes #49
2018-04-28 15:50:25 -07:00
Alexander Kolotov 8d10a792d6
Merge pull request #46 from yrashk/rpc+raw-transactions
Problem: inability to use remote infrastructure
2018-04-27 06:46:26 +03:00
Yurii Rashkovskii c0715dadba
Merge branch 'raw-transactions' into rpc+raw-transactions 2018-04-26 18:21:07 -07:00
Yurii Rashkovskii 58d092f1d4
Merge branch 'rpc' into rpc+raw-transactions-1 2018-04-26 18:13:24 -07:00
Yurii Rashkovskii fe28e335e0
Problem: RPC transport doesn't support HTTPS
Solution: upgrade web3 to the version which has support for TLS
2018-04-26 18:12:01 -07:00