@@ -4,7 +4,7 @@ use crate::{
44 constants:: { CFG_SEED , DISCRIMINATOR_LEN } ,
55 internal:: { Eip1559 , Eip1559Config , GasConfig } ,
66 program:: BaseRelayer as BaseRelayerProgram ,
7- Cfg ,
7+ Cfg , RelayerError ,
88} ;
99
1010/// Accounts for the initialize instruction that sets up the base relayer's initial state.
@@ -33,15 +33,15 @@ pub struct Initialize<'info> {
3333 /// Validates that the signer is indeed the upgrade authority.
3434 #[ account(
3535 constraint = program_data. upgrade_authority_address == Some ( upgrade_authority. key( ) )
36- @ InitializeError :: UnauthorizedInitialization
36+ @ RelayerError :: UnauthorizedInitialization
3737 ) ]
3838 pub program_data : Account < ' info , ProgramData > ,
3939
4040 /// The base_relayer program itself.
4141 /// Validates that program_data is the correct ProgramData account for this program.
4242 #[ account(
4343 constraint = program. programdata_address( ) ? == Some ( program_data. key( ) )
44- @ InitializeError :: IncorrectRelayerProgram
44+ @ RelayerError :: IncorrectRelayerProgram
4545 ) ]
4646 pub program : Program < ' info , BaseRelayerProgram > ,
4747
@@ -74,20 +74,11 @@ pub fn initialize_handler(
7474 Ok ( ( ) )
7575}
7676
77- /// Error codes for initialization
78- #[ error_code]
79- pub enum InitializeError {
80- #[ msg( "Only the upgrade authority can initialize the relayer" ) ]
81- UnauthorizedInitialization = 8000 ,
82- #[ msg( "Incorrect relayer program" ) ]
83- IncorrectRelayerProgram = 8001 ,
84- }
85-
8677#[ cfg( test) ]
8778mod tests {
8879 use super :: * ;
8980 use anchor_lang:: {
90- solana_program:: { bpf_loader_upgradeable , instruction:: Instruction , system_program} ,
81+ solana_program:: { instruction:: Instruction , system_program} ,
9182 InstructionData ,
9283 } ;
9384 use solana_message:: Message ;
@@ -217,7 +208,7 @@ mod tests {
217208 // Verify the error message contains "UnauthorizedInitialization"
218209 let error_string = format ! ( "{:?}" , result. unwrap_err( ) ) ;
219210 assert ! (
220- error_string. contains( "UnauthorizedInitialization" ) || error_string. contains( "8000 " ) , // Error code for UnauthorizedInitialization
211+ error_string. contains( "UnauthorizedInitialization" ) || error_string. contains( "6000 " ) , // Error code for UnauthorizedInitialization
221212 "Expected UnauthorizedInitialization error, got: {}" ,
222213 error_string
223214 ) ;
0 commit comments