-
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
Chain-Config update logic #208
base: feat/chain-config
Are you sure you want to change the base?
Conversation
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
Coverage SummaryTotals
FilesExpand
|
Contract comparison - from 85d3429 to 051ae2c
|
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
Signed-off-by: Andrei Baltariu <[email protected]>
); | ||
} | ||
|
||
fn require_validator_range(&self, min_validators: u64, max_validators: u64) { |
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 should be called in require_config_set
chain-config/src/validator_rules.rs
Outdated
@@ -15,43 +17,21 @@ pub struct TokenIdAmountPair<M: ManagedTypeApi> { | |||
pub trait ValidatorRulesModule { | |||
fn require_config_set(&self) { |
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.
fn require_config_set(&self) { | |
fn require_valid_config(&self) { |
Also, we can send a config as argument and validate it. This should be better because we first check the config, then we set it in storage
self.min_validators().set(min_validators); | ||
self.max_validators().set(max_validators); | ||
self.min_stake().set(min_stake); | ||
fn init(&self, config: SovereignConfig<Self::Api>, admin: ManagedAddress) { |
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.
call require_valid_config
in init
chain-config/src/lib.rs
Outdated
let value = TokenIdAmountPair { token_id, amount }; | ||
#[endpoint(updateConfig)] | ||
fn update_config(&self, new_config: SovereignConfig<Self::Api>) { | ||
self.require_config_set(); |
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.
self.require_config_set(); | |
self.require_config_set(new_config); |
We check if it's valid before setting it
Signed-off-by: Andrei Baltariu <[email protected]>
No description provided.