-
Notifications
You must be signed in to change notification settings - Fork 41
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
fix(node): skip power scale if not collateral based #1149
base: main
Are you sure you want to change the base?
Conversation
) { | ||
args.power_scale.unwrap_or(DEFAULT_POWER_SCALE) | ||
} else { | ||
TokenAmount::DECIMALS as PowerScale |
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.
will this be the value we put in set-federated-power? that would be great if so!
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.
This is great, it will help our federated subnets be more robust! I cannot authoritatively review the code changes but definitely the intended result is correct!
) { | ||
args.power_scale.unwrap_or(DEFAULT_POWER_SCALE) | ||
} else { | ||
TokenAmount::DECIMALS as PowerScale |
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.
@cryptoAtwill shouldn't this be 1? We want X federated power to translate directly into X weight, right? Having 18 here would force users to append 18 zeroes to whatever power they actually want to see in the subnet?
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.
it's a subtraction here:
ipc/fendermint/vm/genesis/src/lib.rs
Line 129 in d881a2e
d if d >= 0 => TokenAmount::DECIMALS.saturating_sub(d as usize) as u32, |
The power scale is used to convert collateral staked into voting power for cometbft.
With federated power, the power scale is also used to convert federated power into voting power. This has caused a lot of confusion for many ppl. For example, if one sets the federated power to 1000, with the power scale division, the voting power set in cometbft is actually 1. For those who are not aware of power scale, they constantly ask how come? This is especially bad if two validators with federated power of, say, 1000 and 1. People would assume 1000 would have a higher power, but it turns out, the two validators have the same power.
This PR makes a quick fix to resolve the above issue at genesis. If the power comes from non-collateral based, power scale is set to 18, which is effectively no power scaling.
Perhaps a more in depth refactor would be replacing the
Collateral
struct withPower
, but that would require breaking changes in too many places, perhaps this way is faster and safer.