-
Notifications
You must be signed in to change notification settings - Fork 75
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
feat(sequencer)!: add validator update with name action #1608
Conversation
@@ -33,6 +33,7 @@ pub enum Action { | |||
Sequence(SequenceAction), | |||
Transfer(TransferAction), | |||
ValidatorUpdate(ValidatorUpdate), | |||
ValidatorUpdateWithName(ValidatorUpdateWithName), |
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.
Open to calling this action something else if people would like. Maybe something like NamedValidatorUpdate
#[instrument(skip_all)] | ||
fn clear_validator_names(&mut self) { | ||
self.delete(VALIDATOR_NAMES_KEY.to_string()); | ||
} |
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.
Seems like this is unused - can it be removed?
fn put_validator_names(&mut self, validator_names: BTreeMap<String, String>) -> Result<()> { | ||
self.put_raw( | ||
VALIDATOR_NAMES_KEY.to_string(), | ||
serde_json::to_vec(&validator_names).wrap_err("failed to serialize validator names")?, |
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.
We're now using Borsh to encode everything in storage. Could you update this to follow the approach taken for other types please?
This will involve creating a new type in authority::storage
like:
#[derive(Debug, BorshSerialize, BorshDeserialize)]
pub(in crate::authority) struct ValidatorName<'a>(Cow<'a, str>);
See the implementation for AddressPrefix
for example.
This new type should then be included as a variant in authority::storage::ValueImpl
.
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.
Could we have a new unit test for the added putter/getter please?
} | ||
}; | ||
|
||
match validator_names.get(&hex::encode(address.address_bytes())) { |
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.
Can we avoid hex-encoding the addresses in this collection?
Summary
Added
ValidatorUpdateWithName
action which wraps aValidatorUpdate
and has an additional field for the validator name to be stored app side.Background
Validator names could previously only be set in the CometBFT genesis, this is meant to give us a way to set validator names app-side.
Changes
ValidatorUpdateWithName
action to proto, core, and sequencer.Testing
ValidatorUpdateWithName
action.validator_name_request
ABCI query.ValidatorUpdateWithName
toapp_execute_transaction_with_every_action_snapshot
Breaking Changelist
Related Issues
closes #1590