diff --git a/programs/steward/src/instructions/auto_add_validator_to_pool.rs b/programs/steward/src/instructions/auto_add_validator_to_pool.rs index b9b2ff76..c2e05cd9 100644 --- a/programs/steward/src/instructions/auto_add_validator_to_pool.rs +++ b/programs/steward/src/instructions/auto_add_validator_to_pool.rs @@ -106,6 +106,8 @@ pub fn handler(ctx: Context) -> Result<()> { let validator_history = ctx.accounts.validator_history_account.load()?; let epoch = Clock::get()?.epoch; + //TODO Cannot add if validator mismatch + // Should not be able to add a validator if update is not complete require!( epoch == state_account.state.current_epoch, diff --git a/programs/steward/src/instructions/auto_remove_validator_from_pool.rs b/programs/steward/src/instructions/auto_remove_validator_from_pool.rs index 70a205e1..babe8dcc 100644 --- a/programs/steward/src/instructions/auto_remove_validator_from_pool.rs +++ b/programs/steward/src/instructions/auto_remove_validator_from_pool.rs @@ -124,6 +124,8 @@ pub struct AutoRemoveValidator<'info> { */ pub fn handler(ctx: Context, validator_list_index: usize) -> Result<()> { + //TODO Cannot remove if mismatch + { let mut state_account = ctx.accounts.state_account.load_mut()?; let validator_list = &ctx.accounts.validator_list; diff --git a/programs/steward/src/instructions/index_mismatch_interrupt.rs b/programs/steward/src/instructions/index_mismatch_interrupt.rs index 95a1062b..ef84e159 100644 --- a/programs/steward/src/instructions/index_mismatch_interrupt.rs +++ b/programs/steward/src/instructions/index_mismatch_interrupt.rs @@ -32,14 +32,16 @@ pub struct IndexMismatchInterrupt<'info> { /// Runs maintenance tasks at the start of each epoch, needs to be run multiple times /// Routines: /// - Remove delinquent validators -pub fn handler( - ctx: Context, - validator_index_to_remove: usize, -) -> Result<()> { +pub fn handler(ctx: Context) -> Result<()> { let mut state_account = ctx.accounts.state_account.load_mut()?; // How do we know if a validator has been removed? + //TODO index passed in has to be lowest marked for removal + // Iterate through the list of validators and check status + // Use diff amount to find correct index to remove + //TODO take out validator index to remove - we always remove the lowest index + { require!( state_account