diff --git a/backend/bots/examples/group_prize_bot/impl/src/updates/handle_direct_message.rs b/backend/bots/examples/group_prize_bot/impl/src/updates/handle_direct_message.rs index decc6049f5..7e66579c92 100644 --- a/backend/bots/examples/group_prize_bot/impl/src/updates/handle_direct_message.rs +++ b/backend/bots/examples/group_prize_bot/impl/src/updates/handle_direct_message.rs @@ -1,10 +1,10 @@ use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_prize_bot::handle_direct_message::*; use types::{BotMessage, MessageContentInitial, TextContent}; -#[update_msgpack] +#[update(msgpack = true)] #[trace] fn handle_direct_message(_args: Args) -> Response { mutate_state(handle_message) diff --git a/backend/bots/examples/icp_dispenser/impl/src/updates/handle_direct_message.rs b/backend/bots/examples/icp_dispenser/impl/src/updates/handle_direct_message.rs index 76962b8556..73ec6676df 100644 --- a/backend/bots/examples/icp_dispenser/impl/src/updates/handle_direct_message.rs +++ b/backend/bots/examples/icp_dispenser/impl/src/updates/handle_direct_message.rs @@ -1,12 +1,12 @@ use crate::model::pending_actions::PendingAction; use crate::model::reward_codes::ClaimRewardCodeResult; use crate::{mutate_state, RewardCodes, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use icp_dispenser_bot::handle_direct_message::*; use types::{BotMessage, MessageContent, MessageContentInitial, TextContent, UserId}; -#[update_msgpack] +#[update(msgpack = true)] #[trace] fn handle_direct_message(args: Args) -> Response { mutate_state(|state| handle_message(args, state)) diff --git a/backend/bots/examples/satoshi_dice/impl/src/updates/c2c_add_user.rs b/backend/bots/examples/satoshi_dice/impl/src/updates/c2c_add_user.rs index 87bedaf08e..236d113888 100644 --- a/backend/bots/examples/satoshi_dice/impl/src/updates/c2c_add_user.rs +++ b/backend/bots/examples/satoshi_dice/impl/src/updates/c2c_add_user.rs @@ -1,12 +1,12 @@ use crate::guards::caller_is_local_user_index; use crate::model::pending_actions_queue::Action; use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use satoshi_dice_canister::c2c_add_user::{Response::*, *}; use types::{BlobReference, CanisterId, ImageContent, MessageContentInitial, TextContent, ThumbnailData, UserId}; -#[update_msgpack(guard = "caller_is_local_user_index")] +#[update(guard = "caller_is_local_user_index", msgpack = true)] #[trace] fn c2c_add_user(args: Args) -> Response { mutate_state(|state| c2c_add_user_impl(args.user_id, state)) diff --git a/backend/bots/examples/satoshi_dice/impl/src/updates/handle_direct_message.rs b/backend/bots/examples/satoshi_dice/impl/src/updates/handle_direct_message.rs index 6a469c7229..c1d3383058 100644 --- a/backend/bots/examples/satoshi_dice/impl/src/updates/handle_direct_message.rs +++ b/backend/bots/examples/satoshi_dice/impl/src/updates/handle_direct_message.rs @@ -1,7 +1,7 @@ use crate::model::pending_actions_queue::{Action, TransferCkbtc}; use crate::model::user_map::DiceRoll; use crate::{mutate_state, RuntimeState, MAX_SATS_PER_ROLL}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use rand::RngCore; use satoshi_dice_canister::handle_direct_message::*; @@ -10,7 +10,7 @@ use utils::time::MINUTE_IN_MS; const MAX_TOTAL_WINNINGS: u64 = 50_000; -#[update_msgpack] +#[update(msgpack = true)] #[trace] fn handle_direct_message(args: Args) -> Response { mutate_state(|state| handle_message(args, state)) diff --git a/backend/bots/examples/sns1_airdrop/impl/src/updates/handle_direct_message.rs b/backend/bots/examples/sns1_airdrop/impl/src/updates/handle_direct_message.rs index e3065ab8ff..d2a02af6c6 100644 --- a/backend/bots/examples/sns1_airdrop/impl/src/updates/handle_direct_message.rs +++ b/backend/bots/examples/sns1_airdrop/impl/src/updates/handle_direct_message.rs @@ -1,12 +1,12 @@ use crate::{mutate_state, RuntimeState}; use candid::Principal; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use sns1_airdrop::handle_direct_message::*; use std::collections::hash_map::Entry::{Occupied, Vacant}; use types::{BotMessage, MessageContent, MessageContentInitial, TextContent, UserId}; -#[update_msgpack] +#[update(msgpack = true)] #[trace] fn handle_direct_message(args: Args) -> Response { mutate_state(|state| handle_message(args, state)) diff --git a/backend/canisters/community/impl/src/queries/c2c_can_issue_access_token_for_channel.rs b/backend/canisters/community/impl/src/queries/c2c_can_issue_access_token_for_channel.rs index 142b90afb7..6b789fb95a 100644 --- a/backend/canisters/community/impl/src/queries/c2c_can_issue_access_token_for_channel.rs +++ b/backend/canisters/community/impl/src/queries/c2c_can_issue_access_token_for_channel.rs @@ -1,12 +1,12 @@ use crate::guards::caller_is_local_user_index; use crate::read_state; use crate::RuntimeState; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use community_canister::c2c_can_issue_access_token_for_channel::*; use group_chat_core::{GroupChatCore, GroupMemberInternal}; use types::{AccessTokenType, VideoCallType}; -#[query_msgpack(guard = "caller_is_local_user_index")] +#[query(guard = "caller_is_local_user_index", msgpack = true)] fn c2c_can_issue_access_token_for_channel(args: Args) -> Response { read_state(|state| c2c_can_issue_access_token_for_channel_impl(args, state)) } diff --git a/backend/canisters/community/impl/src/queries/events.rs b/backend/canisters/community/impl/src/queries/events.rs index 38584fd6f4..77a1eb43d0 100644 --- a/backend/canisters/community/impl/src/queries/events.rs +++ b/backend/canisters/community/impl/src/queries/events.rs @@ -2,18 +2,17 @@ use crate::guards::caller_is_local_user_index; use crate::queries::check_replica_up_to_date; use crate::{read_state, RuntimeState}; use candid::Principal; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use community_canister::c2c_events::Args as C2CArgs; use community_canister::events::{Response::*, *}; use group_chat_core::EventsResult; -use ic_cdk::query; -#[query] +#[query(candid = true)] fn events(args: Args) -> Response { read_state(|state| events_impl(args, None, state)) } -#[query_msgpack(guard = "caller_is_local_user_index")] +#[query(guard = "caller_is_local_user_index", msgpack = true)] fn c2c_events(args: C2CArgs) -> Response { read_state(|state| events_impl(args.args, Some(args.caller), state)) } diff --git a/backend/canisters/community/impl/src/queries/events_by_index.rs b/backend/canisters/community/impl/src/queries/events_by_index.rs index 5b379769a6..54aa57680a 100644 --- a/backend/canisters/community/impl/src/queries/events_by_index.rs +++ b/backend/canisters/community/impl/src/queries/events_by_index.rs @@ -2,18 +2,17 @@ use crate::guards::caller_is_local_user_index; use crate::queries::check_replica_up_to_date; use crate::{read_state, RuntimeState}; use candid::Principal; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use community_canister::c2c_events_by_index::Args as C2CArgs; use community_canister::events_by_index::{Response::*, *}; use group_chat_core::EventsResult; -use ic_cdk::query; -#[query] +#[query(candid = true)] fn events_by_index(args: Args) -> Response { read_state(|state| events_by_index_impl(args, None, state)) } -#[query_msgpack(guard = "caller_is_local_user_index")] +#[query(guard = "caller_is_local_user_index", msgpack = true)] fn c2c_events_by_index(args: C2CArgs) -> Response { read_state(|state| events_by_index_impl(args.args, Some(args.caller), state)) } diff --git a/backend/canisters/community/impl/src/queries/events_window.rs b/backend/canisters/community/impl/src/queries/events_window.rs index ca0c69a0ab..189bf6243c 100644 --- a/backend/canisters/community/impl/src/queries/events_window.rs +++ b/backend/canisters/community/impl/src/queries/events_window.rs @@ -2,18 +2,17 @@ use crate::guards::caller_is_local_user_index; use crate::queries::check_replica_up_to_date; use crate::{read_state, RuntimeState}; use candid::Principal; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use community_canister::c2c_events_window::Args as C2CArgs; use community_canister::events_window::{Response::*, *}; use group_chat_core::EventsResult; -use ic_cdk::query; -#[query] +#[query(candid = true)] fn events_window(args: Args) -> Response { read_state(|state| events_window_impl(args, None, state)) } -#[query_msgpack(guard = "caller_is_local_user_index")] +#[query(guard = "caller_is_local_user_index", msgpack = true)] fn c2c_events_window(args: C2CArgs) -> Response { read_state(|state| events_window_impl(args.args, Some(args.caller), state)) } diff --git a/backend/canisters/community/impl/src/queries/summary.rs b/backend/canisters/community/impl/src/queries/summary.rs index 96f44d4064..44d0c42947 100644 --- a/backend/canisters/community/impl/src/queries/summary.rs +++ b/backend/canisters/community/impl/src/queries/summary.rs @@ -1,17 +1,16 @@ use crate::read_state; use crate::RuntimeState; use candid::Principal; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use community_canister::c2c_summary::{Args as C2CArgs, Response as C2CResponse}; use community_canister::summary::{Response::*, *}; -use ic_cdk::query; -#[query] +#[query(candid = true)] fn summary(args: Args) -> Response { read_state(|state| summary_impl(args.invite_code, None, state)) } -#[query_msgpack] +#[query(msgpack = true)] fn c2c_summary(args: C2CArgs) -> C2CResponse { read_state(|state| summary_impl(args.invite_code, args.on_behalf_of, state)) } diff --git a/backend/canisters/community/impl/src/queries/summary_updates.rs b/backend/canisters/community/impl/src/queries/summary_updates.rs index 62cb9d41f9..7919ead25b 100644 --- a/backend/canisters/community/impl/src/queries/summary_updates.rs +++ b/backend/canisters/community/impl/src/queries/summary_updates.rs @@ -4,21 +4,20 @@ use crate::model::members::CommunityMemberInternal; use crate::RuntimeState; use crate::{read_state, Data}; use candid::Principal; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use community_canister::c2c_summary_updates::{Args as C2CArgs, Response as C2CResponse}; use community_canister::summary_updates::{Response::*, *}; -use ic_cdk::query; use types::{ AccessGate, CommunityCanisterCommunitySummaryUpdates, CommunityMembershipUpdates, CommunityPermissions, EventIndex, FrozenGroupInfo, OptionUpdate, TimestampMillis, }; -#[query] +#[query(candid = true)] fn summary_updates(args: Args) -> Response { read_state(|state| summary_updates_impl(args.updates_since, args.invite_code, None, state)) } -#[query_msgpack] +#[query(msgpack = true)] fn c2c_summary_updates(args: C2CArgs) -> C2CResponse { read_state(|state| summary_updates_impl(args.updates_since, args.invite_code, args.on_behalf_of, state)) } diff --git a/backend/canisters/community/impl/src/updates/add_reaction.rs b/backend/canisters/community/impl/src/updates/add_reaction.rs index 9a754466fb..8e5df39e3e 100644 --- a/backend/canisters/community/impl/src/updates/add_reaction.rs +++ b/backend/canisters/community/impl/src/updates/add_reaction.rs @@ -1,13 +1,13 @@ use crate::activity_notifications::handle_activity_notification; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_candid_and_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use chat_events::Reader; use community_canister::add_reaction::{Response::*, *}; use group_chat_core::{AddRemoveReactionResult, GroupChatCore}; use types::{Achievement, ChannelReactionAddedNotification, EventIndex, EventWrapper, Message, Notification, UserId}; -#[update_candid_and_msgpack] +#[update(candid = true, msgpack = true)] #[trace] fn add_reaction(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/community/impl/src/updates/c2c_delete_community.rs b/backend/canisters/community/impl/src/updates/c2c_delete_community.rs index 32dda8fb40..b99cdb5d9a 100644 --- a/backend/canisters/community/impl/src/updates/c2c_delete_community.rs +++ b/backend/canisters/community/impl/src/updates/c2c_delete_community.rs @@ -1,12 +1,12 @@ use crate::{read_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use community_canister::c2c_delete_community::{Response::*, *}; use group_index_canister::c2c_delete_community; use tracing::error; use types::{CanisterId, CommunityId, UserId}; -#[update_msgpack] +#[update(msgpack = true)] #[trace] async fn c2c_delete_community(_args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/community/impl/src/updates/c2c_freeze_community.rs b/backend/canisters/community/impl/src/updates/c2c_freeze_community.rs index b5e874f397..4a96a2c448 100644 --- a/backend/canisters/community/impl/src/updates/c2c_freeze_community.rs +++ b/backend/canisters/community/impl/src/updates/c2c_freeze_community.rs @@ -2,12 +2,12 @@ use crate::activity_notifications::handle_activity_notification; use crate::guards::caller_is_group_index_or_local_group_index; use crate::model::events::CommunityEventInternal; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use community_canister::c2c_freeze_community::{Response::*, *}; use types::{EventWrapper, FrozenGroupInfo, GroupFrozen, Timestamped}; -#[update_msgpack(guard = "caller_is_group_index_or_local_group_index")] +#[update(guard = "caller_is_group_index_or_local_group_index", msgpack = true)] #[trace] fn c2c_freeze_community(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/community/impl/src/updates/c2c_invite_users.rs b/backend/canisters/community/impl/src/updates/c2c_invite_users.rs index 4f8a537d2a..aed4cd887f 100644 --- a/backend/canisters/community/impl/src/updates/c2c_invite_users.rs +++ b/backend/canisters/community/impl/src/updates/c2c_invite_users.rs @@ -3,14 +3,14 @@ use crate::guards::caller_is_user_index_or_local_user_index; use crate::model::events::CommunityEventInternal; use crate::model::invited_users::UserInvitation; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use community_canister::c2c_invite_users::{Response::*, *}; use types::UsersInvited; const MAX_INVITES: usize = 100; -#[update_msgpack(guard = "caller_is_user_index_or_local_user_index")] +#[update(guard = "caller_is_user_index_or_local_user_index", msgpack = true)] #[trace] fn c2c_invite_users(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/community/impl/src/updates/c2c_invite_users_to_channel.rs b/backend/canisters/community/impl/src/updates/c2c_invite_users_to_channel.rs index 178c3a0152..8a31317f4e 100644 --- a/backend/canisters/community/impl/src/updates/c2c_invite_users_to_channel.rs +++ b/backend/canisters/community/impl/src/updates/c2c_invite_users_to_channel.rs @@ -2,12 +2,12 @@ use crate::activity_notifications::handle_activity_notification; use crate::guards::caller_is_local_user_index; use crate::updates::c2c_invite_users::invite_users_to_community_impl; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use community_canister::c2c_invite_users_to_channel::{Response::*, *}; use group_chat_core::InvitedUsersResult; -#[update_msgpack(guard = "caller_is_local_user_index")] +#[update(guard = "caller_is_local_user_index", msgpack = true)] #[trace] fn c2c_invite_users_to_channel(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/community/impl/src/updates/c2c_join_channel.rs b/backend/canisters/community/impl/src/updates/c2c_join_channel.rs index a869622886..bab90a3100 100644 --- a/backend/canisters/community/impl/src/updates/c2c_join_channel.rs +++ b/backend/canisters/community/impl/src/updates/c2c_join_channel.rs @@ -5,7 +5,7 @@ use crate::run_regular_jobs; use crate::updates::c2c_join_community::join_community; use crate::{activity_notifications::handle_activity_notification, mutate_state, read_state, RuntimeState}; use candid::Principal; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use chat_events::ChatEventInternal; use community_canister::c2c_join_channel::{Response::*, *}; @@ -16,7 +16,7 @@ use gated_groups::{ use group_chat_core::AddResult; use types::{AccessGate, ChannelId, MemberJoined, TimestampMillis, UniquePersonProof, VerifiedCredentialGateArgs}; -#[update_msgpack(guard = "caller_is_user_index_or_local_user_index")] +#[update(guard = "caller_is_user_index_or_local_user_index", msgpack = true)] #[trace] async fn c2c_join_channel(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/community/impl/src/updates/c2c_join_community.rs b/backend/canisters/community/impl/src/updates/c2c_join_community.rs index 86f8adf84b..09017d92cb 100644 --- a/backend/canisters/community/impl/src/updates/c2c_join_community.rs +++ b/backend/canisters/community/impl/src/updates/c2c_join_community.rs @@ -4,13 +4,13 @@ use crate::model::events::CommunityEventInternal; use crate::model::members::AddResult; use crate::updates::c2c_join_channel::join_channel_synchronously; use crate::{mutate_state, read_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use community_canister::c2c_join_community::{Response::*, *}; use gated_groups::{check_if_passes_gate, CheckGateArgs, CheckIfPassesGateResult, CheckVerifiedCredentialGateArgs}; use types::{AccessGate, ChannelId, MemberJoined, UsersUnblocked}; -#[update_msgpack(guard = "caller_is_user_index_or_local_user_index")] +#[update(guard = "caller_is_user_index_or_local_user_index", msgpack = true)] #[trace] async fn c2c_join_community(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/community/impl/src/updates/c2c_leave_community.rs b/backend/canisters/community/impl/src/updates/c2c_leave_community.rs index 96a2b97374..0d1c954f5a 100644 --- a/backend/canisters/community/impl/src/updates/c2c_leave_community.rs +++ b/backend/canisters/community/impl/src/updates/c2c_leave_community.rs @@ -2,13 +2,13 @@ use crate::{ activity_notifications::handle_activity_notification, model::events::CommunityEventInternal, mutate_state, run_regular_jobs, RuntimeState, }; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use community_canister::c2c_leave_community::{Response::*, *}; use types::MemberLeft; // Called via the user's user canister -#[update_msgpack] +#[update(msgpack = true)] #[trace] fn c2c_leave_community(_args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/community/impl/src/updates/c2c_notify_p2p_swap_status_change.rs b/backend/canisters/community/impl/src/updates/c2c_notify_p2p_swap_status_change.rs index 2b7528fae9..c752fa2b6f 100644 --- a/backend/canisters/community/impl/src/updates/c2c_notify_p2p_swap_status_change.rs +++ b/backend/canisters/community/impl/src/updates/c2c_notify_p2p_swap_status_change.rs @@ -1,11 +1,11 @@ use crate::guards::caller_is_escrow_canister; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use escrow_canister::{SwapStatus, SwapStatusChange as Args}; use types::{Chat, EventIndex, P2PSwapCancelled, P2PSwapExpired, P2PSwapLocation, P2PSwapStatus}; -#[update_msgpack(guard = "caller_is_escrow_canister")] +#[update(guard = "caller_is_escrow_canister", msgpack = true)] #[trace] fn c2c_notify_p2p_swap_status_change(args: Args) { run_regular_jobs(); diff --git a/backend/canisters/community/impl/src/updates/c2c_set_user_suspended.rs b/backend/canisters/community/impl/src/updates/c2c_set_user_suspended.rs index c82be50510..9a791b8a46 100644 --- a/backend/canisters/community/impl/src/updates/c2c_set_user_suspended.rs +++ b/backend/canisters/community/impl/src/updates/c2c_set_user_suspended.rs @@ -1,11 +1,11 @@ use crate::guards::caller_is_user_index; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use community_canister::c2c_set_user_suspended::{Response::*, *}; use types::Timestamped; -#[update_msgpack(guard = "caller_is_user_index")] +#[update(guard = "caller_is_user_index", msgpack = true)] #[trace] fn c2c_set_user_suspended(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/community/impl/src/updates/c2c_tip_message.rs b/backend/canisters/community/impl/src/updates/c2c_tip_message.rs index 5abe44e1d2..0f8b4e713e 100644 --- a/backend/canisters/community/impl/src/updates/c2c_tip_message.rs +++ b/backend/canisters/community/impl/src/updates/c2c_tip_message.rs @@ -1,6 +1,6 @@ use crate::activity_notifications::handle_activity_notification; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use chat_events::{Reader, TipMessageArgs}; use community_canister::c2c_tip_message::{Response::*, *}; @@ -8,7 +8,7 @@ use group_chat_core::TipMessageResult; use ledger_utils::format_crypto_amount_with_symbol; use types::{ChannelMessageTipped, EventIndex, Notification}; -#[update_msgpack] +#[update(msgpack = true)] #[trace] fn c2c_tip_message(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/community/impl/src/updates/c2c_unfreeze_community.rs b/backend/canisters/community/impl/src/updates/c2c_unfreeze_community.rs index b2854ad534..9407ee1642 100644 --- a/backend/canisters/community/impl/src/updates/c2c_unfreeze_community.rs +++ b/backend/canisters/community/impl/src/updates/c2c_unfreeze_community.rs @@ -2,12 +2,12 @@ use crate::activity_notifications::handle_activity_notification; use crate::guards::caller_is_group_index_or_local_group_index; use crate::model::events::CommunityEventInternal; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use community_canister::c2c_unfreeze_community::{Response::*, *}; use types::{EventWrapper, GroupUnfrozen, Timestamped}; -#[update_msgpack(guard = "caller_is_group_index_or_local_group_index")] +#[update(guard = "caller_is_group_index_or_local_group_index", msgpack = true)] #[trace] async fn c2c_unfreeze_community(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/community/impl/src/updates/c2c_update_proposals.rs b/backend/canisters/community/impl/src/updates/c2c_update_proposals.rs index 2220f0aec9..48a556a35d 100644 --- a/backend/canisters/community/impl/src/updates/c2c_update_proposals.rs +++ b/backend/canisters/community/impl/src/updates/c2c_update_proposals.rs @@ -1,10 +1,10 @@ use crate::activity_notifications::handle_activity_notification; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use community_canister::c2c_update_proposals::{Response::*, *}; -#[update_msgpack] +#[update(msgpack = true)] #[trace] async fn c2c_update_proposals(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/community/impl/src/updates/c2c_update_user_principal.rs b/backend/canisters/community/impl/src/updates/c2c_update_user_principal.rs index 62e1ce7621..6c51d96238 100644 --- a/backend/canisters/community/impl/src/updates/c2c_update_user_principal.rs +++ b/backend/canisters/community/impl/src/updates/c2c_update_user_principal.rs @@ -1,10 +1,10 @@ use crate::guards::caller_is_user_index; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use community_canister::c2c_update_user_principal::*; -#[update_msgpack(guard = "caller_is_user_index")] +#[update(guard = "caller_is_user_index", msgpack = true)] #[trace] async fn c2c_update_user_principal(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/community/impl/src/updates/change_channel_role.rs b/backend/canisters/community/impl/src/updates/change_channel_role.rs index e95979198b..1e862d51ee 100644 --- a/backend/canisters/community/impl/src/updates/change_channel_role.rs +++ b/backend/canisters/community/impl/src/updates/change_channel_role.rs @@ -1,10 +1,10 @@ use crate::{activity_notifications::handle_activity_notification, mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_candid_and_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use community_canister::change_channel_role::{Response::*, *}; use group_chat_core::ChangeRoleResult; -#[update_candid_and_msgpack] +#[update(candid = true, msgpack = true)] #[trace] fn change_channel_role(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/community/impl/src/updates/create_channel.rs b/backend/canisters/community/impl/src/updates/create_channel.rs index 2cce266111..5a01caa2df 100644 --- a/backend/canisters/community/impl/src/updates/create_channel.rs +++ b/backend/canisters/community/impl/src/updates/create_channel.rs @@ -4,12 +4,11 @@ use crate::guards::caller_is_proposals_bot; use crate::model::channels::Channel; use crate::updates::c2c_join_channel::join_channel_unchecked; use crate::{mutate_state, read_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use community_canister::c2c_join_community; use community_canister::create_channel::{Response::*, *}; use group_chat_core::GroupChatCore; -use ic_cdk::update; use rand::Rng; use std::collections::HashMap; use types::{AccessGate, ChannelId, MultiUserChat, TimestampMillis, UserId}; @@ -18,7 +17,7 @@ use utils::text_validation::{ validate_description, validate_group_name, validate_rules, NameValidationError, RulesValidationError, }; -#[update] +#[update(candid = true)] #[trace] async fn create_channel(args: Args) -> Response { run_regular_jobs(); @@ -31,7 +30,7 @@ async fn create_channel(args: Args) -> Response { mutate_state(|state| create_channel_impl(args, false, diamond_membership_expiry_dates, state)) } -#[update_msgpack(guard = "caller_is_proposals_bot")] +#[update(guard = "caller_is_proposals_bot", msgpack = true)] #[trace] fn c2c_create_proposals_channel(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/community/impl/src/updates/delete_channel.rs b/backend/canisters/community/impl/src/updates/delete_channel.rs index 43639f18a4..67114c8c2a 100644 --- a/backend/canisters/community/impl/src/updates/delete_channel.rs +++ b/backend/canisters/community/impl/src/updates/delete_channel.rs @@ -2,12 +2,12 @@ use crate::{ activity_notifications::handle_activity_notification, model::events::CommunityEventInternal, mutate_state, run_regular_jobs, RuntimeState, }; -use canister_api_macros::update_candid_and_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use community_canister::delete_channel::{Response::*, *}; use types::{ChannelDeleted, ChannelId}; -#[update_candid_and_msgpack] +#[update(candid = true, msgpack = true)] #[trace] fn delete_channel(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/community/impl/src/updates/delete_messages.rs b/backend/canisters/community/impl/src/updates/delete_messages.rs index 75cda88e88..bedbd6f9f6 100644 --- a/backend/canisters/community/impl/src/updates/delete_messages.rs +++ b/backend/canisters/community/impl/src/updates/delete_messages.rs @@ -2,7 +2,7 @@ use crate::activity_notifications::handle_activity_notification; use crate::timer_job_types::HardDeleteMessageContentJob; use crate::{mutate_state, read_state, run_regular_jobs, RuntimeState, TimerJob}; use candid::Principal; -use canister_api_macros::update_candid_and_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use chat_events::DeleteMessageResult; use community_canister::delete_messages::{Response::*, *}; @@ -12,7 +12,7 @@ use user_index_canister_c2c_client::lookup_user; use utils::consts::OPENCHAT_BOT_USER_ID; use utils::time::MINUTE_IN_MS; -#[update_candid_and_msgpack] +#[update(candid = true, msgpack = true)] #[trace] async fn delete_messages(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/community/impl/src/updates/import_group.rs b/backend/canisters/community/impl/src/updates/import_group.rs index 116c26310d..30749751ea 100644 --- a/backend/canisters/community/impl/src/updates/import_group.rs +++ b/backend/canisters/community/impl/src/updates/import_group.rs @@ -1,14 +1,13 @@ use crate::guards::caller_is_proposals_bot; use crate::{mutate_state, read_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use community_canister::import_group::{Response::*, *}; use group_index_canister::c2c_start_importing_group_into_community::Response as C2cResponse; -use ic_cdk::update; use rand::Rng; use types::{CanisterId, ChannelId, ChatId, UserId}; -#[update_msgpack(guard = "caller_is_proposals_bot")] +#[update(guard = "caller_is_proposals_bot", msgpack = true)] async fn c2c_import_proposals_group( args: community_canister::c2c_import_proposals_group::Args, ) -> community_canister::c2c_import_proposals_group::Response { @@ -26,7 +25,7 @@ async fn c2c_import_proposals_group( } } -#[update] +#[update(candid = true)] #[trace] async fn import_group(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/community/impl/src/updates/send_message.rs b/backend/canisters/community/impl/src/updates/send_message.rs index 420af3bd8e..366568a07a 100644 --- a/backend/canisters/community/impl/src/updates/send_message.rs +++ b/backend/canisters/community/impl/src/updates/send_message.rs @@ -3,7 +3,7 @@ use crate::model::members::CommunityMembers; use crate::model::user_groups::UserGroup; use crate::timer_job_types::{DeleteFileReferencesJob, EndPollJob, MarkP2PSwapExpiredJob, RefundPrizeJob, TimerJob}; use crate::{mutate_state, run_regular_jobs, Data, RuntimeState}; -use canister_api_macros::{update_candid_and_msgpack, update_msgpack}; +use canister_api_macros::update; use canister_tracing_macros::trace; use community_canister::c2c_send_message::{Args as C2CArgs, Response as C2CResponse}; use community_canister::send_message::{Response::*, *}; @@ -17,7 +17,7 @@ use types::{ TimestampMillis, User, UserId, Version, }; -#[update_candid_and_msgpack] +#[update(candid = true, msgpack = true)] #[trace] fn send_message(args: Args) -> Response { run_regular_jobs(); @@ -25,7 +25,7 @@ fn send_message(args: Args) -> Response { mutate_state(|state| send_message_impl(args, state)) } -#[update_msgpack] +#[update(msgpack = true)] #[trace] fn c2c_send_message(args: C2CArgs) -> C2CResponse { run_regular_jobs(); diff --git a/backend/canisters/escrow/impl/src/updates/cancel_swap.rs b/backend/canisters/escrow/impl/src/updates/cancel_swap.rs index c1ed94f225..305d948e62 100644 --- a/backend/canisters/escrow/impl/src/updates/cancel_swap.rs +++ b/backend/canisters/escrow/impl/src/updates/cancel_swap.rs @@ -1,9 +1,9 @@ use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_candid_and_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use escrow_canister::cancel_swap::{Response::*, *}; -#[update_candid_and_msgpack] +#[update(candid = true, msgpack = true)] #[trace] fn cancel_swap(args: Args) -> Response { mutate_state(|state| cancel_swap_impl(args, state)) diff --git a/backend/canisters/escrow/impl/src/updates/create_swap.rs b/backend/canisters/escrow/impl/src/updates/create_swap.rs index c65338a3b8..fa5bf8477d 100644 --- a/backend/canisters/escrow/impl/src/updates/create_swap.rs +++ b/backend/canisters/escrow/impl/src/updates/create_swap.rs @@ -1,11 +1,11 @@ use crate::timer_job_types::{ExpireSwapJob, TimerJob}; use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_candid_and_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use escrow_canister::create_swap::{Response::*, *}; use types::TimestampMillis; -#[update_candid_and_msgpack] +#[update(candid = true, msgpack = true)] #[trace] fn create_swap(args: Args) -> Response { mutate_state(|state| create_swap_impl(args, state)) diff --git a/backend/canisters/escrow/impl/src/updates/notify_deposit.rs b/backend/canisters/escrow/impl/src/updates/notify_deposit.rs index dc44d6ca06..8a3a20092d 100644 --- a/backend/canisters/escrow/impl/src/updates/notify_deposit.rs +++ b/backend/canisters/escrow/impl/src/updates/notify_deposit.rs @@ -1,13 +1,13 @@ use crate::model::pending_payments_queue::{PendingPayment, PendingPaymentReason}; use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_candid_and_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use escrow_canister::deposit_subaccount; use escrow_canister::notify_deposit::{Response::*, *}; use icrc_ledger_types::icrc1::account::Account; use types::{CanisterId, UserId}; -#[update_candid_and_msgpack] +#[update(candid = true, msgpack = true)] #[trace] async fn notify_deposit(args: Args) -> Response { let PrepareResult { diff --git a/backend/canisters/group/impl/src/queries/c2c_can_issue_access_token.rs b/backend/canisters/group/impl/src/queries/c2c_can_issue_access_token.rs index 356803c384..bca9acb279 100644 --- a/backend/canisters/group/impl/src/queries/c2c_can_issue_access_token.rs +++ b/backend/canisters/group/impl/src/queries/c2c_can_issue_access_token.rs @@ -1,12 +1,12 @@ use crate::guards::caller_is_local_user_index; use crate::read_state; use crate::RuntimeState; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use group_canister::c2c_can_issue_access_token::*; use group_chat_core::{GroupChatCore, GroupMemberInternal}; use types::{AccessTokenType, VideoCallType}; -#[query_msgpack(guard = "caller_is_local_user_index")] +#[query(guard = "caller_is_local_user_index", msgpack = true)] fn c2c_can_issue_access_token(args: Args) -> Response { read_state(|state| c2c_can_issue_access_token_impl(args, state)) } diff --git a/backend/canisters/group/impl/src/queries/c2c_events_internal.rs b/backend/canisters/group/impl/src/queries/c2c_events_internal.rs index d2a7f76a27..0b1482c259 100644 --- a/backend/canisters/group/impl/src/queries/c2c_events_internal.rs +++ b/backend/canisters/group/impl/src/queries/c2c_events_internal.rs @@ -1,11 +1,11 @@ use crate::guards::caller_is_local_group_index; use crate::{read_state, RuntimeState}; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use chat_events::Reader; use group_canister::c2c_events_internal::{Response::*, *}; use types::EventIndex; -#[query_msgpack(guard = "caller_is_local_group_index")] +#[query(guard = "caller_is_local_group_index", msgpack = true)] fn c2c_events_internal(args: Args) -> Response { read_state(|state| c2c_events_internal_impl(args, state)) } diff --git a/backend/canisters/group/impl/src/queries/c2c_name_and_members.rs b/backend/canisters/group/impl/src/queries/c2c_name_and_members.rs index 4c26a12bb0..6e78fb650e 100644 --- a/backend/canisters/group/impl/src/queries/c2c_name_and_members.rs +++ b/backend/canisters/group/impl/src/queries/c2c_name_and_members.rs @@ -1,10 +1,10 @@ use crate::guards::caller_is_group_index_or_local_group_index; use crate::read_state; use crate::RuntimeState; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use group_canister::c2c_name_and_members::{Response::*, *}; -#[query_msgpack(guard = "caller_is_group_index_or_local_group_index")] +#[query(guard = "caller_is_group_index_or_local_group_index", msgpack = true)] fn c2c_name_and_members(_args: Args) -> Response { read_state(c2c_name_and_members_impl) } diff --git a/backend/canisters/group/impl/src/queries/events.rs b/backend/canisters/group/impl/src/queries/events.rs index b9e2f36d85..7e096a0c49 100644 --- a/backend/canisters/group/impl/src/queries/events.rs +++ b/backend/canisters/group/impl/src/queries/events.rs @@ -2,18 +2,17 @@ use crate::guards::caller_is_local_user_index; use crate::queries::check_replica_up_to_date; use crate::{read_state, RuntimeState}; use candid::Principal; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use group_canister::c2c_events::Args as C2CArgs; use group_canister::events::{Response::*, *}; use group_chat_core::EventsResult; -use ic_cdk::query; -#[query] +#[query(candid = true)] fn events(args: Args) -> Response { read_state(|state| events_impl(args, None, state)) } -#[query_msgpack(guard = "caller_is_local_user_index")] +#[query(guard = "caller_is_local_user_index", msgpack = true)] fn c2c_events(args: C2CArgs) -> Response { read_state(|state| events_impl(args.args, Some(args.caller), state)) } diff --git a/backend/canisters/group/impl/src/queries/events_by_index.rs b/backend/canisters/group/impl/src/queries/events_by_index.rs index 442cfe6fd3..b2d860cfc4 100644 --- a/backend/canisters/group/impl/src/queries/events_by_index.rs +++ b/backend/canisters/group/impl/src/queries/events_by_index.rs @@ -2,18 +2,17 @@ use crate::guards::caller_is_local_user_index; use crate::queries::check_replica_up_to_date; use crate::{read_state, RuntimeState}; use candid::Principal; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use group_canister::c2c_events_by_index::Args as C2CArgs; use group_canister::events_by_index::{Response::*, *}; use group_chat_core::EventsResult; -use ic_cdk::query; -#[query] +#[query(candid = true)] fn events_by_index(args: Args) -> Response { read_state(|state| events_by_index_impl(args, None, state)) } -#[query_msgpack(guard = "caller_is_local_user_index")] +#[query(guard = "caller_is_local_user_index", msgpack = true)] fn c2c_events_by_index(args: C2CArgs) -> Response { read_state(|state| events_by_index_impl(args.args, Some(args.caller), state)) } diff --git a/backend/canisters/group/impl/src/queries/events_window.rs b/backend/canisters/group/impl/src/queries/events_window.rs index 2200dbbd80..8b9481a583 100644 --- a/backend/canisters/group/impl/src/queries/events_window.rs +++ b/backend/canisters/group/impl/src/queries/events_window.rs @@ -2,18 +2,17 @@ use crate::guards::caller_is_local_user_index; use crate::queries::check_replica_up_to_date; use crate::{read_state, RuntimeState}; use candid::Principal; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use group_canister::c2c_events_window::Args as C2CArgs; use group_canister::events_window::{Response::*, *}; use group_chat_core::EventsResult; -use ic_cdk::query; -#[query] +#[query(candid = true)] fn events_window(args: Args) -> Response { read_state(|state| events_window_impl(args, None, state)) } -#[query_msgpack(guard = "caller_is_local_user_index")] +#[query(guard = "caller_is_local_user_index", msgpack = true)] fn c2c_events_window(args: C2CArgs) -> Response { read_state(|state| events_window_impl(args.args, Some(args.caller), state)) } diff --git a/backend/canisters/group/impl/src/queries/public_summary.rs b/backend/canisters/group/impl/src/queries/public_summary.rs index fe8cb814a7..350f4e629c 100644 --- a/backend/canisters/group/impl/src/queries/public_summary.rs +++ b/backend/canisters/group/impl/src/queries/public_summary.rs @@ -1,11 +1,11 @@ use crate::read_state; use crate::RuntimeState; -use canister_api_macros::query_candid_and_msgpack; +use canister_api_macros::query; use chat_events::Reader; use group_canister::public_summary::{Response::*, *}; use types::{BuildVersion, Document, PublicGroupSummary}; -#[query_candid_and_msgpack] +#[query(candid = true, msgpack = true)] fn public_summary(args: Args) -> Response { read_state(|state| public_summary_impl(args, state)) } diff --git a/backend/canisters/group/impl/src/queries/rules.rs b/backend/canisters/group/impl/src/queries/rules.rs index 8a16dc1e8a..dd34b7c32d 100644 --- a/backend/canisters/group/impl/src/queries/rules.rs +++ b/backend/canisters/group/impl/src/queries/rules.rs @@ -1,9 +1,9 @@ use crate::read_state; use crate::RuntimeState; -use canister_api_macros::query_candid_and_msgpack; +use canister_api_macros::query; use group_canister::rules::{Response::*, *}; -#[query_candid_and_msgpack] +#[query(candid = true, msgpack = true)] fn rules(args: Args) -> Response { read_state(|state| rules_impl(args, state)) } diff --git a/backend/canisters/group/impl/src/queries/summary.rs b/backend/canisters/group/impl/src/queries/summary.rs index 7f6d7dc21d..3e68a422c0 100644 --- a/backend/canisters/group/impl/src/queries/summary.rs +++ b/backend/canisters/group/impl/src/queries/summary.rs @@ -1,17 +1,16 @@ use crate::read_state; use crate::RuntimeState; use candid::Principal; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use group_canister::c2c_summary::{Args as C2CArgs, Response as C2CResponse}; use group_canister::summary::{Response::*, *}; -use ic_cdk::query; -#[query] +#[query(candid = true)] fn summary(_: Args) -> Response { read_state(|state| summary_impl(None, state)) } -#[query_msgpack] +#[query(msgpack = true)] fn c2c_summary(args: C2CArgs) -> C2CResponse { read_state(|state| summary_impl(args.on_behalf_of, state)) } diff --git a/backend/canisters/group/impl/src/queries/summary_updates.rs b/backend/canisters/group/impl/src/queries/summary_updates.rs index 5e26421ee6..efb0b0afc2 100644 --- a/backend/canisters/group/impl/src/queries/summary_updates.rs +++ b/backend/canisters/group/impl/src/queries/summary_updates.rs @@ -1,19 +1,18 @@ use crate::{read_state, RuntimeState}; use candid::Principal; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use group_canister::c2c_summary_updates::{Args as C2CArgs, Response as C2CResponse}; use group_canister::summary_updates::{Response::*, *}; -use ic_cdk::query; use types::{ GroupCanisterGroupChatSummaryUpdates, GroupMembershipUpdates, OptionUpdate, TimestampMillis, MAX_THREADS_IN_SUMMARY, }; -#[query] +#[query(candid = true)] fn summary_updates(args: Args) -> Response { read_state(|state| summary_updates_impl(args.updates_since, None, state)) } -#[query_msgpack] +#[query(msgpack = true)] fn c2c_summary_updates(args: C2CArgs) -> C2CResponse { read_state(|state| summary_updates_impl(args.updates_since, args.on_behalf_of, state)) } diff --git a/backend/canisters/group/impl/src/updates/c2c_delete_group.rs b/backend/canisters/group/impl/src/updates/c2c_delete_group.rs index b831a66fec..53a71db8cd 100644 --- a/backend/canisters/group/impl/src/updates/c2c_delete_group.rs +++ b/backend/canisters/group/impl/src/updates/c2c_delete_group.rs @@ -1,11 +1,11 @@ use crate::{read_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_canister::c2c_delete_group::{Response::*, *}; use group_index_canister::c2c_delete_group; use types::{CanisterId, UserId}; -#[update_msgpack] +#[update(msgpack = true)] #[trace] async fn c2c_delete_group(_args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/group/impl/src/updates/c2c_export_group.rs b/backend/canisters/group/impl/src/updates/c2c_export_group.rs index 6a0e6c6537..9b031c3818 100644 --- a/backend/canisters/group/impl/src/updates/c2c_export_group.rs +++ b/backend/canisters/group/impl/src/updates/c2c_export_group.rs @@ -1,12 +1,12 @@ use crate::guards::caller_is_community_being_imported_into; use crate::RuntimeState; use crate::{read_state, run_regular_jobs}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use group_canister::c2c_export_group::{Response::*, *}; use serde_bytes::ByteBuf; use std::cmp::min; -#[update_msgpack(guard = "caller_is_community_being_imported_into")] +#[update(guard = "caller_is_community_being_imported_into", msgpack = true)] fn c2c_export_group(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/group/impl/src/updates/c2c_freeze_group.rs b/backend/canisters/group/impl/src/updates/c2c_freeze_group.rs index 88014ffee2..2f1baca831 100644 --- a/backend/canisters/group/impl/src/updates/c2c_freeze_group.rs +++ b/backend/canisters/group/impl/src/updates/c2c_freeze_group.rs @@ -1,12 +1,12 @@ use crate::activity_notifications::handle_activity_notification; use crate::guards::caller_is_group_index_or_local_group_index; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_canister::c2c_freeze_group::{Response::*, *}; use types::{EventWrapper, FrozenGroupInfo, GroupFrozen, Timestamped, UserId}; -#[update_msgpack(guard = "caller_is_group_index_or_local_group_index")] +#[update(guard = "caller_is_group_index_or_local_group_index", msgpack = true)] #[trace] fn c2c_freeze_group(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/group/impl/src/updates/c2c_invite_users.rs b/backend/canisters/group/impl/src/updates/c2c_invite_users.rs index fe8a0b932b..27becf79f2 100644 --- a/backend/canisters/group/impl/src/updates/c2c_invite_users.rs +++ b/backend/canisters/group/impl/src/updates/c2c_invite_users.rs @@ -1,12 +1,12 @@ use crate::activity_notifications::handle_activity_notification; use crate::guards::caller_is_user_index_or_local_user_index; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_canister::c2c_invite_users::{Response::*, *}; use group_chat_core::InvitedUsersResult; -#[update_msgpack(guard = "caller_is_user_index_or_local_user_index")] +#[update(guard = "caller_is_user_index_or_local_user_index", msgpack = true)] #[trace] fn c2c_invite_users(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/group/impl/src/updates/c2c_join_group.rs b/backend/canisters/group/impl/src/updates/c2c_join_group.rs index a250b2a733..5cba162b1b 100644 --- a/backend/canisters/group/impl/src/updates/c2c_join_group.rs +++ b/backend/canisters/group/impl/src/updates/c2c_join_group.rs @@ -1,7 +1,7 @@ use crate::activity_notifications::handle_activity_notification; use crate::guards::caller_is_user_index_or_local_user_index; use crate::{mutate_state, read_state, run_regular_jobs, AddMemberArgs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use chat_events::ChatEventInternal; use gated_groups::{check_if_passes_gate, CheckGateArgs, CheckIfPassesGateResult, CheckVerifiedCredentialGateArgs}; @@ -9,7 +9,7 @@ use group_canister::c2c_join_group::{Response::*, *}; use group_chat_core::AddResult; use types::{AccessGate, MemberJoined, UsersUnblocked}; -#[update_msgpack(guard = "caller_is_user_index_or_local_user_index")] +#[update(guard = "caller_is_user_index_or_local_user_index", msgpack = true)] #[trace] async fn c2c_join_group(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/group/impl/src/updates/c2c_leave_group.rs b/backend/canisters/group/impl/src/updates/c2c_leave_group.rs index bccca68249..5300e67586 100644 --- a/backend/canisters/group/impl/src/updates/c2c_leave_group.rs +++ b/backend/canisters/group/impl/src/updates/c2c_leave_group.rs @@ -1,12 +1,12 @@ use crate::activity_notifications::handle_activity_notification; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_canister::c2c_leave_group::{Response::*, *}; use group_chat_core::LeaveResult; // Called via the user's user canister -#[update_msgpack] +#[update(msgpack = true)] #[trace] fn c2c_leave_group(_args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/group/impl/src/updates/c2c_notify_p2p_swap_status_change.rs b/backend/canisters/group/impl/src/updates/c2c_notify_p2p_swap_status_change.rs index fc480f4693..8bf7b2e835 100644 --- a/backend/canisters/group/impl/src/updates/c2c_notify_p2p_swap_status_change.rs +++ b/backend/canisters/group/impl/src/updates/c2c_notify_p2p_swap_status_change.rs @@ -1,11 +1,11 @@ use crate::guards::caller_is_escrow_canister; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use escrow_canister::{SwapStatus, SwapStatusChange as Args}; use types::{EventIndex, P2PSwapCancelled, P2PSwapExpired, P2PSwapLocation, P2PSwapStatus}; -#[update_msgpack(guard = "caller_is_escrow_canister")] +#[update(guard = "caller_is_escrow_canister", msgpack = true)] #[trace] fn c2c_notify_p2p_swap_status_change(args: Args) { run_regular_jobs(); diff --git a/backend/canisters/group/impl/src/updates/c2c_report_message_v2.rs b/backend/canisters/group/impl/src/updates/c2c_report_message_v2.rs index d1631ce931..a223d1d615 100644 --- a/backend/canisters/group/impl/src/updates/c2c_report_message_v2.rs +++ b/backend/canisters/group/impl/src/updates/c2c_report_message_v2.rs @@ -1,11 +1,11 @@ use crate::activity_notifications::handle_activity_notification; use crate::guards::caller_is_user_index_or_local_user_index; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_canister::c2c_report_message_v2::{Response::*, *}; -#[update_msgpack(guard = "caller_is_user_index_or_local_user_index")] +#[update(guard = "caller_is_user_index_or_local_user_index", msgpack = true)] #[trace] fn c2c_report_message_v2(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/group/impl/src/updates/c2c_set_user_suspended.rs b/backend/canisters/group/impl/src/updates/c2c_set_user_suspended.rs index 95cf4b7c87..9cce8ea570 100644 --- a/backend/canisters/group/impl/src/updates/c2c_set_user_suspended.rs +++ b/backend/canisters/group/impl/src/updates/c2c_set_user_suspended.rs @@ -1,11 +1,11 @@ use crate::guards::caller_is_user_index; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_canister::c2c_set_user_suspended::{Response::*, *}; use types::Timestamped; -#[update_msgpack(guard = "caller_is_user_index")] +#[update(guard = "caller_is_user_index", msgpack = true)] #[trace] fn c2c_set_user_suspended(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/group/impl/src/updates/c2c_start_import_into_community.rs b/backend/canisters/group/impl/src/updates/c2c_start_import_into_community.rs index 56ccd818d3..8cece1c3f7 100644 --- a/backend/canisters/group/impl/src/updates/c2c_start_import_into_community.rs +++ b/backend/canisters/group/impl/src/updates/c2c_start_import_into_community.rs @@ -1,10 +1,10 @@ use crate::guards::caller_is_group_index_or_local_group_index; use crate::{mutate_state, run_regular_jobs, CommunityBeingImportedInto, RuntimeState, StartImportIntoCommunityResult}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_canister::c2c_start_import_into_community::{Response::*, *}; -#[update_msgpack(guard = "caller_is_group_index_or_local_group_index")] +#[update(guard = "caller_is_group_index_or_local_group_index", msgpack = true)] #[trace] fn c2c_start_import_into_community(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/group/impl/src/updates/c2c_tip_message.rs b/backend/canisters/group/impl/src/updates/c2c_tip_message.rs index acd0233082..3c24697f2c 100644 --- a/backend/canisters/group/impl/src/updates/c2c_tip_message.rs +++ b/backend/canisters/group/impl/src/updates/c2c_tip_message.rs @@ -1,6 +1,6 @@ use crate::activity_notifications::handle_activity_notification; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use chat_events::{Reader, TipMessageArgs}; use group_canister::c2c_tip_message::{Response::*, *}; @@ -8,7 +8,7 @@ use group_chat_core::TipMessageResult; use ledger_utils::format_crypto_amount_with_symbol; use types::{EventIndex, GroupMessageTipped, Notification}; -#[update_msgpack] +#[update(msgpack = true)] #[trace] fn c2c_tip_message(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/group/impl/src/updates/c2c_unfreeze_group.rs b/backend/canisters/group/impl/src/updates/c2c_unfreeze_group.rs index 5a8dad82a8..23391eae8a 100644 --- a/backend/canisters/group/impl/src/updates/c2c_unfreeze_group.rs +++ b/backend/canisters/group/impl/src/updates/c2c_unfreeze_group.rs @@ -1,12 +1,12 @@ use crate::activity_notifications::handle_activity_notification; use crate::guards::caller_is_group_index_or_local_group_index; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_canister::c2c_unfreeze_group::{Response::*, *}; use types::{EventWrapper, GroupUnfrozen, Timestamped, UserId}; -#[update_msgpack(guard = "caller_is_group_index_or_local_group_index")] +#[update(guard = "caller_is_group_index_or_local_group_index", msgpack = true)] #[trace] async fn c2c_unfreeze_group(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/group/impl/src/updates/c2c_update_proposals.rs b/backend/canisters/group/impl/src/updates/c2c_update_proposals.rs index 8b492b8831..089b69f051 100644 --- a/backend/canisters/group/impl/src/updates/c2c_update_proposals.rs +++ b/backend/canisters/group/impl/src/updates/c2c_update_proposals.rs @@ -1,10 +1,10 @@ use crate::activity_notifications::handle_activity_notification; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_canister::c2c_update_proposals::{Response::*, *}; -#[update_msgpack] +#[update(msgpack = true)] #[trace] async fn c2c_update_proposals(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/group/impl/src/updates/c2c_update_user_principal.rs b/backend/canisters/group/impl/src/updates/c2c_update_user_principal.rs index 811dd5dbf7..c111efd1e4 100644 --- a/backend/canisters/group/impl/src/updates/c2c_update_user_principal.rs +++ b/backend/canisters/group/impl/src/updates/c2c_update_user_principal.rs @@ -1,10 +1,10 @@ use crate::guards::caller_is_user_index; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_canister::c2c_update_user_principal::*; -#[update_msgpack(guard = "caller_is_user_index")] +#[update(guard = "caller_is_user_index", msgpack = true)] #[trace] async fn c2c_update_user_principal(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/group/impl/src/updates/delete_messages.rs b/backend/canisters/group/impl/src/updates/delete_messages.rs index ad5c64c7c9..66b8e1f26c 100644 --- a/backend/canisters/group/impl/src/updates/delete_messages.rs +++ b/backend/canisters/group/impl/src/updates/delete_messages.rs @@ -2,7 +2,7 @@ use crate::activity_notifications::handle_activity_notification; use crate::timer_job_types::HardDeleteMessageContentJob; use crate::{mutate_state, read_state, run_regular_jobs, RuntimeState, TimerJob}; use candid::Principal; -use canister_api_macros::update_candid_and_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use chat_events::DeleteMessageResult; use group_canister::delete_messages::{Response::*, *}; @@ -12,7 +12,7 @@ use user_index_canister_c2c_client::lookup_user; use utils::consts::OPENCHAT_BOT_USER_ID; use utils::time::MINUTE_IN_MS; -#[update_candid_and_msgpack] +#[update(candid = true, msgpack = true)] #[trace] async fn delete_messages(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/group/impl/src/updates/send_message.rs b/backend/canisters/group/impl/src/updates/send_message.rs index e38aa6dae2..ebaed95632 100644 --- a/backend/canisters/group/impl/src/updates/send_message.rs +++ b/backend/canisters/group/impl/src/updates/send_message.rs @@ -1,7 +1,7 @@ use crate::activity_notifications::handle_activity_notification; use crate::timer_job_types::{DeleteFileReferencesJob, EndPollJob, MarkP2PSwapExpiredJob, RefundPrizeJob}; use crate::{mutate_state, run_regular_jobs, Data, RuntimeState, TimerJob}; -use canister_api_macros::{update_candid_and_msgpack, update_msgpack}; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_canister::c2c_send_message::{Args as C2CArgs, Response as C2CResponse}; use group_canister::send_message_v2::{Response::*, *}; @@ -11,7 +11,7 @@ use types::{ User, UserId, }; -#[update_candid_and_msgpack] +#[update(candid = true, msgpack = true)] #[trace] fn send_message_v2(args: Args) -> Response { run_regular_jobs(); @@ -19,7 +19,7 @@ fn send_message_v2(args: Args) -> Response { mutate_state(|state| send_message_impl(args, state)) } -#[update_msgpack] +#[update(msgpack = true)] #[trace] fn c2c_send_message(args: C2CArgs) -> C2CResponse { run_regular_jobs(); diff --git a/backend/canisters/group_index/impl/src/queries/active_groups.rs b/backend/canisters/group_index/impl/src/queries/active_groups.rs index df882f0513..1d44d671af 100644 --- a/backend/canisters/group_index/impl/src/queries/active_groups.rs +++ b/backend/canisters/group_index/impl/src/queries/active_groups.rs @@ -1,14 +1,13 @@ use crate::{read_state, RuntimeState}; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use group_index_canister::active_groups::{Response::*, *}; -use ic_cdk::query; -#[query] +#[query(candid = true)] fn active_groups(args: Args) -> Response { read_state(|state| active_groups_impl(args, state)) } -#[query_msgpack] +#[query(msgpack = true)] fn c2c_active_groups(args: group_index_canister::c2c_active_groups::Args) -> group_index_canister::c2c_active_groups::Response { read_state(|state| active_groups_impl(args, state)) } diff --git a/backend/canisters/group_index/impl/src/updates/c2c_convert_group_into_community.rs b/backend/canisters/group_index/impl/src/updates/c2c_convert_group_into_community.rs index eedb2167b5..6111d516d0 100644 --- a/backend/canisters/group_index/impl/src/updates/c2c_convert_group_into_community.rs +++ b/backend/canisters/group_index/impl/src/updates/c2c_convert_group_into_community.rs @@ -1,12 +1,12 @@ use crate::guards::caller_is_group_canister; use crate::updates::c2c_create_community::create_community_impl; use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_index_canister::c2c_convert_group_into_community::{Response::*, *}; use types::{CanisterId, SourceGroup}; -#[update_msgpack(guard = "caller_is_group_canister")] +#[update(guard = "caller_is_group_canister", msgpack = true)] #[trace] async fn c2c_convert_group_into_community(args: Args) -> Response { let PrepareResult { diff --git a/backend/canisters/group_index/impl/src/updates/c2c_create_community.rs b/backend/canisters/group_index/impl/src/updates/c2c_create_community.rs index d4184d6815..ddb3f31541 100644 --- a/backend/canisters/group_index/impl/src/updates/c2c_create_community.rs +++ b/backend/canisters/group_index/impl/src/updates/c2c_create_community.rs @@ -1,12 +1,12 @@ use crate::model::private_communities::PrivateCommunityInfo; use crate::{mutate_state, read_state, RuntimeState}; use candid::Principal; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_index_canister::c2c_create_community::{Response::*, *}; use types::{AccessGate, CanisterId, CommunityId, Document, UserId}; -#[update_msgpack] +#[update(msgpack = true)] #[trace] async fn c2c_create_community(args: Args) -> Response { let (user_id, principal) = match validate_caller().await { diff --git a/backend/canisters/group_index/impl/src/updates/c2c_create_group.rs b/backend/canisters/group_index/impl/src/updates/c2c_create_group.rs index 742e2f5198..59fd50c629 100644 --- a/backend/canisters/group_index/impl/src/updates/c2c_create_group.rs +++ b/backend/canisters/group_index/impl/src/updates/c2c_create_group.rs @@ -1,12 +1,12 @@ use crate::model::private_groups::PrivateGroupInfo; use crate::{mutate_state, read_state, RuntimeState}; use candid::Principal; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_index_canister::c2c_create_group::{Response::*, *}; use types::{AccessGate, CanisterId, ChatId, Document, GroupSubtype, UserId}; -#[update_msgpack] +#[update(msgpack = true)] #[trace] async fn c2c_create_group(args: Args) -> Response { let avatar_id = Document::id(&args.avatar); diff --git a/backend/canisters/group_index/impl/src/updates/c2c_delete_community.rs b/backend/canisters/group_index/impl/src/updates/c2c_delete_community.rs index fa381d4ac4..4493929f25 100644 --- a/backend/canisters/group_index/impl/src/updates/c2c_delete_community.rs +++ b/backend/canisters/group_index/impl/src/updates/c2c_delete_community.rs @@ -1,11 +1,11 @@ use crate::{mutate_state, read_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_index_canister::c2c_delete_community::{Response::*, *}; use ic_cdk::api::call::CallResult; use types::{CanisterId, CommunityId, DeletedCommunityInfo, UserId}; -#[update_msgpack] +#[update(msgpack = true)] #[trace] async fn c2c_delete_community(args: Args) -> Response { let PrepareResult { diff --git a/backend/canisters/group_index/impl/src/updates/c2c_delete_group.rs b/backend/canisters/group_index/impl/src/updates/c2c_delete_group.rs index e198c8add0..26db1514e6 100644 --- a/backend/canisters/group_index/impl/src/updates/c2c_delete_group.rs +++ b/backend/canisters/group_index/impl/src/updates/c2c_delete_group.rs @@ -1,11 +1,11 @@ use crate::guards::caller_is_group_canister; use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_index_canister::c2c_delete_group::{Response::*, *}; use types::{ChatId, CommunityImportedInto, DeletedGroupInfoInternal, UserId}; -#[update_msgpack(guard = "caller_is_group_canister")] +#[update(guard = "caller_is_group_canister", msgpack = true)] #[trace] fn c2c_delete_group(args: Args) -> Response { mutate_state(|state| { diff --git a/backend/canisters/group_index/impl/src/updates/c2c_make_community_private.rs b/backend/canisters/group_index/impl/src/updates/c2c_make_community_private.rs index e991e6e7a8..4b77279479 100644 --- a/backend/canisters/group_index/impl/src/updates/c2c_make_community_private.rs +++ b/backend/canisters/group_index/impl/src/updates/c2c_make_community_private.rs @@ -1,10 +1,10 @@ use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_index_canister::c2c_make_community_private::{Response::*, *}; use types::CommunityId; -#[update_msgpack] +#[update(msgpack = true)] #[trace] fn c2c_make_community_private(_args: Args) -> Response { mutate_state(c2c_make_community_private_impl) diff --git a/backend/canisters/group_index/impl/src/updates/c2c_make_private.rs b/backend/canisters/group_index/impl/src/updates/c2c_make_private.rs index 00eb3d76b2..a62e1cc561 100644 --- a/backend/canisters/group_index/impl/src/updates/c2c_make_private.rs +++ b/backend/canisters/group_index/impl/src/updates/c2c_make_private.rs @@ -1,10 +1,10 @@ use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_index_canister::c2c_make_private::{Response::*, *}; use types::ChatId; -#[update_msgpack] +#[update(msgpack = true)] #[trace] fn c2c_make_private(_args: Args) -> Response { mutate_state(c2c_make_private_impl) diff --git a/backend/canisters/group_index/impl/src/updates/c2c_mark_active.rs b/backend/canisters/group_index/impl/src/updates/c2c_mark_active.rs index 9cd83c27fe..dfc367b630 100644 --- a/backend/canisters/group_index/impl/src/updates/c2c_mark_active.rs +++ b/backend/canisters/group_index/impl/src/updates/c2c_mark_active.rs @@ -1,10 +1,10 @@ use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_index_canister::c2c_mark_active::{Response::*, *}; use types::ChatId; -#[update_msgpack] +#[update(msgpack = true)] #[trace] fn c2c_mark_active(args: Args) -> Response { mutate_state(|state| c2c_mark_active_impl(args, state)) diff --git a/backend/canisters/group_index/impl/src/updates/c2c_mark_community_active.rs b/backend/canisters/group_index/impl/src/updates/c2c_mark_community_active.rs index 3551bbd465..1da2ec6955 100644 --- a/backend/canisters/group_index/impl/src/updates/c2c_mark_community_active.rs +++ b/backend/canisters/group_index/impl/src/updates/c2c_mark_community_active.rs @@ -1,11 +1,11 @@ use crate::guards::caller_is_community_canister; use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_index_canister::c2c_mark_community_active::{Response::*, *}; use types::{CommunityId, Milliseconds, PublicCommunityActivity}; -#[update_msgpack(guard = "caller_is_community_canister")] +#[update(guard = "caller_is_community_canister", msgpack = true)] #[trace] fn c2c_mark_community_active(args: Args) -> Response { mutate_state(|state| c2c_mark_community_active_impl(args.duration, args.public_community_activity, state)) diff --git a/backend/canisters/group_index/impl/src/updates/c2c_mark_group_import_complete.rs b/backend/canisters/group_index/impl/src/updates/c2c_mark_group_import_complete.rs index d1fe48f6a6..6e8c316ff0 100644 --- a/backend/canisters/group_index/impl/src/updates/c2c_mark_group_import_complete.rs +++ b/backend/canisters/group_index/impl/src/updates/c2c_mark_group_import_complete.rs @@ -2,13 +2,13 @@ use crate::guards::caller_is_community_canister; use crate::updates::c2c_delete_group::delete_group; use crate::updates::c2c_mark_community_active::c2c_mark_community_active_impl; use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_index_canister::c2c_mark_group_import_complete::{Response::*, *}; use types::{CommunityId, CommunityImportedInto}; use utils::consts::OPENCHAT_BOT_USER_ID; -#[update_msgpack(guard = "caller_is_community_canister")] +#[update(guard = "caller_is_community_canister", msgpack = true)] #[trace] fn c2c_mark_group_import_complete(args: Args) -> Response { mutate_state(|state| c2c_mark_group_import_complete_impl(args, state)) diff --git a/backend/canisters/group_index/impl/src/updates/c2c_report_message.rs b/backend/canisters/group_index/impl/src/updates/c2c_report_message.rs index 56498cf68b..836351f697 100644 --- a/backend/canisters/group_index/impl/src/updates/c2c_report_message.rs +++ b/backend/canisters/group_index/impl/src/updates/c2c_report_message.rs @@ -1,10 +1,10 @@ use crate::guards::caller_is_group_or_community_canister; use crate::read_state; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_index_canister::c2c_report_message::{Response::*, *}; -#[update_msgpack(guard = "caller_is_group_or_community_canister")] +#[update(guard = "caller_is_group_or_community_canister", msgpack = true)] #[trace] async fn c2c_report_message(args: Args) -> Response { let user_index_canister_id = read_state(|state| state.data.user_index_canister_id); diff --git a/backend/canisters/group_index/impl/src/updates/c2c_start_importing_group_into_community.rs b/backend/canisters/group_index/impl/src/updates/c2c_start_importing_group_into_community.rs index c77ddb5b86..2415035e68 100644 --- a/backend/canisters/group_index/impl/src/updates/c2c_start_importing_group_into_community.rs +++ b/backend/canisters/group_index/impl/src/updates/c2c_start_importing_group_into_community.rs @@ -1,11 +1,11 @@ use crate::guards::caller_is_community_canister; use crate::{read_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_index_canister::c2c_start_importing_group_into_community::{Response::*, *}; use types::CommunityId; -#[update_msgpack(guard = "caller_is_community_canister")] +#[update(guard = "caller_is_community_canister", msgpack = true)] #[trace] async fn c2c_start_importing_group_into_community(args: Args) -> Response { let community_id = match read_state(|state| prepare(&args, state)) { diff --git a/backend/canisters/group_index/impl/src/updates/c2c_update_community.rs b/backend/canisters/group_index/impl/src/updates/c2c_update_community.rs index 240fdc51c4..263b561b66 100644 --- a/backend/canisters/group_index/impl/src/updates/c2c_update_community.rs +++ b/backend/canisters/group_index/impl/src/updates/c2c_update_community.rs @@ -1,10 +1,10 @@ use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_index_canister::c2c_update_community::{Response::*, *}; use types::CommunityId; -#[update_msgpack] +#[update(msgpack = true)] #[trace] fn c2c_update_community(args: Args) -> Response { mutate_state(|state| c2c_update_community_impl(args, state)) diff --git a/backend/canisters/group_index/impl/src/updates/c2c_update_group.rs b/backend/canisters/group_index/impl/src/updates/c2c_update_group.rs index 90662a39d0..4d098beb93 100644 --- a/backend/canisters/group_index/impl/src/updates/c2c_update_group.rs +++ b/backend/canisters/group_index/impl/src/updates/c2c_update_group.rs @@ -1,10 +1,10 @@ use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use group_index_canister::c2c_update_group::{Response::*, *}; use types::ChatId; -#[update_msgpack] +#[update(msgpack = true)] #[trace] fn c2c_update_group(args: Args) -> Response { mutate_state(|state| c2c_update_group_impl(args, state)) diff --git a/backend/canisters/identity/impl/src/updates/c2c_set_user_ids.rs b/backend/canisters/identity/impl/src/updates/c2c_set_user_ids.rs index 84498b2947..6e8aa7acf9 100644 --- a/backend/canisters/identity/impl/src/updates/c2c_set_user_ids.rs +++ b/backend/canisters/identity/impl/src/updates/c2c_set_user_ids.rs @@ -1,10 +1,10 @@ use crate::guards::caller_is_user_index_canister; use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use identity_canister::c2c_set_user_ids::{Response::*, *}; -#[update_msgpack(guard = "caller_is_user_index_canister")] +#[update(guard = "caller_is_user_index_canister", msgpack = true)] #[trace] fn c2c_set_user_ids(args: Args) -> Response { // This function runs in O(number of users registered x batch size), diff --git a/backend/canisters/local_group_index/impl/src/queries/c2c_can_push_notifications.rs b/backend/canisters/local_group_index/impl/src/queries/c2c_can_push_notifications.rs index 41ebfd91eb..93793e529d 100644 --- a/backend/canisters/local_group_index/impl/src/queries/c2c_can_push_notifications.rs +++ b/backend/canisters/local_group_index/impl/src/queries/c2c_can_push_notifications.rs @@ -1,10 +1,10 @@ use crate::guards::caller_is_notifications_canister; use crate::{read_state, RuntimeState}; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use canister_tracing_macros::trace; use local_group_index_canister::c2c_can_push_notifications::*; -#[query_msgpack(guard = "caller_is_notifications_canister")] +#[query(guard = "caller_is_notifications_canister", msgpack = true)] #[trace] fn c2c_can_push_notifications(args: Args) -> Response { read_state(|state| c2c_can_push_notifications_impl(args, state)) diff --git a/backend/canisters/local_group_index/impl/src/updates/c2c_create_community.rs b/backend/canisters/local_group_index/impl/src/updates/c2c_create_community.rs index 3ebb3ad5b6..7239e1d473 100644 --- a/backend/canisters/local_group_index/impl/src/updates/c2c_create_community.rs +++ b/backend/canisters/local_group_index/impl/src/updates/c2c_create_community.rs @@ -1,6 +1,6 @@ use crate::guards::caller_is_group_index_canister; use crate::{mutate_state, RuntimeState, COMMUNITY_CANISTER_INITIAL_CYCLES_BALANCE, MARK_ACTIVE_DURATION}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use community_canister::init::Args as InitCommunityCanisterArgs; use event_store_producer::EventBuilder; @@ -10,7 +10,7 @@ use utils::canister; use utils::canister::CreateAndInstallError; use utils::consts::{min_cycles_balance, CREATE_CANISTER_CYCLES_FEE}; -#[update_msgpack(guard = "caller_is_group_index_canister")] +#[update(guard = "caller_is_group_index_canister", msgpack = true)] #[trace] async fn c2c_create_community(args: Args) -> Response { let prepare_ok = match mutate_state(|state| prepare(args, state)) { diff --git a/backend/canisters/local_group_index/impl/src/updates/c2c_create_group.rs b/backend/canisters/local_group_index/impl/src/updates/c2c_create_group.rs index 4b90b8219c..a373023236 100644 --- a/backend/canisters/local_group_index/impl/src/updates/c2c_create_group.rs +++ b/backend/canisters/local_group_index/impl/src/updates/c2c_create_group.rs @@ -1,6 +1,6 @@ use crate::guards::caller_is_group_index_canister; use crate::{mutate_state, RuntimeState, GROUP_CANISTER_INITIAL_CYCLES_BALANCE, MARK_ACTIVE_DURATION}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use event_store_producer::EventBuilder; use group_canister::init::Args as InitGroupCanisterArgs; @@ -10,7 +10,7 @@ use utils::canister; use utils::canister::CreateAndInstallError; use utils::consts::{min_cycles_balance, CREATE_CANISTER_CYCLES_FEE}; -#[update_msgpack(guard = "caller_is_group_index_canister")] +#[update(guard = "caller_is_group_index_canister", msgpack = true)] #[trace] async fn c2c_create_group(args: Args) -> Response { let prepare_ok = match mutate_state(|state| prepare(args, state)) { diff --git a/backend/canisters/local_group_index/impl/src/updates/c2c_delete_community.rs b/backend/canisters/local_group_index/impl/src/updates/c2c_delete_community.rs index c5dadfeb66..40f56fac07 100644 --- a/backend/canisters/local_group_index/impl/src/updates/c2c_delete_community.rs +++ b/backend/canisters/local_group_index/impl/src/updates/c2c_delete_community.rs @@ -1,12 +1,12 @@ use crate::guards::caller_is_group_index_canister; use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use local_group_index_canister::c2c_delete_community::{Response::*, *}; use types::CanisterId; use utils::canister::{delete, stop}; -#[update_msgpack(guard = "caller_is_group_index_canister")] +#[update(guard = "caller_is_group_index_canister", msgpack = true)] #[trace] fn c2c_delete_community(args: Args) -> Response { mutate_state(|state| c2c_delete_community_impl(args, state)) diff --git a/backend/canisters/local_group_index/impl/src/updates/c2c_delete_group.rs b/backend/canisters/local_group_index/impl/src/updates/c2c_delete_group.rs index e7614eca02..2036d61745 100644 --- a/backend/canisters/local_group_index/impl/src/updates/c2c_delete_group.rs +++ b/backend/canisters/local_group_index/impl/src/updates/c2c_delete_group.rs @@ -1,12 +1,12 @@ use crate::guards::caller_is_group_index_canister; use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use local_group_index_canister::c2c_delete_group::{Response::*, *}; use types::CanisterId; use utils::canister::{delete, stop}; -#[update_msgpack(guard = "caller_is_group_index_canister")] +#[update(guard = "caller_is_group_index_canister", msgpack = true)] #[trace] fn c2c_delete_group(args: Args) -> Response { mutate_state(|state| c2c_delete_group_impl(args, state)) diff --git a/backend/canisters/local_group_index/impl/src/updates/c2c_notify_low_balance.rs b/backend/canisters/local_group_index/impl/src/updates/c2c_notify_low_balance.rs index 70ba75fb49..f64aff5ffc 100644 --- a/backend/canisters/local_group_index/impl/src/updates/c2c_notify_low_balance.rs +++ b/backend/canisters/local_group_index/impl/src/updates/c2c_notify_low_balance.rs @@ -1,13 +1,13 @@ use crate::guards::caller_is_local_group_or_community_canister; use crate::{mutate_state, read_state, RuntimeState, COMMUNITY_CANISTER_TOP_UP_AMOUNT, GROUP_CANISTER_TOP_UP_AMOUNT}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use types::{CanisterId, CyclesTopUp, NotifyLowBalanceArgs, NotifyLowBalanceResponse}; use utils::canister::deposit_cycles; use utils::consts::min_cycles_balance; use utils::cycles::can_spend_cycles; -#[update_msgpack(guard = "caller_is_local_group_or_community_canister")] +#[update(guard = "caller_is_local_group_or_community_canister", msgpack = true)] #[trace] async fn c2c_notify_low_balance(_args: NotifyLowBalanceArgs) -> NotifyLowBalanceResponse { let prepare_ok = match read_state(prepare) { diff --git a/backend/canisters/local_group_index/impl/src/updates/c2c_set_community_upgrade_concurrency.rs b/backend/canisters/local_group_index/impl/src/updates/c2c_set_community_upgrade_concurrency.rs index 732d1c4152..71734dc046 100644 --- a/backend/canisters/local_group_index/impl/src/updates/c2c_set_community_upgrade_concurrency.rs +++ b/backend/canisters/local_group_index/impl/src/updates/c2c_set_community_upgrade_concurrency.rs @@ -1,12 +1,12 @@ use crate::guards::caller_is_group_index_canister; use crate::mutate_state; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use local_group_index_canister::c2c_set_community_upgrade_concurrency::{Response::*, *}; use std::cmp::min; use tracing::info; -#[update_msgpack(guard = "caller_is_group_index_canister")] +#[update(guard = "caller_is_group_index_canister", msgpack = true)] #[trace] fn c2c_set_community_upgrade_concurrency(args: Args) -> Response { mutate_state(|state| { diff --git a/backend/canisters/local_group_index/impl/src/updates/c2c_set_group_upgrade_concurrency.rs b/backend/canisters/local_group_index/impl/src/updates/c2c_set_group_upgrade_concurrency.rs index 3ed2447641..a406a5254e 100644 --- a/backend/canisters/local_group_index/impl/src/updates/c2c_set_group_upgrade_concurrency.rs +++ b/backend/canisters/local_group_index/impl/src/updates/c2c_set_group_upgrade_concurrency.rs @@ -1,12 +1,12 @@ use crate::guards::caller_is_group_index_canister; use crate::mutate_state; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use local_group_index_canister::c2c_set_group_upgrade_concurrency::{Response::*, *}; use std::cmp::min; use tracing::info; -#[update_msgpack(guard = "caller_is_group_index_canister")] +#[update(guard = "caller_is_group_index_canister", msgpack = true)] #[trace] fn c2c_set_group_upgrade_concurrency(args: Args) -> Response { mutate_state(|state| { diff --git a/backend/canisters/local_group_index/impl/src/updates/c2c_set_max_concurrent_community_upgrades.rs b/backend/canisters/local_group_index/impl/src/updates/c2c_set_max_concurrent_community_upgrades.rs index 4d0023de3d..37449c326d 100644 --- a/backend/canisters/local_group_index/impl/src/updates/c2c_set_max_concurrent_community_upgrades.rs +++ b/backend/canisters/local_group_index/impl/src/updates/c2c_set_max_concurrent_community_upgrades.rs @@ -1,11 +1,11 @@ use crate::guards::caller_is_group_index_canister; use crate::mutate_state; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use local_group_index_canister::c2c_set_max_concurrent_community_upgrades::{Args, Response}; use tracing::info; -#[update_msgpack(guard = "caller_is_group_index_canister")] +#[update(guard = "caller_is_group_index_canister", msgpack = true)] #[trace] fn c2c_set_max_concurrent_community_upgrades(args: Args) -> Response { mutate_state(|state| { diff --git a/backend/canisters/local_group_index/impl/src/updates/c2c_set_max_concurrent_group_upgrades.rs b/backend/canisters/local_group_index/impl/src/updates/c2c_set_max_concurrent_group_upgrades.rs index f78aac17b3..52d9517195 100644 --- a/backend/canisters/local_group_index/impl/src/updates/c2c_set_max_concurrent_group_upgrades.rs +++ b/backend/canisters/local_group_index/impl/src/updates/c2c_set_max_concurrent_group_upgrades.rs @@ -1,11 +1,11 @@ use crate::guards::caller_is_group_index_canister; use crate::mutate_state; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use local_group_index_canister::c2c_set_max_concurrent_group_upgrades::{Args, Response}; use tracing::info; -#[update_msgpack(guard = "caller_is_group_index_canister")] +#[update(guard = "caller_is_group_index_canister", msgpack = true)] #[trace] fn c2c_set_max_concurrent_group_upgrades(args: Args) -> Response { mutate_state(|state| { diff --git a/backend/canisters/local_group_index/impl/src/updates/c2c_trigger_upgrade.rs b/backend/canisters/local_group_index/impl/src/updates/c2c_trigger_upgrade.rs index c4128d485c..d3149beaf3 100644 --- a/backend/canisters/local_group_index/impl/src/updates/c2c_trigger_upgrade.rs +++ b/backend/canisters/local_group_index/impl/src/updates/c2c_trigger_upgrade.rs @@ -1,9 +1,9 @@ use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use local_group_index_canister::c2c_trigger_upgrade::{Response::*, *}; -#[update_msgpack] +#[update(msgpack = true)] #[trace] fn c2c_trigger_upgrade(_args: Args) -> Response { mutate_state(c2c_trigger_upgrade_impl) diff --git a/backend/canisters/local_group_index/impl/src/updates/c2c_upgrade_community_canister_wasm.rs b/backend/canisters/local_group_index/impl/src/updates/c2c_upgrade_community_canister_wasm.rs index e2d7a2ee60..479c3f1a9e 100644 --- a/backend/canisters/local_group_index/impl/src/updates/c2c_upgrade_community_canister_wasm.rs +++ b/backend/canisters/local_group_index/impl/src/updates/c2c_upgrade_community_canister_wasm.rs @@ -1,6 +1,6 @@ use crate::guards::caller_is_group_index_canister; use crate::{mutate_state, read_state, Data, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use local_group_index_canister::c2c_upgrade_community_canister_wasm::{Response::*, *}; use sha256::sha256; @@ -9,7 +9,7 @@ use tracing::info; use types::{BuildVersion, CanisterId, ChunkedCanisterWasm, Hash}; use utils::canister::{should_perform_upgrade, upload_wasm_in_chunks}; -#[update_msgpack(guard = "caller_is_group_index_canister")] +#[update(guard = "caller_is_group_index_canister", msgpack = true)] #[trace] async fn c2c_upgrade_community_canister_wasm(args: Args) -> Response { let PrepareResult { diff --git a/backend/canisters/local_group_index/impl/src/updates/c2c_upgrade_group_canister_wasm.rs b/backend/canisters/local_group_index/impl/src/updates/c2c_upgrade_group_canister_wasm.rs index 97baa64fbf..9d1c60edf0 100644 --- a/backend/canisters/local_group_index/impl/src/updates/c2c_upgrade_group_canister_wasm.rs +++ b/backend/canisters/local_group_index/impl/src/updates/c2c_upgrade_group_canister_wasm.rs @@ -1,6 +1,6 @@ use crate::guards::caller_is_group_index_canister; use crate::{mutate_state, read_state, Data, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use local_group_index_canister::c2c_upgrade_group_canister_wasm::{Response::*, *}; use sha256::sha256; @@ -9,7 +9,7 @@ use tracing::info; use types::{BuildVersion, CanisterId, ChunkedCanisterWasm, Hash}; use utils::canister::{should_perform_upgrade, upload_wasm_in_chunks}; -#[update_msgpack(guard = "caller_is_group_index_canister")] +#[update(guard = "caller_is_group_index_canister", msgpack = true)] #[trace] async fn c2c_upgrade_group_canister_wasm(args: Args) -> Response { let PrepareResult { diff --git a/backend/canisters/local_user_index/impl/src/queries/c2c_can_push_notifications.rs b/backend/canisters/local_user_index/impl/src/queries/c2c_can_push_notifications.rs index d95c9d391e..87e8496f45 100644 --- a/backend/canisters/local_user_index/impl/src/queries/c2c_can_push_notifications.rs +++ b/backend/canisters/local_user_index/impl/src/queries/c2c_can_push_notifications.rs @@ -1,11 +1,11 @@ use crate::guards::caller_is_notifications_canister; use crate::{read_state, RuntimeState}; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use canister_tracing_macros::trace; use local_user_index_canister::c2c_can_push_notifications::*; use types::UserId; -#[query_msgpack(guard = "caller_is_notifications_canister")] +#[query(guard = "caller_is_notifications_canister", msgpack = true)] #[trace] fn c2c_can_push_notifications(args: Args) -> Response { read_state(|state| c2c_can_push_notifications_impl(args, state)) diff --git a/backend/canisters/local_user_index/impl/src/queries/c2c_diamond_membership_expiry_dates.rs b/backend/canisters/local_user_index/impl/src/queries/c2c_diamond_membership_expiry_dates.rs index 99065bd2e8..f54ff59d70 100644 --- a/backend/canisters/local_user_index/impl/src/queries/c2c_diamond_membership_expiry_dates.rs +++ b/backend/canisters/local_user_index/impl/src/queries/c2c_diamond_membership_expiry_dates.rs @@ -1,8 +1,8 @@ use crate::{read_state, RuntimeState}; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use local_user_index_canister::c2c_diamond_membership_expiry_dates::{Response::*, *}; -#[query_msgpack] +#[query(msgpack = true)] fn c2c_diamond_membership_expiry_dates(args: Args) -> Response { read_state(|state| c2c_diamond_membership_expiry_dates_impl(args, state)) } diff --git a/backend/canisters/local_user_index/impl/src/queries/c2c_lookup_user.rs b/backend/canisters/local_user_index/impl/src/queries/c2c_lookup_user.rs index ee87b12bfd..af89f7b6ae 100644 --- a/backend/canisters/local_user_index/impl/src/queries/c2c_lookup_user.rs +++ b/backend/canisters/local_user_index/impl/src/queries/c2c_lookup_user.rs @@ -1,8 +1,8 @@ use crate::{read_state, RuntimeState}; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use local_user_index_canister::c2c_lookup_user::{Response::*, *}; -#[query_msgpack] +#[query(msgpack = true)] fn c2c_lookup_user(args: Args) -> Response { read_state(|state| c2c_lookup_user_impl(args, state)) } diff --git a/backend/canisters/local_user_index/impl/src/queries/c2c_user_principals.rs b/backend/canisters/local_user_index/impl/src/queries/c2c_user_principals.rs index 59bf2d90d7..78ed8f9fdd 100644 --- a/backend/canisters/local_user_index/impl/src/queries/c2c_user_principals.rs +++ b/backend/canisters/local_user_index/impl/src/queries/c2c_user_principals.rs @@ -1,8 +1,8 @@ use crate::{read_state, RuntimeState}; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use local_user_index_canister::c2c_user_principals::{Response::*, *}; -#[query_msgpack] +#[query(msgpack = true)] fn c2c_user_principals(args: Args) -> Response { read_state(|state| c2c_user_principals_impl(args, state)) } diff --git a/backend/canisters/local_user_index/impl/src/updates/c2c_notify_low_balance.rs b/backend/canisters/local_user_index/impl/src/updates/c2c_notify_low_balance.rs index d3230532a3..dc74e347b4 100644 --- a/backend/canisters/local_user_index/impl/src/updates/c2c_notify_low_balance.rs +++ b/backend/canisters/local_user_index/impl/src/updates/c2c_notify_low_balance.rs @@ -1,13 +1,13 @@ use crate::guards::caller_is_local_user_canister; use crate::{mutate_state, read_state, RuntimeState, USER_CANISTER_TOP_UP_AMOUNT}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use types::{CyclesTopUp, NotifyLowBalanceArgs, NotifyLowBalanceResponse, UserId}; use utils::canister::deposit_cycles; use utils::consts::min_cycles_balance; use utils::cycles::can_spend_cycles; -#[update_msgpack(guard = "caller_is_local_user_canister")] +#[update(guard = "caller_is_local_user_canister", msgpack = true)] #[trace] async fn c2c_notify_low_balance(_args: NotifyLowBalanceArgs) -> NotifyLowBalanceResponse { top_up_user(None).await diff --git a/backend/canisters/local_user_index/impl/src/updates/c2c_notify_user_index_events.rs b/backend/canisters/local_user_index/impl/src/updates/c2c_notify_user_index_events.rs index 6744da231b..4698780d47 100644 --- a/backend/canisters/local_user_index/impl/src/updates/c2c_notify_user_index_events.rs +++ b/backend/canisters/local_user_index/impl/src/updates/c2c_notify_user_index_events.rs @@ -1,6 +1,6 @@ use crate::guards::caller_is_user_index_canister; use crate::{jobs, mutate_state, RuntimeState, UserToDelete}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use local_user_index_canister::c2c_notify_user_index_events::{Response::*, *}; use local_user_index_canister::Event; @@ -11,7 +11,7 @@ use user_canister::{ ReferredUserRegistered, StorageUpgraded, UserJoinedCommunityOrChannel, UserJoinedGroup, UserSuspended, UsernameChanged, }; -#[update_msgpack(guard = "caller_is_user_index_canister")] +#[update(guard = "caller_is_user_index_canister", msgpack = true)] #[trace] fn c2c_notify_user_index_events(args: Args) -> Response { mutate_state(|state| c2c_notify_user_index_events_impl(args, state)) diff --git a/backend/canisters/local_user_index/impl/src/updates/c2c_upgrade_user_canister_wasm.rs b/backend/canisters/local_user_index/impl/src/updates/c2c_upgrade_user_canister_wasm.rs index 557486d95e..9ab6a9726a 100644 --- a/backend/canisters/local_user_index/impl/src/updates/c2c_upgrade_user_canister_wasm.rs +++ b/backend/canisters/local_user_index/impl/src/updates/c2c_upgrade_user_canister_wasm.rs @@ -1,6 +1,6 @@ use crate::guards::caller_is_user_index_canister; use crate::{mutate_state, read_state, Data, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use itertools::Itertools; use local_user_index_canister::c2c_upgrade_user_canister_wasm::{Response::*, *}; @@ -11,7 +11,7 @@ use tracing::info; use types::{BuildVersion, CanisterId, ChunkedCanisterWasm, Hash}; use utils::canister::{clear_chunk_store, should_perform_upgrade, upload_wasm_in_chunks}; -#[update_msgpack(guard = "caller_is_user_index_canister")] +#[update(guard = "caller_is_user_index_canister", msgpack = true)] #[trace] async fn c2c_upgrade_user_canister_wasm(args: Args) -> Response { let PrepareResult { this_canister_id } = match read_state(|state| prepare(&args, state)) { diff --git a/backend/canisters/notifications/impl/src/updates/c2c_push_notification.rs b/backend/canisters/notifications/impl/src/updates/c2c_push_notification.rs index 386565e170..b48c71fd3b 100644 --- a/backend/canisters/notifications/impl/src/updates/c2c_push_notification.rs +++ b/backend/canisters/notifications/impl/src/updates/c2c_push_notification.rs @@ -1,12 +1,12 @@ use crate::{mutate_state, read_state, RuntimeState}; use candid::Principal; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use notifications_canister::c2c_push_notification::{Response::*, *}; use serde_bytes::ByteBuf; use types::{CanPushNotificationsArgs, CanPushNotificationsResponse, CanisterId, NotificationEnvelope, UserId}; -#[update_msgpack] +#[update(msgpack = true)] #[trace] async fn c2c_push_notification(args: Args) -> Response { match read_state(|state| can_push_notifications(&args, state)) { diff --git a/backend/canisters/notifications/impl/src/updates/c2c_sync_index.rs b/backend/canisters/notifications/impl/src/updates/c2c_sync_index.rs index 5bb9bffc53..8ffd081c43 100644 --- a/backend/canisters/notifications/impl/src/updates/c2c_sync_index.rs +++ b/backend/canisters/notifications/impl/src/updates/c2c_sync_index.rs @@ -1,11 +1,11 @@ use crate::guards::caller_is_notifications_index; use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use notifications_canister::c2c_sync_index::{Response::*, *}; use notifications_index_canister::NotificationsIndexEvent; -#[update_msgpack(guard = "caller_is_notifications_index")] +#[update(guard = "caller_is_notifications_index", msgpack = true)] #[trace] fn c2c_sync_index(args: Args) -> Response { mutate_state(|state| c2c_sync_index_impl(args, state)) diff --git a/backend/canisters/proposals_bot/impl/src/updates/c2c_submit_proposal.rs b/backend/canisters/proposals_bot/impl/src/updates/c2c_submit_proposal.rs index df1f7a378b..66b3a73dc2 100644 --- a/backend/canisters/proposals_bot/impl/src/updates/c2c_submit_proposal.rs +++ b/backend/canisters/proposals_bot/impl/src/updates/c2c_submit_proposal.rs @@ -2,7 +2,7 @@ use crate::model::nervous_systems::ValidateSubmitProposalPaymentError; use crate::timer_job_types::{LookupUserThenSubmitProposalJob, ProcessUserRefundJob, SubmitProposalJob, TimerJob}; use crate::{mutate_state, read_state, RuntimeState}; use candid::Principal; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_timer_jobs::Job; use canister_tracing_macros::trace; use proposals_bot_canister::c2c_submit_proposal::{Response::*, *}; @@ -20,7 +20,7 @@ use utils::time::SECOND_IN_MS; const OC_ROOT_URL: &str = "https://oc.app/"; -#[update_msgpack] +#[update(msgpack = true)] #[trace] async fn c2c_submit_proposal(args: Args) -> Response { let PrepareResult { diff --git a/backend/canisters/registry/impl/src/queries/c2c_nervous_systems.rs b/backend/canisters/registry/impl/src/queries/c2c_nervous_systems.rs index 993587ae5f..41a88b6c0c 100644 --- a/backend/canisters/registry/impl/src/queries/c2c_nervous_systems.rs +++ b/backend/canisters/registry/impl/src/queries/c2c_nervous_systems.rs @@ -1,9 +1,9 @@ use crate::{read_state, RuntimeState}; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use canister_tracing_macros::trace; use registry_canister::c2c_nervous_systems::{Response::*, *}; -#[query_msgpack] +#[query(msgpack = true)] #[trace] fn c2c_nervous_systems(args: Args) -> Response { read_state(|state| c2c_nervous_systems_impl(args, state)) diff --git a/backend/canisters/registry/impl/src/updates/c2c_set_submitting_proposals_enabled.rs b/backend/canisters/registry/impl/src/updates/c2c_set_submitting_proposals_enabled.rs index f6a44bbb41..24e3283db1 100644 --- a/backend/canisters/registry/impl/src/updates/c2c_set_submitting_proposals_enabled.rs +++ b/backend/canisters/registry/impl/src/updates/c2c_set_submitting_proposals_enabled.rs @@ -1,10 +1,10 @@ use crate::guards::caller_is_proposals_bot; use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use registry_canister::c2c_set_submitting_proposals_enabled::{Response::*, *}; -#[update_msgpack(guard = "caller_is_proposals_bot")] +#[update(guard = "caller_is_proposals_bot", msgpack = true)] #[trace] fn c2c_set_submitting_proposals_enabled(args: Args) -> Response { mutate_state(|state| c2c_set_submitting_proposals_enabled_impl(args, state)) diff --git a/backend/canisters/storage_index/impl/src/updates/c2c_notify_low_balance.rs b/backend/canisters/storage_index/impl/src/updates/c2c_notify_low_balance.rs index f23381d308..3ca6977025 100644 --- a/backend/canisters/storage_index/impl/src/updates/c2c_notify_low_balance.rs +++ b/backend/canisters/storage_index/impl/src/updates/c2c_notify_low_balance.rs @@ -1,12 +1,12 @@ use crate::{mutate_state, read_state, RuntimeState, BUCKET_CANISTER_TOP_UP_AMOUNT, MIN_CYCLES_BALANCE}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use storage_index_canister::c2c_notify_low_balance::*; use types::{CanisterId, CyclesTopUp}; use utils::canister::deposit_cycles; use utils::cycles::can_spend_cycles; -#[update_msgpack] +#[update(msgpack = true)] #[trace] async fn c2c_notify_low_balance(_args: Args) -> Response { let prepare_ok = match read_state(prepare) { diff --git a/backend/canisters/storage_index/impl/src/updates/c2c_update_user_principal.rs b/backend/canisters/storage_index/impl/src/updates/c2c_update_user_principal.rs index 9a5f9db73c..21c49f22ee 100644 --- a/backend/canisters/storage_index/impl/src/updates/c2c_update_user_principal.rs +++ b/backend/canisters/storage_index/impl/src/updates/c2c_update_user_principal.rs @@ -1,11 +1,11 @@ use crate::guards::caller_is_user_controller; use crate::model::bucket_sync_state::EventToSync; use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use storage_index_canister::c2c_update_user_principal::*; -#[update_msgpack(guard = "caller_is_user_controller")] +#[update(guard = "caller_is_user_controller", msgpack = true)] #[trace] fn c2c_update_user_principal(args: Args) -> Response { mutate_state(|state| c2c_update_user_principal_impl(args, state)) diff --git a/backend/canisters/user/impl/src/queries/c2c_can_issue_access_token.rs b/backend/canisters/user/impl/src/queries/c2c_can_issue_access_token.rs index 4845376688..33be257fb0 100644 --- a/backend/canisters/user/impl/src/queries/c2c_can_issue_access_token.rs +++ b/backend/canisters/user/impl/src/queries/c2c_can_issue_access_token.rs @@ -1,11 +1,11 @@ use crate::guards::caller_is_local_user_index; use crate::read_state; use crate::RuntimeState; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use types::AccessTokenType; use user_canister::c2c_can_issue_access_token::*; -#[query_msgpack(guard = "caller_is_local_user_index")] +#[query(guard = "caller_is_local_user_index", msgpack = true)] fn c2c_can_issue_access_token(args: Args) -> Response { read_state(|state| c2c_can_issue_access_token_impl(args, state)) } diff --git a/backend/canisters/user/impl/src/queries/c2c_is_empty_and_dormant.rs b/backend/canisters/user/impl/src/queries/c2c_is_empty_and_dormant.rs index 0c894206db..f573640c79 100644 --- a/backend/canisters/user/impl/src/queries/c2c_is_empty_and_dormant.rs +++ b/backend/canisters/user/impl/src/queries/c2c_is_empty_and_dormant.rs @@ -1,13 +1,13 @@ use crate::guards::caller_is_local_user_index; use crate::{read_state, RuntimeState}; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use types::Milliseconds; use user_canister::c2c_is_empty_and_dormant::*; use utils::time::DAY_IN_MS; const SIX_MONTHS: Milliseconds = 183 * DAY_IN_MS; -#[query_msgpack(guard = "caller_is_local_user_index")] +#[query(guard = "caller_is_local_user_index", msgpack = true)] fn c2c_is_empty_and_dormant(_args: Args) -> Response { read_state(is_empty_and_dormant_impl) } diff --git a/backend/canisters/user/impl/src/queries/chit_events.rs b/backend/canisters/user/impl/src/queries/chit_events.rs index 055c0dbd27..d5b7652493 100644 --- a/backend/canisters/user/impl/src/queries/chit_events.rs +++ b/backend/canisters/user/impl/src/queries/chit_events.rs @@ -1,9 +1,9 @@ use crate::guards::caller_is_owner; use crate::{read_state, RuntimeState}; -use canister_api_macros::query_candid_and_msgpack; +use canister_api_macros::query; use user_canister::chit_events::*; -#[query_candid_and_msgpack(guard = "caller_is_owner")] +#[query(guard = "caller_is_owner", candid = true, msgpack = true)] fn chit_events(args: Args) -> Response { read_state(|state| chit_events_impl(args, state)) } diff --git a/backend/canisters/user/impl/src/queries/events.rs b/backend/canisters/user/impl/src/queries/events.rs index ca8ba1f31c..6cc847d0a3 100644 --- a/backend/canisters/user/impl/src/queries/events.rs +++ b/backend/canisters/user/impl/src/queries/events.rs @@ -1,12 +1,12 @@ use crate::guards::caller_is_owner_or_local_user_index; use crate::queries::check_replica_up_to_date; use crate::{read_state, RuntimeState}; -use canister_api_macros::query_candid_and_msgpack; +use canister_api_macros::query; use chat_events::Reader; use types::{EventIndex, EventOrExpiredRange, EventsResponse}; use user_canister::events::{Response::*, *}; -#[query_candid_and_msgpack(guard = "caller_is_owner_or_local_user_index")] +#[query(guard = "caller_is_owner_or_local_user_index", candid = true, msgpack = true)] fn events(args: Args) -> Response { read_state(|state| events_impl(args, state)) } diff --git a/backend/canisters/user/impl/src/queries/events_by_index.rs b/backend/canisters/user/impl/src/queries/events_by_index.rs index 8751c86201..f3b2ef385b 100644 --- a/backend/canisters/user/impl/src/queries/events_by_index.rs +++ b/backend/canisters/user/impl/src/queries/events_by_index.rs @@ -1,12 +1,12 @@ use crate::guards::caller_is_owner_or_local_user_index; use crate::queries::check_replica_up_to_date; use crate::{read_state, RuntimeState}; -use canister_api_macros::query_candid_and_msgpack; +use canister_api_macros::query; use chat_events::Reader; use types::{EventIndex, EventOrExpiredRange, EventsResponse}; use user_canister::events_by_index::{Response::*, *}; -#[query_candid_and_msgpack(guard = "caller_is_owner_or_local_user_index")] +#[query(guard = "caller_is_owner_or_local_user_index", candid = true, msgpack = true)] fn events_by_index(args: Args) -> Response { read_state(|state| events_by_index_impl(args, state)) } diff --git a/backend/canisters/user/impl/src/queries/events_window.rs b/backend/canisters/user/impl/src/queries/events_window.rs index 441aec72db..b023a42c08 100644 --- a/backend/canisters/user/impl/src/queries/events_window.rs +++ b/backend/canisters/user/impl/src/queries/events_window.rs @@ -1,12 +1,12 @@ use crate::guards::caller_is_owner_or_local_user_index; use crate::queries::check_replica_up_to_date; use crate::{read_state, RuntimeState}; -use canister_api_macros::query_candid_and_msgpack; +use canister_api_macros::query; use chat_events::Reader; use types::{EventIndex, EventOrExpiredRange, EventsResponse}; use user_canister::events_window::{Response::*, *}; -#[query_candid_and_msgpack(guard = "caller_is_owner_or_local_user_index")] +#[query(guard = "caller_is_owner_or_local_user_index", candid = true, msgpack = true)] fn events_window(args: Args) -> Response { read_state(|state| events_window_impl(args, state)) } diff --git a/backend/canisters/user/impl/src/updates/c2c_accept_p2p_swap.rs b/backend/canisters/user/impl/src/updates/c2c_accept_p2p_swap.rs index 89fdefe858..023e434897 100644 --- a/backend/canisters/user/impl/src/updates/c2c_accept_p2p_swap.rs +++ b/backend/canisters/user/impl/src/updates/c2c_accept_p2p_swap.rs @@ -2,7 +2,7 @@ use crate::guards::caller_is_known_group_or_community_canister; use crate::model::p2p_swaps::P2PSwap; use crate::model::pin_number::VerifyPinError; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use escrow_canister::deposit_subaccount; use icrc_ledger_types::icrc1::account::Account; @@ -12,7 +12,7 @@ use user_canister::c2c_accept_p2p_swap::{Response::*, *}; use utils::consts::MEMO_P2P_SWAP_ACCEPT; use utils::time::NANOS_PER_MILLISECOND; -#[update_msgpack(guard = "caller_is_known_group_or_community_canister")] +#[update(guard = "caller_is_known_group_or_community_canister", msgpack = true)] #[trace] async fn c2c_accept_p2p_swap(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/c2c_charge_user_account.rs b/backend/canisters/user/impl/src/updates/c2c_charge_user_account.rs index 29977339af..c2ee9b02de 100644 --- a/backend/canisters/user/impl/src/updates/c2c_charge_user_account.rs +++ b/backend/canisters/user/impl/src/updates/c2c_charge_user_account.rs @@ -1,12 +1,12 @@ use crate::guards::caller_is_user_index; use crate::{read_state, run_regular_jobs}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use icrc_ledger_types::icrc1::account::Account; use icrc_ledger_types::icrc1::transfer::TransferArg; use user_canister::c2c_charge_user_account::{Response::*, *}; -#[update_msgpack(guard = "caller_is_user_index")] +#[update(guard = "caller_is_user_index", msgpack = true)] #[trace] async fn c2c_charge_user_account(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/c2c_grant_super_admin.rs b/backend/canisters/user/impl/src/updates/c2c_grant_super_admin.rs index b6549d5066..84643cb829 100644 --- a/backend/canisters/user/impl/src/updates/c2c_grant_super_admin.rs +++ b/backend/canisters/user/impl/src/updates/c2c_grant_super_admin.rs @@ -1,10 +1,10 @@ use crate::guards::caller_is_user_index; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use user_canister::c2c_grant_super_admin::{Response::*, *}; -#[update_msgpack(guard = "caller_is_user_index")] +#[update(guard = "caller_is_user_index", msgpack = true)] #[trace] fn c2c_grant_super_admin(_args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/c2c_mark_community_updated_for_user.rs b/backend/canisters/user/impl/src/updates/c2c_mark_community_updated_for_user.rs index fd7a96e860..24d1eb8f11 100644 --- a/backend/canisters/user/impl/src/updates/c2c_mark_community_updated_for_user.rs +++ b/backend/canisters/user/impl/src/updates/c2c_mark_community_updated_for_user.rs @@ -1,10 +1,10 @@ use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use types::CommunityId; use user_canister::c2c_mark_community_updated_for_user::{Response::*, *}; -#[update_msgpack] +#[update(msgpack = true)] #[trace] fn c2c_mark_community_updated_for_user(_args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/c2c_mark_group_updated_for_user.rs b/backend/canisters/user/impl/src/updates/c2c_mark_group_updated_for_user.rs index 8b93320eef..9a6de1604f 100644 --- a/backend/canisters/user/impl/src/updates/c2c_mark_group_updated_for_user.rs +++ b/backend/canisters/user/impl/src/updates/c2c_mark_group_updated_for_user.rs @@ -1,10 +1,10 @@ use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use types::ChatId; use user_canister::c2c_mark_group_updated_for_user::{Response::*, *}; -#[update_msgpack] +#[update(msgpack = true)] #[trace] fn c2c_mark_group_updated_for_user(_args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/c2c_notify_achievement.rs b/backend/canisters/user/impl/src/updates/c2c_notify_achievement.rs index 8967052750..3468ba0bea 100644 --- a/backend/canisters/user/impl/src/updates/c2c_notify_achievement.rs +++ b/backend/canisters/user/impl/src/updates/c2c_notify_achievement.rs @@ -1,10 +1,9 @@ use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; -use types::{ChatId, CommunityId}; use user_canister::c2c_notify_achievement::{Response::*, *}; -#[update_msgpack] +#[update(msgpack = true)] #[trace] fn c2c_notify_achievement(args: Args) -> Response { run_regular_jobs(); @@ -13,10 +12,9 @@ fn c2c_notify_achievement(args: Args) -> Response { } fn c2c_notify_achievement_impl(args: Args, state: &mut RuntimeState) -> Response { - let community_id: CommunityId = state.env.caller().into(); - let group_id: ChatId = state.env.caller().into(); + let caller = state.env.caller(); - if !state.data.communities.exists(&community_id) && !state.data.group_chats.exists(&group_id) { + if !state.data.communities.exists(&caller.into()) && !state.data.group_chats.exists(&caller.into()) { return CallerNotFound; } diff --git a/backend/canisters/user/impl/src/updates/c2c_notify_community_deleted.rs b/backend/canisters/user/impl/src/updates/c2c_notify_community_deleted.rs index ff9264a751..c118a4fb21 100644 --- a/backend/canisters/user/impl/src/updates/c2c_notify_community_deleted.rs +++ b/backend/canisters/user/impl/src/updates/c2c_notify_community_deleted.rs @@ -1,10 +1,10 @@ use crate::guards::caller_is_group_index; use crate::{mutate_state, openchat_bot, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use user_canister::c2c_notify_community_deleted::{Response::*, *}; -#[update_msgpack(guard = "caller_is_group_index")] +#[update(guard = "caller_is_group_index", msgpack = true)] #[trace] fn c2c_notify_community_deleted(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/c2c_notify_events.rs b/backend/canisters/user/impl/src/updates/c2c_notify_events.rs index ff04bdf813..bc0b6e0879 100644 --- a/backend/canisters/user/impl/src/updates/c2c_notify_events.rs +++ b/backend/canisters/user/impl/src/updates/c2c_notify_events.rs @@ -1,13 +1,13 @@ use crate::guards::caller_is_local_user_index; use crate::{mutate_state, openchat_bot, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use types::{Achievement, DiamondMembershipPlanDuration, MessageContentInitial, Timestamped}; use user_canister::c2c_notify_events::{Response::*, *}; use user_canister::mark_read::ChannelMessagesRead; use user_canister::Event; -#[update_msgpack(guard = "caller_is_local_user_index")] +#[update(guard = "caller_is_local_user_index", msgpack = true)] #[trace] fn c2c_notify_events(args: Args) -> Response { mutate_state(|state| c2c_notify_events_impl(args, state)) diff --git a/backend/canisters/user/impl/src/updates/c2c_notify_group_deleted.rs b/backend/canisters/user/impl/src/updates/c2c_notify_group_deleted.rs index 0c4d8161c9..a00c1e14d7 100644 --- a/backend/canisters/user/impl/src/updates/c2c_notify_group_deleted.rs +++ b/backend/canisters/user/impl/src/updates/c2c_notify_group_deleted.rs @@ -1,14 +1,14 @@ use crate::guards::caller_is_group_index; use crate::timer_job_types::TimerJob; use crate::{mutate_state, openchat_bot, run_regular_jobs, Data, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use chat_events::ChatInternal; use types::{ChannelId, Chat, ChatId, CommunityId, CommunityImportedInto, TimestampMillis}; use user_canister::c2c_notify_group_deleted::{Response::*, *}; use user_canister::mark_read::ChannelMessagesRead; -#[update_msgpack(guard = "caller_is_group_index")] +#[update(guard = "caller_is_group_index", msgpack = true)] #[trace] fn c2c_notify_group_deleted(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/c2c_notify_p2p_swap_status_change.rs b/backend/canisters/user/impl/src/updates/c2c_notify_p2p_swap_status_change.rs index 0cdc87be76..0ccb26408e 100644 --- a/backend/canisters/user/impl/src/updates/c2c_notify_p2p_swap_status_change.rs +++ b/backend/canisters/user/impl/src/updates/c2c_notify_p2p_swap_status_change.rs @@ -1,12 +1,12 @@ use crate::guards::caller_is_escrow_canister; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use escrow_canister::{SwapStatus, SwapStatusChange as Args}; use types::{Chat, CompleteP2PSwapResult, EventIndex, P2PSwapCancelled, P2PSwapExpired, P2PSwapLocation, P2PSwapStatus}; use user_canister::{P2PSwapStatusChange, UserCanisterEvent}; -#[update_msgpack(guard = "caller_is_escrow_canister")] +#[update(guard = "caller_is_escrow_canister", msgpack = true)] #[trace] fn c2c_notify_p2p_swap_status_change(args: Args) { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/c2c_notify_user_canister_events.rs b/backend/canisters/user/impl/src/updates/c2c_notify_user_canister_events.rs index 7e81588f0e..7c12e0399c 100644 --- a/backend/canisters/user/impl/src/updates/c2c_notify_user_canister_events.rs +++ b/backend/canisters/user/impl/src/updates/c2c_notify_user_canister_events.rs @@ -3,7 +3,7 @@ use crate::timer_job_types::{HardDeleteMessageContentJob, TimerJob}; use crate::updates::c2c_send_messages::{get_sender_status, handle_message_impl, verify_user, HandleMessageArgs}; use crate::updates::start_video_call::handle_start_video_call; use crate::{mutate_state, read_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use chat_events::{ AddRemoveReactionArgs, AddRemoveReactionResult, DeleteMessageResult, DeleteUndeleteMessagesArgs, EditMessageArgs, @@ -18,7 +18,7 @@ use user_canister::c2c_notify_user_canister_events::{Response::*, *}; use user_canister::{SendMessagesArgs, ToggleReactionArgs, UserCanisterEvent}; use utils::time::{HOUR_IN_MS, MINUTE_IN_MS}; -#[update_msgpack] +#[update(msgpack = true)] #[trace] async fn c2c_notify_user_canister_events(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/c2c_remove_from_community.rs b/backend/canisters/user/impl/src/updates/c2c_remove_from_community.rs index 4006fd67ce..058e5bf9c1 100644 --- a/backend/canisters/user/impl/src/updates/c2c_remove_from_community.rs +++ b/backend/canisters/user/impl/src/updates/c2c_remove_from_community.rs @@ -1,9 +1,9 @@ use crate::{mutate_state, openchat_bot, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use user_canister::c2c_remove_from_community::{Response::*, *}; -#[update_msgpack] +#[update(msgpack = true)] #[trace] fn c2c_remove_from_community(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/c2c_remove_from_group.rs b/backend/canisters/user/impl/src/updates/c2c_remove_from_group.rs index abd32484ab..e0cc29253a 100644 --- a/backend/canisters/user/impl/src/updates/c2c_remove_from_group.rs +++ b/backend/canisters/user/impl/src/updates/c2c_remove_from_group.rs @@ -1,9 +1,9 @@ use crate::{mutate_state, openchat_bot, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use user_canister::c2c_remove_from_group::{Response::*, *}; -#[update_msgpack] +#[update(msgpack = true)] #[trace] fn c2c_remove_from_group(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/c2c_revoke_super_admin.rs b/backend/canisters/user/impl/src/updates/c2c_revoke_super_admin.rs index 3e77a8cd7f..017f6c925d 100644 --- a/backend/canisters/user/impl/src/updates/c2c_revoke_super_admin.rs +++ b/backend/canisters/user/impl/src/updates/c2c_revoke_super_admin.rs @@ -1,10 +1,10 @@ use crate::guards::caller_is_user_index; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use user_canister::c2c_revoke_super_admin::{Response::*, *}; -#[update_msgpack(guard = "caller_is_user_index")] +#[update(guard = "caller_is_user_index", msgpack = true)] #[trace] fn c2c_revoke_super_admin(_args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/c2c_set_user_suspended.rs b/backend/canisters/user/impl/src/updates/c2c_set_user_suspended.rs index 81dcc7f2d7..241e7e7968 100644 --- a/backend/canisters/user/impl/src/updates/c2c_set_user_suspended.rs +++ b/backend/canisters/user/impl/src/updates/c2c_set_user_suspended.rs @@ -1,11 +1,11 @@ use crate::guards::caller_is_user_index; use crate::{mutate_state, run_regular_jobs, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use types::Timestamped; use user_canister::c2c_set_user_suspended::{Response::*, *}; -#[update_msgpack(guard = "caller_is_user_index")] +#[update(guard = "caller_is_user_index", msgpack = true)] #[trace] fn c2c_set_user_suspended(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/c2c_vote_on_proposal.rs b/backend/canisters/user/impl/src/updates/c2c_vote_on_proposal.rs index 1d6da480a6..da0cc009e3 100644 --- a/backend/canisters/user/impl/src/updates/c2c_vote_on_proposal.rs +++ b/backend/canisters/user/impl/src/updates/c2c_vote_on_proposal.rs @@ -1,13 +1,13 @@ use crate::governance_clients::nns::GetBallotsResult; use crate::guards::caller_is_known_group_or_community_canister; use crate::{read_state, run_regular_jobs}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use ic_cdk::api::call::CallResult; use types::{CanisterId, NnsNeuronId, ProposalId, SnsNeuronId}; use user_canister::c2c_vote_on_proposal::{Response::*, *}; -#[update_msgpack(guard = "caller_is_known_group_or_community_canister")] +#[update(guard = "caller_is_known_group_or_community_canister", msgpack = true)] #[trace] async fn c2c_vote_on_proposal(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user_index/impl/src/queries/c2c_lookup_user.rs b/backend/canisters/user_index/impl/src/queries/c2c_lookup_user.rs index b405d3af62..f3a2835793 100644 --- a/backend/canisters/user_index/impl/src/queries/c2c_lookup_user.rs +++ b/backend/canisters/user_index/impl/src/queries/c2c_lookup_user.rs @@ -1,9 +1,9 @@ use crate::{read_state, RuntimeState}; -use canister_api_macros::query_msgpack; +use canister_api_macros::query; use types::UserDetails; use user_index_canister::c2c_lookup_user::{Response::*, *}; -#[query_msgpack] +#[query(msgpack = true)] fn c2c_lookup_user(args: Args) -> Response { read_state(|state| c2c_lookup_user_impl(args, state)) } diff --git a/backend/canisters/user_index/impl/src/queries/user.rs b/backend/canisters/user_index/impl/src/queries/user.rs index 097136ee15..8c1774eb90 100644 --- a/backend/canisters/user_index/impl/src/queries/user.rs +++ b/backend/canisters/user_index/impl/src/queries/user.rs @@ -1,8 +1,8 @@ use crate::{read_state, RuntimeState}; -use canister_api_macros::query_candid_and_msgpack; +use canister_api_macros::query; use user_index_canister::user::{Response::*, *}; -#[query_candid_and_msgpack] +#[query(candid = true, msgpack = true)] fn user(args: Args) -> Response { read_state(|state| user_impl(args, state)) } diff --git a/backend/canisters/user_index/impl/src/updates/c2c_mark_user_canister_empty.rs b/backend/canisters/user_index/impl/src/updates/c2c_mark_user_canister_empty.rs index 07f5385bd3..1e4294d2d2 100644 --- a/backend/canisters/user_index/impl/src/updates/c2c_mark_user_canister_empty.rs +++ b/backend/canisters/user_index/impl/src/updates/c2c_mark_user_canister_empty.rs @@ -1,9 +1,9 @@ use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use user_index_canister::c2c_mark_user_canister_empty::{Response::*, *}; -#[update_msgpack] +#[update(msgpack = true)] #[trace] fn c2c_mark_user_canister_empty(_args: Args) -> Response { mutate_state(c2c_mark_user_canister_empty_impl) diff --git a/backend/canisters/user_index/impl/src/updates/c2c_notify_chit.rs b/backend/canisters/user_index/impl/src/updates/c2c_notify_chit.rs index 9f6821d84e..4c5d00afab 100644 --- a/backend/canisters/user_index/impl/src/updates/c2c_notify_chit.rs +++ b/backend/canisters/user_index/impl/src/updates/c2c_notify_chit.rs @@ -1,10 +1,10 @@ use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use types::UserId; use user_index_canister::c2c_notify_chit::{Response::*, *}; -#[update_msgpack] +#[update(msgpack = true)] #[trace] fn c2c_notify_chit(args: Args) -> Response { mutate_state(|state| c2c_notify_chit_impl(args, state)) diff --git a/backend/canisters/user_index/impl/src/updates/c2c_notify_events.rs b/backend/canisters/user_index/impl/src/updates/c2c_notify_events.rs index 86d42017ee..f66ea73df0 100644 --- a/backend/canisters/user_index/impl/src/updates/c2c_notify_events.rs +++ b/backend/canisters/user_index/impl/src/updates/c2c_notify_events.rs @@ -2,7 +2,7 @@ use crate::guards::caller_is_local_user_index_canister; use crate::timer_job_types::{JoinUserToGroup, TimerJob}; use crate::{mutate_state, RuntimeState, UserRegisteredEventPayload, ONE_MB}; use candid::Principal; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use event_store_producer::EventBuilder; use local_user_index_canister::{ @@ -14,7 +14,7 @@ use types::{CanisterId, MessageContent, TextContent, UserId}; use user_index_canister::c2c_notify_events::{Response::*, *}; use user_index_canister::Event; -#[update_msgpack(guard = "caller_is_local_user_index_canister")] +#[update(guard = "caller_is_local_user_index_canister", msgpack = true)] #[trace] fn c2c_notify_events(args: Args) -> Response { mutate_state(|state| c2c_notify_events_impl(args, state)) diff --git a/backend/canisters/user_index/impl/src/updates/c2c_notify_low_balance.rs b/backend/canisters/user_index/impl/src/updates/c2c_notify_low_balance.rs index 46067d6cb8..c4d9a39467 100644 --- a/backend/canisters/user_index/impl/src/updates/c2c_notify_low_balance.rs +++ b/backend/canisters/user_index/impl/src/updates/c2c_notify_low_balance.rs @@ -1,12 +1,12 @@ use crate::{mutate_state, read_state, RuntimeState, USER_CANISTER_TOP_UP_AMOUNT}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use types::{CyclesTopUp, NotifyLowBalanceArgs, NotifyLowBalanceResponse, UserId}; use utils::canister::deposit_cycles; use utils::consts::min_cycles_balance; use utils::cycles::can_spend_cycles; -#[update_msgpack] +#[update(msgpack = true)] #[trace] async fn c2c_notify_low_balance(_args: NotifyLowBalanceArgs) -> NotifyLowBalanceResponse { let prepare_ok = match read_state(prepare) { diff --git a/backend/canisters/user_index/impl/src/updates/c2c_report_message.rs b/backend/canisters/user_index/impl/src/updates/c2c_report_message.rs index 4fc1aee97c..46318e4597 100644 --- a/backend/canisters/user_index/impl/src/updates/c2c_report_message.rs +++ b/backend/canisters/user_index/impl/src/updates/c2c_report_message.rs @@ -6,14 +6,14 @@ use crate::{ }, mutate_state, RuntimeState, }; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use chat_events::deep_message_links; use modclub_canister::submitHtmlContent::Level; use types::{Chat, Message, MessageContent, MessageIndex}; use user_index_canister::c2c_report_message::{Response::*, *}; -#[update_msgpack(guard = "caller_is_user_canister_or_group_index")] +#[update(guard = "caller_is_user_canister_or_group_index", msgpack = true)] #[trace] fn c2c_report_message(args: Args) -> Response { mutate_state(|state| c2c_report_message_impl(args, state)) diff --git a/backend/canisters/user_index/impl/src/updates/c2c_send_openchat_bot_messages.rs b/backend/canisters/user_index/impl/src/updates/c2c_send_openchat_bot_messages.rs index ceec834b17..7dbc80a9bc 100644 --- a/backend/canisters/user_index/impl/src/updates/c2c_send_openchat_bot_messages.rs +++ b/backend/canisters/user_index/impl/src/updates/c2c_send_openchat_bot_messages.rs @@ -1,11 +1,11 @@ use crate::{guards::caller_is_translations_canister, mutate_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use local_user_index_canister::{Event, OpenChatBotMessage}; use types::{MessageContent, TextContent}; use user_index_canister::c2c_send_openchat_bot_messages::{Response::*, *}; -#[update_msgpack(guard = "caller_is_translations_canister")] +#[update(guard = "caller_is_translations_canister", msgpack = true)] #[trace] fn c2c_send_openchat_bot_messages(args: Args) -> Response { mutate_state(|state| c2c_send_openchat_bot_messages_impl(args, state)) diff --git a/backend/canisters/user_index/impl/src/updates/c2c_set_avatar.rs b/backend/canisters/user_index/impl/src/updates/c2c_set_avatar.rs index b2e3f474e0..a7d36c8a3f 100644 --- a/backend/canisters/user_index/impl/src/updates/c2c_set_avatar.rs +++ b/backend/canisters/user_index/impl/src/updates/c2c_set_avatar.rs @@ -1,10 +1,10 @@ use crate::guards::caller_is_openchat_user; use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use user_index_canister::c2c_set_avatar::{Response::*, *}; -#[update_msgpack(guard = "caller_is_openchat_user")] +#[update(guard = "caller_is_openchat_user", msgpack = true)] #[trace] fn c2c_set_avatar(args: Args) -> Response { mutate_state(|state| c2c_set_avatar_impl(args, state)) diff --git a/backend/canisters/user_index/impl/src/updates/c2c_suspend_users.rs b/backend/canisters/user_index/impl/src/updates/c2c_suspend_users.rs index 9c81be0b52..1a6901d59b 100644 --- a/backend/canisters/user_index/impl/src/updates/c2c_suspend_users.rs +++ b/backend/canisters/user_index/impl/src/updates/c2c_suspend_users.rs @@ -1,11 +1,11 @@ use crate::guards::caller_is_group_index; use crate::timer_job_types::{SetUserSuspended, TimerJob}; use crate::{mutate_state, RuntimeState}; -use canister_api_macros::update_msgpack; +use canister_api_macros::update; use canister_tracing_macros::trace; use user_index_canister::c2c_suspend_users::{Response::*, *}; -#[update_msgpack(guard = "caller_is_group_index")] +#[update(guard = "caller_is_group_index", msgpack = true)] #[trace] fn c2c_suspend_users(args: Args) -> Response { mutate_state(|state| c2c_suspend_users_impl(args, state)) diff --git a/backend/libraries/canister_api_macros/src/lib.rs b/backend/libraries/canister_api_macros/src/lib.rs index 8821d59e78..ea5fbfec4e 100644 --- a/backend/libraries/canister_api_macros/src/lib.rs +++ b/backend/libraries/canister_api_macros/src/lib.rs @@ -26,30 +26,24 @@ struct AttributeInput { pub name: Option, pub guard: Option, #[serde(default)] + pub candid: bool, + #[serde(default)] + pub msgpack: bool, + #[serde(default)] pub manual_reply: bool, } #[proc_macro_attribute] -pub fn update_candid_and_msgpack(attr: TokenStream, item: TokenStream) -> TokenStream { - canister_api_method(MethodType::Update, attr, item, true) -} - -#[proc_macro_attribute] -pub fn query_candid_and_msgpack(attr: TokenStream, item: TokenStream) -> TokenStream { - canister_api_method(MethodType::Query, attr, item, true) +pub fn update(attr: TokenStream, item: TokenStream) -> TokenStream { + canister_api_method(MethodType::Update, attr, item) } #[proc_macro_attribute] -pub fn update_msgpack(attr: TokenStream, item: TokenStream) -> TokenStream { - canister_api_method(MethodType::Update, attr, item, false) +pub fn query(attr: TokenStream, item: TokenStream) -> TokenStream { + canister_api_method(MethodType::Query, attr, item) } -#[proc_macro_attribute] -pub fn query_msgpack(attr: TokenStream, item: TokenStream) -> TokenStream { - canister_api_method(MethodType::Query, attr, item, false) -} - -fn canister_api_method(method_type: MethodType, attr: TokenStream, item: TokenStream, include_candid: bool) -> TokenStream { +fn canister_api_method(method_type: MethodType, attr: TokenStream, item: TokenStream) -> TokenStream { let attr: AttributeInput = from_tokenstream(&attr.into()).unwrap(); let item = parse_macro_input!(item as ItemFn); @@ -59,18 +53,7 @@ fn canister_api_method(method_type: MethodType, attr: TokenStream, item: TokenSt let guard = attr.guard.map(|g| quote! { guard = #g, }); let manual_reply = attr.manual_reply.then_some(quote! { manual_reply = "true", }); - let msgpack_name = format!("{name}_msgpack"); - - let serializer_name = format!("{msgpack_name}_serializer"); - let serializer_ident = Ident::new(&serializer_name, Span::call_site()); - - let deserializer_name = format!("{msgpack_name}_deserializer"); - let deserializer_ident = Ident::new(&deserializer_name, Span::call_site()); - - let serializer = quote! { serializer = #serializer_name, }; - let deserializer = quote! { deserializer = #deserializer_name }; - - let candid = if include_candid { + let candid = if attr.candid { quote! { #[ic_cdk::#method_type(name = #name, #guard #manual_reply)] #item @@ -79,18 +62,33 @@ fn canister_api_method(method_type: MethodType, attr: TokenStream, item: TokenSt quote! {} }; - let mut msgpack_item = item.clone(); - msgpack_item.sig.ident = Ident::new(&msgpack_name, Span::call_site()); + let msgpack = if attr.msgpack { + let msgpack_name = format!("{name}_msgpack"); + + let serializer_name = format!("{msgpack_name}_serializer"); + let serializer_ident = Ident::new(&serializer_name, Span::call_site()); + + let deserializer_name = format!("{msgpack_name}_deserializer"); + let deserializer_ident = Ident::new(&deserializer_name, Span::call_site()); - let msgpack = quote! { - #[ic_cdk::#method_type(name = #msgpack_name, #guard #manual_reply #serializer #deserializer)] - #msgpack_item + let serializer = quote! { serializer = #serializer_name, }; + let deserializer = quote! { deserializer = #deserializer_name }; + + let mut msgpack_item = item.clone(); + msgpack_item.sig.ident = Ident::new(&msgpack_name, Span::call_site()); + + quote! { + use msgpack::serialize_then_unwrap as #serializer_ident; + use msgpack::deserialize_then_unwrap as #deserializer_ident; + + #[ic_cdk::#method_type(name = #msgpack_name, #guard #manual_reply #serializer #deserializer)] + #msgpack_item + } + } else { + quote! {} }; TokenStream::from(quote! { - use msgpack::serialize_then_unwrap as #serializer_ident; - use msgpack::deserialize_then_unwrap as #deserializer_ident; - #candid #msgpack })