polyswarm / relay

Sidechain relay for PolySwarm, the first decentralized threat intelligence market.
https://polyswarm.io
GNU General Public License v3.0
2 stars 1 forks source link

MissedTransfers calling approveWithdrawal a lot more than expected #67

Closed ceseale closed 5 years ago

ceseale commented 5 years ago

Describe the bug When running in orchestration with testing set to 50+ relay verifiers call approveWithdrawal 1000s of times by block 1000.

To Reproduce Steps to reproduce the behavior:

  1. checkout ` in orchestrationfeature/dev-block-watcher`
  2. checkout ` in contractorfeature/dev-block-watcher`
  3. run with orchestration and notice transaction counts
  4. comment out lines https://github.com/polyswarm/relay/blob/master/src/relay.rs#L67-L68 and try again. Notice there are much less transactions

Expected behavior Relay makes less transactions when handling missed transactions

Additional context

Log with MissedTransfers

contractor_1           | INFO:root:Block Number: 1183
contractor_1           | INFO:root:Number of transactions: 3
contractor_1           | INFO:root:
contractor_1           | User                           Balance (nectar)            Change (cumulative)  Function Calls (cumulative)
contractor_1           | ------------------  ---------------------------  -----------------------------  -------------------------------------------------------------------------------
contractor_1           | Abiter 0xF8704      610000006250000000000000000    590000006250000000000000000  {'approve': 2, 'deposit': 2, 'voteOnBounty': 49, 'settleBounty': 50}
contractor_1           | ArbiterStaking       10000000000000000000000000     10000000000000000000000000  {}
contractor_1           | BountyRegistry                                0                              0  {}
contractor_1           | ERC20Relay            5913075851542181982426285  -1860000000000000000000000000  {}
contractor_1           | Fee Wallet 0x34E58                            0                              0  {}
contractor_1           | NectarToken                                   0                              0  {}
contractor_1           | User 0x05328        620000000000000000000000000    620000000000000000000000000  {'approve': 52, 'postAssertion': 52, 'revealAssertion': 54, 'settleBounty': 52}
contractor_1           | User 0x12152                                  0                              0  {}
contractor_1           | User 0x2B813                                  0                              0  {}
contractor_1           | User 0x4B186        639999993750000000000000000    639999993750000000000000000  {'approve': 58, 'postBounty': 58, 'settleBounty': 50}
contractor_1           | User 0xf0243                                  0                              0  {}
contractor_1           | Verifier 0x085ba                              0                              0  {'approveWithdrawal': 1066}
contractor_1           | Verifier 0x4F101                              0                              0  {'approveWithdrawal': 1109}
contractor_1           | Verifier 0xD87e4                              0                              0  {'approveWithdrawal': 1036}

Log without MissedTransfers

contractor_1           | INFO:root:Block Number: 334
contractor_1           | INFO:root:Number of transactions: 1
contractor_1           | INFO:root:
contractor_1           | User                           Balance (nectar)            Change (cumulative)  Function Calls (cumulative)
contractor_1           | ------------------  ---------------------------  -----------------------------  -------------------------------------------------------------------------------
contractor_1           | Abiter 0xF8704      610000006250000000000000000    610000006250000000000000000  {'voteOnBounty': 54, 'settleBounty': 52}
contractor_1           | ArbiterStaking       10000000000000000000000000     10000000000000000000000000  {}
contractor_1           | BountyRegistry                                0                              0  {}
contractor_1           | ERC20Relay            5913075851542181982426285  -1880000000000000000000000000  {}
contractor_1           | Fee Wallet 0x34E58                            0                              0  {}
contractor_1           | NectarToken                                   0                              0  {}
contractor_1           | User 0x05328        640000000000000000000000000    640000000000000000000000000  {'approve': 53, 'postAssertion': 54, 'revealAssertion': 52, 'settleBounty': 53}
contractor_1           | User 0x12152                                  0                              0  {}
contractor_1           | User 0x2B813                                  0                              0  {}
contractor_1           | User 0x4B186        619999993750000000000000000    619999993750000000000000000  {'approve': 52, 'postBounty': 52, 'settleBounty': 52}
contractor_1           | User 0xf0243                                  0                              0  {}
contractor_1           | Verifier 0x085ba                              0                              0  {'approveWithdrawal': 122}
contractor_1           | Verifier 0x4F101                              0                              0  {'approveWithdrawal': 143}
contractor_1           | Verifier 0xD87e4                              0                              0  {'approveWithdrawal': 164}
orchestration_microengine_1 exited with code 0
orchestration_arbiter_1 exited with code 0
orchestration_ambassador_1 exited with code 0
Rizato commented 5 years ago

Are you seeing this behavior on stage/prod?

ceseale commented 5 years ago

@Rizato this is locally via orchestration, I'll run this logging in stage and report back

ceseale commented 5 years ago

Did some more investigation and ran logging in staging. It's hard to tell in staging the extent of extra transactions because we don't have a baseline for how many missed transfers to expect. The bug can be more clearly seen in orchestation using the method described above.