Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(svm): L-06 Unnecessary Use of InitSpace Macro #839

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions programs/svm-spoke/src/common/v3_relay_data.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anchor_lang::prelude::*;

#[derive(AnchorSerialize, AnchorDeserialize, Clone, InitSpace)]
#[derive(AnchorSerialize, AnchorDeserialize, Clone)]
pub struct V3RelayData {
pub depositor: Pubkey,
pub recipient: Pubkey,
Expand All @@ -13,6 +13,5 @@ pub struct V3RelayData {
pub deposit_id: [u8; 32],
pub fill_deadline: u32,
pub exclusivity_deadline: u32,
#[max_len(0)]
pub message: Vec<u8>,
}
4 changes: 1 addition & 3 deletions programs/svm-spoke/src/instructions/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,13 @@ pub struct ExecuteRelayerRefundLeaf<'info> {
pub system_program: Program<'info, System>,
}

#[derive(AnchorSerialize, AnchorDeserialize, Clone, InitSpace)]
#[derive(AnchorSerialize, AnchorDeserialize, Clone)]
pub struct RelayerRefundLeaf {
pub amount_to_return: u64,
pub chain_id: u64,
#[max_len(0)]
pub refund_amounts: Vec<u64>,
pub leaf_id: u32,
pub mint_public_key: Pubkey,
#[max_len(0)]
pub refund_addresses: Vec<Pubkey>,
}

Expand Down
2 changes: 1 addition & 1 deletion programs/svm-spoke/src/instructions/slow_fill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ fn unwrap_request_v3_slow_fill_params(
}
}

#[derive(AnchorSerialize, AnchorDeserialize, Clone, InitSpace)]
#[derive(AnchorSerialize, AnchorDeserialize, Clone)]
pub struct V3SlowFill {
pub relay_data: V3RelayData,
pub chain_id: u64,
Expand Down
8 changes: 1 addition & 7 deletions programs/svm-spoke/src/state/instruction_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,27 @@ use anchor_lang::prelude::*;
use crate::{RelayerRefundLeaf, V3RelayData, V3SlowFill};

#[account]
#[derive(InitSpace)]
pub struct ExecuteRelayerRefundLeafParams {
pub root_bundle_id: u32, // ID of the root bundle to be used.
pub relayer_refund_leaf: RelayerRefundLeaf, // Leaf to be verified against the proof and instruct bundle execution.
#[max_len(0)]
pub proof: Vec<[u8; 32]>, // Proof to verify the leaf's inclusion in relayer refund merkle tree.
pub proof: Vec<[u8; 32]>, // Proof to verify the leaf's inclusion in relayer refund merkle tree.
}

#[account]
#[derive(InitSpace)]
pub struct FillV3RelayParams {
pub relay_data: V3RelayData,
pub repayment_chain_id: u64,
pub repayment_address: Pubkey,
}

#[account]
#[derive(InitSpace)]
pub struct RequestV3SlowFillParams {
pub relay_data: V3RelayData,
}

#[account]
#[derive(InitSpace)]
pub struct ExecuteV3SlowRelayLeafParams {
pub slow_fill_leaf: V3SlowFill,
pub root_bundle_id: u32,
#[max_len(0)]
pub proof: Vec<[u8; 32]>,
}
Loading