Skip to content
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

It's possible to override existing operational address when calling change_operational_address #6

Open
h33333333 opened this issue Sep 20, 2024 · 0 comments

Comments

@h33333333
Copy link

There is a check in stake that ensures that provided operational_address is not used by any other staker:

assert_with_err(
self.operational_address_to_staker_address.read(operational_address).is_zero(),
Error::OPERATIONAL_EXISTS
);

but this check is missing in change_operational_address which can lead to operational address override if operational_address was already in use by some other staker:

self.general_prerequisites();
self.roles.only_operator();
let staker_address = get_tx_info().account_contract_address;
let mut staker_info = self.get_staker_info(:staker_address);
self
.operational_address_to_staker_address
.write(staker_info.operational_address, Zero::zero());
let old_address = staker_info.operational_address;
staker_info.operational_address = operational_address;
self.staker_info.write(staker_address, Option::Some(staker_info));
self.operational_address_to_staker_address.write(operational_address, staker_address);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant