Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ All notable changes to this project will be documented in this file.
- Extend `validate_program_account!` migration to remaining user and multicastgroup allowlist processors (`set_bgp_status`, `delete`, `closeaccount`, publisher/subscriber `add`/`remove`)
- Add `OutboundIcmp` target type (`= 2`) to the geolocation onchain program, enabling ICMP-based probing as an alternative to TWAMP for outbound geolocation targets
- Allow pending users with subs to be deleted
- Rename subscribe processor functions (`process_subscribe_multicastgroup` → `process_update_multicastgroup_subscription`) to reflect that they handle both subscribe and unsubscribe, and simplify the status validation guard
- Geolocation
- Standardize CLI flag naming: probe mutation commands use `--probe` (was `--code`) accepting pubkey or code; rename `--signing-keypair` → `--signing-pubkey` and `--target-pk` → `--target-signing-pubkey`; add `--json-compact` to `get` commands
- geoprobe-target can now store LocationOffset messages in ClickHouse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ use crate::{
delete::process_delete_multicastgroup,
reactivate::process_reactivate_multicastgroup,
reject::process_reject_multicastgroup,
subscribe::process_subscribe_multicastgroup,
subscribe::process_update_multicastgroup_subscription,
suspend::process_suspend_multicastgroup,
update::process_update_multicastgroup,
},
Expand Down Expand Up @@ -294,7 +294,7 @@ pub fn process_instruction(
process_remove_multicast_sub_allowlist(program_id, accounts, &value)?
}
DoubleZeroInstruction::SubscribeMulticastGroup(value) => {
process_subscribe_multicastgroup(program_id, accounts, &value)?
process_update_multicastgroup_subscription(program_id, accounts, &value)?
}
DoubleZeroInstruction::CreateSubscribeUser(value) => {
process_create_subscribe_user(program_id, accounts, &value)?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub struct SubscribeUserResult {
/// and post-activation subscription changes (add/remove toggle). The caller is
/// responsible for setting `user.status = Updating` when
/// `publisher_list_transitioned` is true and the user is already activated.
pub fn subscribe_user_to_multicastgroup(
pub fn update_user_multicastgroup_subscription(
mgroup_account: &AccountInfo,
accesspass: &AccessPass,
user: &mut User,
Expand Down Expand Up @@ -130,7 +130,7 @@ pub fn subscribe_user_to_multicastgroup(
})
}

pub fn process_subscribe_multicastgroup(
pub fn process_update_multicastgroup_subscription(
program_id: &Pubkey,
accounts: &[AccountInfo],
value: &MulticastGroupSubscribeArgs,
Expand Down Expand Up @@ -171,7 +171,7 @@ pub fn process_subscribe_multicastgroup(
let system_program = next_account_info(accounts_iter)?;

#[cfg(test)]
msg!("process_subscribe_multicastgroup({:?})", value);
msg!("process_update_multicastgroup_subscription({:?})", value);

// Check if the payer is a signer
assert!(payer_account.is_signer, "Payer must be a signer");
Expand Down Expand Up @@ -201,14 +201,10 @@ pub fn process_subscribe_multicastgroup(

// Parse and validate user
let mut user: User = User::try_from(user_account)?;
// Allow pure-unsubscribe (both false) for any status so that users
// created atomically via CreateSubscribeUser can be cleaned up before
// activation. Subscribe operations still require Activated/Updating.
let is_unsubscribe_only = !value.publisher && !value.subscriber;
if !is_unsubscribe_only
&& user.status != UserStatus::Activated
&& user.status != UserStatus::Updating
{
// Unsubscribe is allowed for any status so that users
// created via CreateSubscribeUser can be cleaned up before activation.
let is_subscribe = value.publisher || value.subscriber;
if is_subscribe && user.status != UserStatus::Activated && user.status != UserStatus::Updating {
msg!("UserStatus: {:?}", user.status);
return Err(DoubleZeroError::InvalidStatus.into());
}
Expand Down Expand Up @@ -252,7 +248,7 @@ pub fn process_subscribe_multicastgroup(
}
}

let result = subscribe_user_to_multicastgroup(
let result = update_user_multicastgroup_subscription(
mgroup_account,
&accesspass,
&mut user,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use super::{
create_core::{create_user_core, CreateUserCoreAccounts, PDAVersion},
resource_onchain_helpers,
};
use crate::processors::multicastgroup::subscribe::subscribe_user_to_multicastgroup;
use crate::processors::multicastgroup::subscribe::update_user_multicastgroup_subscription;

#[derive(BorshSerialize, BorshDeserializeIncremental, PartialEq, Clone)]
pub struct UserCreateSubscribeArgs {
Expand Down Expand Up @@ -111,7 +111,7 @@ pub fn process_create_subscribe_user(
)?;

// Subscribe user to multicast group
let subscribe_result = subscribe_user_to_multicastgroup(
let subscribe_result = update_user_multicastgroup_subscription(
mgroup_account,
&result.accesspass,
&mut result.user,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ async fn test_duplicate_publisher_subscribe_is_noop() {
}

/// Foundation admin (payer != user.owner) can subscribe a user to a multicast group.
/// Regression test for the bug where process_subscribe_multicastgroup derived the AccessPass PDA
/// Regression test for the bug where process_update_multicastgroup_subscription derived the AccessPass PDA
/// using payer_account.key instead of user.owner.
#[tokio::test]
async fn test_subscribe_foundation_admin_payer_differs_from_user_owner() {
Expand Down
Loading