omni / poa-bridge

POA <-> Ethereum bridge for self transfers of POA native token to POA20 (ERC20 representation). Not supported. Use TokenBridge instead
https://github.com/poanetwork/token-bridge
GNU General Public License v3.0
80 stars 38 forks source link

Extend bridge logging functionality #11

Open akolotov opened 6 years ago

akolotov commented 6 years ago

Currently the bridge instance support logging through configuration of the environment variable RUST_LOG. The bridge produces the logs with log level info and allows to get details about JSON-RPC call by setting the level debug.

env RUST_LOG=info ./bridge --config config.toml --database db.toml

example of logs: https://gist.github.com/akolotov/47d951346db3627562acc7e6578dabaa#file-01_info_level-md

or

env RUST_LOG=debug ./bridge --config config.toml --database db.toml

example of logs: https://gist.github.com/akolotov/47d951346db3627562acc7e6578dabaa#file-02_debug_level-md

From examples above it is clear that info level does not provide enough information to investigate possible issues whereas debug level produces lots of lines (not presented in the example above) which are superfluous for investigation of issues related to skipped or missed transactions or hard to use for tracing state of transfers.

Proposal for changes:

It is necessary to extend the logging functionality on 'info' level in order to have information hanlded and generated by the bridge instance more transparent. Below is the list of information needed for every type of operation:

  1. deposit_relay

    • tx hash of the transaction used to send funds to the HomeBridge contract, transaction originator, value of transaction.
    • tx hash of the transaction sent by the bridge to the ForeingBridge contract, a reference tx hash (allow to link this transaction to transaction from previous item)
    • information whether respond from the bridge contract (Deposit() event) recieved with the reference tx hash
    • information about other bridges responds with the reference tx hash
  2. withdraw_confirm

    • tx hash of the transaction used to request withdraw from the ForeignBridge contract, transaction originator, value of transaction.
    • tx hash of the transaction sent by the bridge to the ForeingBridge contract, a reference tx hash (allow to link this transaction to transaction from previous item)
    • information whether respond from the bridge contract (event implemented under https://github.com/poanetwork/parity-bridge/issues/9) recieved with the reference tx hash
    • information about other bridges responds with the reference tx hash
  3. withdraw_relay

    • tx hash of the transaction used to inform about signatures collected on ForeignBridge contract with decision if this bridge instance is responsible for relaying the withdraw
    • tx hash of the transaction sent by the bridge to the HomeBridge contract, a reference tx hash (allow to link this transaction to transaction from previous item)
    • information whether respond from the bridge contract (Withdraw() event) recieved with the reference tx hash. This should be included even if another instance of bridge sent information to the HomeBridge contract.