Document AccountState
* Don't use option_env * Fix 'cargo test' (it was failing on ambiguous module names)
This commit is contained in:
parent
c04d25e704
commit
ff15ca3a67
|
@ -7,11 +7,11 @@ pub mod posted_vaa;
|
||||||
pub mod sequence;
|
pub mod sequence;
|
||||||
pub mod signature_set;
|
pub mod signature_set;
|
||||||
|
|
||||||
pub use bridge::*;
|
pub use self::bridge::*;
|
||||||
pub use claim::*;
|
pub use self::claim::*;
|
||||||
pub use fee_collector::*;
|
pub use self::fee_collector::*;
|
||||||
pub use guardian_set::*;
|
pub use self::guardian_set::*;
|
||||||
pub use posted_message::*;
|
pub use self::posted_message::*;
|
||||||
pub use posted_vaa::*;
|
pub use self::posted_vaa::*;
|
||||||
pub use sequence::*;
|
pub use self::sequence::*;
|
||||||
pub use signature_set::*;
|
pub use self::signature_set::*;
|
||||||
|
|
|
@ -42,10 +42,7 @@ fn verify_governance<'a, T>(vaa: &ClaimableVAA<'a, T>) -> Result<()>
|
||||||
where
|
where
|
||||||
T: DeserializePayload,
|
T: DeserializePayload,
|
||||||
{
|
{
|
||||||
let expected_emitter = std::option_env!("EMITTER_ADDRESS").ok_or_else(|| {
|
let expected_emitter = std::env!("EMITTER_ADDRESS");
|
||||||
sol_log("EMITTER_ADDRESS not set at compile-time");
|
|
||||||
ProgramError::UninitializedAccount
|
|
||||||
})?;
|
|
||||||
let current_emitter = format!(
|
let current_emitter = format!(
|
||||||
"{}",
|
"{}",
|
||||||
Pubkey::new_from_array(vaa.message.meta().emitter_address)
|
Pubkey::new_from_array(vaa.message.meta().emitter_address)
|
||||||
|
|
|
@ -34,6 +34,21 @@ use crate::{
|
||||||
/// A short alias for AccountInfo.
|
/// A short alias for AccountInfo.
|
||||||
pub type Info<'r> = AccountInfo<'r>;
|
pub type Info<'r> = AccountInfo<'r>;
|
||||||
|
|
||||||
|
/// Represents an account's state in terms of initialization, which we use as
|
||||||
|
/// preconditions in our instructions.
|
||||||
|
///
|
||||||
|
/// * An [`Initialized`] account is one that has some data stored in it. If we
|
||||||
|
/// (the program) own the account, this means that we had written that data in
|
||||||
|
/// the first place. For security reasons, initialisation check should always be
|
||||||
|
/// in conjuction with an appropriate ownership check.
|
||||||
|
/// * An [`Uninitialized`] account is an account that has no data inside of it.
|
||||||
|
/// We may require an account to be [`Uninitialized`] when we want to initialize
|
||||||
|
/// it ourselves. Once initialized, an account's size and owner are immutable
|
||||||
|
/// (as guaranteed by the Solana runtime), so when we initialize a previously
|
||||||
|
/// uninitialized account, we will want to make sure to assign the right size
|
||||||
|
/// and owner.
|
||||||
|
/// * A [`MaybeInitialized`] account can be in either state. The instruction can
|
||||||
|
/// then query the state of the account and decide on a next step based on it.
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Debug, Eq, PartialEq)]
|
||||||
pub enum AccountState {
|
pub enum AccountState {
|
||||||
Initialized,
|
Initialized,
|
||||||
|
|
Loading…
Reference in New Issue