This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Repository navigation
Conversation
pepyakin
reviewed
Jun 27, 2018
| // Ok - all valid. | ||
|
|
||
| // update nominators_for | ||
| t.swap_remove(target_index); |
Contributor
There was a problem hiding this comment.
Just a question to refine my own understanding: isn't this will invalidate an index of the last nominator?
so for example, there are two calls:
unnominate(0, 0)unnominate(1, 1)
the second call will return an error Invalid target index because the first call invalidated the index of the nominator 1.
Member
Author
There was a problem hiding this comment.
yes - in that case, the second will be a no-op - they'll need to resubmit the tx. shit happens :)
pepyakin
reviewed
Jun 27, 2018
| //let r = Self::voting_balance(n) * reward / total; // correct formula, but might overflow with large reard * total. | ||
| let quant = T::Balance::sa(1usize << 31); | ||
| let s = (Self::voting_balance(n) * quant / total) * rem / quant; // avoid overflow by using quant as a denominator. | ||
| let _ = Self::slash(n, s); // will never fail as nominator accounts must be created, but even if it did, it's just a missed reward. |
Contributor
There was a problem hiding this comment.
wait a minute, we are not talking about rewards here : D
pepyakin
reviewed
Jun 27, 2018
| } | ||
|
|
||
| fn nominate(aux: &T::PublicAux, target: RawAddress<T::AccountId, T::AccountIndex>) -> Result { | ||
| let target = Self::lookup(target)?; |
Contributor
There was a problem hiding this comment.
I'm a validator. Can I nominate myself?
Contributor
There was a problem hiding this comment.
Is there any check that prevents this?
Member
Author
|
Review continues in the rebased #262 |
liuchengxu
pushed a commit
to chainx-org/substrate
that referenced
this pull request
Aug 23, 2021
* no message * update orderpair * no message
liuchengxu
pushed a commit
to autonomys/substrate
that referenced
this pull request
Jun 3, 2022
Subspace networking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second part of #194 . Nothing special here, just added
nominateandunnominate, which roughly follow semantics ofstakeandunstake, except they nominate themselves to some other (potential) validator and share the reward.