Add deactivation cooldown before address lookup tables can be closed (#22011)

This commit is contained in:
Justin Starry
2021-12-20 17:33:46 -06:00
committed by GitHub
parent c0c3d7c1f2
commit f5d1115468
8 changed files with 430 additions and 72 deletions

View File

@@ -78,6 +78,30 @@ async fn test_freeze_immutable_lookup_table() {
.await;
}
#[tokio::test]
async fn test_freeze_deactivated_lookup_table() {
let mut context = setup_test_context().await;
let authority = Keypair::new();
let initialized_table = {
let mut table = new_address_lookup_table(Some(authority.pubkey()), 10);
table.meta.deactivation_slot = 0;
table
};
let lookup_table_address = Pubkey::new_unique();
add_lookup_table_account(&mut context, lookup_table_address, initialized_table).await;
let ix = freeze_lookup_table(lookup_table_address, authority.pubkey());
assert_ix_error(
&mut context,
ix,
Some(&authority),
InstructionError::InvalidArgument,
)
.await;
}
#[tokio::test]
async fn test_freeze_lookup_table_with_wrong_authority() {
let mut context = setup_test_context().await;