-
Notifications
You must be signed in to change notification settings - Fork 2
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: Add checks against eviction cases #231
Conversation
The commit updates the property names in the `StakingContractInfo` type to improve clarity and consistency. The `minStakingDuration` property is renamed to `minimumStakingDuration`, and the `serviceStakingTime` property is renamed to `serviceStakingStartTime`. This change aligns with the recent user commits and follows the established commit message conventions in the repository.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mohandast52 a general question, if the user, after their agent's eviction, waits enough time, but is still blocked due to not having enough slots, how will they know?
serviceId: number, | ||
): Promise<StakingContractInfo | undefined> => { | ||
if (!serviceId) return; | ||
|
||
const contractCalls = [ | ||
serviceStakingTokenMechUsageContract.availableRewards(), | ||
serviceStakingTokenMechUsageContract.maxNumServices(), | ||
serviceStakingTokenMechUsageContract.getServiceIds(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these ServiceIds and the ones first of which we pass to the getStakingContractInfo with this new change (I mean the services
from services?.[0]?.chain_data?.token
) kind of the same? Just wonder, if they are, maybe we can not do unnecessary call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. The services in ServicesProvider
are fetched from an API (as you can see here) and not from a contract.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep I saw that too, was just wondering if the values are the same
The user will still see that the slots are empty. Do you have a different perspective on this? |
Warning
The code was tested by mocking the services within the app.
Case 1: Evicted and minimum staking duration achieved
serviceID: 529
in the UI. Here is a representation of the service information on eth95.dev.serviceStakingState
is 2) and was started on July 13th, surpassing theminimum staking duration of 3 days
. Therefore, the user can start the agent without any issues.Case 2: Evicted and minimum staking duration NOT achieved
serviceStakingState
as 2.EVICTION MESSAGE