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

feat: partial payouts for cancelled requests #561

Merged
merged 6 commits into from
Oct 24, 2023

Conversation

AuHau
Copy link
Member

@AuHau AuHau commented Oct 3, 2023

Adds support for partial payouts of canceled requests.

Also closes #556 and fixes off-by-one bug for calling withdrawFunds() contract function for canceled requests which leads to errors "Request is not expired yet".

The integration test is failing, though, because of the Hardhat's mining mode - automine. The time needs to be advanced (eq. mined block) before calling the withdrawFunds() function for the canceled request, but I have not figured out any way how to do it in the test's code. I have tried switching the Hardhat's mining mode into mining block every second and for that the test worked. Maybe we should consider changing the mining mode? It had brought us more problems recently 😳

The PR is blocked by the contract's PR: codex-storage/codex-contracts-eth#69

Also closes codex-storage/codex-contracts-eth#57

@AuHau AuHau requested review from markspanbroek and emizzle October 3, 2023 13:40
Copy link
Member

@markspanbroek markspanbroek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

Looks like the newly added test is failing on CI.

codex/sales/states/unknown.nim Outdated Show resolved Hide resolved
tests/integration/testIntegration.nim Show resolved Hide resolved
@AuHau AuHau force-pushed the feat/partial-expired-payouts branch from ead24a4 to 13ae69a Compare October 16, 2023 11:38
@AuHau AuHau force-pushed the feat/partial-expired-payouts branch from 13ae69a to 6aed1b6 Compare October 19, 2023 15:42
@AuHau
Copy link
Member Author

AuHau commented Oct 23, 2023

I have added the verification of the truly canceled state and also the termination of canceled requests in cancelled states (both in purchasing and sales).

@AuHau AuHau requested a review from markspanbroek October 23, 2023 09:33
Copy link
Member

@markspanbroek markspanbroek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done @AuHau!

codex/purchasing/states/submitted.nim Outdated Show resolved Hide resolved
tests/codex/sales/testsales.nim Show resolved Hide resolved
@AuHau AuHau force-pushed the feat/partial-expired-payouts branch from d0831f4 to 049dd76 Compare October 24, 2023 09:25
@AuHau AuHau force-pushed the feat/partial-expired-payouts branch from 049dd76 to 4b375ec Compare October 24, 2023 09:27
@AuHau AuHau enabled auto-merge (squash) October 24, 2023 09:28
@AuHau AuHau merged commit 2fc71cf into master Oct 24, 2023
@AuHau AuHau deleted the feat/partial-expired-payouts branch October 24, 2023 10:12
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 this pull request may close these issues.

Sales statemachine should call freeSlot() for failed slots Return client funds on failed request
2 participants