feat: remove developer token vs swap_distribution.total_e8s validation check#9425
feat: remove developer token vs swap_distribution.total_e8s validation check#9425
Conversation
…n check The Neurons' Fund has been discontinued so direct participants can assess for themselves whether the proposed token distributions are acceptable. The overflow sanity check is kept.
|
|
||
| if total_developer_e8s > swap_distribution.total_e8s { | ||
| return Err("Error: The sum of all developer allocated tokens must be less than or equal to swap_distribution.total_e8s".to_string()); | ||
| if Self::get_total_distributions(&developer_distribution.developer_neurons).is_err() { |
There was a problem hiding this comment.
This is the only place where get_total_distributions is called. The existing usage pattern is already a bit weird - the error message from this function is never used, and after the changes here, it's weirder as neither the u64 or the String in the return type Result<u64, String> is ever used. Consider simplifying by changing the function to something like fn check_total_developer_neurons_e8s_not_overflowing(&Vec<NeuronDistribution>) -> Result<(), String> and simply call Self::check_total_developer_neurons_e8s_not_overflowing()?
Actually, I wonder if this check can be removed entirely - it seems to me that the original "overflow" check was a byproduct of having to compute total_developer_e8s. It's not like we check every total is not overflow. I don't have a strong opinion about this though.
| initial_token_distribution | ||
| .validate(&nervous_system_parameters) | ||
| .is_err() | ||
| .is_ok() |
There was a problem hiding this comment.
Nit: in newer code we usually do assert_eq!(some_result, Ok()), so that when it fails we actually see the error message
Summary
swap_distribution.total_e8sinFractionalDeveloperVotingPower::validate()