Eliminate doc warnings and fix some markdown (#18566)
* Fix link target in doc comment * Fix formatting of log examples in process_instruction * Fix doc markdown in solana-gossip * Fix doc markdown in solana-runtime * Escape square braces in doc comments to avoid warnings * Surround 'account references' doc items in code spans to avoid warnings * Fix code block in loader_upgradeable_instruction * Fix doctest for loader_upgradable_instruction
This commit is contained in:
parent
aeb30fa873
commit
37ee0b5599
|
@ -1,4 +1,5 @@
|
||||||
//! Crds Gossip
|
//! Crds Gossip.
|
||||||
|
//!
|
||||||
//! This module ties together Crds and the push and pull gossip overlays. The interface is
|
//! This module ties together Crds and the push and pull gossip overlays. The interface is
|
||||||
//! designed to run with a simulator or over a UDP network connection with messages up to a
|
//! designed to run with a simulator or over a UDP network connection with messages up to a
|
||||||
//! packet::PACKET_DATA_SIZE size.
|
//! packet::PACKET_DATA_SIZE size.
|
||||||
|
@ -39,7 +40,8 @@ pub struct CrdsGossip {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CrdsGossip {
|
impl CrdsGossip {
|
||||||
/// process a push message to the network
|
/// Process a push message to the network.
|
||||||
|
///
|
||||||
/// Returns unique origins' pubkeys of upserted values.
|
/// Returns unique origins' pubkeys of upserted values.
|
||||||
pub fn process_push_message(
|
pub fn process_push_message(
|
||||||
&self,
|
&self,
|
||||||
|
@ -54,7 +56,7 @@ impl CrdsGossip {
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// remove redundant paths in the network
|
/// Remove redundant paths in the network.
|
||||||
pub fn prune_received_cache<I>(
|
pub fn prune_received_cache<I>(
|
||||||
&self,
|
&self,
|
||||||
self_pubkey: &Pubkey,
|
self_pubkey: &Pubkey,
|
||||||
|
@ -145,7 +147,7 @@ impl CrdsGossip {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// add the `from` to the peer's filter of nodes
|
/// Add the `from` to the peer's filter of nodes.
|
||||||
pub fn process_prune_msg(
|
pub fn process_prune_msg(
|
||||||
&self,
|
&self,
|
||||||
self_pubkey: &Pubkey,
|
self_pubkey: &Pubkey,
|
||||||
|
@ -167,8 +169,7 @@ impl CrdsGossip {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// refresh the push active set
|
/// Refresh the push active set.
|
||||||
/// * ratio - number of actives to rotate
|
|
||||||
pub fn refresh_push_active_set(
|
pub fn refresh_push_active_set(
|
||||||
&self,
|
&self,
|
||||||
self_pubkey: &Pubkey,
|
self_pubkey: &Pubkey,
|
||||||
|
@ -188,7 +189,7 @@ impl CrdsGossip {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generate a random request
|
/// Generate a random request.
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn new_pull_request(
|
pub fn new_pull_request(
|
||||||
&self,
|
&self,
|
||||||
|
@ -216,14 +217,15 @@ impl CrdsGossip {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// time when a request to `from` was initiated
|
/// Time when a request to `from` was initiated.
|
||||||
|
///
|
||||||
/// This is used for weighted random selection during `new_pull_request`
|
/// This is used for weighted random selection during `new_pull_request`
|
||||||
/// It's important to use the local nodes request creation time as the weight
|
/// It's important to use the local nodes request creation time as the weight
|
||||||
/// instead of the response received time otherwise failed nodes will increase their weight.
|
/// instead of the response received time otherwise failed nodes will increase their weight.
|
||||||
pub fn mark_pull_request_creation_time(&self, from: Pubkey, now: u64) {
|
pub fn mark_pull_request_creation_time(&self, from: Pubkey, now: u64) {
|
||||||
self.pull.mark_pull_request_creation_time(from, now)
|
self.pull.mark_pull_request_creation_time(from, now)
|
||||||
}
|
}
|
||||||
/// process a pull request and create a response
|
/// Process a pull request and create a response.
|
||||||
pub fn process_pull_requests<I>(&self, callers: I, now: u64)
|
pub fn process_pull_requests<I>(&self, callers: I, now: u64)
|
||||||
where
|
where
|
||||||
I: IntoIterator<Item = CrdsValue>,
|
I: IntoIterator<Item = CrdsValue>,
|
||||||
|
@ -255,7 +257,7 @@ impl CrdsGossip {
|
||||||
.filter_pull_responses(&self.crds, timeouts, response, now, process_pull_stats)
|
.filter_pull_responses(&self.crds, timeouts, response, now, process_pull_stats)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// process a pull response
|
/// Process a pull response.
|
||||||
pub fn process_pull_responses(
|
pub fn process_pull_responses(
|
||||||
&self,
|
&self,
|
||||||
from: &Pubkey,
|
from: &Pubkey,
|
||||||
|
@ -322,14 +324,15 @@ impl CrdsGossip {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Computes a normalized(log of actual stake) stake
|
/// Computes a normalized (log of actual stake) stake.
|
||||||
pub fn get_stake<S: std::hash::BuildHasher>(id: &Pubkey, stakes: &HashMap<Pubkey, u64, S>) -> f32 {
|
pub fn get_stake<S: std::hash::BuildHasher>(id: &Pubkey, stakes: &HashMap<Pubkey, u64, S>) -> f32 {
|
||||||
// cap the max balance to u32 max (it should be plenty)
|
// cap the max balance to u32 max (it should be plenty)
|
||||||
let bal = f64::from(u32::max_value()).min(*stakes.get(id).unwrap_or(&0) as f64);
|
let bal = f64::from(u32::max_value()).min(*stakes.get(id).unwrap_or(&0) as f64);
|
||||||
1_f32.max((bal as f32).ln())
|
1_f32.max((bal as f32).ln())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Computes bounded weight given some max, a time since last selected, and a stake value
|
/// Computes bounded weight given some max, a time since last selected, and a stake value.
|
||||||
|
///
|
||||||
/// The minimum stake is 1 and not 0 to allow 'time since last' picked to factor in.
|
/// The minimum stake is 1 and not 0 to allow 'time since last' picked to factor in.
|
||||||
pub fn get_weight(max_weight: f32, time_since_last_selected: u32, stake: f32) -> f32 {
|
pub fn get_weight(max_weight: f32, time_since_last_selected: u32, stake: f32) -> f32 {
|
||||||
let mut weight = time_since_last_selected as f32 * stake;
|
let mut weight = time_since_last_selected as f32 * stake;
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
//! Crds Gossip Pull overlay
|
//! Crds Gossip Pull overlay.
|
||||||
|
//!
|
||||||
//! This module implements the anti-entropy protocol for the network.
|
//! This module implements the anti-entropy protocol for the network.
|
||||||
//!
|
//!
|
||||||
//! The basic strategy is as follows:
|
//! The basic strategy is as follows:
|
||||||
|
//!
|
||||||
//! 1. Construct a bloom filter of the local data set
|
//! 1. Construct a bloom filter of the local data set
|
||||||
//! 2. Randomly ask a node on the network for data that is not contained in the bloom filter.
|
//! 2. Randomly ask a node on the network for data that is not contained in the bloom filter.
|
||||||
//!
|
//!
|
||||||
|
@ -186,7 +188,7 @@ pub struct ProcessPullStats {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct CrdsGossipPull {
|
pub struct CrdsGossipPull {
|
||||||
/// timestamp of last request
|
/// Timestamp of last request
|
||||||
pull_request_time: RwLock<LruCache<Pubkey, /*timestamp:*/ u64>>,
|
pull_request_time: RwLock<LruCache<Pubkey, /*timestamp:*/ u64>>,
|
||||||
// Hash value and record time (ms) of the pull responses which failed to be
|
// Hash value and record time (ms) of the pull responses which failed to be
|
||||||
// inserted in crds table; Preserved to stop the sender to send back the
|
// inserted in crds table; Preserved to stop the sender to send back the
|
||||||
|
@ -210,7 +212,7 @@ impl Default for CrdsGossipPull {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl CrdsGossipPull {
|
impl CrdsGossipPull {
|
||||||
/// generate a random request
|
/// Generate a random request
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub(crate) fn new_pull_request(
|
pub(crate) fn new_pull_request(
|
||||||
&self,
|
&self,
|
||||||
|
@ -326,7 +328,8 @@ impl CrdsGossipPull {
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// time when a request to `from` was initiated
|
/// Time when a request to `from` was initiated.
|
||||||
|
///
|
||||||
/// This is used for weighted random selection during `new_pull_request`
|
/// This is used for weighted random selection during `new_pull_request`
|
||||||
/// It's important to use the local nodes request creation time as the weight
|
/// It's important to use the local nodes request creation time as the weight
|
||||||
/// instead of the response received time otherwise failed nodes will increase their weight.
|
/// instead of the response received time otherwise failed nodes will increase their weight.
|
||||||
|
@ -334,7 +337,7 @@ impl CrdsGossipPull {
|
||||||
self.pull_request_time.write().unwrap().put(from, now);
|
self.pull_request_time.write().unwrap().put(from, now);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// process a pull request
|
/// Process a pull request
|
||||||
pub(crate) fn process_pull_requests<I>(crds: &RwLock<Crds>, callers: I, now: u64)
|
pub(crate) fn process_pull_requests<I>(crds: &RwLock<Crds>, callers: I, now: u64)
|
||||||
where
|
where
|
||||||
I: IntoIterator<Item = CrdsValue>,
|
I: IntoIterator<Item = CrdsValue>,
|
||||||
|
@ -409,7 +412,7 @@ impl CrdsGossipPull {
|
||||||
(active_values, expired_values, failed_inserts)
|
(active_values, expired_values, failed_inserts)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// process a vec of pull responses
|
/// Process a vec of pull responses
|
||||||
pub(crate) fn process_pull_responses(
|
pub(crate) fn process_pull_responses(
|
||||||
&self,
|
&self,
|
||||||
crds: &RwLock<Crds>,
|
crds: &RwLock<Crds>,
|
||||||
|
@ -499,7 +502,7 @@ impl CrdsGossipPull {
|
||||||
filters.into()
|
filters.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// filter values that fail the bloom filter up to max_bytes
|
/// Filter values that fail the bloom filter up to `max_bytes`.
|
||||||
fn filter_crds_values(
|
fn filter_crds_values(
|
||||||
crds: &RwLock<Crds>,
|
crds: &RwLock<Crds>,
|
||||||
filters: &[(CrdsValue, CrdsFilter)],
|
filters: &[(CrdsValue, CrdsFilter)],
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
//! Crds Gossip Push overlay
|
//! Crds Gossip Push overlay.
|
||||||
|
//!
|
||||||
//! This module is used to propagate recently created CrdsValues across the network
|
//! This module is used to propagate recently created CrdsValues across the network
|
||||||
//! Eager push strategy is based on Plumtree
|
//! Eager push strategy is based on [Plumtree].
|
||||||
//! http://asc.di.fct.unl.pt/~jleitao/pdf/srds07-leitao.pdf
|
//!
|
||||||
|
//! [Plumtree]: http://asc.di.fct.unl.pt/~jleitao/pdf/srds07-leitao.pdf
|
||||||
//!
|
//!
|
||||||
//! Main differences are:
|
//! Main differences are:
|
||||||
|
//!
|
||||||
//! 1. There is no `max hop`. Messages are signed with a local wallclock. If they are outside of
|
//! 1. There is no `max hop`. Messages are signed with a local wallclock. If they are outside of
|
||||||
//! the local nodes wallclock window they are dropped silently.
|
//! the local nodes wallclock window they are dropped silently.
|
||||||
//! 2. The prune set is stored in a Bloom filter.
|
//! 2. The prune set is stored in a Bloom filter.
|
||||||
|
@ -50,14 +53,15 @@ pub const CRDS_GOSSIP_PRUNE_MIN_INGRESS_NODES: usize = 3;
|
||||||
const PUSH_ACTIVE_TIMEOUT_MS: u64 = 60_000;
|
const PUSH_ACTIVE_TIMEOUT_MS: u64 = 60_000;
|
||||||
|
|
||||||
pub struct CrdsGossipPush {
|
pub struct CrdsGossipPush {
|
||||||
/// max bytes per message
|
/// Max bytes per message
|
||||||
max_bytes: usize,
|
max_bytes: usize,
|
||||||
/// active set of validators for push
|
/// Active set of validators for push
|
||||||
active_set: RwLock<IndexMap<Pubkey, AtomicBloom<Pubkey>>>,
|
active_set: RwLock<IndexMap<Pubkey, AtomicBloom<Pubkey>>>,
|
||||||
/// Cursor into the crds table for values to push.
|
/// Cursor into the crds table for values to push.
|
||||||
crds_cursor: Mutex<Cursor>,
|
crds_cursor: Mutex<Cursor>,
|
||||||
/// Cache that tracks which validators a message was received from
|
/// Cache that tracks which validators a message was received from
|
||||||
/// bool indicates it has been pruned.
|
/// bool indicates it has been pruned.
|
||||||
|
///
|
||||||
/// This cache represents a lagging view of which validators
|
/// This cache represents a lagging view of which validators
|
||||||
/// currently have this node in their `active_set`
|
/// currently have this node in their `active_set`
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
|
@ -199,7 +203,8 @@ impl CrdsGossipPush {
|
||||||
now.saturating_sub(self.msg_timeout)..=now.saturating_add(self.msg_timeout)
|
now.saturating_sub(self.msg_timeout)..=now.saturating_add(self.msg_timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// process a push message to the network
|
/// Process a push message to the network.
|
||||||
|
///
|
||||||
/// Returns origins' pubkeys of upserted values.
|
/// Returns origins' pubkeys of upserted values.
|
||||||
pub(crate) fn process_push_message(
|
pub(crate) fn process_push_message(
|
||||||
&self,
|
&self,
|
||||||
|
@ -246,6 +251,7 @@ impl CrdsGossipPush {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// New push message to broadcast to peers.
|
/// New push message to broadcast to peers.
|
||||||
|
///
|
||||||
/// Returns a list of Pubkeys for the selected peers and a list of values to send to all the
|
/// Returns a list of Pubkeys for the selected peers and a list of values to send to all the
|
||||||
/// peers.
|
/// peers.
|
||||||
/// The list of push messages is created such that all the randomly selected peers have not
|
/// The list of push messages is created such that all the randomly selected peers have not
|
||||||
|
@ -306,7 +312,7 @@ impl CrdsGossipPush {
|
||||||
push_messages
|
push_messages
|
||||||
}
|
}
|
||||||
|
|
||||||
/// add the `from` to the peer's filter of nodes
|
/// Add the `from` to the peer's filter of nodes.
|
||||||
pub fn process_prune_msg(&self, self_pubkey: &Pubkey, peer: &Pubkey, origins: &[Pubkey]) {
|
pub fn process_prune_msg(&self, self_pubkey: &Pubkey, peer: &Pubkey, origins: &[Pubkey]) {
|
||||||
if let Some(filter) = self.active_set.read().unwrap().get(peer) {
|
if let Some(filter) = self.active_set.read().unwrap().get(peer) {
|
||||||
for origin in origins {
|
for origin in origins {
|
||||||
|
@ -322,7 +328,10 @@ impl CrdsGossipPush {
|
||||||
cmp::min(num_active, (num_active - active_set_len) + num)
|
cmp::min(num_active, (num_active - active_set_len) + num)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// refresh the push active set
|
/// Refresh the push active set.
|
||||||
|
///
|
||||||
|
/// # Arguments
|
||||||
|
///
|
||||||
/// * ratio - active_set.len()/ratio is the number of actives to rotate
|
/// * ratio - active_set.len()/ratio is the number of actives to rotate
|
||||||
pub(crate) fn refresh_push_active_set(
|
pub(crate) fn refresh_push_active_set(
|
||||||
&self,
|
&self,
|
||||||
|
@ -429,7 +438,7 @@ impl CrdsGossipPush {
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// purge received push message cache
|
/// Purge received push message cache
|
||||||
pub(crate) fn purge_old_received_cache(&self, min_time: u64) {
|
pub(crate) fn purge_old_received_cache(&self, min_time: u64) {
|
||||||
self.received_cache.lock().unwrap().retain(|_, v| {
|
self.received_cache.lock().unwrap().retain(|_, v| {
|
||||||
v.retain(|_, (_, t)| *t > min_time);
|
v.retain(|_, (_, t)| *t > min_time);
|
||||||
|
|
|
@ -8,7 +8,7 @@ pub struct PurgeStats {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Blockstore {
|
impl Blockstore {
|
||||||
/// Silently deletes all blockstore column families in the range [from_slot,to_slot]
|
/// Silently deletes all blockstore column families in the range \[from_slot,to_slot\]
|
||||||
/// Dangerous; Use with care:
|
/// Dangerous; Use with care:
|
||||||
/// Does not check for integrity and does not update slot metas that refer to deleted slots
|
/// Does not check for integrity and does not update slot metas that refer to deleted slots
|
||||||
/// Modifies multiple column families simultaneously
|
/// Modifies multiple column families simultaneously
|
||||||
|
@ -57,7 +57,7 @@ impl Blockstore {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Ensures that the SlotMeta::next_slots vector for all slots contain no references in the
|
/// Ensures that the SlotMeta::next_slots vector for all slots contain no references in the
|
||||||
/// [from_slot,to_slot] range
|
/// \[from_slot,to_slot\] range
|
||||||
///
|
///
|
||||||
/// Dangerous; Use with care
|
/// Dangerous; Use with care
|
||||||
pub fn purge_from_next_slots(&self, from_slot: Slot, to_slot: Slot) {
|
pub fn purge_from_next_slots(&self, from_slot: Slot, to_slot: Slot) {
|
||||||
|
|
|
@ -57,59 +57,59 @@ pub enum VoteInstruction {
|
||||||
/// Initialize a vote account
|
/// Initialize a vote account
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Uninitialized vote account
|
/// 0. `[WRITE]` Uninitialized vote account
|
||||||
/// 1. [] Rent sysvar
|
/// 1. `[]` Rent sysvar
|
||||||
/// 2. [] Clock sysvar
|
/// 2. `[]` Clock sysvar
|
||||||
/// 3. [SIGNER] New validator identity (node_pubkey)
|
/// 3. `[SIGNER]` New validator identity (node_pubkey)
|
||||||
InitializeAccount(VoteInit),
|
InitializeAccount(VoteInit),
|
||||||
|
|
||||||
/// Authorize a key to send votes or issue a withdrawal
|
/// Authorize a key to send votes or issue a withdrawal
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Vote account to be updated with the Pubkey for authorization
|
/// 0. `[WRITE]` Vote account to be updated with the Pubkey for authorization
|
||||||
/// 1. [] Clock sysvar
|
/// 1. `[]` Clock sysvar
|
||||||
/// 2. [SIGNER] Vote or withdraw authority
|
/// 2. `[SIGNER]` Vote or withdraw authority
|
||||||
Authorize(Pubkey, VoteAuthorize),
|
Authorize(Pubkey, VoteAuthorize),
|
||||||
|
|
||||||
/// A Vote instruction with recent votes
|
/// A Vote instruction with recent votes
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Vote account to vote with
|
/// 0. `[WRITE]` Vote account to vote with
|
||||||
/// 1. [] Slot hashes sysvar
|
/// 1. `[]` Slot hashes sysvar
|
||||||
/// 2. [] Clock sysvar
|
/// 2. `[]` Clock sysvar
|
||||||
/// 3. [SIGNER] Vote authority
|
/// 3. `[SIGNER]` Vote authority
|
||||||
Vote(Vote),
|
Vote(Vote),
|
||||||
|
|
||||||
/// Withdraw some amount of funds
|
/// Withdraw some amount of funds
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Vote account to withdraw from
|
/// 0. `[WRITE]` Vote account to withdraw from
|
||||||
/// 1. [WRITE] Recipient account
|
/// 1. `[WRITE]` Recipient account
|
||||||
/// 2. [SIGNER] Withdraw authority
|
/// 2. `[SIGNER]` Withdraw authority
|
||||||
Withdraw(u64),
|
Withdraw(u64),
|
||||||
|
|
||||||
/// Update the vote account's validator identity (node_pubkey)
|
/// Update the vote account's validator identity (node_pubkey)
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Vote account to be updated with the given authority public key
|
/// 0. `[WRITE]` Vote account to be updated with the given authority public key
|
||||||
/// 1. [SIGNER] New validator identity (node_pubkey)
|
/// 1. `[SIGNER]` New validator identity (node_pubkey)
|
||||||
/// 2. [SIGNER] Withdraw authority
|
/// 2. `[SIGNER]` Withdraw authority
|
||||||
UpdateValidatorIdentity,
|
UpdateValidatorIdentity,
|
||||||
|
|
||||||
/// Update the commission for the vote account
|
/// Update the commission for the vote account
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Vote account to be updated
|
/// 0. `[WRITE]` Vote account to be updated
|
||||||
/// 1. [SIGNER] Withdraw authority
|
/// 1. `[SIGNER]` Withdraw authority
|
||||||
UpdateCommission(u8),
|
UpdateCommission(u8),
|
||||||
|
|
||||||
/// A Vote instruction with recent votes
|
/// A Vote instruction with recent votes
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Vote account to vote with
|
/// 0. `[WRITE]` Vote account to vote with
|
||||||
/// 1. [] Slot hashes sysvar
|
/// 1. `[]` Slot hashes sysvar
|
||||||
/// 2. [] Clock sysvar
|
/// 2. `[]` Clock sysvar
|
||||||
/// 3. [SIGNER] Vote authority
|
/// 3. `[SIGNER]` Vote authority
|
||||||
VoteSwitch(Vote, Hash),
|
VoteSwitch(Vote, Hash),
|
||||||
|
|
||||||
/// Authorize a key to send votes or issue a withdrawal
|
/// Authorize a key to send votes or issue a withdrawal
|
||||||
|
@ -118,10 +118,10 @@ pub enum VoteInstruction {
|
||||||
/// or withdraw authority must also be a signer.
|
/// or withdraw authority must also be a signer.
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Vote account to be updated with the Pubkey for authorization
|
/// 0. `[WRITE]` Vote account to be updated with the Pubkey for authorization
|
||||||
/// 1. [] Clock sysvar
|
/// 1. `[]` Clock sysvar
|
||||||
/// 2. [SIGNER] Vote or withdraw authority
|
/// 2. `[SIGNER]` Vote or withdraw authority
|
||||||
/// 3. [SIGNER] New vote or withdraw authority
|
/// 3. `[SIGNER]` New vote or withdraw authority
|
||||||
AuthorizeChecked(VoteAuthorize),
|
AuthorizeChecked(VoteAuthorize),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
//! Persistent storage for accounts. For more information, see:
|
//! Persistent storage for accounts.
|
||||||
//! https://docs.solana.com/implemented-proposals/persistent-account-storage
|
//!
|
||||||
|
//! For more information, see:
|
||||||
|
//!
|
||||||
|
//! <https://docs.solana.com/implemented-proposals/persistent-account-storage>
|
||||||
|
|
||||||
use log::*;
|
use log::*;
|
||||||
use memmap2::MmapMut;
|
use memmap2::MmapMut;
|
||||||
|
|
|
@ -67,10 +67,12 @@ impl<T: BloomHashIndex> Bloom<T> {
|
||||||
_phantom: PhantomData::default(),
|
_phantom: PhantomData::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// create filter optimal for num size given the `FALSE_RATE`
|
/// Create filter optimal for num size given the `FALSE_RATE`.
|
||||||
/// the keys are randomized for picking data out of a collision resistant hash of size
|
///
|
||||||
/// `keysize` bytes
|
/// The keys are randomized for picking data out of a collision resistant hash of size
|
||||||
/// https://hur.st/bloomfilter/
|
/// `keysize` bytes.
|
||||||
|
///
|
||||||
|
/// See <https://hur.st/bloomfilter/>.
|
||||||
pub fn random(num_items: usize, false_rate: f64, max_bits: usize) -> Self {
|
pub fn random(num_items: usize, false_rate: f64, max_bits: usize) -> Self {
|
||||||
let m = Self::num_bits(num_items as f64, false_rate);
|
let m = Self::num_bits(num_items as f64, false_rate);
|
||||||
let num_bits = cmp::max(1, cmp::min(m as usize, max_bits));
|
let num_bits = cmp::max(1, cmp::min(m as usize, max_bits));
|
||||||
|
|
|
@ -15,16 +15,16 @@ pub enum UpgradeableLoaderInstruction {
|
||||||
/// Otherwise another party may initialize the account.
|
/// Otherwise another party may initialize the account.
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [writable] source account to initialize.
|
/// 0. `[writable]` source account to initialize.
|
||||||
/// 1. [] Buffer authority, optional, if omitted then the buffer will be
|
/// 1. `[]` Buffer authority, optional, if omitted then the buffer will be
|
||||||
/// immutable.
|
/// immutable.
|
||||||
InitializeBuffer,
|
InitializeBuffer,
|
||||||
|
|
||||||
/// Write program data into a Buffer account.
|
/// Write program data into a Buffer account.
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [writable] Buffer account to write program data to.
|
/// 0. `[writable]` Buffer account to write program data to.
|
||||||
/// 1. [signer] Buffer authority
|
/// 1. `[signer]` Buffer authority
|
||||||
Write {
|
Write {
|
||||||
/// Offset at which to write the given bytes.
|
/// Offset at which to write the given bytes.
|
||||||
offset: u32,
|
offset: u32,
|
||||||
|
@ -46,10 +46,15 @@ pub enum UpgradeableLoaderInstruction {
|
||||||
/// The ProgramData address is derived from the Program account's address as
|
/// The ProgramData address is derived from the Program account's address as
|
||||||
/// follows:
|
/// follows:
|
||||||
///
|
///
|
||||||
/// `let (program_data_address, _) = Pubkey::find_program_address(
|
/// ```
|
||||||
|
/// # use solana_program::pubkey::Pubkey;
|
||||||
|
/// # use solana_program::bpf_loader_upgradeable;
|
||||||
|
/// # let program_address = &[];
|
||||||
|
/// let (program_data_address, _) = Pubkey::find_program_address(
|
||||||
/// &[program_address],
|
/// &[program_address],
|
||||||
/// &bpf_loader_upgradeable::id()
|
/// &bpf_loader_upgradeable::id()
|
||||||
/// );`
|
/// );
|
||||||
|
/// ```
|
||||||
///
|
///
|
||||||
/// The `DeployWithMaxDataLen` instruction does not require the ProgramData
|
/// The `DeployWithMaxDataLen` instruction does not require the ProgramData
|
||||||
/// account be a signer and therefore MUST be included within the same
|
/// account be a signer and therefore MUST be included within the same
|
||||||
|
@ -58,17 +63,17 @@ pub enum UpgradeableLoaderInstruction {
|
||||||
/// account.
|
/// account.
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [signer] The payer account that will pay to create the ProgramData
|
/// 0. `[signer]` The payer account that will pay to create the ProgramData
|
||||||
/// account.
|
/// account.
|
||||||
/// 1. [writable] The uninitialized ProgramData account.
|
/// 1. `[writable]` The uninitialized ProgramData account.
|
||||||
/// 2. [writable] The uninitialized Program account.
|
/// 2. `[writable]` The uninitialized Program account.
|
||||||
/// 3. [writable] The Buffer account where the program data has been
|
/// 3. `[writable]` The Buffer account where the program data has been
|
||||||
/// written. The buffer account's authority must match the program's
|
/// written. The buffer account's authority must match the program's
|
||||||
/// authority
|
/// authority
|
||||||
/// 4. [] Rent sysvar.
|
/// 4. `[]` Rent sysvar.
|
||||||
/// 5. [] Clock sysvar.
|
/// 5. `[]` Clock sysvar.
|
||||||
/// 6. [] System program (`solana_sdk::system_program::id()`).
|
/// 6. `[]` System program (`solana_sdk::system_program::id()`).
|
||||||
/// 7. [signer] The program's authority
|
/// 7. `[signer]` The program's authority
|
||||||
DeployWithMaxDataLen {
|
DeployWithMaxDataLen {
|
||||||
/// Maximum length that the program can be upgraded to.
|
/// Maximum length that the program can be upgraded to.
|
||||||
max_data_len: usize,
|
max_data_len: usize,
|
||||||
|
@ -85,15 +90,15 @@ pub enum UpgradeableLoaderInstruction {
|
||||||
/// balance at zero.
|
/// balance at zero.
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [writable] The ProgramData account.
|
/// 0. `[writable]` The ProgramData account.
|
||||||
/// 1. [writable] The Program account.
|
/// 1. `[writable]` The Program account.
|
||||||
/// 2. [writable] The Buffer account where the program data has been
|
/// 2. `[writable]` The Buffer account where the program data has been
|
||||||
/// written. The buffer account's authority must match the program's
|
/// written. The buffer account's authority must match the program's
|
||||||
/// authority
|
/// authority
|
||||||
/// 3. [writable] The spill account.
|
/// 3. `[writable]` The spill account.
|
||||||
/// 4. [] Rent sysvar.
|
/// 4. `[]` Rent sysvar.
|
||||||
/// 5. [] Clock sysvar.
|
/// 5. `[]` Clock sysvar.
|
||||||
/// 6. [signer] The program's authority.
|
/// 6. `[signer]` The program's authority.
|
||||||
Upgrade,
|
Upgrade,
|
||||||
|
|
||||||
/// Set a new authority that is allowed to write the buffer or upgrade the
|
/// Set a new authority that is allowed to write the buffer or upgrade the
|
||||||
|
|
|
@ -880,7 +880,7 @@ impl<T: Clone> Clone for COption<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Default for COption<T> {
|
impl<T> Default for COption<T> {
|
||||||
/// Returns [`COption::None`][COption::COption::None].
|
/// Returns [`COption::None`][COption::None].
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
|
|
|
@ -59,8 +59,8 @@ pub enum StakeInstruction {
|
||||||
/// Initialize a stake with lockup and authorization information
|
/// Initialize a stake with lockup and authorization information
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Uninitialized stake account
|
/// 0. `[WRITE]` Uninitialized stake account
|
||||||
/// 1. [] Rent sysvar
|
/// 1. `[]` Rent sysvar
|
||||||
///
|
///
|
||||||
/// Authorized carries pubkeys that must sign staker transactions
|
/// Authorized carries pubkeys that must sign staker transactions
|
||||||
/// and withdrawer transactions.
|
/// and withdrawer transactions.
|
||||||
|
@ -70,22 +70,22 @@ pub enum StakeInstruction {
|
||||||
/// Authorize a key to manage stake or withdrawal
|
/// Authorize a key to manage stake or withdrawal
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Stake account to be updated
|
/// 0. `[WRITE]` Stake account to be updated
|
||||||
/// 1. [] Clock sysvar
|
/// 1. `[]` Clock sysvar
|
||||||
/// 2. [SIGNER] The stake or withdraw authority
|
/// 2. `[SIGNER]` The stake or withdraw authority
|
||||||
/// 3. Optional: [SIGNER] Lockup authority, if updating StakeAuthorize::Withdrawer before
|
/// 3. Optional: `[SIGNER]` Lockup authority, if updating StakeAuthorize::Withdrawer before
|
||||||
/// lockup expiration
|
/// lockup expiration
|
||||||
Authorize(Pubkey, StakeAuthorize),
|
Authorize(Pubkey, StakeAuthorize),
|
||||||
|
|
||||||
/// Delegate a stake to a particular vote account
|
/// Delegate a stake to a particular vote account
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Initialized stake account to be delegated
|
/// 0. `[WRITE]` Initialized stake account to be delegated
|
||||||
/// 1. [] Vote account to which this stake will be delegated
|
/// 1. `[]` Vote account to which this stake will be delegated
|
||||||
/// 2. [] Clock sysvar
|
/// 2. `[]` Clock sysvar
|
||||||
/// 3. [] Stake history sysvar that carries stake warmup/cooldown history
|
/// 3. `[]` Stake history sysvar that carries stake warmup/cooldown history
|
||||||
/// 4. [] Address of config account that carries stake config
|
/// 4. `[]` Address of config account that carries stake config
|
||||||
/// 5. [SIGNER] Stake authority
|
/// 5. `[SIGNER]` Stake authority
|
||||||
///
|
///
|
||||||
/// The entire balance of the staking account is staked. DelegateStake
|
/// The entire balance of the staking account is staked. DelegateStake
|
||||||
/// can be called multiple times, but re-delegation is delayed
|
/// can be called multiple times, but re-delegation is delayed
|
||||||
|
@ -95,20 +95,20 @@ pub enum StakeInstruction {
|
||||||
/// Split u64 tokens and stake off a stake account into another stake account.
|
/// Split u64 tokens and stake off a stake account into another stake account.
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Stake account to be split; must be in the Initialized or Stake state
|
/// 0. `[WRITE]` Stake account to be split; must be in the Initialized or Stake state
|
||||||
/// 1. [WRITE] Uninitialized stake account that will take the split-off amount
|
/// 1. `[WRITE]` Uninitialized stake account that will take the split-off amount
|
||||||
/// 2. [SIGNER] Stake authority
|
/// 2. `[SIGNER]` Stake authority
|
||||||
Split(u64),
|
Split(u64),
|
||||||
|
|
||||||
/// Withdraw unstaked lamports from the stake account
|
/// Withdraw unstaked lamports from the stake account
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Stake account from which to withdraw
|
/// 0. `[WRITE]` Stake account from which to withdraw
|
||||||
/// 1. [WRITE] Recipient account
|
/// 1. `[WRITE]` Recipient account
|
||||||
/// 2. [] Clock sysvar
|
/// 2. `[]` Clock sysvar
|
||||||
/// 3. [] Stake history sysvar that carries stake warmup/cooldown history
|
/// 3. `[]` Stake history sysvar that carries stake warmup/cooldown history
|
||||||
/// 4. [SIGNER] Withdraw authority
|
/// 4. `[SIGNER]` Withdraw authority
|
||||||
/// 5. Optional: [SIGNER] Lockup authority, if before lockup expiration
|
/// 5. Optional: `[SIGNER]` Lockup authority, if before lockup expiration
|
||||||
///
|
///
|
||||||
/// The u64 is the portion of the stake account balance to be withdrawn,
|
/// The u64 is the portion of the stake account balance to be withdrawn,
|
||||||
/// must be `<= StakeAccount.lamports - staked_lamports`.
|
/// must be `<= StakeAccount.lamports - staked_lamports`.
|
||||||
|
@ -117,9 +117,9 @@ pub enum StakeInstruction {
|
||||||
/// Deactivates the stake in the account
|
/// Deactivates the stake in the account
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Delegated stake account
|
/// 0. `[WRITE]` Delegated stake account
|
||||||
/// 1. [] Clock sysvar
|
/// 1. `[]` Clock sysvar
|
||||||
/// 2. [SIGNER] Stake authority
|
/// 2. `[SIGNER]` Stake authority
|
||||||
Deactivate,
|
Deactivate,
|
||||||
|
|
||||||
/// Set stake lockup
|
/// Set stake lockup
|
||||||
|
@ -128,8 +128,8 @@ pub enum StakeInstruction {
|
||||||
/// If a lockup is active, the lockup custodian may update the lockup parameters
|
/// If a lockup is active, the lockup custodian may update the lockup parameters
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Initialized stake account
|
/// 0. `[WRITE]` Initialized stake account
|
||||||
/// 1. [SIGNER] Lockup authority or withdraw authority
|
/// 1. `[SIGNER]` Lockup authority or withdraw authority
|
||||||
SetLockup(LockupArgs),
|
SetLockup(LockupArgs),
|
||||||
|
|
||||||
/// Merge two stake accounts.
|
/// Merge two stake accounts.
|
||||||
|
@ -151,20 +151,20 @@ pub enum StakeInstruction {
|
||||||
/// non-zero effective stake.
|
/// non-zero effective stake.
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Destination stake account for the merge
|
/// 0. `[WRITE]` Destination stake account for the merge
|
||||||
/// 1. [WRITE] Source stake account for to merge. This account will be drained
|
/// 1. `[WRITE]` Source stake account for to merge. This account will be drained
|
||||||
/// 2. [] Clock sysvar
|
/// 2. `[]` Clock sysvar
|
||||||
/// 3. [] Stake history sysvar that carries stake warmup/cooldown history
|
/// 3. `[]` Stake history sysvar that carries stake warmup/cooldown history
|
||||||
/// 4. [SIGNER] Stake authority
|
/// 4. `[SIGNER]` Stake authority
|
||||||
Merge,
|
Merge,
|
||||||
|
|
||||||
/// Authorize a key to manage stake or withdrawal with a derived key
|
/// Authorize a key to manage stake or withdrawal with a derived key
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Stake account to be updated
|
/// 0. `[WRITE]` Stake account to be updated
|
||||||
/// 1. [SIGNER] Base key of stake or withdraw authority
|
/// 1. `[SIGNER]` Base key of stake or withdraw authority
|
||||||
/// 2. [] Clock sysvar
|
/// 2. `[]` Clock sysvar
|
||||||
/// 3. Optional: [SIGNER] Lockup authority, if updating StakeAuthorize::Withdrawer before
|
/// 3. Optional: `[SIGNER]` Lockup authority, if updating StakeAuthorize::Withdrawer before
|
||||||
/// lockup expiration
|
/// lockup expiration
|
||||||
AuthorizeWithSeed(AuthorizeWithSeedArgs),
|
AuthorizeWithSeed(AuthorizeWithSeedArgs),
|
||||||
|
|
||||||
|
@ -174,10 +174,10 @@ pub enum StakeInstruction {
|
||||||
/// must be a signer, and no lockup is applied to the account.
|
/// must be a signer, and no lockup is applied to the account.
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Uninitialized stake account
|
/// 0. `[WRITE]` Uninitialized stake account
|
||||||
/// 1. [] Rent sysvar
|
/// 1. `[]` Rent sysvar
|
||||||
/// 2. [] The stake authority
|
/// 2. `[]` The stake authority
|
||||||
/// 3. [SIGNER] The withdraw authority
|
/// 3. `[SIGNER]` The withdraw authority
|
||||||
///
|
///
|
||||||
InitializeChecked,
|
InitializeChecked,
|
||||||
|
|
||||||
|
@ -187,11 +187,11 @@ pub enum StakeInstruction {
|
||||||
/// stake or withdraw authority must also be a signer.
|
/// stake or withdraw authority must also be a signer.
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Stake account to be updated
|
/// 0. `[WRITE]` Stake account to be updated
|
||||||
/// 1. [] Clock sysvar
|
/// 1. `[]` Clock sysvar
|
||||||
/// 2. [SIGNER] The stake or withdraw authority
|
/// 2. `[SIGNER]` The stake or withdraw authority
|
||||||
/// 3. [SIGNER] The new stake or withdraw authority
|
/// 3. `[SIGNER]` The new stake or withdraw authority
|
||||||
/// 4. Optional: [SIGNER] Lockup authority, if updating StakeAuthorize::Withdrawer before
|
/// 4. Optional: `[SIGNER]` Lockup authority, if updating StakeAuthorize::Withdrawer before
|
||||||
/// lockup expiration
|
/// lockup expiration
|
||||||
AuthorizeChecked(StakeAuthorize),
|
AuthorizeChecked(StakeAuthorize),
|
||||||
|
|
||||||
|
@ -201,11 +201,11 @@ pub enum StakeInstruction {
|
||||||
/// the new stake or withdraw authority must also be a signer.
|
/// the new stake or withdraw authority must also be a signer.
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Stake account to be updated
|
/// 0. `[WRITE]` Stake account to be updated
|
||||||
/// 1. [SIGNER] Base key of stake or withdraw authority
|
/// 1. `[SIGNER]` Base key of stake or withdraw authority
|
||||||
/// 2. [] Clock sysvar
|
/// 2. `[]` Clock sysvar
|
||||||
/// 3. [SIGNER] The new stake or withdraw authority
|
/// 3. `[SIGNER]` The new stake or withdraw authority
|
||||||
/// 4. Optional: [SIGNER] Lockup authority, if updating StakeAuthorize::Withdrawer before
|
/// 4. Optional: `[SIGNER]` Lockup authority, if updating StakeAuthorize::Withdrawer before
|
||||||
/// lockup expiration
|
/// lockup expiration
|
||||||
AuthorizeCheckedWithSeed(AuthorizeCheckedWithSeedArgs),
|
AuthorizeCheckedWithSeed(AuthorizeCheckedWithSeedArgs),
|
||||||
|
|
||||||
|
@ -218,9 +218,9 @@ pub enum StakeInstruction {
|
||||||
/// If a lockup is active, the lockup custodian may update the lockup parameters
|
/// If a lockup is active, the lockup custodian may update the lockup parameters
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Initialized stake account
|
/// 0. `[WRITE]` Initialized stake account
|
||||||
/// 1. [SIGNER] Lockup authority or withdraw authority
|
/// 1. `[SIGNER]` Lockup authority or withdraw authority
|
||||||
/// 2. Optional: [SIGNER] New lockup authority
|
/// 2. Optional: `[SIGNER]` New lockup authority
|
||||||
SetLockupChecked(LockupCheckedArgs),
|
SetLockupChecked(LockupCheckedArgs),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,8 +58,8 @@ pub enum SystemInstruction {
|
||||||
/// Create a new account
|
/// Create a new account
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE, SIGNER] Funding account
|
/// 0. `[WRITE, SIGNER]` Funding account
|
||||||
/// 1. [WRITE, SIGNER] New account
|
/// 1. `[WRITE, SIGNER]` New account
|
||||||
CreateAccount {
|
CreateAccount {
|
||||||
/// Number of lamports to transfer to the new account
|
/// Number of lamports to transfer to the new account
|
||||||
lamports: u64,
|
lamports: u64,
|
||||||
|
@ -74,7 +74,7 @@ pub enum SystemInstruction {
|
||||||
/// Assign account to a program
|
/// Assign account to a program
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE, SIGNER] Assigned account public key
|
/// 0. `[WRITE, SIGNER]` Assigned account public key
|
||||||
Assign {
|
Assign {
|
||||||
/// Owner program account
|
/// Owner program account
|
||||||
owner: Pubkey,
|
owner: Pubkey,
|
||||||
|
@ -83,16 +83,16 @@ pub enum SystemInstruction {
|
||||||
/// Transfer lamports
|
/// Transfer lamports
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE, SIGNER] Funding account
|
/// 0. `[WRITE, SIGNER]` Funding account
|
||||||
/// 1. [WRITE] Recipient account
|
/// 1. `[WRITE]` Recipient account
|
||||||
Transfer { lamports: u64 },
|
Transfer { lamports: u64 },
|
||||||
|
|
||||||
/// Create a new account at an address derived from a base pubkey and a seed
|
/// Create a new account at an address derived from a base pubkey and a seed
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE, SIGNER] Funding account
|
/// 0. `[WRITE, SIGNER]` Funding account
|
||||||
/// 1. [WRITE] Created account
|
/// 1. `[WRITE]` Created account
|
||||||
/// 2. [SIGNER] (optional) Base account; the account matching the base Pubkey below must be
|
/// 2. `[SIGNER]` (optional) Base account; the account matching the base Pubkey below must be
|
||||||
/// provided as a signer, but may be the same as the funding account
|
/// provided as a signer, but may be the same as the funding account
|
||||||
/// and provided as account 0
|
/// and provided as account 0
|
||||||
CreateAccountWithSeed {
|
CreateAccountWithSeed {
|
||||||
|
@ -115,19 +115,19 @@ pub enum SystemInstruction {
|
||||||
/// Consumes a stored nonce, replacing it with a successor
|
/// Consumes a stored nonce, replacing it with a successor
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Nonce account
|
/// 0. `[WRITE]` Nonce account
|
||||||
/// 1. [] RecentBlockhashes sysvar
|
/// 1. `[]` RecentBlockhashes sysvar
|
||||||
/// 2. [SIGNER] Nonce authority
|
/// 2. `[SIGNER]` Nonce authority
|
||||||
AdvanceNonceAccount,
|
AdvanceNonceAccount,
|
||||||
|
|
||||||
/// Withdraw funds from a nonce account
|
/// Withdraw funds from a nonce account
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Nonce account
|
/// 0. `[WRITE]` Nonce account
|
||||||
/// 1. [WRITE] Recipient account
|
/// 1. `[WRITE]` Recipient account
|
||||||
/// 2. [] RecentBlockhashes sysvar
|
/// 2. `[]` RecentBlockhashes sysvar
|
||||||
/// 3. [] Rent sysvar
|
/// 3. `[]` Rent sysvar
|
||||||
/// 4. [SIGNER] Nonce authority
|
/// 4. `[SIGNER]` Nonce authority
|
||||||
///
|
///
|
||||||
/// The `u64` parameter is the lamports to withdraw, which must leave the
|
/// The `u64` parameter is the lamports to withdraw, which must leave the
|
||||||
/// account balance above the rent exempt reserve or at zero.
|
/// account balance above the rent exempt reserve or at zero.
|
||||||
|
@ -136,9 +136,9 @@ pub enum SystemInstruction {
|
||||||
/// Drive state of Uninitalized nonce account to Initialized, setting the nonce value
|
/// Drive state of Uninitalized nonce account to Initialized, setting the nonce value
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Nonce account
|
/// 0. `[WRITE]` Nonce account
|
||||||
/// 1. [] RecentBlockhashes sysvar
|
/// 1. `[]` RecentBlockhashes sysvar
|
||||||
/// 2. [] Rent sysvar
|
/// 2. `[]` Rent sysvar
|
||||||
///
|
///
|
||||||
/// The `Pubkey` parameter specifies the entity authorized to execute nonce
|
/// The `Pubkey` parameter specifies the entity authorized to execute nonce
|
||||||
/// instruction on the account
|
/// instruction on the account
|
||||||
|
@ -150,8 +150,8 @@ pub enum SystemInstruction {
|
||||||
/// Change the entity authorized to execute nonce instructions on the account
|
/// Change the entity authorized to execute nonce instructions on the account
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Nonce account
|
/// 0. `[WRITE]` Nonce account
|
||||||
/// 1. [SIGNER] Nonce authority
|
/// 1. `[SIGNER]` Nonce authority
|
||||||
///
|
///
|
||||||
/// The `Pubkey` parameter identifies the entity to authorize
|
/// The `Pubkey` parameter identifies the entity to authorize
|
||||||
AuthorizeNonceAccount(Pubkey),
|
AuthorizeNonceAccount(Pubkey),
|
||||||
|
@ -159,7 +159,7 @@ pub enum SystemInstruction {
|
||||||
/// Allocate space in a (possibly new) account without funding
|
/// Allocate space in a (possibly new) account without funding
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE, SIGNER] New account
|
/// 0. `[WRITE, SIGNER]` New account
|
||||||
Allocate {
|
Allocate {
|
||||||
/// Number of bytes of memory to allocate
|
/// Number of bytes of memory to allocate
|
||||||
space: u64,
|
space: u64,
|
||||||
|
@ -169,8 +169,8 @@ pub enum SystemInstruction {
|
||||||
/// derived from a base public key and a seed
|
/// derived from a base public key and a seed
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Allocated account
|
/// 0. `[WRITE]` Allocated account
|
||||||
/// 1. [SIGNER] Base account
|
/// 1. `[SIGNER]` Base account
|
||||||
AllocateWithSeed {
|
AllocateWithSeed {
|
||||||
/// Base public key
|
/// Base public key
|
||||||
base: Pubkey,
|
base: Pubkey,
|
||||||
|
@ -188,8 +188,8 @@ pub enum SystemInstruction {
|
||||||
/// Assign account to a program based on a seed
|
/// Assign account to a program based on a seed
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Assigned account
|
/// 0. `[WRITE]` Assigned account
|
||||||
/// 1. [SIGNER] Base account
|
/// 1. `[SIGNER]` Base account
|
||||||
AssignWithSeed {
|
AssignWithSeed {
|
||||||
/// Base public key
|
/// Base public key
|
||||||
base: Pubkey,
|
base: Pubkey,
|
||||||
|
@ -204,9 +204,9 @@ pub enum SystemInstruction {
|
||||||
/// Transfer lamports from a derived address
|
/// Transfer lamports from a derived address
|
||||||
///
|
///
|
||||||
/// # Account references
|
/// # Account references
|
||||||
/// 0. [WRITE] Funding account
|
/// 0. `[WRITE]` Funding account
|
||||||
/// 1. [SIGNER] Base for funding account
|
/// 1. `[SIGNER]` Base for funding account
|
||||||
/// 2. [WRITE] Recipient account
|
/// 2. `[WRITE]` Recipient account
|
||||||
TransferWithSeed {
|
TransferWithSeed {
|
||||||
/// Amount to transfer
|
/// Amount to transfer
|
||||||
lamports: u64,
|
lamports: u64,
|
||||||
|
|
|
@ -243,7 +243,10 @@ pub mod stable_log {
|
||||||
/// Log a program invoke.
|
/// Log a program invoke.
|
||||||
///
|
///
|
||||||
/// The general form is:
|
/// The general form is:
|
||||||
/// "Program <address> invoke [<depth>]"
|
///
|
||||||
|
/// ```notrust
|
||||||
|
/// "Program <address> invoke [<depth>]"
|
||||||
|
/// ```
|
||||||
pub fn program_invoke(
|
pub fn program_invoke(
|
||||||
logger: &Rc<RefCell<dyn Logger>>,
|
logger: &Rc<RefCell<dyn Logger>>,
|
||||||
program_id: &Pubkey,
|
program_id: &Pubkey,
|
||||||
|
@ -255,7 +258,11 @@ pub mod stable_log {
|
||||||
/// Log a message from the program itself.
|
/// Log a message from the program itself.
|
||||||
///
|
///
|
||||||
/// The general form is:
|
/// The general form is:
|
||||||
/// "Program log: <program-generated output>"
|
///
|
||||||
|
/// ```notrust
|
||||||
|
/// "Program log: <program-generated output>"
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
/// That is, any program-generated output is guaranteed to be prefixed by "Program log: "
|
/// That is, any program-generated output is guaranteed to be prefixed by "Program log: "
|
||||||
pub fn program_log(logger: &Rc<RefCell<dyn Logger>>, message: &str) {
|
pub fn program_log(logger: &Rc<RefCell<dyn Logger>>, message: &str) {
|
||||||
ic_logger_msg!(logger, "Program log: {}", message);
|
ic_logger_msg!(logger, "Program log: {}", message);
|
||||||
|
@ -264,7 +271,10 @@ pub mod stable_log {
|
||||||
/// Log successful program execution.
|
/// Log successful program execution.
|
||||||
///
|
///
|
||||||
/// The general form is:
|
/// The general form is:
|
||||||
/// "Program <address> success"
|
///
|
||||||
|
/// ```notrust
|
||||||
|
/// "Program <address> success"
|
||||||
|
/// ```
|
||||||
pub fn program_success(logger: &Rc<RefCell<dyn Logger>>, program_id: &Pubkey) {
|
pub fn program_success(logger: &Rc<RefCell<dyn Logger>>, program_id: &Pubkey) {
|
||||||
ic_logger_msg!(logger, "Program {} success", program_id);
|
ic_logger_msg!(logger, "Program {} success", program_id);
|
||||||
}
|
}
|
||||||
|
@ -272,7 +282,10 @@ pub mod stable_log {
|
||||||
/// Log program execution failure
|
/// Log program execution failure
|
||||||
///
|
///
|
||||||
/// The general form is:
|
/// The general form is:
|
||||||
/// "Program <address> failed: <program error details>"
|
///
|
||||||
|
/// ```notrust
|
||||||
|
/// "Program <address> failed: <program error details>"
|
||||||
|
/// ```
|
||||||
pub fn program_failure(
|
pub fn program_failure(
|
||||||
logger: &Rc<RefCell<dyn Logger>>,
|
logger: &Rc<RefCell<dyn Logger>>,
|
||||||
program_id: &Pubkey,
|
program_id: &Pubkey,
|
||||||
|
|
Loading…
Reference in New Issue