Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server Side Grants Transaction Validator #6318

Closed
owocki opened this issue Mar 27, 2020 · 22 comments
Closed

Server Side Grants Transaction Validator #6318

owocki opened this issue Mar 27, 2020 · 22 comments

Comments

@owocki
Copy link
Contributor

owocki commented Mar 27, 2020

Validator 1

I would like a python script written that I can pass in a list of transactions, token amounts, and token names, and it can return a 1 or a 0 for each txn to tell me if those tokens were transfered as part of that txn

Note that Gitcoin has a tool that does this already, but we're having some problems with false negatives and with replaced transactions. So I'm interested in seeing how a bounty hunter would handle this issue so we can perhaps integrate it.

example input: https://gist.github.com/owocki/179186552ec7e4c036918c5195949a25

example output

success, reason
True
True
False - tx failed
False - amount was off by 0.001

Acceptance Criteria:

  • No more than 1% false negatives
  • Should handle dropped/replaced txns

Please submit a PR that can validate token transfers (both ETH and ERC20 tokens) by Sunday night to participate in this bounty.

Validator 2

I would like some python functions that I can pass in an ethereum mainnet account and a erc20-style contract address, and it can tell me where the tokens came from.

ie.

  • if account minted the token, then it returns 0x0
  • if account received the tokens from 0xabc it returns 0xabc
  • if account received the tokens from 0xabc and 0xabc2 it returns [0xabc, 0xabc2]
@owocki owocki changed the title Grant Transaction Validator Server Side Grants Transaction Validator Mar 27, 2020
@gitcoinbot
Copy link
Member

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 2.0 ETH (272.86 USD @ $136.43/ETH) attached to it.

@gitcoinbot
Copy link
Member

gitcoinbot commented Mar 27, 2020

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 2 weeks from now.
Please review their action plans below:

1) developerfred has been approved to start work.

Great interesting challenge I would like to work on improving this algorithm.

Learn more on the Gitcoin Issue Details page.

@owocki
Copy link
Contributor Author

owocki commented Mar 27, 2020

@developerfred can u get a PR togehter by sunday u think?

@developerfred
Copy link
Contributor

@developerfred can u get a PR togehter by sunday u think?

I believe so, I have already structured a mind map for this quest, I will focus on scalability and agility.

@erib3
Copy link

erib3 commented Mar 28, 2020

@owocki What's the amount_minus_gitcoin_fee for?

@owocki
Copy link
Contributor Author

owocki commented Mar 28, 2020

@developerfred mind submitting a WIP PR? im keen to track the progress here..

@erib3 if the gitcoin fee was charged, then the amount on chain will be amount_minus_gitcoin_fee not amount, so its provided just to make vlaidation of amounts easier for whomever is wrtiing the validator

@erib3
Copy link

erib3 commented Mar 28, 2020

@owocki thanks, to handle replaced transactions is it just find transaction with same nonce? I think we might need the 'From' address to handle dropped and replaced transactions

@gitcoinbot
Copy link
Member

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 2.0 ETH (255.87 USD @ $127.94/ETH) has been submitted by:

  1. @developerfred

@owocki please take a look at the submitted work:


@owocki
Copy link
Contributor Author

owocki commented Mar 30, 2020

I think we might need the 'From' address to handle dropped and replaced transactions

shoot. yeah youre right. either that or use the blockscout API to handle it. if i generate you another export with from adresses in it, can you update your script to handle them?

@inspireme6
Copy link
Contributor

@owocki there are cases like this one:

0x64ced12ccfd17e1d965ae22eb1a1ad4bdcbc70997ebb67445285ba2258d9ce1f 0.050000000000000000 0.05 0x6B175474E89094C44Da98b954EedeAC495271d0F

where eth was transferred instead of DAI, this kind of tx should be put as failed or success?

@erib3
Copy link

erib3 commented Mar 30, 2020

@owocki I could update my code, also I don't see how we could use blockscout API for this. So I think we need a new upload with 'from' address and also the 'nonce' for faster lookups

@inspireme6
Copy link
Contributor

inspireme6 commented Mar 30, 2020

I just noticed the token transactions are Approval methods not the real transfer.

0x4216da9b2e848d592d63c8a4d6b57d3aa77dfc63c074182d093ddc35b5a1c5cb 6.900000000000000000 6.555000000000001 0x6B175474E89094C44Da98b954EedeAC495271d0F

e.g this tx approves 1000 DAI to be spended but only 6.9 was actually transferred, this could be misleading i think.

not ideal but scraping the grants addresses could be more accurate and will most likely fix both the false negatives and replaced txs issues.

@owocki
Copy link
Contributor Author

owocki commented Mar 30, 2020

where eth was transferred instead of DAI, this kind of tx should be put as failed or success?

definitely failed, but with a comment explaining why.

I could update my code, also I don't see how we could use blockscout API for this.

someone told me the blockscout API can give you the replacement tx_id.

I just noticed the token transactions are Approval methods not the real transfer.

if i provide a combo of txid1 and txid2, of which one must be the transfer of the actual tokens, would that work? there are cases in which we receive 2 txns from the frontend but only the second will transfer funds.

@owocki
Copy link
Contributor Author

owocki commented Mar 30, 2020

here is some new input data that includes txid1 and txid2, but also the from address (so we can find dropped and replaced txns) https://gist.github.com/owocki/a298bad096288754d55d61e87b385eac

developerfred added a commit to developerfred/web that referenced this issue Mar 30, 2020
developerfred added a commit to developerfred/web that referenced this issue Mar 30, 2020
@inspireme6
Copy link
Contributor

Let me know if #6349 is kind of a good approach or definitely no.

@owocki
Copy link
Contributor Author

owocki commented Apr 1, 2020

@inspireme6 thanks for doing that, but @developerfred is working on the bounty so i def have to continue on the track with him. just an FYI RE: the bounty funds. maybe if we fold some of your approach in i can pay ya both out since the result will be better!

@inspireme6
Copy link
Contributor

@owocki that sounds okay to me! I wish there was a better way to tackle the issue with the dropped/replaced tx. I still had fun :)

@owocki
Copy link
Contributor Author

owocki commented Apr 1, 2020

old ticket => #5762

developerfred added a commit to developerfred/web that referenced this issue Apr 1, 2020
developerfred added a commit to developerfred/web that referenced this issue Apr 1, 2020
@gitcoinbot
Copy link
Member

⚡️ A tip worth 2.50000 ETH (382.87 USD @ $153.15/ETH) has been granted to @developerfred for this issue from @owocki. ⚡️

Nice work @developerfred! Your tip has automatically been deposited in the ETH address we have on file.

@gitcoinbot
Copy link
Member

⚡️ A tip worth 0.50000 ETH (76.57 USD @ $153.15/ETH) has been granted to @inspireme6 for this issue from @owocki. ⚡️

Nice work @inspireme6! Your tip has automatically been deposited in the ETH address we have on file.

@gitcoinbot
Copy link
Member

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This Bounty has been completed.

Additional Tips for this Bounty:

  • owocki tipped 0.5000 ETH worth 76.6 USD to inspireme6.
  • owocki tipped 2.5000 ETH worth 382.99 USD to developerfred.

@inspireme6
Copy link
Contributor

Thanks @owocki @developerfred

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants