Skip to content

foreign chain config/votes are not cleaned up when removing participant #2769

@DSharifi

Description

@DSharifi

Background

In vote reshared we get potentially new set of participants. If a participant is removed, we should also clean up their foreign chain config from the contract, otherwise we risk collecting stale data.

mpc/crates/contract/src/lib.rs

Lines 1207 to 1240 in ba631ef

if let Some(new_state) = self.protocol_state.vote_reshared(key_event_id)? {
// Resharing has concluded, transition to running state
self.protocol_state = new_state;
// Spawn a promise to clean up votes from non-participants.
// Note: MpcContract::vote_update uses filtering to ensure correctness even if this cleanup fails.
Promise::new(env::current_account_id())
.function_call(
method_names::REMOVE_NON_PARTICIPANT_UPDATE_VOTES.to_string(),
vec![],
NearToken::from_yoctonear(0),
Gas::from_tgas(self.config.remove_non_participant_update_votes_tera_gas),
)
.detach();
// Spawn a promise to clean up TEE information for non-participants
Promise::new(env::current_account_id())
.function_call(
method_names::CLEAN_TEE_STATUS.to_string(),
vec![],
NearToken::from_yoctonear(0),
Gas::from_tgas(self.config.clean_tee_status_tera_gas),
)
.detach();
// Spawn a promise to clean up orphaned node migrations for non-participants
Promise::new(env::current_account_id())
.function_call(
method_names::CLEANUP_ORPHANED_NODE_MIGRATIONS.to_string(),
vec![],
NearToken::from_yoctonear(0),
Gas::from_tgas(self.config.cleanup_orphaned_node_migrations_tera_gas),
)
.detach();
}

User Story

No response

Acceptance Criteria

foreign chain configs of non participants are removed if the participant leaves the network

Resources & Additional Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions