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

No indication if the contract executiton requires more gas than it was specified #13

Open akolotov opened 6 years ago

akolotov commented 6 years ago

Steps to reproduce:

  1. Change the configuration file to reduce gas for deposit_relay to 25400.
  2. Run the bridge with RUST_LOG=debug
  3. Send ether to the HomeBridge contract

When the bridge is trying to send deposit confirmation to the ForeignBridge contract it reports that transaction was sent and deposit completed even it was not handled properly (in my case it was not included in a new block at all):

INFO:bridge::bridge::deposit_relay: got 1 new deposits to relay
DEBUG:<unknown>: [29] Calling: {"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"data":"0x26b3293f00000000000000000000000037a30534da3d53aa1867adde26e114a3161b2b1200000000
0000000000000000000000000000000000000000000a8503892e10001b254563acfa39c680314bf887d84561a8dddb3bb832664d0adaa16a2142a896","from":"0xf3ee321df87781864f46f6464e764c2827fca73b","gas":
"0x6338","gasPrice":"0x430e23400","to":"0x6500d471c8973d95493b417c44ab85f31265a2b6"}],"id":29}
INFO:bridge::bridge::deposit_relay: relaying 1 deposits
...
INFO:bridge::bridge::deposit_relay: deposit relay completed

Moreover the counter of checked_deposit_relay is increased in the database file. So, the bridge is in incorrect state after sending of such transaction.

Expected behavior

  1. The bridge must track the transactions it is sending and reports if something was wrong with them.
  2. If some relay or confirm operation cannot be completed due to failed transactions the corresponding counter in the database file must not be incremented.
yrashk commented 6 years ago

Have we encountered this recently? Currently, the bridge will crash with a designated error code (5) when gas is too low.