Web: standardbounties: Check web3 vs. database to see if bounty exists

Created on 23 Jan 2018  路  4Comments  路  Source: gitcoinco/web

Currently, if a user tries to Kill/Fulfill/Accept an issue that does not exist, the code queries the API to see if that issue URL exists. If it doesn't, it will pop up a red error banner to the user.

While this works, it might be more thourough to also check the blockchain if the bounty exists. In theory, the database should always be syncing with web3 on any changes, so this shouldn't be an issue.

If we were to do this, the flow would have to be:

  • Call back-end API using github issue URL to get database information
  • Grab the standard_bounties_id and use web3 to query getBounty(_bountyId).
  • If this call fails or returns nothing, we return an error to the user.
Gitcoin Bounties enhancement

Most helpful comment

If a user closes their browser window on the pending confirmation page, it will get out of sync. This is an especially pervasive issue in times of network slowness.

All 4 comments

@jasonrhaas

went through kill_bounty.js
I'm guessing the code would sort of look like this as everything else is available

 bounty.getBounty(bountyId, (error, result) => {
    if(error || result == null)
        errormsg = "No active funded issue found at this address.  Are you sure this is an active funded issue?";
 });

A lil confused here though, under what scenario would the bounty not exist on the blockhain but on our backend API ? (or is it just a safety precaution )

^ @mbeacom / @owocki on the off chance @jasonrhaas is held up

@thelostone-mc The database should always be sync'ed up with the blockchain. It might be possible for it to get out of sync if the contract was altered somewhere outside of gitcoin. Also, when #128 is implemented I think that should also help to make sure the DB and the blockchain are always in sync.

If a user closes their browser window on the pending confirmation page, it will get out of sync. This is an especially pervasive issue in times of network slowness.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mbeacom picture mbeacom  路  4Comments

abitrolly picture abitrolly  路  4Comments

aashutoshrathi picture aashutoshrathi  路  4Comments

christianbundy picture christianbundy  路  3Comments

IgorPerikov picture IgorPerikov  路  3Comments