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

Failed to redeem RAV #1010

Open
suntzu93 opened this issue Oct 3, 2024 · 0 comments
Open

Failed to redeem RAV #1010

suntzu93 opened this issue Oct 3, 2024 · 0 comments

Comments

@suntzu93
Copy link

suntzu93 commented Oct 3, 2024

I encountered a situation where allocations have been redeemed on-chain but in the database the 'final' column is still false. As a result, the agent attempts to redeem that allocation again and encounters the error 'Failed to redeem query fee voucher.' After checking the code, I realized a few points:

  1. This code aims to find items that exist on-chain and also in the database but have 'final' = false. I think the correct approach should be ravsLastNotFinal.find , if you use !ravsLastNotFinal.find it means that it exists on-chain but does not exist in the database, which I have never encountered. If such a case were to occur, the method markRavAsRedeemed would only be updating the item, if it doesn't exist in the database, how can it update?

  2. I debugged and found the following data:

    • rav.senderAddress = 0xDDE4cfFd3D9052A9cb618fC05a1Cd02be1f2F467
    • rav.allocationId = 0xC0ccccc865cEd16F3E56640E5798A9648233AE92
    • tx.sender.id = 0xdde4cffd3d9052a9cb618fc05a1cd02be1f2f467
    • tx.allocationID = 0xc0ccccc865ced16f3e56640e5798a9648233ae92

toAddress(rav.senderAddress) === toAddress(tx.sender.id) &&

In the code, you are not using toLowerCase(), so clearly, this case will not be updated as redeemed even though there is a transaction on-chain.

  1. SET redeemed_at = ${timestamp ? timestamp : 'NOW()'}
    The method markRavAsRedeemed has a logic error when redeemed_at is a timestamp, while you are using a number."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🗃️ Inbox
Development

No branches or pull requests

1 participant