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

[Bug]: Deals marked as proposal_expired and then published #336

Closed
xinaxu opened this issue Sep 20, 2023 · 1 comment
Closed

[Bug]: Deals marked as proposal_expired and then published #336

xinaxu opened this issue Sep 20, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@xinaxu
Copy link
Contributor

xinaxu commented Sep 20, 2023

Description

I got some weird behavior with deal-tracker
Deal state changed {"dealID": xxx, "oldState": "proposal_expired", "newState": "published"}
marked 3 deal as proposal_expired
updated 3 deals and inserted 0 deals
How could a deal move from expired to published?
Happens each round, with the same message, so guess no real update is being done

Steps to Reproduce

A couple IDs I have at the moment:
2023-09-20T09:32:43.957+0200 INFO dealtracker dealtracker/dealtracker.go:468 Deal state changed {"dealID": 54464983, "oldState": "proposal_expired", "newState": "published"}
2023-09-20T09:32:44.307+0200 INFO dealtracker dealtracker/dealtracker.go:468 Deal state changed {"dealID": 54486432, "oldState": "proposal_expired", "newState": "published"}

Version

singularity v0.4.1-a1977e5

Operating System

Linux

Database Backend

SQLite

Additional context

No response

@xinaxu xinaxu added bug Something isn't working triage labels Sep 20, 2023
@xinaxu xinaxu self-assigned this Sep 20, 2023
@xinaxu xinaxu removed the triage label Sep 21, 2023
@github-project-automation github-project-automation bot moved this to 🍇 Backlog in ActionArena Sep 21, 2023
@xinaxu
Copy link
Contributor Author

xinaxu commented Oct 12, 2023

The root cause identified. When determing new state, there is 1 day of buffer time to consider when the deal proposal has expired to take into account the potential latency of lotus API / state market deals. After updating the state, the deal is updated back to expiration based on the actual delay of lotus API. Those two time mismatched, causing the deal to be updated back and force between expired and published within that 24 hours window

@xinaxu xinaxu moved this from 🍇 Backlog to 👨‍💻 In Progress in ActionArena Oct 12, 2023
xinaxu added a commit that referenced this issue Oct 12, 2023
resovles #336 

Previously, we are making a 24 hour buffer time to account for potential
latency of StateMarketDeals call. However, that leads to some deal state
to change between expired and published during 24 hour window as the
buffer time for marking a deal expired comes from the last updated time
inside StateMarketDeal payload.

This change fixes most of the problem by first calling Lotus ChainHead
to determine the current lotus latency first. Edges cases are handled
below
* If the StateMarketDeals response is based on an earlier epoch than
ChainHead response, then it's likely some deals are in expired state
based on ChainHead latency but is not expired in StateMarketDeals
response, the state of the deal will be updated in the next run when
StateMarketDeals response is based on a later epoch
* If the StateMarketDeals response is based on a latter epoch than
ChainHead response, then those deals that are in non_expired state based
on ChainHead latency will be marked as expired
@xinaxu xinaxu closed this as completed Oct 13, 2023
@github-project-automation github-project-automation bot moved this from 👨‍💻 In Progress to 🚢 Done in ActionArena Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 🚢 Done
Development

No branches or pull requests

1 participant