Ensure the behavior of the bump ix arguments is unchanged
This commit is contained in:
parent
233e5414f4
commit
8eee11a86a
|
@ -48,6 +48,7 @@ pub struct CreateRegistrar<'info> {
|
|||
/// used for voting.
|
||||
pub fn create_registrar(ctx: Context<CreateRegistrar>, registrar_bump: u8) -> Result<()> {
|
||||
let registrar = &mut ctx.accounts.registrar.load_init()?;
|
||||
require_eq!(registrar_bump, *ctx.bumps.get("registrar").unwrap());
|
||||
registrar.bump = registrar_bump;
|
||||
registrar.governance_program_id = ctx.accounts.governance_program_id.key();
|
||||
registrar.realm = ctx.accounts.realm.key();
|
||||
|
|
|
@ -67,6 +67,12 @@ pub fn create_voter(
|
|||
);
|
||||
}
|
||||
|
||||
require_eq!(voter_bump, *ctx.bumps.get("voter").unwrap());
|
||||
require_eq!(
|
||||
voter_weight_record_bump,
|
||||
*ctx.bumps.get("voter_weight_record").unwrap()
|
||||
);
|
||||
|
||||
// Load accounts.
|
||||
let registrar = &ctx.accounts.registrar.load()?;
|
||||
let voter_authority = ctx.accounts.voter_authority.key();
|
||||
|
|
|
@ -105,6 +105,12 @@ pub fn grant(
|
|||
allow_clawback: bool,
|
||||
amount: u64,
|
||||
) -> Result<()> {
|
||||
require_eq!(voter_bump, *ctx.bumps.get("voter").unwrap());
|
||||
require_eq!(
|
||||
voter_weight_record_bump,
|
||||
*ctx.bumps.get("voter_weight_record").unwrap()
|
||||
);
|
||||
|
||||
// Load accounts.
|
||||
let registrar = &ctx.accounts.registrar.load()?;
|
||||
let voter_authority = ctx.accounts.voter_authority.key();
|
||||
|
|
Loading…
Reference in New Issue