Skip to content

Commit

Permalink
pr comments
Browse files Browse the repository at this point in the history
- remove is_immutable and make admin optional
- remove has one admin constraint as it is redundant with check_admin
- fixed claim admin constraints and added test
- fixed typos and other nits alike
Signed-off-by: bingyuyap <[email protected]>
  • Loading branch information
bingyuyap committed Oct 24, 2024
1 parent 64e3659 commit 54e887b
Show file tree
Hide file tree
Showing 19 changed files with 225 additions and 201 deletions.
2 changes: 1 addition & 1 deletion svm/programs/mock-integrator/tests/add_transceiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ async fn test_add_transceiver_with_transfer_in_progress() {
// Verify that the integrator config hasn't changed
let integrator_config: IntegratorConfig =
get_account(&mut context.banks_client, integrator_config_pda).await;
assert_eq!(integrator_config.admin, admin.pubkey());
assert_eq!(integrator_config.admin, Some(admin.pubkey()));
assert_eq!(
integrator_config.pending_admin,
Some(pending_admin.pubkey())
Expand Down
4 changes: 2 additions & 2 deletions svm/programs/mock-integrator/tests/disable_transceiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ async fn test_disable_transceiver_with_transfer_in_progress() {
// Verify that the integrator config hasn't changed
let integrator_config: IntegratorConfig =
get_account(&mut context.banks_client, integrator_config_pda).await;
assert_eq!(integrator_config.admin, admin.pubkey());
assert_eq!(integrator_config.admin, Some(admin.pubkey()));
assert_eq!(
integrator_config.pending_admin,
Some(pending_admin.pubkey())
Expand Down Expand Up @@ -515,5 +515,5 @@ async fn test_disable_transceiver_with_immutable_config() {
// Verify that the integrator config is immutable
let integrator_config: IntegratorConfig =
get_account(&mut context.banks_client, integrator_config_pda).await;
assert_eq!(integrator_config.is_immutable, true);
assert_eq!(integrator_config.admin, None);
}
2 changes: 1 addition & 1 deletion svm/programs/mock-integrator/tests/discard_admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async fn test_discard_admin_success() {
// Verify that the admin has been discarded
let integrator_config: IntegratorConfig =
get_account(&mut context.banks_client, integrator_config_pda).await;
assert_eq!(integrator_config.is_immutable, true);
assert_eq!(integrator_config.admin, None);
}

#[tokio::test]
Expand Down
2 changes: 1 addition & 1 deletion svm/programs/mock-integrator/tests/enable_transceiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -508,5 +508,5 @@ async fn test_enable_transceiver_with_immutable_config() {
// Verify that the integrator config is immutable
let integrator_config: IntegratorConfig =
get_account(&mut context.banks_client, integrator_config_pda).await;
assert_eq!(integrator_config.is_immutable, true);
assert_eq!(integrator_config.admin, None);
}
2 changes: 1 addition & 1 deletion svm/programs/mock-integrator/tests/register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async fn test_invoke_register() {
let integrator_config_data: router::state::IntegratorConfig =
get_account(&mut context.banks_client, integrator_config).await;

assert_eq!(integrator_config_data.admin, admin.pubkey());
assert_eq!(integrator_config_data.admin, Some(admin.pubkey()));
assert_eq!(
integrator_config_data.integrator_program_id,
mock_integrator::id()
Expand Down
Loading

0 comments on commit 54e887b

Please sign in to comment.