Skip to content

fix(svm): N-03 use consistent variable names in the instruction constraint #962

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

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
6 changes: 3 additions & 3 deletions programs/svm-spoke/src/instructions/fill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::{

#[event_cpi]
#[derive(Accounts)]
#[instruction(relay_hash: [u8; 32], relay_data: Option<RelayData>)]
#[instruction(_relay_hash: [u8; 32], relay_data: Option<RelayData>)]
pub struct FillRelay<'info> {
#[account(mut)]
pub signer: Signer<'info>,
Expand Down Expand Up @@ -65,10 +65,10 @@ pub struct FillRelay<'info> {
init_if_needed,
payer = signer,
space = DISCRIMINATOR_SIZE + FillStatusAccount::INIT_SPACE,
seeds = [b"fills", relay_hash.as_ref()],
seeds = [b"fills", _relay_hash.as_ref()],
bump,
constraint = is_relay_hash_valid(
&relay_hash,
&_relay_hash,
&relay_data.clone().unwrap_or_else(|| instruction_params.as_ref().unwrap().relay_data.clone()),
&state) @ SvmError::InvalidRelayHash
)]
Expand Down
4 changes: 2 additions & 2 deletions programs/svm-spoke/src/instructions/instruction_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use anchor_lang::{prelude::*, solana_program::system_program};
use crate::error::SvmError;

#[derive(Accounts)]
#[instruction(total_size: u32)]
#[instruction(_total_size: u32)]
pub struct InitializeInstructionParams<'info> {
#[account(mut)]
pub signer: Signer<'info>,
Expand All @@ -12,7 +12,7 @@ pub struct InitializeInstructionParams<'info> {
#[account(
init,
payer = signer,
space = total_size as usize,
space = _total_size as usize,
seeds = [b"instruction_params", signer.key().as_ref()],
bump
)]
Expand Down
14 changes: 7 additions & 7 deletions programs/svm-spoke/src/instructions/slow_fill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{

#[event_cpi]
#[derive(Accounts)]
#[instruction(relay_hash: [u8; 32], relay_data: Option<RelayData>)]
#[instruction(_relay_hash: [u8; 32], relay_data: Option<RelayData>)]
pub struct RequestSlowFill<'info> {
#[account(mut)]
pub signer: Signer<'info>,
Expand All @@ -33,10 +33,10 @@ pub struct RequestSlowFill<'info> {
init_if_needed,
payer = signer,
space = DISCRIMINATOR_SIZE + FillStatusAccount::INIT_SPACE,
seeds = [b"fills", relay_hash.as_ref()],
seeds = [b"fills", _relay_hash.as_ref()],
bump,
constraint = is_relay_hash_valid(
&relay_hash,
&_relay_hash,
&relay_data.clone().unwrap_or_else(|| instruction_params.as_ref().unwrap().relay_data.clone()),
&state) @ SvmError::InvalidRelayHash
)]
Expand Down Expand Up @@ -133,7 +133,7 @@ impl SlowFill {

#[event_cpi]
#[derive(Accounts)]
#[instruction(relay_hash: [u8; 32], slow_fill_leaf: Option<SlowFill>, root_bundle_id: Option<u32>)]
#[instruction(_relay_hash: [u8; 32], slow_fill_leaf: Option<SlowFill>, _root_bundle_id: Option<u32>)]
pub struct ExecuteSlowRelayLeaf<'info> {
pub signer: Signer<'info>,

Expand All @@ -148,7 +148,7 @@ pub struct ExecuteSlowRelayLeaf<'info> {
seeds = [
b"root_bundle",
state.seed.to_le_bytes().as_ref(),
root_bundle_id
_root_bundle_id
.unwrap_or_else(|| instruction_params.as_ref().unwrap().root_bundle_id)
.to_le_bytes()
.as_ref(),
Expand All @@ -159,11 +159,11 @@ pub struct ExecuteSlowRelayLeaf<'info> {

#[account(
mut,
seeds = [b"fills", relay_hash.as_ref()],
seeds = [b"fills", _relay_hash.as_ref()],
bump,
// Make sure caller provided relay_hash used in PDA seeds is valid.
constraint = is_relay_hash_valid(
&relay_hash,
&_relay_hash,
&slow_fill_leaf
.clone()
.unwrap_or_else(|| instruction_params.as_ref().unwrap().slow_fill_leaf.clone())
Expand Down
Loading