Use associated account for guardian set.
Change-Id: Ic535115be997d3173c6bb891d980cb8c3e09d5d4
This commit is contained in:
parent
c4286b9df5
commit
edc8a91ecd
|
@ -5,6 +5,10 @@ mod types;
|
||||||
|
|
||||||
use types::{Index, BridgeConfig};
|
use types::{Index, BridgeConfig};
|
||||||
|
|
||||||
|
// Without this, Anchor's derivation macros break. It requires names with no path components at all
|
||||||
|
// otherwise it errors.
|
||||||
|
use anchor_bridge::Bridge;
|
||||||
|
|
||||||
/// An enum with labeled network identifiers. These must be consistent accross all wormhole
|
/// An enum with labeled network identifiers. These must be consistent accross all wormhole
|
||||||
/// contracts deployed on each chain.
|
/// contracts deployed on each chain.
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
|
@ -37,19 +41,23 @@ pub struct VerifySigsData {
|
||||||
pub initial_creation: bool,
|
pub initial_creation: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Accounts)]
|
#[derive(Accounts)]
|
||||||
pub struct Initialize<'info> {
|
pub struct Initialize<'info> {
|
||||||
/// Account used to pay for auxillary instructions.
|
/// Account used to pay for auxillary instructions.
|
||||||
#[account(signer)]
|
#[account(signer)]
|
||||||
pub payer: AccountInfo<'info>,
|
pub payer: AccountInfo<'info>,
|
||||||
|
|
||||||
|
/// Information about the current guardian set.
|
||||||
|
#[account(init, associated = state)]
|
||||||
|
pub guardian_set: ProgramAccount<'info, GuardianSetInfo>,
|
||||||
|
|
||||||
|
/// State struct, derived by #[state], used for associated accounts.
|
||||||
|
pub state: ProgramState<'info, Bridge>,
|
||||||
|
|
||||||
/// Used for timestamping actions.
|
/// Used for timestamping actions.
|
||||||
pub clock: Sysvar<'info, Clock>,
|
pub clock: Sysvar<'info, Clock>,
|
||||||
|
|
||||||
/// Information about the current guardian set.
|
|
||||||
#[account(init)]
|
|
||||||
pub guardian_set: ProgramAccount<'info, GuardianSetInfo>,
|
|
||||||
|
|
||||||
/// Required by Anchor for associated accounts.
|
/// Required by Anchor for associated accounts.
|
||||||
pub rent: Sysvar<'info, Rent>,
|
pub rent: Sysvar<'info, Rent>,
|
||||||
|
|
||||||
|
@ -158,7 +166,7 @@ pub enum ErrorCode {
|
||||||
#[account]
|
#[account]
|
||||||
pub struct BridgeInfo {}
|
pub struct BridgeInfo {}
|
||||||
|
|
||||||
#[account]
|
#[associated]
|
||||||
pub struct GuardianSetInfo {
|
pub struct GuardianSetInfo {
|
||||||
/// Version number of this guardian set.
|
/// Version number of this guardian set.
|
||||||
pub index: Index,
|
pub index: Index,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use anchor_lang::prelude::*;
|
use anchor_lang::prelude::*;
|
||||||
|
|
||||||
// Enforces a single bumping index number.
|
// Enforces a single bumping index number.
|
||||||
#[derive(AnchorSerialize, AnchorDeserialize, Clone, Copy, Debug)]
|
#[derive(AnchorSerialize, AnchorDeserialize, Clone, Copy, Debug, Default)]
|
||||||
pub struct Index(pub u32);
|
pub struct Index(pub u32);
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
|
Loading…
Reference in New Issue