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

Dump validators list from oasisscan and use as fallback #734

Merged
merged 8 commits into from
Mar 25, 2022

Conversation

lukaw3d
Copy link
Member

@lukaw3d lukaw3d commented Mar 4, 2022

Part of #751
Part of #749

Currently, oasisscan is down, and oasismonitor is not loading validators.

Before After
image localhost_3000_account_oasis1qp25k3hv6ysrm6wntjnt6x0j5du0ud4qqchplrf2_stake (1)
localhost_3000_account_oasis1qp25k3hv6ysrm6wntjnt6x0j5du0ud4qqchplrf2_stake (2)

@lukaw3d lukaw3d requested review from tjanez and pro-wh March 4, 2022 20:52
@github-actions

This comment was marked as resolved.

Copy link
Member

@tjanez tjanez left a comment

Choose a reason for hiding this comment

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

I like this approach. I would perhaps just add a general notification like "Showing validator list as of <DATE-AND-TIME>".

Update: Could we tune the text to not show

Validators

Couldn't load validators. List may be empty or out of date. Error: request https://monitor.oasis.dev/data/validators?limit=500 status 500

but something like:

Validators (last updated: <DATE-AND-TIME>)

Error obtaining validator list from Oasis Monitor: request https://monitor.oasis.dev/data/validators?limit=500 returned status 500.

If everything works, it could just show:

Validators

But that can be done in a follow-up PR.

@codecov

This comment was marked as resolved.

Yawning
Yawning previously requested changes Mar 4, 2022

export const initialState: StakingState = {
debondingDelegations: [],
delegations: [],
validators: [],
validators: validatorsDump.validators,
Copy link

Choose a reason for hiding this comment

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

So with this users can end up delegating to a stale validator that may no longer exist? At a minimum staking operations while this data is being provided to users should be limited to debonding.

NACK.

Copy link
Member

Choose a reason for hiding this comment

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

Fair point, agreed

Copy link
Member Author

Choose a reason for hiding this comment

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

Mitigated by marking them all inactive for now, but I don't intend to merge image

Copy link
Contributor

Choose a reason for hiding this comment

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

imo instead of changing initial state we should fallback in saga when a request fails. instead of dispatching updateValidatorsError action we can dispatch
yield* put(stakingActions.updateValidators(validatorsDump.validators))

Copy link
Member Author

Choose a reason for hiding this comment

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

One difference in that case (without extra handling): if getting validators first succeeds, but fails second time, result is:

  • fallback on error: fallback
  • fallback in initial state: first success

Copy link
Contributor

Choose a reason for hiding this comment

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

ah true, is it possible that between the first and the second request validator could be updated? First success -> validator A works just fine -> something bad happens to validator A -> the second request to monitor fails -> we show fallback in initial state: first success where validator A is Ok -> user delegates to a stale validator.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, it is possible

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a warning before staking to validators with status inactive* or unknown:

localhost_3000_account_oasis1qp25k3hv6ysrm6wntjnt6x0j5du0ud4qqchplrf2_stake (2)


* Active/inactive meaning oasisscan/swagger.yml#L306-L309:

If "true", an entity has a node that is registered for being a validator, node is up to date, and has successfully registered itself. However, it may or may not be part of validator set (top <scheduler.params.max_validators> by stake).

Copy link

Choose a reason for hiding this comment

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

While the warning does make things clearer, I am still torn on this because it still forces people that delegate to something not working, into the debonding period. I am still of the opinion that instead of a warning this should just flat out reject the operation.

Inevitably someone will ignore the warning, and later complain once their tokens get stuck in debonding. While it is on them, forcing people to wait till things recover (in what should be an increasingly rare occurence in the future), is likely better.

If people really can't wait to delegate the command line tools will always work...

@@ -4,11 +4,12 @@ import { useInjectReducer, useInjectSaga } from 'utils/redux-injectors'

import { stakingSaga } from './saga'
import { DebondingDelegation, Delegation, StakingState, Validator, ValidatorDetails } from './types'
import * as validatorsDump from 'vendors/smartstake/validators_dump'
Copy link
Member Author

Choose a reason for hiding this comment

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

Another issue: this list is inaccurate for testnet

@lukaw3d lukaw3d force-pushed the lw/dump-validators branch 3 times, most recently from 8404629 to 83a293f Compare March 8, 2022 23:37
@lukaw3d lukaw3d changed the title Dump validators list from smartstake and use as fallback Dump validators list from oasisscan and use as fallback Mar 9, 2022
@lukaw3d lukaw3d force-pushed the lw/dump-validators branch 4 times, most recently from 29d2a2c to d5c5d40 Compare March 11, 2022 03:22
@lukaw3d lukaw3d force-pushed the lw/dump-validators branch 4 times, most recently from e61d268 to 74eac79 Compare March 23, 2022 00:51
@lukaw3d lukaw3d dismissed Yawning’s stale review March 25, 2022 01:31

Disabled confirm button

@lukaw3d lukaw3d merged commit e9c5ac7 into master Mar 25, 2022
@lukaw3d lukaw3d deleted the lw/dump-validators branch March 25, 2022 01:34
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.

None yet

4 participants